CCOS.Dev.FPD.HaoBo.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #pragma once
  2. #include "CCOS.Dev.FPDDeviceMould.hpp"
  3. #include "OemAcq.h"
  4. #include "OemSync.h"
  5. #include "OemCalib.h"
  6. #include "OemCtrl.h"
  7. #include "DetectorConfiguration.h"
  8. #include "CCOS.Dev.MSGMould.hpp"
  9. //#include "FPDErrorWarningProcess.h"
  10. #define CCOS_FPD_RF_API
  11. enum AcqMode
  12. {
  13. RAD = 1,
  14. CF = 2,
  15. PF = 3
  16. };
  17. namespace CCOS::Dev::Detail::Detector
  18. {
  19. class CCOS_FPD_RF_API HaoBoDriver : public FPDDriverMould
  20. {
  21. FPDDeviceHaoBo* pObjDev;
  22. ResDataObject m_DeviceConfig;
  23. ResDataObject m_ConfigAll; //存储当前的配置,用于修改配置时写回文件
  24. ResDataObject m_Configurations; //存储当前配置中“CONFIGURATION”节点的内容
  25. std::unique_ptr <ResDataObject> m_pAttribute;
  26. std::unique_ptr <ResDataObject> m_pDescription;
  27. public:
  28. HaoBoDriver();
  29. virtual ~HaoBoDriver();
  30. bool m_bDriverConnect; //driver是否连接的标记位
  31. virtual void Prepare() override;
  32. virtual bool Connect() override;
  33. virtual void Disconnect() override;
  34. virtual bool isConnected() const override;
  35. virtual auto CreateDevice(int index)->std::unique_ptr <IODevice> override;
  36. virtual std::string DriverProbe() override;
  37. virtual std::string GetResource() override;
  38. virtual std::string DeviceProbe() override;
  39. bool GetDeviceConfig(std::string& Cfg);
  40. bool SetDeviceConfig(std::string Cfg);
  41. bool SaveConfigFile(bool bSendNotify);
  42. bool GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue);
  43. bool SetDeviceConfigValue(ResDataObject& config, const char* pInnerKey, int nPathID, const char* szValue);
  44. };
  45. namespace nsDetail = CCOS::Dev::Detail;
  46. class CCOS_FPD_RF_API FPDDeviceHaoBo : public FPDDeviceMould
  47. {
  48. using super = IODeviceDetail; //IODeviceDetail类的别名声明
  49. std::unique_ptr <DetectorCtrlUnit> m_DetectorCtrlUnit;
  50. std::unique_ptr <AcqUnit> m_AcqUnit;
  51. std::unique_ptr <SyncUnit> m_SyncUnit;
  52. std::unique_ptr <CalibUnit> m_CalibUnit;
  53. std::unique_ptr <DeviceTemperatureMould> m_Temperature;
  54. std::unique_ptr <DeviceBatteryMould> m_Battery;
  55. std::unique_ptr <DeviceWifiMould> m_Wifi;
  56. std::unique_ptr <DetectorConfiguration> m_DetectorConfiguration;
  57. //std::unique_ptr <FPDErrorWarning> m_WarnAndError;
  58. DeviceIndexStruct m_stDeviceConfig;
  59. std::string m_strWorkPath;
  60. int m_nWidth;
  61. int m_nHeight;
  62. int m_nImgBits;
  63. int m_nAngle;
  64. int m_nPixelSpacing;
  65. int m_nSensitivity;
  66. float m_fDose;
  67. unsigned short* m_pImgBuffer;
  68. APP_STATUS m_eAppStatus;
  69. bool m_bDeviceConnect;
  70. ResDataObject m_CalibDoseList;
  71. int m_nCurrentAcqMode;//记录当前的采集模式
  72. float m_fCurrentPPS;//当前帧率
  73. std::vector<AcqModeInfo> m_vAcqModeInfoList;
  74. float m_fFactorEXI2UGY; //探测器EXI -> UGY 转换系数
  75. public:
  76. FPDDeviceHaoBo(std::shared_ptr<IOEventCenter> center, std::string strConfigPath);
  77. ~FPDDeviceHaoBo();
  78. virtual std::string GetGUID() const override;
  79. virtual bool Prepare() override;
  80. bool CreateDevice();
  81. void Register();
  82. RET_STATUS Connect();
  83. RET_STATUS SetAcqMode(string strAcqMode);
  84. RET_STATUS EnterExam(int nExamMode);
  85. RET_STATUS PrepareAcquisition();
  86. RET_STATUS StartAcquisition(string in = "");
  87. RET_STATUS StopAcquisition();
  88. RET_STATUS SetXrayOnNum();
  89. RET_STATUS SetExposureTimes(int nTimes);
  90. RET_STATUS ActiveCalibration(CCOS_CALIBRATION_TYPE eType);
  91. RET_STATUS PrepareCalibration();
  92. RET_STATUS GetRequestedDose(std::string& strDose);
  93. RET_STATUS StartCalibration();
  94. RET_STATUS StopCalibration();
  95. RET_STATUS AbortCalibration();
  96. RET_STATUS CompleteCalibration();
  97. RET_STATUS SetFluPPS(float fFluPPS);
  98. RET_STATUS GetFluPPS(float& fFluPPS);
  99. RET_STATUS StartOffset(bool isAll);
  100. RET_STATUS AbortOffset();
  101. RET_STATUS UpdateModeInRunning(std::vector<AcqModeInfo>& vAcqModeList);
  102. RET_STATUS GetDetectorInfo(string& strInfo);
  103. RET_STATUS FaultInjection(string strErrorCode);
  104. RET_STATUS EliminateFault(string strErrorCode);
  105. bool Support_DarkCalib();
  106. bool Support_XrayCalib();
  107. void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  108. bool GetLogicMode(string& strAcqMode, int& nLogicMode);
  109. private:
  110. bool LoadConfig();
  111. void OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  112. void OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  113. void OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  114. void OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  115. void OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  116. void OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  117. protected:
  118. void RegisterCtrl(nsDetail::Dispatch* Dispatch);
  119. void RegisterAcq(nsDetail::Dispatch* Dispatch);
  120. void RegisterSync(nsDetail::Dispatch* Dispatch);
  121. void RegisterCalib(nsDetail::Dispatch* Dispatch);
  122. void RegisterOthers(nsDetail::Dispatch* Dispatch);
  123. };
  124. }