DIOS.Dev.FPD.CareRayDR.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. #ifdef CCOSDEVFPDCARERAYDR_EXPORTS
  9. #define CCOSDEVFPDCARERAYDR_API __declspec(dllexport)
  10. #else
  11. #define CCOSDEVFPDCARERAYDR_API __declspec(dllimport)
  12. #endif
  13. namespace CCOS::Dev::Detail::Detector
  14. {
  15. class CCOSDEVFPDCARERAYDR_API CareRayDriver : public FPDDriverMould
  16. {
  17. FPDDeviceCareRay* pObjDev;
  18. bool m_bDriverConnect; //driver是否连接的标记位
  19. //*** 配置文件相关成员变量begin ***
  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. //*** 配置文件相关成员变量end ***
  26. public:
  27. CareRayDriver();
  28. virtual ~CareRayDriver();
  29. virtual void Prepare() override;
  30. virtual bool Connect() override;
  31. virtual void Disconnect() override;
  32. virtual bool isConnected() const override;
  33. virtual auto CreateDevice(int index)->std::unique_ptr <IODevice> override;
  34. virtual std::string DriverProbe() override;
  35. virtual std::string GetResource() override;
  36. virtual std::string DeviceProbe() override;
  37. virtual bool GetDeviceConfig(std::string& Cfg) override;
  38. virtual bool SetDeviceConfig(std::string Cfg) override;
  39. bool SaveConfigFile(bool bSendNotify);
  40. bool GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue);
  41. bool SetDeviceConfigValue(ResDataObject &config, const char* pInnerKey, int nPathID, const char* szValue);
  42. };
  43. namespace nsDetail = CCOS::Dev::Detail;
  44. class CCOSDEVFPDCARERAYDR_API FPDDeviceCareRay : public FPDDeviceMould
  45. {
  46. using super = IODeviceDetail; //IODeviceDetail类的别名声明
  47. std::unique_ptr <DetectorCtrlUnit> m_DetectorCtrlUnit;
  48. std::unique_ptr <AcqUnit> m_AcqUnit;
  49. std::unique_ptr <SyncUnit> m_SyncUnit;
  50. std::unique_ptr <CalibUnit> m_CalibUnit;
  51. std::unique_ptr <DeviceTemperatureMould> m_Temperature;
  52. std::unique_ptr <DeviceBatteryMould> m_Battery;
  53. std::unique_ptr <DeviceWifiMould> m_Wifi;
  54. std::unique_ptr <DetectorConfiguration> m_DetectorConfiguration;
  55. //std::unique_ptr <FPDErrorWarning> m_WarnAndError;
  56. ResDataObject m_ACQMODElist;
  57. DeviceIndexStruct m_stDeviceConfig;
  58. std::string m_strWorkPath;
  59. int m_nFullImageHeight;
  60. int m_nFullImageWidth;
  61. int m_nImgBits;
  62. int m_nAngle;
  63. int m_nPixelSpacing;
  64. int m_nSensitivity;
  65. int m_nAcqMode;
  66. float m_fDose;
  67. WORD* m_pFullImgBuffer;
  68. APP_STATUS m_eAppStatus;
  69. bool m_bDeviceConnect;
  70. SYSTEMTIME m_stImgCreateTime; //记录图像生成时间(软同步使用开窗时间),用于填写dicom
  71. SYNC_MODE m_eSyncMode;
  72. int m_nFPDExpReadyTime; //窗口
  73. float m_fFactorEXI2UGY; //探测器EXI -> UGY 转换系数
  74. ResDataObject m_CalibDoseList; //ZSKK校正时加载校正剂量配置
  75. HANDLE m_WaitCalibDoseEvt;
  76. float m_fDoseParam;// 校正用的曝光计量,发送到UI 且本地记录
  77. int m_nCalibTotalExposureNum; //校正曝光总次数
  78. int m_nCalibCurrentCalibrationRound; //校正曝光第几轮
  79. int m_nCalibCurrentExposureIndex; //校正曝光第几次
  80. int m_nCalibCurrentExposureNum; //已校正曝光总次数
  81. bool m_bOnlyHaveFpd;//当前系统是否只配置了一个真实的探测器并且处于AED同步模式,其他设备没有或者是demo的 1-是 0-否 默认否
  82. public:
  83. FPDDeviceCareRay(std::shared_ptr<IOEventCenter> center, std::string strConfigPath);
  84. ~FPDDeviceCareRay();
  85. virtual std::string GetGUID() const override;
  86. virtual bool Prepare() override;
  87. bool CreateDevice();
  88. void Register();
  89. RET_STATUS Connect();
  90. RET_STATUS EnterExam(int nExamMode);
  91. RET_STATUS SetAcqMode(string strMode);
  92. RET_STATUS GetSyncMode(SYNC_MODE &eSyncMode);
  93. RET_STATUS PrepareAcquisition();
  94. RET_STATUS StartAcquisition(string in = "");
  95. RET_STATUS ToFrameAcq(string in = "");
  96. RET_STATUS RequestXray(string in = "");
  97. RET_STATUS StopAcquisition();
  98. RET_STATUS ActiveCalibration(CCOS_CALIBRATION_TYPE eType);
  99. RET_STATUS PrepareCalibration();
  100. RET_STATUS GetRequestedDose(std::string& strDose);
  101. RET_STATUS StartCalibration();
  102. RET_STATUS StopCalibration();
  103. RET_STATUS GetCalibrationStep(int nDetectorID, string& strCalibrationStepInfo);
  104. RET_STATUS AcceptCalibration();
  105. RET_STATUS RejectCalibration();
  106. void AbortCalibration();
  107. bool CompleteCalibration();
  108. RET_STATUS SaveCalibrationFile(bool bSaveFlag);
  109. bool GetOnlyHaveFpd();
  110. int GetGainExposureNum();
  111. void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  112. void ConfirmCalExposure();
  113. void RejectCalExposure();
  114. bool Support_DarkCalib();
  115. bool Support_XrayCalib();
  116. private:
  117. void SendTemperatureValue(float fValue);
  118. void SendWifiValue(int nValue);
  119. void SendBatteryValue(int nValue);
  120. bool LoadConfig();
  121. void OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  122. void OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  123. void OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  124. void OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  125. void OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  126. void OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  127. protected:
  128. void RegisterCtrl(nsDetail::Dispatch* Dispatch);
  129. void RegisterAcq(nsDetail::Dispatch* Dispatch);
  130. void RegisterSync(nsDetail::Dispatch* Dispatch);
  131. void RegisterCalib(nsDetail::Dispatch* Dispatch);
  132. void RegisterOthers(nsDetail::Dispatch* Dispatch);
  133. };
  134. }