DIOS.Dev.FPD.PZMedical.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. #pragma warning(disable:6258) //允许线程清理
  11. #pragma warning(disable:28159) //无需考虑使用“GetTickCount64”而不是“GetTickCount”。
  12. #ifdef CCOSDEVFPD_EXPORTS
  13. #define CCOSDEVFPD_API __declspec(dllexport)
  14. #else
  15. #define CCOSDEVFPD_API __declspec(dllimport)
  16. #endif
  17. class PZMedicalCtrl;
  18. namespace CCOS::Dev::Detail::Detector
  19. {
  20. class CCOSDEVFPD_API PZMedicalDriver : public FPDDriverMould
  21. {
  22. FPDDevicePZMedical* pObjDev;
  23. bool m_bConnect; //driver是否连接的标记位
  24. //*** 配置文件相关成员变量begin ***
  25. ResDataObject m_DeviceConfig;
  26. ResDataObject m_ConfigAll; //存储当前的配置,用于修改配置时写回文件
  27. ResDataObject m_Configurations; //存储当前配置中“CONFIGURATION”节点的内容
  28. std::unique_ptr <ResDataObject> m_pAttribute;
  29. std::unique_ptr <ResDataObject> m_pDescription;
  30. //*** 配置文件相关成员变量end ***
  31. public:
  32. PZMedicalDriver();
  33. virtual ~PZMedicalDriver();
  34. virtual void Prepare() override;
  35. virtual bool Connect() override;
  36. virtual void Disconnect() override;
  37. virtual bool isConnected() const override;
  38. virtual auto CreateDevice(int index)->std::unique_ptr <IODevice> override;
  39. virtual std::string DriverProbe() override;
  40. virtual std::string GetResource() override;
  41. virtual std::string DeviceProbe() override;
  42. virtual bool GetDeviceConfig(std::string& Cfg) override;
  43. virtual bool SetDeviceConfig(std::string Cfg) override;
  44. bool SaveConfigFile(bool bSendNotify);
  45. bool GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue);
  46. bool SetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, const char* szValue);
  47. };
  48. namespace nsDetail = CCOS::Dev::Detail;
  49. class CCOSDEVFPD_API FPDDevicePZMedical : public FPDDeviceMould
  50. {
  51. using super = IODeviceDetail; //IODeviceDetail类的别名声明
  52. std::unique_ptr <DetectorCtrlUnit> m_DetectorCtrlUnit;
  53. std::unique_ptr <AcqUnit> m_AcqUnit;
  54. std::unique_ptr <SyncUnit> m_SyncUnit;
  55. std::unique_ptr <CalibUnit> m_CalibUnit;
  56. std::unique_ptr <DeviceTemperatureMould> m_Temperature;
  57. std::unique_ptr <DeviceBatteryMould> m_Battery;
  58. std::unique_ptr <DeviceWifiMould> m_Wifi;
  59. std::unique_ptr <DetectorConfiguration> m_DetectorConfiguration;
  60. //std::unique_ptr <FPDErrorWarning> m_WarnAndError;
  61. PZMedicalCtrl* m_pDetector;
  62. DeviceIndexStruct m_stDeviceConfig;
  63. std::string m_strWorkPath; //进程路径
  64. //int m_nImageHeight;
  65. //int m_nImageWidth;
  66. /*int m_nCropLeft;
  67. int m_nCropRight;
  68. int m_nCropTop;
  69. int m_nCropBottom;
  70. int m_nRawImgHeight;
  71. int m_nRawImgWidth;*/
  72. //int m_nImgBits;
  73. //int m_nAngle;
  74. //int m_nPixelSpacing;
  75. //int m_nSensitivity;
  76. //float m_fDose;
  77. WORD* m_pImgBuffer;
  78. APP_STATUS m_eAppStatus;
  79. bool m_bConnect; //设备是否连接
  80. SYSTEMTIME m_stImgCreateTime; //记录图像生成时间(软同步使用开窗时间),用于填写dicom
  81. SYNC_MODE m_eSyncMode; //同步模式
  82. float m_fFactorEXI2UGY; //探测器EXI -> UGY 转换系数
  83. int m_nCurrentMode; //已选择的模式
  84. float m_fCurrentDetectorTemperature; //当前探测器的温度
  85. DetModeInfo m_stModeInfo;
  86. DetCalibInfo m_stCalibInfo;
  87. float m_fCurrentPPS; //上层设置的帧率
  88. public:
  89. FPDDevicePZMedical(std::shared_ptr<IOEventCenter> center, std::string strConfigPath);
  90. ~FPDDevicePZMedical();
  91. virtual std::string GetGUID() const override;
  92. virtual bool Prepare() override;
  93. bool CreateDevice();
  94. void Register();
  95. void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  96. RET_STATUS Connect();
  97. RET_STATUS EnterExam(int nExamMode);
  98. RET_STATUS SetAcqMode(std::string strAcqMode);
  99. //RET_STATUS SetSyncMode(SYNC_MODE eSyncMode, HARDWARE_TRIGGER_MODE eTriggerMode);
  100. //RET_STATUS SetXwindow(float fXwindowSize);
  101. RET_STATUS ActiveDetector(bool bActive);
  102. RET_STATUS GetSyncMode(SYNC_MODE &eSyncMode);
  103. RET_STATUS PrepareAcquisition();
  104. RET_STATUS StartAcquisition(string in);
  105. RET_STATUS StopAcquisition();
  106. RET_STATUS ActiveCalibration(CCOS_CALIBRATION_TYPE eType);
  107. RET_STATUS PrepareCalibration();
  108. RET_STATUS GetRequestedDose(string& strDose);
  109. RET_STATUS StartCalibration();
  110. RET_STATUS StopCalibration();
  111. RET_STATUS SetFluPPS(float fFluPPS);
  112. RET_STATUS GetFluPPS(float& fFluPPS);
  113. bool Support_DarkCalib();
  114. bool Support_XrayCalib();
  115. bool Support_HaveImageCalib();
  116. RET_STATUS GetCalibrationStep(int nDetectorID, std::string& strCalibrationStepInfo);
  117. RET_STATUS AcceptCalibration();
  118. RET_STATUS RejectCalibration();
  119. RET_STATUS SaveCalibrationFile(bool bSaveFlag);
  120. RET_STATUS StartOffset(bool isAll);
  121. RET_STATUS AbortOffset();
  122. RET_STATUS UpdateModeInRunning(std::vector<AcqModeInfo>& vAcqModeList);
  123. private:
  124. void SendTemperatureValue(float fValue);
  125. void SendWifiValue(int nValue);
  126. void SendBatteryValue(int nValue);
  127. bool LoadConfig();
  128. void OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  129. void OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  130. void OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  131. void OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  132. void OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  133. void OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  134. protected:
  135. void RegisterCtrl(nsDetail::Dispatch* Dispatch);
  136. void RegisterAcq(nsDetail::Dispatch* Dispatch);
  137. void RegisterSync(nsDetail::Dispatch* Dispatch);
  138. void RegisterCalib(nsDetail::Dispatch* Dispatch);
  139. void RegisterOthers(nsDetail::Dispatch* Dispatch);
  140. };
  141. } //end namespace CCOS::Dev::Detail::Detector