DIOS.Dev.FPD.CareRay.h 6.2 KB

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