DIOS.Dev.FPD.Rayence.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 "logicClient.h"
  8. #include "DetectorConfiguration.h"
  9. #ifdef CCOSDEVFPDRAYENCERF_EXPORTS
  10. #define CCOSDEVFPDRAYENCERF_API __declspec(dllexport)
  11. #else
  12. #define CCOSDEVFPDRAYENCERF_API __declspec(dllimport)
  13. #endif
  14. enum class AcqMode
  15. {
  16. RAD = 1,
  17. RAD_PREVIEW = 2,//preview or tomo
  18. CF = 3,
  19. PF = 4
  20. };
  21. namespace CCOS::Dev::Detail::Detector
  22. {
  23. class CCOSDEVFPDRAYENCERF_API RayenceDriver : public FPDDriverMould
  24. {
  25. FPDDeviceRayence* pObjDev;
  26. bool m_bDriverConnect; //driver是否连接的标记位
  27. ResDataObject m_DeviceConfig;
  28. ResDataObject m_ConfigAll; //存储当前的配置,用于修改配置时写回文件
  29. ResDataObject m_Configurations; //存储当前配置中“CONFIGURATION”节点的内容
  30. std::unique_ptr <ResDataObject> m_pAttribute;
  31. std::unique_ptr <ResDataObject> m_pDescription;
  32. public:
  33. RayenceDriver();
  34. virtual ~RayenceDriver();
  35. virtual void Prepare() override;
  36. virtual bool Connect() override;
  37. virtual void Disconnect() override;
  38. virtual bool isConnected() const override;
  39. virtual auto CreateDevice(int index)->std::unique_ptr <IODevice> override;
  40. virtual std::string DriverProbe() override;
  41. virtual std::string GetResource() override;
  42. virtual std::string DeviceProbe() override;
  43. bool GetDeviceConfig(std::string& Cfg);
  44. bool SetDeviceConfig(std::string Cfg);
  45. bool SaveConfigFile(bool bSendNotify);
  46. bool GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue);
  47. bool SetDeviceConfigValue(ResDataObject& config, const char* pInnerKey, int nPathID, const char* szValue);
  48. };
  49. namespace nsDetail = CCOS::Dev::Detail;
  50. class CCOSDEVFPDRAYENCERF_API FPDDeviceRayence : public FPDDeviceMould
  51. {
  52. using super = IODeviceDetail; //IODeviceDetail类的别名声明
  53. std::unique_ptr <DetectorCtrlUnit> m_DetectorCtrlUnit;
  54. std::unique_ptr <AcqUnit> m_AcqUnit;
  55. std::unique_ptr <SyncUnit> m_SyncUnit;
  56. std::unique_ptr <CalibUnit> m_CalibUnit;
  57. std::unique_ptr <DetectorConfiguration> m_DetectorConfiguration;
  58. PVOID m_pDetector;
  59. ResDataObject m_ACQMODElist;
  60. DeviceIndexStruct m_stDeviceConfig;
  61. std::string m_strWorkPath;
  62. std::string m_strCurrentAcqMode;
  63. int m_nImageHeight;
  64. int m_nImageWidth;
  65. int m_nImgBits;
  66. int m_nAngle;
  67. int m_nPixelSpacing;
  68. int m_nSensitivity;
  69. float m_fDose;
  70. float m_fCurrentPPS;
  71. float m_fMaxFrameRate;//探测器支持的最大帧率
  72. WORD* m_pImgBuffer;
  73. APP_STATUS m_eAppStatus;
  74. bool m_bConnect;
  75. ResDataObject m_CalibDoseList;
  76. ResDataObject m_DetectorModeList;//探测器的采集模式列表
  77. std::vector<DetectorMode> m_vDetectorModeList;
  78. public:
  79. FPDDeviceRayence(std::shared_ptr<IOEventCenter> center, std::string strConfigPath);
  80. ~FPDDeviceRayence();
  81. virtual std::string GetGUID() const override;
  82. virtual bool Prepare() override;
  83. bool CreateDevice();
  84. void Register();
  85. RET_STATUS Connect();
  86. RET_STATUS SetAcqMode(string nMode);
  87. RET_STATUS EnterExam(int nExamMode);
  88. RET_STATUS PrepareAcquisition();
  89. RET_STATUS StartAcquisition(string in);
  90. RET_STATUS StopAcquisition();
  91. RET_STATUS SetExposureTimes(int nTimes);
  92. RET_STATUS ActiveCalibration(CCOS_CALIBRATION_TYPE eType);
  93. RET_STATUS PrepareCalibration();
  94. RET_STATUS GetRequestedDose(std::string& strDose);
  95. RET_STATUS StartCalibration();
  96. RET_STATUS StopCalibration();
  97. RET_STATUS StartOffset(bool isAll);
  98. RET_STATUS AbortOffset();
  99. RET_STATUS SetFluPPS(float fFluPPS);
  100. RET_STATUS GetFluPPS(float& fFluPPS);
  101. bool Support_DarkCalib();
  102. bool Support_XrayCalib();
  103. void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  104. private:
  105. bool LoadConfig();
  106. void OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  107. void OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  108. void OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  109. void OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  110. void OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  111. void OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
  112. protected:
  113. void RegisterCtrl(nsDetail::Dispatch* Dispatch);
  114. void RegisterAcq(nsDetail::Dispatch* Dispatch);
  115. void RegisterSync(nsDetail::Dispatch* Dispatch);
  116. void RegisterCalib(nsDetail::Dispatch* Dispatch);
  117. };
  118. } //end namespace CCOS::Dev::Detail::Detector