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.
 
 
 
 
 
 

169 lines
4.8 KiB

#ifndef __BASICCAMERA_H_INCL__
#define __BASICCAMERA_H_INCL__
#ifndef M_E
#include <math.h>
#endif
#include "basicTypes.h"
#include "basicPosition.h"
#include "../object/objectSystemAnchor.h"
#include "basicCameraInfo.h"
//#include "basicMediaSource.h"
#ifndef NO_VIDEO_FILTERS
#include "basicVideoAnalyzer.h"
#endif
#include "basicEventHandler.h"
#include "basicObject.h"
#include "../../data/media/videoNode.h"
typedef enum E_processStatus{
PS_BORN = 0x01,
PS_INIT = 0x02,
PS_RUN = 0x03,
PS_STOP = 0x04,
PS_STALL = 0x05,
PS_END = 0x06,
PS_DEAD = 0x07,
PS_ZOMBE = 0x08
} processStatus;
typedef enum E_basicCameraCommandCodes {
CMD_CAMERA_GET_STATUS = 0,
CMD_CAMERA_GET_PTZ = 1,
CMD_CAMERA_SET_PTZ = 2,
CMD_CAMERA_MOVE_PAN = 3,
CMD_CAMERA_MOVE_TILT = 4,
CMD_CAMERA_MOVE_ZOOM = 5,
CMD_CAMERA_SET_IRIS = 6,
CMD_CAMERA_BUSY = 7,
CMD_CAMERA_ERROR = 8,
CMD_CAMERA_WIPER = 9,
CMD_CAMERA_SET_FOCUS = 10,
CMD_CAMERA_GET_FOCUS = 11,
CMD_CAMERA_MOVE_FOCUS = 12,
CMD_CAMERA_GET_DOPLER = 13,
CMD_CAMERA_SET_DOPLER = 14,
CMD_CAMERA_DOPLER_ALARM = 15,
CMD_CAMERA_GET_DOPLER_MASK = 16,
CMD_CAMERA_SET_DOPLER_MASK = 17,
CMD_CAMERA_START_RECORD = 18,
CMD_CAMERA_STOP_RECORD = 19,
CMD_CAMERA_SET_PAN = 20,
CMD_CAMERA_SET_TILT = 21,
CMD_CAMERA_SET_PAN_TILT = 22,
CMD_CAMERA_SET_ZOOM = 23,
CMD_CAMERA_SET_AF_MODE = 24,
CMD_CAMERA_SET_BL_MODE = 25,
CMD_CAMERA_SET_NV_MODE = 26,
CMD_CAMERA_SET_WB_MODE = 27,
CMD_CAMERA_SET_IRIS_MODE = 28,
CMD_CAMERA_SET_GAIN_MODE = 29,
CMD_CAMERA_GO_HOME = 30,
CMD_CAMERA_SET_HOME = 31,
CMD_CAMERA_INIT = 255
} basicCameraCommandCode;
typedef struct S_basicCameraCommand {
basicCameraCommandCode m_cCode;
void *m_pParam;
} basicCameraCommand;
typedef struct S_absCameraMoveParam {
float m_fPan; // In Degreeses
float m_fTilt; // In Degreeses
float m_fRange; // In Meters
} absCameraMoveParam;
typedef struct S_osdLabel {
uint8_t color[4];//RGBA
uint16_t x, y;
char text[256];
} osdLabel;
typedef std::vector<osdLabel> vOSD;
typedef std::queue<basicCameraCommand*> qCameraCommands;
typedef enum E_osdLabelLines{
OSD_PROTO = 0,
OSD_FOCUS = 1
} osdLabelLines;
/**
* TODO: Add class description
*
* @author gagua
*/
class basicCamera : public basicObject, public basicPosition, public basicEventHandler {
protected:
basicMediaSource *m_pVideoSource;
processStatus m_iStatus;
config_setting_t *m_pSettings;
//basicCameraInfo m_sCameraInfo;
SOURCE_INFO m_sSourceInfo;
vOSD m_vOSD;
#ifndef NO_VIDEO_FILTERS
//vectorVA m_vVideoAnalyzers;
basicVideoAnalyzer *m_pVideoAnalyzer;
#endif
public:
videoNode *m_pVideoNode;
// Constructor
explicit basicCamera(config_setting_t *Settings = NULL);
// Destructor
virtual ~basicCamera();
virtual void dispatchEvent( basicEvent *Evt );
osdLabel *getLabel(uint8_t id){ if (id < m_vOSD.size()) return &(m_vOSD.at(id)); return NULL; };
uint8_t getLabelCount(void){ return ( uint8_t ) m_vOSD.size(); };
processStatus getProcessStatus( void ){ return m_iStatus; };
SOURCE_INFO *getInfo(void){ return &m_sSourceInfo;};
void setProcessStatus( processStatus Status ){ m_iStatus = Status; };
void setViewer(basicMediaDestination *A){ m_pVideoNode->connect(A); };
int getType(void){ return m_sSourceInfo.type; };
int getWidth(void){ return m_sSourceInfo.width; };
int getHeight(void){ return m_sSourceInfo.height; };
virtual bool init(void){ return true; };
virtual bool stop(void){
if (m_pVideoSource != NULL){
if (!m_pVideoSource->_stop()){
return false;
};
};
if (m_pVideoNode != NULL){
m_pVideoNode->stopConveyour();
delete(m_pVideoNode);
m_pVideoNode = NULL;
};
return true;
};
virtual void trigger( bool CaptureOn ){};
virtual void cmdPowerOn( void ){};
virtual void cmdPowerOff( void ){};
virtual void cmdSetIris( double ){};
virtual void cmdSetAF( bool AF_Enable ){};
virtual void cmdSetAE( bool AE_Enable ){};
virtual void cmdSetAWB( bool AWB_Enable ){};
virtual void cmdSetBLC( bool BLC_Enable ){};
virtual void cmdSetIR( bool IR_Enable ){};
virtual void cmdSetAS( bool AS_Enable ){};
virtual void cmdBeginFocusFar( void ){};
virtual void cmdBeginFocusNear( void ){};
virtual void cmdEndManualFocus( void ){};
virtual void cmdBeginZoomWide( void ){};
virtual void cmdBeginZoomTele( void ){};
virtual void cmdEndManualZoom( void ){};
virtual void ctrlProc( void ){};
virtual bool create(void);
virtual bool create(SOURCE_INFO *SI);
virtual void updateSettings(void);
};
typedef vector<basicCamera *> vectorCameras;
typedef vector<basicCamera *>::iterator vectorCamerasInterator;
#endif // __BASICCAMERA_H_INCL__