You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
6.6 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __PROTOCOLPTZ_H_INCL__
  2. #ifndef NO_PTZ_CAMERAS
  3. #define __PROTOCOLPTZ_H_INCL__
  4. #include "protocol.h"
  5. #include "../../components/base/basicTypes.h"
  6. #include "../../components/base/basicTransport.h"
  7. #define PPTZ_TAG_COM_PORT "COM_PORT"
  8. #define PPTZ_TAG_COM_SPEED "COM_SPEED"
  9. #define PPTZ_TAG_CAM_ID "CAMERA_ID"
  10. #define PPTZ_TAG_ONVIF_USER "ONVIF_USER"
  11. #define PPTZ_TAG_ONVIF_PASS "ONVIF_PASSWORD"
  12. #define PPTZ_TAG_ONVIF_DEV_URI "ONVIF_DEVICE_URI"
  13. #define PTZ_DRIVE_NONE 0x00000000
  14. #define PTZ_DRIVE_PAN_MASK 0x00000003
  15. #define PTZ_DRIVE_PAN_LEFT 0x00000001
  16. #define PTZ_DRIVE_PAN_RIGHT 0x00000002
  17. #define PTZ_DRIVE_TILT_MASK 0x0000000C
  18. #define PTZ_DRIVE_TILT_UP 0x00000004
  19. #define PTZ_DRIVE_TILT_DOWN 0x00000008
  20. #define PTZ_DRIVE_ZOOM_MASK 0x00000030
  21. #define PTZ_DRIVE_ZOOM_WIDE 0x00000010
  22. #define PTZ_DRIVE_ZOOM_TELE 0x00000020
  23. #define PTZ_DRIVE_ABS_MASK 0x000001C0
  24. #define PTZ_DRIVE_ABS_PAN 0x00000040
  25. #define PTZ_DRIVE_ABS_TILT 0x00000080
  26. #define PTZ_DRIVE_ABS_ZOOM 0x00000100
  27. typedef enum E_PTZ_CAMERA_PROTOCOL_TYPE{
  28. PTZ_PROTO_NONE = 0,
  29. PTZ_PROTO_VISCA = 1,
  30. PTZ_PROTO_PELCO = 2,
  31. PTZ_PROTO_ONVIF = 3
  32. } PTZ_CAMERA_PROTOCOL_TYPE;
  33. enum CAM_WB_MODE{
  34. WB_AUTO = 0,
  35. WB_INDOOR = 1,
  36. WB_OUTDOOR,
  37. WB_CUSTOM
  38. };
  39. enum CAM_EXP_MODE{
  40. EXP_AUTO = 0,
  41. EXP_MANUAL = 1,
  42. EXP_SHUTTER_PRIO,
  43. EXP_IRIS_PRIO,
  44. EXP_BRIGHT_PRIO
  45. };
  46. enum CAM_PTZ_COMMAND{
  47. CMD_PTZ_NOOP = 0,
  48. CMD_PTZ_INIT = 1,
  49. CMD_PTZ_IF_CLEAR = 2,
  50. CMD_PTZ_RESET = 3,
  51. CMD_PTZ_POWER_ON,
  52. CMD_PTZ_POWER_OFF
  53. };
  54. /**
  55. * TODO: Add class description
  56. *
  57. * @author gagua
  58. */
  59. class protocolPTZ: public protocolParser {
  60. protected:
  61. basicTransport *m_pDataTransport;
  62. CAM_WB_MODE m_eWB_Mode;
  63. CAM_EXP_MODE m_eExp_Mode;
  64. U8 m_bLastCommandIssued;
  65. bool m_bPowerSave_Mode;
  66. bool m_bAutoFocus_Mode;
  67. bool m_bBackLight_Mode;
  68. bool m_bWideConversionLens;
  69. bool m_bReplyRequired;
  70. double m_dPan;
  71. double m_dTilt;
  72. double m_dZoom;
  73. double m_dFocus;
  74. double m_dWideConversionLens;
  75. double m_dTiltSpeed;
  76. double m_dPanSpeed;
  77. double m_dZoomSpeed;
  78. public:
  79. // Constructor
  80. explicit protocolPTZ( config_setting_t *Settings = NULL );
  81. //ToDo: change Serial to BaseClass of some kind of socket
  82. //protocolPTZ( basicTransport *Serial );
  83. // Destructor
  84. virtual ~protocolPTZ();
  85. virtual bool create(void);
  86. U8 getLastCommand(void){ return m_bLastCommandIssued; };
  87. virtual bool initCamera(void){ return true; };
  88. bool hasReply(void){ return m_bReplyRequired; };
  89. virtual bool cancelLastCommand( int backNumber ){ return true; };
  90. virtual bool setPowerSaveMode( bool nMode ){ m_bPowerSave_Mode = nMode; return true;};
  91. virtual bool getPowerSaveMode( void ){ return m_bPowerSave_Mode;};
  92. virtual bool startZoomWide( void ){ return true; };
  93. virtual bool startZoomTele( void ){ return true; };
  94. virtual bool startZoomWide( double nSpeed ){ m_dZoomSpeed = nSpeed; return true; };
  95. virtual bool startZoomTele( double nSpeed ){ m_dZoomSpeed = nSpeed; return true; };
  96. virtual bool stopZoom( void ){ return true; };
  97. virtual bool setPanPos( double dPan ){ return true; };
  98. virtual bool setTiltPos( double dTilt ){ return true; };
  99. virtual bool setZoom( double nZoom ){ return true; };
  100. virtual double getPan( void ){ return m_dPan; };
  101. virtual double getTilt( void ){ return m_dTilt; };
  102. virtual double getZoom( void ){ return m_dZoom; };
  103. virtual bool startFocusFar(void){ return false; };
  104. virtual bool startFocusNear(void){ return false; };
  105. virtual bool setAutoFocus( bool nMode ){ m_bAutoFocus_Mode = nMode; return true; };
  106. virtual bool getAutoFocus( void ){ return m_bAutoFocus_Mode; };
  107. virtual bool setFocus(double nFocus){ m_dFocus = nFocus; return true; };// 0.0 -> 1.0
  108. virtual double getFocus( void ){ return m_dFocus; };
  109. virtual bool setWhiteBalanceMode( CAM_WB_MODE nMode ){ m_eWB_Mode = nMode; return true; };
  110. virtual bool triggerWBPoint( void ){ return true; };
  111. virtual bool setExposureMode( CAM_EXP_MODE nMode ){ m_eExp_Mode = nMode; return true; };
  112. virtual bool expBrightReset( void ){ return true; };
  113. virtual bool expBrightUp( void ){ return true; };
  114. virtual bool expBrightDown( void ){ return true; };
  115. virtual bool expShutterReset( void ){ return true; };
  116. virtual bool expShutterUp( void ){ return true; };
  117. virtual bool expShutterDown( void ){ return true; };
  118. virtual bool expIrisReset( void ){ return true; };
  119. virtual bool expIrisUp( void ){ return true; };
  120. virtual bool expIrisDown( void ){ return true; };
  121. virtual bool expGainReset( void ){ return true; };
  122. virtual bool expGainUp( void ){ return true; };
  123. virtual bool expGainDown( void ){ return true; };
  124. virtual bool setBackLightMode( bool nMode ){ m_bBackLight_Mode = nMode; return true; };
  125. virtual bool getBackLightMode( void ){ return m_bBackLight_Mode; };
  126. virtual bool saveSettings( int backNumber ){ return true;};
  127. virtual bool recallSetings( int backNumber ){ return true; };
  128. virtual bool setWideConversionLens( double Magnifier ){
  129. if( Magnifier > 0 ){
  130. m_bWideConversionLens = true;
  131. m_dWideConversionLens = Magnifier;
  132. } else {
  133. m_bWideConversionLens = false;
  134. m_dWideConversionLens = 0;
  135. };
  136. return true;
  137. };
  138. virtual bool resetPTZDrive( void ){ return true; };
  139. virtual bool goHomePosition( void ){ return true; };
  140. virtual bool setPTZSpeed( double pSpeed, double tSpeed, double zSpeed ){
  141. m_dPanSpeed = pSpeed;
  142. m_dTiltSpeed = tSpeed;
  143. m_dZoomSpeed = zSpeed;
  144. return true;
  145. };
  146. virtual double getPSpeed( void ){ return m_dPanSpeed; };
  147. virtual double getTSpeed( void ){ return m_dTiltSpeed; };
  148. virtual double getZSpeed( void ){ return m_dZoomSpeed; };
  149. virtual bool move(uint32_t MoveMatrix){ return true; };
  150. virtual bool goUp( void ){ return true; };
  151. virtual bool goDown( void ){ return true; };
  152. virtual bool goLeft( void ){ return true; };
  153. virtual bool goRight( void ){ return true; };
  154. virtual bool goDownLeft( void ){ return true; };
  155. virtual bool goDownRight( void ){ return true; };
  156. virtual bool goUpLeft( void ){ return true; };
  157. virtual bool goUpRight( void ){ return true; };
  158. virtual bool goStop( void ){ return true; };
  159. virtual bool goAbsolute( double dPan, double dTilt, double dZoom ){ return true; };
  160. virtual bool setOSD( bool nMode ){ return true; };
  161. };
  162. #endif // NO_PTZ_CAMERAS
  163. #endif // __PROTOCOLPTZ_H_INCL__