DIOS.Dev.FPD.CareRay.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #pragma once
  2. #include "CCOS.Dev.FPDDeviceMould.hpp"
  3. #include "OemAcq.h"
  4. #include "OemSync.h"
  5. #include "OemCtrl.h"
  6. #include "OemCalib.h"
  7. #include "DetectorConfiguration.h"
  8. #pragma warning(disable:26812) //枚举类型“ENUM_PANEL_EVENT_STATE”未设定范围。相比于 "enum",首选 "enum class" (Enum.3)
  9. #pragma warning(disable:26451) //算术溢出 : 使用 4 字节值上的运算符 * ,然后将结果转换到 8 字节值。在调用运算符 * 之前将值强制转换为宽类型可避免溢出(io.2)。
  10. #ifdef CCOSDEVFPDCARERAY_EXPORTS
  11. #define CCOSDEVFPDCARERAY_API __declspec(dllexport)
  12. #else
  13. #define CCOSDEVFPDCARERAY_API __declspec(dllimport)
  14. #endif
  15. enum ExposureMode
  16. {
  17. DEFAULTMODE,
  18. RAD,
  19. AEC
  20. };
  21. namespace CCOS::Dev::Detail::Detector
  22. {
  23. class CCOSDEVFPDCARERAY_API CareRayDriver : public FPDDriverMould
  24. {
  25. FPDDeviceCareRay* pObjDev;
  26. bool m_bConnect; //driver是否连接的标记位
  27. //*** 配置文件相关成员变量begin ***
  28. ResDataObject m_DeviceConfig;
  29. ResDataObject m_ConfigAll; //存储当前的配置,用于修改配置时写回文件
  30. ResDataObject m_Configurations; //存储当前配置中“CONFIGURATION”节点的内容
  31. std::unique_ptr <ResDataObject> m_pAttribute;
  32. std::unique_ptr <ResDataObject> m_pDescription;
  33. //*** 配置文件相关成员变量end ***
  34. public:
  35. CareRayDriver();
  36. virtual ~CareRayDriver();
  37. virtual void Prepare() override;
  38. virtual bool Connect() override;
  39. virtual void Disconnect() override;
  40. virtual bool isConnected() const override;
  41. virtual auto CreateDevice(int index)->std::unique_ptr <IODevice> override;
  42. virtual std::string DriverProbe() override;
  43. virtual std::string GetResource() override;
  44. virtual std::string DeviceProbe() override;
  45. virtual bool GetDeviceConfig(std::string& Cfg) override;
  46. virtual bool SetDeviceConfig(std::string Cfg) override;
  47. bool SaveConfigFile(bool bSendNotify);
  48. bool GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue);
  49. bool SetDeviceConfigValue(ResDataObject& config, const char* pInnerKey, int nPathID, const char* szValue);
  50. };
  51. namespace nsDetail = CCOS::Dev::Detail;
  52. class CCOSDEVFPDCARERAY_API FPDDeviceCareRay : public FPDDeviceMould
  53. {
  54. using super = IODeviceDetail; //IODeviceDetail类的别名声明
  55. std::unique_ptr <DetectorCtrlUnit> m_DetectorCtrlUnit;
  56. std::unique_ptr <AcqUnit> m_AcqUnit;
  57. std::unique_ptr <SyncUnit> m_SyncUnit;
  58. std::unique_ptr <CalibUnit> m_CalibUnit;
  59. std::unique_ptr <DeviceTemperatureMould> m_Temperature;
  60. std::unique_ptr <DeviceBatteryMould> m_Battery;
  61. std::unique_ptr <DeviceWifiMould> m_Wifi;
  62. std::unique_ptr <DetectorConfiguration> m_DetectorConfiguration;
  63. //std::unique_ptr <FPDErrorWarning> m_WarnAndError;
  64. ResDataObject m_ACQMODElist;
  65. DeviceIndexStruct m_stDeviceConfig;//保存从配置文件读取的一些配置
  66. std::string m_strWorkPath;
  67. WORD* m_pImgBuffer;
  68. APP_STATUS m_eAppStatus;
  69. bool m_bConnect;
  70. SYSTEMTIME m_stImgCreateTime; //记录图像生成时间(软同步使用开窗时间),用于填写dicom
  71. SYNC_MODE m_eSyncMode;
  72. float m_fFactorEXI2UGY; //探测器EXI -> UGY 转换系数
  73. int m_nCurrentMode; //已选择的模式
  74. int m_nCurrentActiveDetectorID; //已经激活的探测器ID
  75. float m_fCurrentDetectorTemperature; //当前探测器的温度
  76. int m_nCurrentBatteryValue;//当前探测器电量值
  77. int m_nCurrentWifiValue;//当前探测器wifi值
  78. DetModeInfoStruct m_stModeInfo;
  79. DetCalibInfo m_stCalibInfo;
  80. public:
  81. FPDDeviceCareRay(std::shared_ptr<IOEventCenter> center, std::string strConfigPath);
  82. ~FPDDeviceCareRay();
  83. virtual std::string GetGUID() const override;
  84. virtual bool Prepare() override;
  85. bool CreateDevice();
  86. void Register();
  87. RET_STATUS Connect();
  88. RET_STATUS GetDetectorInfo(string& strFPDInfo);
  89. RET_STATUS EnterExam(int nExamMode);
  90. RET_STATUS SetAcqMode(string strAcqMode);
  91. //RET_STATUS SetSyncMode(SYNC_MODE eSyncMode, HARDWARE_TRIGGER_MODE eTriggerMode);
  92. //RET_STATUS SetXwindow(float fXwindowSize);
  93. RET_STATUS ActiveDetector(bool bActive);
  94. RET_STATUS GetSyncMode(SYNC_MODE &eSyncMode);
  95. RET_STATUS PrepareAcquisition();
  96. RET_STATUS StartAcquisition(string in = "");
  97. RET_STATUS StopAcquisition();
  98. RET_STATUS ActiveCalibration(CCOS_CALIBRATION_TYPE eType);
  99. RET_STATUS PrepareCalibration();
  100. RET_STATUS GetRequestedDose(string& strDose);
  101. RET_STATUS StartCalibration();
  102. RET_STATUS StopCalibration();
  103. //RET_STATUS SetCorrectionType(CCOS_CORRECTION_TYPE eType);
  104. void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  105. void ConfirmCalExposure();
  106. void RejectCalExposure();
  107. bool Support_DarkCalib();
  108. bool Support_XrayCalib();
  109. bool GetLogicMode(string& strAcqMode, int& nLogicMode);
  110. private:
  111. void SendTemperatureValue(float fValue);
  112. void SendTemperatureMaxLimit(float fValue);
  113. void SendTemperatureLowLimit(float fValue);
  114. void SendTemperatureMaxWarn(float fValue);
  115. void SendTemperatureMinWarn(float fValue);
  116. void SendWifiValue(int nValue);
  117. void SendWifiMinLimit(int nValue);
  118. void SendWifiMinWarn(int nValue);
  119. void SendBatteryValue(int nValue);
  120. void SendBatteryMinLimit(int nValue);
  121. void SendBatteryMinWarn(int nValue);
  122. bool LoadConfig();
  123. void OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  124. void OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  125. void OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  126. void OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  127. void OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  128. void OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  129. protected:
  130. void RegisterCtrl(nsDetail::Dispatch* Dispatch);
  131. void RegisterAcq(nsDetail::Dispatch* Dispatch);
  132. void RegisterSync(nsDetail::Dispatch* Dispatch);
  133. void RegisterCalib(nsDetail::Dispatch* Dispatch);
  134. void RegisterOthers(nsDetail::Dispatch* Dispatch);
  135. };
  136. } //end namespace CCOS::Dev::Detail::Detector