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.
 
 
 
 
 
 

203 lines
7.2 KiB

#ifndef __PROTOCOLPTZ_H_INCL__
#ifndef NO_PTZ_CAMERAS
#define __PROTOCOLPTZ_H_INCL__
#include "protocol.h"
#include "../../components/base/basicTypes.h"
#include "../../components/base/basicTransport.h"
#define PPTZ_TAG_COM_PORT "COM_PORT"
#define PPTZ_TAG_COM_SPEED "COM_SPEED"
#define PPTZ_TAG_CAM_ID "CAMERA_ID"
#define PPTZ_TAG_ONVIF_USER "ONVIF_USER"
#define PPTZ_TAG_ONVIF_PASS "ONVIF_PASSWORD"
#define PPTZ_TAG_ONVIF_DEV_URI "ONVIF_DEVICE_URI"
#define PTZ_DRIVE_NONE 0x00000000
#define PTZ_DRIVE_PAN_MASK 0x00000003
#define PTZ_DRIVE_PAN_LEFT 0x00000001
#define PTZ_DRIVE_PAN_RIGHT 0x00000002
#define PTZ_DRIVE_TILT_MASK 0x0000000C
#define PTZ_DRIVE_TILT_UP 0x00000004
#define PTZ_DRIVE_TILT_DOWN 0x00000008
#define PTZ_DRIVE_ZOOM_MASK 0x00000030
#define PTZ_DRIVE_ZOOM_WIDE 0x00000010
#define PTZ_DRIVE_ZOOM_TELE 0x00000020
#define PTZ_DRIVE_ABS_MASK 0x000001C0
#define PTZ_DRIVE_ABS_PAN 0x00000040
#define PTZ_DRIVE_ABS_TILT 0x00000080
#define PTZ_DRIVE_ABS_ZOOM 0x00000100
typedef enum E_PTZ_CAMERA_PROTOCOL_TYPE{
PTZ_PROTO_NONE = 0,
PTZ_PROTO_VISCA = 1,
PTZ_PROTO_PELCO = 2,
PTZ_PROTO_ONVIF = 3
} PTZ_CAMERA_PROTOCOL_TYPE;
enum CAM_WB_MODE{
WB_AUTO = 0,
WB_INDOOR = 1,
WB_OUTDOOR,
WB_CUSTOM
};
enum CAM_EXP_MODE{
EXP_AUTO = 0,
EXP_MANUAL = 1,
EXP_SHUTTER_PRIO,
EXP_IRIS_PRIO,
EXP_BRIGHT_PRIO
};
enum CAM_PTZ_COMMAND{
CMD_PTZ_NOOP = 0,
CMD_PTZ_INIT = 1,
CMD_PTZ_IF_CLEAR = 2,
CMD_PTZ_RESET = 3,
CMD_PTZ_POWER_ON,
CMD_PTZ_POWER_OFF
};
/**
* TODO: Add class description
*
* @author gagua
*/
class protocolPTZ: public protocolParser {
protected:
//basicTransport *m_pDataTransport;
CAM_WB_MODE m_eWB_Mode;
CAM_EXP_MODE m_eExp_Mode;
U8 m_bLastCommandIssued;
U8 m_bProtocolDeviceID;
bool m_bPowerSave_Mode;
bool m_bAutoFocus_Mode;
bool m_bBackLight_Mode;
bool m_bWideConversionLens;
bool m_bReplyRequired;
double m_dPan;
double m_dTilt;
double m_dZoom;
double m_dFocus;
double m_dWideConversionLens;
double m_dTiltSpeed;
double m_dPanSpeed;
double m_dZoomSpeed;
double m_dFocusSpeed;
public:
// Constructor
protocolPTZ();
//ToDo: change Serial to BaseClass of some kind of socket
//protocolPTZ( basicTransport *Serial );
// Destructor
virtual ~protocolPTZ();
virtual bool create(void);
U8 getLastCommand(void){ return m_bLastCommandIssued; };
virtual bool initCamera(void){ return true; };
bool hasReply(void){ return m_bReplyRequired; };
virtual bool cancelLastCommand( int backNumber ){ return true; };
virtual bool setPowerSaveMode( bool nMode ){ m_bPowerSave_Mode = nMode; return true;};
virtual bool getPowerSaveMode( void ){ return m_bPowerSave_Mode;};
virtual bool startZoomWide( void ){ return true; };
virtual bool startZoomTele( void ){ return true; };
virtual bool startZoomWide( double nSpeed ){ m_dZoomSpeed = nSpeed; return true; };
virtual bool startZoomTele( double nSpeed ){ m_dZoomSpeed = nSpeed; return true; };
virtual bool stopZoom( void ){ return true; };
virtual bool setPanPos( double dPan ){ return true; };
virtual bool setTiltPos( double dTilt ){ return true; };
virtual bool setZoom( double nZoom ){ return true; };
void setProtocolDeviceID( U8 device_id ){ m_bProtocolDeviceID = device_id; };
virtual double getPan( void ){ return m_dPan; };
virtual double getTilt( void ){ return m_dTilt; };
virtual double getZoom( void ){ return m_dZoom; };
virtual bool startFocusFar(void){ return false; };
virtual bool startFocusNear(void){ return false; };
virtual bool setAutoFocus( bool nMode ){ m_bAutoFocus_Mode = nMode; return true; };
virtual bool getAutoFocus( void ){ return m_bAutoFocus_Mode; };
virtual bool setFocus(double nFocus){ m_dFocus = nFocus; return true; };// 0.0 -> 1.0
virtual double getFocus( void ){ return m_dFocus; };
virtual bool setWhiteBalanceMode( CAM_WB_MODE nMode ){ m_eWB_Mode = nMode; return true; };
virtual bool triggerWBPoint( void ){ return true; };
virtual bool setExposureMode( CAM_EXP_MODE nMode ){ m_eExp_Mode = nMode; return true; };
virtual bool expBrightReset( void ){ return true; };
virtual bool expBrightUp( void ){ return true; };
virtual bool expBrightDown( void ){ return true; };
virtual bool expShutterReset( void ){ return true; };
virtual bool expShutterUp( void ){ return true; };
virtual bool expShutterDown( void ){ return true; };
virtual bool expIrisReset( void ){ return true; };
virtual bool expIrisUp( void ){ return true; };
virtual bool expIrisDown( void ){ return true; };
virtual bool expGainReset( void ){ return true; };
virtual bool expGainUp( void ){ return true; };
virtual bool expGainDown( void ){ return true; };
virtual bool setBackLightMode( bool nMode ){ m_bBackLight_Mode = nMode; return true; };
virtual bool getBackLightMode( void ){ return m_bBackLight_Mode; };
virtual bool saveSettings( int backNumber ){ return true;};
virtual bool recallSetings( int backNumber ){ return true; };
virtual bool setWideConversionLens( double Magnifier ){
if( Magnifier > 0 ){
m_bWideConversionLens = true;
m_dWideConversionLens = Magnifier;
} else {
m_bWideConversionLens = false;
m_dWideConversionLens = 0;
};
return true;
};
virtual bool resetPTZDrive( void ){ return true; };
virtual bool goHomePosition( void ){ return true; };
virtual bool setPTZSpeed( double pSpeed, double tSpeed, double zSpeed ){
m_dPanSpeed = pSpeed;
m_dTiltSpeed = tSpeed;
m_dZoomSpeed = zSpeed;
return true;
};
virtual bool setPSpeed(double Speed) { m_dPanSpeed = Speed; return true; };
virtual bool setTSpeed(double Speed) { m_dTiltSpeed = Speed; return true; };
virtual bool setZSpeed(double Speed) { m_dZoomSpeed = Speed; return true; };
virtual bool setFSpeed(double Speed) { m_dFocusSpeed = Speed; return true; };
virtual double getPSpeed( void ){ return m_dPanSpeed; };
virtual double getTSpeed( void ){ return m_dTiltSpeed; };
virtual double getZSpeed( void ){ return m_dZoomSpeed; };
virtual bool getPresets( void ){ return false; };
virtual bool move(uint32_t MoveMatrix){ return true; };
virtual bool goUp( void ){ return true; };
virtual bool goDown( void ){ return true; };
virtual bool goLeft( void ){ return true; };
virtual bool goRight( void ){ return true; };
virtual bool goDownLeft( void ){ return true; };
virtual bool goDownRight( void ){ return true; };
virtual bool goUpLeft( void ){ return true; };
virtual bool goUpRight( void ){ return true; };
virtual bool goStop( void ){ return true; };
virtual bool goAbsolute( float dPan, float dTilt, float dZoom ){ return true; };
virtual bool goPreset( char *PresetToken ){ return true; };
virtual bool setOSD( bool nMode ){ return true; };
virtual bool waitMoveIsDone( void ){ return false; };
};
#endif // NO_PTZ_CAMERAS
#endif // __PROTOCOLPTZ_H_INCL__