123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- #pragma once
- #include "CCOS.Dev.FPDDeviceMould.hpp"
- #include "OemAcq.h"
- #include "OemSync.h"
- #include "OemCtrl.h"
- #include "OemCalib.h"
- #include "DetectorConfiguration.h"
- #include "FPDErrorWarningProcess.h"
- #pragma warning(disable:26812) //枚举类型“ENUM_PANEL_EVENT_STATE”未设定范围。相比于 "enum",首选 "enum class" (Enum.3)
- #pragma warning(disable:26451) //算术溢出 : 使用 4 字节值上的运算符 * ,然后将结果转换到 8 字节值。在调用运算符 * 之前将值强制转换为宽类型可避免溢出(io.2)。
- #ifdef CCOSDEVFPDCARERAY_EXPORTS
- #define CCOSDEVFPDCARERAY_API __declspec(dllexport)
- #else
- #define CCOSDEVFPDCARERAY_API __declspec(dllimport)
- #endif
- enum ExposureMode
- {
- DEFAULTMODE,
- RAD,
- AEC
- };
- namespace CCOS::Dev::Detail::Detector
- {
- class CCOSDEVFPDCARERAY_API CareRayDriver : public FPDDriverMould
- {
- FPDDeviceCareRay* pObjDev;
- bool m_bConnect; //driver是否连接的标记位
- //*** 配置文件相关成员变量begin ***
- ResDataObject m_DeviceConfig;
- ResDataObject m_ConfigAll; //存储当前的配置,用于修改配置时写回文件
- ResDataObject m_Configurations; //存储当前配置中“CONFIGURATION”节点的内容
- std::unique_ptr <ResDataObject> m_pAttribute;
- std::unique_ptr <ResDataObject> m_pDescription;
- //*** 配置文件相关成员变量end ***
- public:
- CareRayDriver();
- virtual ~CareRayDriver();
- virtual void Prepare() override;
- virtual bool Connect() override;
- virtual void Disconnect() override;
- virtual bool isConnected() const override;
- virtual auto CreateDevice(int index)->std::unique_ptr <IODevice> override;
- virtual std::string DriverProbe() override;
- virtual std::string GetResource() override;
- virtual std::string DeviceProbe() override;
- virtual bool GetDeviceConfig(std::string& Cfg) override;
- virtual bool SetDeviceConfig(std::string Cfg) override;
- bool SaveConfigFile(bool bSendNotify);
- bool GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue);
- bool SetDeviceConfigValue(ResDataObject& config, const char* pInnerKey, int nPathID, const char* szValue);
- };
- namespace nsDetail = CCOS::Dev::Detail;
- class CCOSDEVFPDCARERAY_API FPDDeviceCareRay : public FPDDeviceMould
- {
- using super = IODeviceDetail; //IODeviceDetail类的别名声明
- std::unique_ptr <DetectorCtrlUnit> m_DetectorCtrlUnit;
- std::unique_ptr <AcqUnit> m_AcqUnit;
- std::unique_ptr <SyncUnit> m_SyncUnit;
- std::unique_ptr <CalibUnit> m_CalibUnit;
- std::unique_ptr <DeviceTemperatureMould> m_Temperature;
- std::unique_ptr <DeviceBatteryMould> m_Battery;
- std::unique_ptr <DeviceWifiMould> m_Wifi;
- std::unique_ptr <DetectorConfiguration> m_DetectorConfiguration;
- std::unique_ptr <FPDErrorWarning> m_WarnAndError;
- ResDataObject m_ACQMODElist;
- DeviceIndexStruct m_stDeviceConfig;//保存从配置文件读取的一些配置
- std::string m_strWorkPath;
- WORD* m_pImgBuffer;
- APP_STATUS m_eAppStatus;
- bool m_bConnect;
- SYSTEMTIME m_stImgCreateTime; //记录图像生成时间(软同步使用开窗时间),用于填写dicom
- SYNC_MODE m_eSyncMode;
- float m_fFactorEXI2UGY; //探测器EXI -> UGY 转换系数
- int m_nCurrentMode; //已选择的模式
- int m_nCurrentActiveDetectorID; //已经激活的探测器ID
- float m_fCurrentDetectorTemperature; //当前探测器的温度
- int m_nCurrentBatteryValue;//当前探测器电量值
- int m_nCurrentWifiValue;//当前探测器wifi值
- DetModeInfoStruct m_stModeInfo;
- DetCalibInfo m_stCalibInfo;
- public:
- FPDDeviceCareRay(std::shared_ptr<IOEventCenter> center, std::string strConfigPath);
- ~FPDDeviceCareRay();
- virtual std::string GetGUID() const override;
- virtual bool Prepare() override;
- bool CreateDevice();
- void Register();
- RET_STATUS Connect();
- RET_STATUS GetDetectorInfo(string& strFPDInfo);
- RET_STATUS EnterExam(int nExamMode);
- RET_STATUS SetAcqMode(string strAcqMode);
- //RET_STATUS SetSyncMode(SYNC_MODE eSyncMode, HARDWARE_TRIGGER_MODE eTriggerMode);
- //RET_STATUS SetXwindow(float fXwindowSize);
- RET_STATUS ActiveDetector(bool bActive);
- RET_STATUS GetSyncMode(SYNC_MODE &eSyncMode);
- RET_STATUS PrepareAcquisition();
- RET_STATUS StartAcquisition(string in = "");
- RET_STATUS StopAcquisition();
- RET_STATUS ActiveCalibration(CCOS_CALIBRATION_TYPE eType);
- RET_STATUS PrepareCalibration();
- RET_STATUS GetRequestedDose(string& strDose);
- RET_STATUS StartCalibration();
- RET_STATUS StopCalibration();
- //RET_STATUS SetCorrectionType(CCOS_CORRECTION_TYPE eType);
- void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
- void ConfirmCalExposure();
- void RejectCalExposure();
- bool Support_DarkCalib();
- bool Support_XrayCalib();
- bool GetLogicMode(string& strAcqMode, int& nLogicMode);
- private:
- void SendTemperatureValue(float fValue);
- void SendTemperatureMaxLimit(float fValue);
- void SendTemperatureLowLimit(float fValue);
- void SendTemperatureMaxWarn(float fValue);
- void SendTemperatureMinWarn(float fValue);
- void SendWifiValue(int nValue);
- void SendWifiMinLimit(int nValue);
- void SendWifiMinWarn(int nValue);
- void SendBatteryValue(int nValue);
- void SendBatteryMinLimit(int nValue);
- void SendBatteryMinWarn(int nValue);
- bool LoadConfig();
- void OnEventProcessConf(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
- void OnEventProcessInfo(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
- void OnEventProcessStatus(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
- void OnEventProcessData(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
- void OnEventProcessError(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
- void OnEventProcessWarning(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
- protected:
- void RegisterCtrl(nsDetail::Dispatch* Dispatch);
- void RegisterAcq(nsDetail::Dispatch* Dispatch);
- void RegisterSync(nsDetail::Dispatch* Dispatch);
- void RegisterCalib(nsDetail::Dispatch* Dispatch);
- void RegisterOthers(nsDetail::Dispatch* Dispatch);
- };
- } //end namespace CCOS::Dev::Detail::Detector
|