CCOS.Dev.FPD.TiRayDR.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 "MyPingip.h"
  9. #define CCOSDEVFPDTIRAYDR_API
  10. #define TiRay4343W 1
  11. namespace CCOS::Dev::Detail::Detector
  12. {
  13. class CCOSDEVFPDTIRAYDR_API TiRayDriver : public FPDDriverMould
  14. {
  15. FPDDeviceTiRay* pObjDev;
  16. bool m_bDriverConnect; //driver是否连接的标记位
  17. //*** 配置文件相关成员变量begin ***
  18. ResDataObject m_DeviceConfig;
  19. ResDataObject m_ConfigAll; //存储当前的配置,用于修改配置时写回文件
  20. ResDataObject m_Configurations; //存储当前配置中“CONFIGURATION”节点的内容
  21. std::unique_ptr <ResDataObject> m_pAttribute;
  22. std::unique_ptr <ResDataObject> m_pDescription;
  23. std::unique_ptr <DetectorConfiguration> m_DetectorConfiguration;
  24. //*** 配置文件相关成员变量end ***
  25. public:
  26. TiRayDriver();
  27. virtual ~TiRayDriver();
  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. virtual bool GetDeviceConfig(std::string& Cfg) override;
  37. virtual bool SetDeviceConfig(std::string Cfg) override;
  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. bool CheckConnect(std::string strIP);
  42. };
  43. namespace nsDetail = CCOS::Dev::Detail;
  44. class CCOSDEVFPDTIRAYDR_API FPDDeviceTiRay : 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_nPixelSpacing;
  63. int m_nSensitivity;
  64. int m_nAcqMode;
  65. float m_fDose;
  66. unsigned short* m_pFullImgBuffer;
  67. APP_STATUS m_eAppStatus;
  68. bool m_bDeviceConnect;
  69. GlobalTime m_stImgCreateTime; //记录图像生成时间(软同步使用开窗时间),用于填写dicom
  70. SYNC_MODE m_eSyncMode;
  71. int m_nFPDExpReadyTime; //窗口
  72. float m_fFactorEXI2UGY; //探测器EXI -> UGY 转换系数
  73. ResDataObject m_CalibDoseList; //ZSKK校正时加载校正剂量配置
  74. std::shared_ptr<LinuxEvent> m_WaitCalibDoseEvt;
  75. float m_fDoseParam;// 校正用的曝光计量,发送到UI 且本地记录
  76. int m_nCalibTotalExposureNum; //校正曝光总次数
  77. int m_nCalibCurrentCalibrationRound; //校正曝光第几轮
  78. int m_nCalibCurrentExposureIndex; //校正曝光第几次
  79. int m_nCalibCurrentExposureNum; //已校正曝光总次数
  80. int m_nTargetCalibExi;// 校正时图像需要达到的EXI值 康众4343W增益校正 推荐10000EXI
  81. bool m_bEnterAcqStatus;//探测器是否真正进入了采集状态,与通知工作流事件触发的状态不同,这个是真正的状态
  82. CCOS_CALIBRATION_TYPE m_CalibType;
  83. public:
  84. FPDDeviceTiRay(std::shared_ptr<IOEventCenter> center, std::string strConfigPath);
  85. ~FPDDeviceTiRay();
  86. virtual std::string GetGUID() const override;
  87. virtual bool Prepare() override;
  88. bool CreateDevice();
  89. void Register();
  90. RET_STATUS ScanDetector(string& strDetectorInfo);
  91. RET_STATUS Connect();
  92. RET_STATUS EnterExam(int nExamMode);
  93. RET_STATUS SetAcqMode(string strMode);
  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(std::string& strDose);
  101. RET_STATUS SetRequestedDose(std::string strDose);
  102. RET_STATUS StartCalibration();
  103. RET_STATUS StopCalibration();
  104. RET_STATUS GetCalibrationStep(int nDetectorID, string& strCalibrationStepInfo);
  105. RET_STATUS AcceptCalibration();
  106. RET_STATUS RejectCalibration();
  107. RET_STATUS ActiveDetector(bool bActive);
  108. RET_STATUS CompleteCalibration();
  109. RET_STATUS UpdateCalibMode(CCOS_CALIBRATION_MODE eCalibMode);
  110. RET_STATUS ActiveSyncMode(int nSyncMode);
  111. RET_STATUS UpdateLastCalibrationDate(std::string in);
  112. RET_STATUS UpdateCalibrationFileExpireTime(std::string in);
  113. RET_STATUS AbortCalibration();
  114. RET_STATUS SaveCalibrationFile(bool bSaveFlag);
  115. void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  116. bool Support_DarkCalib();
  117. bool Support_XrayCalib();
  118. private:
  119. void SendTemperatureValue(float fValue);
  120. void SendWifiValue(int nValue);
  121. void SendBatteryValue(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. }