Ptz.hpp
1 /*
2 * @Author: xiong
3 * @Date: 2023/4/7
4 */
5 
6 #ifndef EMX_Ptz_HPP
7 #define EMX_Ptz_HPP
8 
9 #include "EmxCore.hpp"
10 
11 namespace Emx {
15  class MotorBase;
16 
17  class Ptz {
18  public:
19  Ptz();
20 
21  virtual ~Ptz();
22 
24  enum class TypeE : uint8_t {
25  Horizon = 0,
26  Vertical,
27  Zoom,
28  Iris,
29  Focus,
30  };
31 
33  struct StatusValue {
34  int min;
35  int max;
36  int current;
37  };
38 
40  struct Status {
41  bool busy;
44  };
45 
46  public:
52 
56  void DeInit();
57 
67  ErrCodeE MoveStep(TypeE type, bool block, int step, int speed = 0, bool unlimitedStep = false);
68 
74 
81  bool IsBusy(Ptz::TypeE type);
82 
90  ErrCodeE GetStat(TypeE type, bool block, Status &status);
91 
92  private:
93  MotorBase *m_motor;
94  };
96 }// namespace Emx
97 #endif//EMX_Ptz_HPP
Definition: Ptz.hpp:17
bool IsBusy(Ptz::TypeE type)
获取指定类型的当前是否正在运行,当仅需要判断是否正在运行的时候 推荐使用此接口,而非GetStat,效率较高,不会引起阻塞
void DeInit()
反初始化
ErrCodeE Reset()
复位所有PTZ通道,所有电机恢复默认位置,此操作会引起长时间的阻塞
ErrCodeE GetStat(TypeE type, bool block, Status &status)
获取指定类型的当前状态
ErrCodeE MoveStep(TypeE type, bool block, int step, int speed=0, bool unlimitedStep=false)
根据指定的类型和方向,按照指定的速度移动指定步长
ErrCodeE Init()
初始化驱动,此处会对所有的电机进行复位,是阻塞操作,会引起长时间的阻塞
TypeE
操作类型
Definition: Ptz.hpp:24
virtual ~Ptz()
ErrCodeE
错误码定义
Definition: EmxTypeDef.hpp:29
Definition: EmxGpio.hpp:10
状态值
Definition: Ptz.hpp:33
int min
最小值
Definition: Ptz.hpp:34
int current
当前值
Definition: Ptz.hpp:36
int max
最大值
Definition: Ptz.hpp:35
状态
Definition: Ptz.hpp:40
StatusValue step
步数状态
Definition: Ptz.hpp:42
StatusValue speed
速度状态
Definition: Ptz.hpp:43
bool busy
当前类型是否处于忙碌状态(移动中)
Definition: Ptz.hpp:41