DIOS.Dev.FPD.TeledyneDalsa.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #pragma once
  2. #include "CCOS.Dev.FPDDeviceMould.hpp"
  3. #include "OEMAcq.h"
  4. #include "OEMSync.h"
  5. #include "OEMCalib.h"
  6. #include "OEMCtrl.h"
  7. //#include "DetectorCtrlDefinition.h"
  8. #include "DetectorConfiguration.h"
  9. #ifdef CCOSDEVFPDCARERAYRF_EXPORTS
  10. #define CCOSDEVFPDCARERAYRF_API __declspec(dllexport)
  11. #else
  12. #define CCOSDEVFPDCARERAYRF_API __declspec(dllimport)
  13. #endif
  14. namespace CCOS::Dev::Detail::Detector
  15. {
  16. class CCOSDEVFPDCARERAYRF_API TeledyneDalsaDriver : public FPDDriverMould
  17. {
  18. FPDDeviceTeledyneDalsa* pObjDev;
  19. bool m_bConnect; //driver是否连接的标记位
  20. ResDataObject m_DeviceConfig;
  21. ResDataObject m_ConfigAll; //存储当前的配置,用于修改配置时写回文件
  22. ResDataObject m_Configurations; //存储当前配置中“CONFIGURATION”节点的内容
  23. std::unique_ptr <ResDataObject> m_pAttribute;
  24. std::unique_ptr <ResDataObject> m_pDescription;
  25. public:
  26. TeledyneDalsaDriver();
  27. virtual ~TeledyneDalsaDriver();
  28. virtual void Prepare() override;
  29. virtual bool Connect() override;
  30. virtual void Disconnect() override;
  31. virtual bool isConnected() const override;
  32. virtual auto CreateDevice(int index)->std::unique_ptr <IODevice> override;
  33. virtual std::string DriverProbe() override;
  34. virtual std::string GetResource() override;
  35. virtual std::string DeviceProbe() override;
  36. bool GetDeviceConfig(std::string& Cfg);
  37. bool SetDeviceConfig(std::string Cfg);
  38. bool SaveConfigFile(bool bSendNotify);
  39. bool GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue);
  40. bool SetDeviceConfigValue(ResDataObject& config, const char* pInnerKey, int nPathID, const char* szValue);
  41. };
  42. namespace nsDetail = CCOS::Dev::Detail;
  43. class CCOSDEVFPDCARERAYRF_API FPDDeviceTeledyneDalsa : public FPDDeviceMould
  44. {
  45. using super = IODeviceDetail; //IODeviceDetail类的别名声明
  46. std::unique_ptr <DetectorCtrlUnit> m_DetectorCtrlUnit;
  47. std::unique_ptr <AcqUnit> m_AcqUnit;
  48. std::unique_ptr <SyncUnit> m_SyncUnit;
  49. std::unique_ptr <CalibUnit> m_CalibUnit;
  50. //std::unique_ptr <DeviceTemperatureMould> m_Temperature;
  51. //std::unique_ptr <DeviceBatteryMould> m_Battery;
  52. //std::unique_ptr <DeviceWifiMould> m_Wifi;
  53. std::unique_ptr <DetectorConfiguration> m_DetectorConfiguration;
  54. //std::unique_ptr <FPDErrorWarning> m_WarnAndError;
  55. PVOID m_pDetector;
  56. ResDataObject m_ACQMODElist;
  57. DeviceIndexStruct m_stDeviceConfig;
  58. std::string m_strWorkPath;
  59. int m_nImageHeight;
  60. int m_nImageWidth;
  61. /*int m_nCropLeft;
  62. int m_nCropRight;
  63. int m_nCropTop;
  64. int m_nCropBottom;
  65. int m_nRawImgHeight;
  66. int m_nRawImgWidth;*/
  67. int m_nImgBits;
  68. int m_nAngle;
  69. int m_nPixelSpacing;
  70. int m_nSensitivity;
  71. float m_fDose;
  72. WORD* m_pImgBuffer;
  73. APP_STATUS m_eAppStatus;
  74. bool m_bConnect;
  75. ResDataObject m_CalibDoseList;
  76. public:
  77. FPDDeviceTeledyneDalsa(std::shared_ptr<IOEventCenter> center, std::string strConfigPath);
  78. ~FPDDeviceTeledyneDalsa();
  79. virtual std::string GetGUID() const override;
  80. virtual bool Prepare() override;
  81. bool CreateDevice();
  82. void Register();
  83. RET_STATUS Connect();
  84. RET_STATUS SetAcqMode(int nMode);
  85. RET_STATUS EnterExam(int nExamMode);
  86. //RET_STATUS SetSyncMode(SYNC_MODE eSyncMode, HARDWARE_TRIGGER_MODE eTriggerMode);
  87. //RET_STATUS SetXwindow(float fXwindowSize);
  88. RET_STATUS PrepareAcquisition();
  89. RET_STATUS StartAcquisition();
  90. RET_STATUS StopAcquisition();
  91. RET_STATUS SetXrayOnNum();
  92. RET_STATUS SetExposureTimes(int nTimes);
  93. RET_STATUS ActiveCalibration(CCOS_CALIBRATION_TYPE eType);
  94. RET_STATUS PrepareCalibration();
  95. RET_STATUS GetRequestedDose(std::string& strDose);
  96. RET_STATUS StartCalibration();
  97. RET_STATUS StopCalibration();
  98. //RET_STATUS SetCorrectionType(CCOS_CORRECTION_TYPE eType);
  99. bool Support_DarkCalib();
  100. bool Support_XrayCalib();
  101. void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  102. private:
  103. bool LoadConfig();
  104. void OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  105. void OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  106. void OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  107. void OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  108. void OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  109. void OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  110. protected:
  111. void RegisterCtrl(nsDetail::Dispatch* Dispatch);
  112. void RegisterAcq(nsDetail::Dispatch* Dispatch);
  113. void RegisterSync(nsDetail::Dispatch* Dispatch);
  114. void RegisterCalib(nsDetail::Dispatch* Dispatch);
  115. };
  116. } //end namespace CCOS::Dev::Detail::Detector