CHIKVisionCamera.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #include "MvCamera.h"
  3. #include "CCameraBase.h"
  4. #include "CMessageBox.h"
  5. #ifdef HIKVISION_CAMERA_EXPORTS
  6. #define HIKVISION_CAMERA_DLL_API __declspec(dllexport)
  7. #else
  8. #define HIKVISION_CAMERA_DLL_API //__declspec(dllimport)
  9. #endif
  10. class HIKVISION_CAMERA_DLL_API CHIKVisionCamera :
  11. public CCameraBase
  12. {
  13. public:
  14. CHIKVisionCamera(int id,string sDescribe, bool bEnable);
  15. ~CHIKVisionCamera();
  16. virtual long Open() override;
  17. virtual void Close() override;
  18. virtual long VideoStart() override;
  19. virtual long VideoStop() override;
  20. virtual long GrabImage(ImageInfo& image) override;
  21. virtual long SetExposure(double exposure) override;
  22. virtual double GetExposure() override;
  23. virtual long SetGain(double gain) override;
  24. virtual double GetGain() override;
  25. private:
  26. static CHAR strErrorText[256];
  27. static CHAR* GetErrText(INT nErrorNum);
  28. static bool m_bFindDevList;
  29. static MV_CC_DEVICE_INFO_LIST* m_stDevList;
  30. bool m_bOpenDevice; // ch:是否打开设备 | en:Whether to open device
  31. VOID* m_hGrabThread = NULL; // ch:取流线程句柄 | en:Grab thread handle
  32. bool m_bThreadState;
  33. MV_CC_DEVICE_INFO* m_pDeviceInfo;
  34. CMvCamera m_stMvCamera;
  35. UCHAR* GetDeviceUserDefinedName(MV_CC_DEVICE_INFO* pDeviceInfo);
  36. CMessageBox* m_pMeaasgeBox = nullptr;
  37. private:
  38. CRITICAL_SECTION m_hSaveImageMux;
  39. UINT m_nSaveImageBufSize;
  40. bool m_bGrabImageDone;
  41. UCHAR* m_pSaveImageBuf = nullptr; //图像缓存
  42. bool m_bStartVedioBing = false; // ch:是否开始抓图 | en:Whether to start grabbing
  43. LONG m_bTimeOutNum = 0;
  44. public:
  45. LONG SaveImageBuf(unsigned char* pData, MV_FRAME_OUT_INFO_EX* stImageInfo);
  46. long ImageToViewThreadProcess();
  47. };