123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
-
- #pragma once
- #include "CCOS.Dev.FPDDeviceMould.hpp"
- #include "TemperatureMould.hpp"
- #include "BatteryMould.hpp"
- #include "WifiMould.hpp"
- #include "OemAcq.h"
- #include "OemSync.h"
- #include "OemCalib.h"
- #include "OemCtrl.h"
- #include "DetectorConfiguration.h"
- #include "FPDErrorWarningProcess.h"
- #include "CalibrationProcess.h"
- #include "DetectorConfig.h"
- #include "IRayDefinition.h"
- #ifdef CCOSDEVFPDIRAY_EXPORTS
- #define CCOSDEVFPDIRAY_API __declspec(dllexport)
- #else
- #define CCOSDEVFPDIRAY_API __declspec(dllimport)
- #endif
- namespace CCOS::Dev::Detail::Detector
- {
- //-----------------------------------------------------------------------------
- // IRayDriver
- //-----------------------------------------------------------------------------
- class CCOSDEVFPDIRAY_API IRayDriver : public FPDDriverMould
- {
- using super = FPDDriverMould;
- FPDDeviceIRay* 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:
- IRayDriver();
- virtual ~IRayDriver();
- 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);
- };
- //-----------------------------------------------------------------------------
- // FPDDeviceIRay
- //-----------------------------------------------------------------------------
- class IRayCtrl;
- class CCOSDEVFPDIRAY_API FPDDeviceIRay : public FPDDeviceMould
- {
- public:
- FPDDeviceIRay(std::shared_ptr <IOEventCenter> center, string ConfigPath);
- ~FPDDeviceIRay();
- public:
- void Register();
- 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);
- virtual std::string GetGUID() const override;
- virtual bool Prepare() override;
- void SyncErrorList();
- bool CreateDevice();
- RET_STATUS Connect();
- RET_STATUS ActiveDetector(bool bActive);
- RET_STATUS SetAcqMode(int nMode);
- RET_STATUS SetSyncMode(SYNC_MODE nSyncMode, HARDWARE_TRIGGER_MODE TriggerMode);
- RET_STATUS SetXwindow(float XwindowSize);
- RET_STATUS PrepareAcquisition();
- RET_STATUS StartAcquisition(string in = "");
- RET_STATUS StopAcquisition();
- RET_STATUS SetSID(int nSID);
- RET_STATUS ActiveCalibration(CCOS_CALIBRATION_TYPE in);
- RET_STATUS PrepareCalibration();
- RET_STATUS GetRequestedDose(string& strDose);
- RET_STATUS StartCalibration();
- RET_STATUS StopCalibration();
- RET_STATUS SetCorrectionType(CCOS_CORRECTION_TYPE in);
- RET_STATUS EnterExam(int nExamStatus);
- RET_STATUS ResetConnect();
- RET_STATUS DisConnectFPD();
- RET_STATUS UpdateFirmware();
- RET_STATUS AttachConnect();
- RET_STATUS CancelAttach();
- RET_STATUS SetAttachStatus(int nStatus);
- RET_STATUS SaveSensitivity();
- RET_STATUS RecoverImage(bool bRecoverIt);
- RET_STATUS GetRecoverImageState(string& strREI);
- RET_STATUS GetDetectorInfo(string& strFDI);
- RET_STATUS UploadCalibrationFiles(string strFileName);
- RET_STATUS ResetError();
- void UnactiveBySDK(void* pActviedDPC);
- void OnFPDCallback(int nDetectorID, int nEventID, int nEventLevel, const char* pszMsg, int nParam1, float fParam2, int nPtrParamLen, void* pParam);
- void SaveFailedCalibFile();
- RET_STATUS SetFluPPS(float fFluPPS);
- RET_STATUS GetFluPPS(float& fFluPPS);
- RET_STATUS StartOffset(bool isAll);
- RET_STATUS AbortOffset();
- RET_STATUS SetBinningMode(int nBinningX, int nBinningY);
- int GetTotalAcqModeNum();
- private:
- using super = IODeviceDetail;
- //void* m_pDetectors;
- IRayCtrl* m_pDetectors;
- 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;
- std::unique_ptr <CalibrationProcess> m_CalibProcess;
- int m_nDeviceIndex; //当前探测器的ID
- std::string g_strAppPath;
- std::string m_strSDKPath;
- DeviceIndexStruct m_stDeviceConfig;
- APP_STATUS m_eAppStatus; //DROC的当前状态,检查/校正/ATTACH界面
- ResDataObject* m_pPreviewImageHead;
- ResDataObject* m_pFullImageHead;
- WORD* m_pwFullImageData; //裁剪后的有效图像内存
- WORD* m_pwRawImageData; //原始图像内存
- WORD* m_pwPreviewImg; //preview内存
- SYSTEMTIME m_stImgCreateTime;
- WORK_STATION m_eWorkStation;
- int m_nGridLicense;
- bool m_bForceGridSuppress;
- string m_strModuleIP;
- string m_strShockSensor;
- string m_strSelfTest;// 探测器自检信息
- string m_strLastError; //DLL反馈的错误内容
- bool m_bDisConnected;
- bool m_bAttached;
- bool m_bOpened; //初始化开始与否
- bool m_bBatteryCharging; //电池充电与否的状态
- bool m_bRecoveringImage;//是否在恢复图像的流程中;若是,屏蔽其他错误,以防止干扰恢复图像的界面流程
- bool m_bAbortRecover; //放弃恢复图像(状态),恢复图像过程中中止,恢复图像失败的提示不再往上发送;目前不起作用
- int m_nRecoverImageTimes; // 恢复图像失败的次数,每2次提示用户一次
- bool m_bSendRecoverMessage;
- bool m_bUIConfirmRecover;
- bool m_bRecoverImageStatusInit;
- ResDataObject m_RecoverImageStatus;
- int m_nBatteryCapacity;
- int m_nBatteryCharges;
- float m_fBatteryTemperature;
- int m_nShockCounts;
- CCOS_CALIBRATION_TYPE m_nCalibrationType;
- int m_fDoseParam;// 校正用的曝光计量,发送到UI 且本地记录
- int m_nRawImgWidth; //原始图像宽
- int m_nRawImgHeight; //原始图像高
- int m_nFullImgWidth; //有效图像的宽
- int m_nFullImgHeight; //有效图像的高
- int m_nLeftOffset; //图像左侧裁剪像素值
- int m_nTopOffset; //图像上边裁剪像素值
- int m_nRightOffset; //图像右侧裁剪像素值
- int m_nBottomOffset; //图像下边裁剪像素值
- int m_nImageBits; //图像位数
- float m_fFactorEXI2UGY; //探测器EXI -> UGY 转换系数
- bool m_bPreviewEnable; //是否显示preview image
- bool m_bSaveRaw; //是否保存原始图
- int m_nPixelPitch; //像素尺寸
- HANDLE m_ExitEvt;
- int m_nXrayCalibNum;
- HANDLE m_OffsetCalibrationEvt;
- HANDLE m_PauseCalibrationEvt;
- HANDLE m_CompleteCalibrationEvt;
- HANDLE m_CrateCalibReportEvt;
- HANDLE m_WaitCalibDoseEvt;
- HANDLE m_WriteCumstomFileEvt;
- HANDLE m_hNotifyThread;
- DWORD m_NotifyThreadID;
- static DWORD WINAPI OnNotify(LPVOID pParam);
- HANDLE m_UploadCalibMapOver;
- HANDLE m_CalibGapEvt;
- float m_CalTemperlowWarn;
- float m_CalTemperupWarn;
- ResDataObject m_CalibDoseList;
- int m_nCurrentMode;
- float m_fCurrentPPS; //上层设置的帧率
- private:
- 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 OnInitResult(bool bSuccess);
- bool LoadSensitivity();
- bool CallSiemensRecoverAction(bool bErrorResult);
- bool OnProcessImage(WORD* pImage, int nWidth, int nHeight, float fImageReferUGY = 2.5);
- bool OnProcessPreviewImage(WORD* pRawImage, int nWidth, int nHeight);
- bool GetEffectiveImage(WORD* pOutImg, WORD* pInImg, int nInWidth);
- void OnProcessTemperature(int nID, float fTemperature);
- void InitializeTemperatureConfigs();
- void Action_ExpReady();
- bool CompleteCalibration();
- bool SaveConfigFile(bool bSendNotify);
- string GetFileVersion(string strFilePathName);
- void SendTemperatureValue(float fTemp);
- void SendWifiValue(int nWifi);
- void SendBatteryValue(int nBattery);
- RET_STATUS XWindowOnNotify();
- RET_STATUS XWindowOffNotify();
- void PrevImageDateArrived(WORD* pImg);
- void FullImageDateArrived(WORD* pImg);
- RET_STATUS PauseCalibration();
- bool CheckCalibartionDue();
- void AbortCalibration();
- void StopCalibrationInside();
- //向HW(转到发生器模块)发送当前探测器的状态
- void OnError(string strErrCode, string strErr = "");
- void OnErrorX(string strErrCode);
- //响应警告事件 nIndex:探测器ID strWarnCode:警告事件ID,strWarn:警告内容
- void OnWarn(int nIndex, string strWarnCode, string strWarn = "");
- void OnWarnX(string strWarnCode);
- void SendAllError();
- void ProcessTempreatureOnLostCommunicate();
- void ResetAllError();
- RET_STATUS AddFrameWithRawHead(IMAGE_VIEW_TYPE Type, WORD* pFrameBuff, DWORD FrameSize);
- string MakeImageHead(IMAGE_VIEW_TYPE Type);
- void ClearAllError();
- void FreeImageMemory();
- };
- }
|