#ifndef _CAMERA_H_ #define _CAMERA_H_ #include #include "HBDCamera.h" class CameraDeviceOfflineEventHandle; class GalaxyCamera:public HBDCamera { public: GalaxyCamera(); ~GalaxyCamera(); bool Init(); unsigned int GetShowImage(); unsigned int GetShowImage(unsigned char * data, unsigned long size, int *width, int *height); bool GenLogImage(void); void SetExposureAutoByCfg(); void SetExposureTimeByCfg(); //unsigned char * GetImage(void) { return m_image; } //unsigned long GetImageSize(void) { return m_image_size; } bool IsConnect(void) { return !m_bIsOffline; } //float GetAspect(void) { return m_aspect; }; void SetGainAuto(); protected: bool ConnectCamera(); void CatpureRun(); void GenTex(uint32_t *tex, unsigned int w, unsigned int h, void * data); private: GX_VALID_BIT_LIST GetBestValudBit(GX_PIXEL_FORMAT_ENTRY emPixelFormatEntry); void ProcOffline(); // CRITICAL_SECTION m_rcs; // uint32_t m_width; // uint32_t m_height; // unsigned char* m_image; // unsigned long m_image_size; // unsigned int m_ImgWidth; // unsigned int m_ImgHeight; // bool m_HadPreInit; public: bool m_bIsOffline; ///< 设备掉线标识 private: static bool m_IsStaticInit; int m_EntityCount; bool m_ImageChanged; CGXDevicePointer m_objDevicePtr; ///< 设备句柄 CGXStreamPointer m_objStreamPtr; ///< 流对象 CGXFeatureControlPointer m_objFeatureControlPtr; ///< 属性控制器对象 GX_DEVICE_OFFLINE_CALLBACK_HANDLE m_hCB; ///< 掉线回调句柄 CImageDataPointer m_objImageDataPtr; ///< GetImage获取的图像 string m_IP; bool m_bIsOpen; ///< 设备打开标识 bool m_bIsSnap; ///< 设备采集标识 //CameraDeviceOfflineEventHandle* m_pDeviceOfflineEventHandle; ///< 掉线事件指针 CameraDeviceOfflineEventHandle* m_pDeviceOfflineEventHandle; ///< 掉线事件指针 }; class CameraDeviceOfflineEventHandle :public IDeviceOfflineEventHandler { public: //-------------------------------------------------- /** \brief 掉线回调函数 \param pUserParam 用户参数 \return void */ //-------------------------------------------------- void DoOnDeviceOfflineEvent(void* pUserParam) { try { GalaxyCamera* pCamera = (GalaxyCamera*)pUserParam; pCamera->m_bIsOffline = true; } catch (CGalaxyException) { } catch (std::exception) { } } }; #endif