123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
-
- #pragma once
- #include "CCOS.Dev.FPDDeviceMould.hpp"
- #include "OEM.Acq.h"
- #include "OEM.Sync.h"
- #include "OEM.Calib.h"
- #include "OEM.DetectorCtrl.h"
- #include "DetectorConfiguration.h"
- #include "FPDErrorWarningProcess.h"
- #include "DetectorDefinition.h"
- #ifdef CCOSDEVFPDXIUYUAN_EXPORTS
- #define __CCOSDEVFPDXIUYUAN_EXPORTS__ __declspec(dllexport)
- #else
- #define __CCOSDEVFPDXIUYUAN_EXPORTS__ __declspec(dllimport)
- #endif
- namespace CCOS::Dev::Detail::Detector
- {
- //-----------------------------------------------------------------------------
- // XiuYuanDriver
- //-----------------------------------------------------------------------------
- class __CCOSDEVFPDXIUYUAN_EXPORTS__ XiuYuanDriver : public FPDDriverMould
- {
- using super = FPDDriverMould;
- FPDDeviceXiuYuan* dev;
- bool m_bConnect;
- ResDataObject m_ConfigAll;
- ResDataObject m_Configurations;
- ResDataObject m_DeviceConfig;
- std::unique_ptr <ResDataObject> m_pAttribute;
- std::unique_ptr <ResDataObject> m_pDescription;
- public:
- XiuYuanDriver();
- virtual ~XiuYuanDriver();
- 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);
- };
- //-----------------------------------------------------------------------------
- // FPDDeviceXiuYuan
- //-----------------------------------------------------------------------------
- class XiuYuanCtrl;
- class __CCOSDEVFPDXIUYUAN_EXPORTS__ FPDDeviceXiuYuan : public FPDDeviceMould
- {
- using super = IODeviceDetail;
- private:
- std::unique_ptr <AcqUnit> m_AcqUnit;
- std::unique_ptr <SyncUnit> m_SyncUnit;
- std::unique_ptr <CalibUnit> m_CalibUnit;
- std::unique_ptr <DetectorCtrlUnit> m_DetectorCtrlUnit;
- 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;
- SYNC_MODE m_eSyncMode;
- APP_STATUS m_eAppStatus; //DROC的当前状态
- SYSTEMTIME m_stImgCreateTime;
- ResDataObject m_CalibDoseList; //ZSKK校正时加载校正剂量配置
- DeviceIndexStruct m_stDeviceConfig;
- CCOS_CALIBRATION_TYPE m_CalibType;
-
- WORD* m_pFullImgBuffer; //裁剪后的有效图像内存
- WORD* m_pPreviewImgBuffer;
-
- std::string m_strWorkPath;
-
- int m_nCalibTotalExposureNum; //校正曝光总次数
- int m_nFullImgWidth; //有效图像的宽
- int m_nFullImgHeight; //有效图像的高
- int m_nAngle;
- int m_nPixelSpacing;
- int m_nSensitivity;
- int m_nImageBits; //图像位数
- int m_nPreviewEnable;
- int m_nPreviewImageWidth;
- int m_nPreviewImageHeight;
- int m_nCalibCurrentCalibrationRound;
- int m_nCalibCurrentExposureIndex;
- int m_nCalibCurrentExposureNum;
-
- float m_fFactorEXI2UGY; //探测器EXI -> UGY 转换系数
- bool m_bSaveRaw;
- bool m_bConnectStatus;
- bool LoadConfig();
- void SaveRawImage(const char* pImgName, const WORD* pRawImg, int nWidth, int nHeight);
- 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);
- bool GetEffectiveImage(WORD* pwInImgData, int nRawImageWidth);
- bool CompleteCalibration();
- bool SaveConfigFile(bool bSendNotify);
- string GetFileVersion(string strFilePathName);
- void SendTemperatureValue(float fTemp);
- void SendWifiValue(int nWifi);
- void SendBatteryValue(int nBattery);
- void AbortCalibration();
- bool Support_DarkCalib();
- bool Support_XrayCalib();
- RET_STATUS AddFrameWithRawHead(IMAGE_VIEW_TYPE Type, WORD* pFrameBuff, DWORD FrameSize);
- string MakeImageHead(IMAGE_VIEW_TYPE Type);
- public:
- FPDDeviceXiuYuan(std::shared_ptr <IOEventCenter> center, string ConfigPath);
- ~FPDDeviceXiuYuan();
- bool m_bOffsetCalibRunning;
- public:
- void Register();
- virtual std::string GetGUID() const override;
- virtual bool Prepare() override;
- protected:
- void RegisterCtrl(CCOS::Dev::Detail::Dispatch* Dispatch);
- void RegisterAcq(CCOS::Dev::Detail::Dispatch* Dispatch);
- void RegisterSync(CCOS::Dev::Detail::Dispatch* Dispatch);
- void RegisterCalib(CCOS::Dev::Detail::Dispatch* Dispatch);
- void RegisterOthers(CCOS::Dev::Detail::Dispatch* Dispatch);
- public:
- bool CreateDevice();
- RET_STATUS Connect();
- RET_STATUS ActiveDetector(bool bActive);
- RET_STATUS SetAcqMode(string strAcqMode);
- RET_STATUS GetSyncMode(SYNC_MODE& eSyncMode);
- RET_STATUS PrepareAcquisition();
- RET_STATUS StartAcquisition(string in = "");
- RET_STATUS StopAcquisition();
- RET_STATUS ActiveSyncMode(int nSyncMode);
- RET_STATUS ActiveCalibration(CCOS_CALIBRATION_TYPE in);
- RET_STATUS PrepareCalibration();
- RET_STATUS GetRequestedDose(string& strDose);
- RET_STATUS SetRequestedDose(std::string strDose);
- RET_STATUS GetCalibrationStep(int nDetectorID, string& strCalibrationStepInfo);
- RET_STATUS StartCalibration();
- RET_STATUS StopCalibration();
- RET_STATUS AcceptCalibration();
- RET_STATUS RejectCalibration();
- RET_STATUS SaveCalibrationFile(bool bSaveFlag);
- RET_STATUS UpdateCalibMode(CCOS_CALIBRATION_MODE eCalibMode);
- RET_STATUS UpdateNotifyStatusTimePeriod(int nTime);
- RET_STATUS UpdateReconnectTimePeriod(int nTime);
- RET_STATUS EnterExam(int nExamStatus);
- void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
- };
- }
|