#pragma once #include #include "ResDataObject.h" #include "Detector_Model_Def.h" #include "DIOS.Dev.IODevice.hpp" #include "DIOS.Dev.IODevice.Detail.hpp" #include "BatteryMould.hpp" #include "TemperatureMould.hpp" #include "WifiMould.hpp" #ifdef DIOSDEVFPDDEVICEMOULD_EXPORTS #define _DIOSDEVFPDDEVICEMOULD_API __declspec(dllexport) #else #define _DIOSDEVFPDDEVICEMOULD_API __declspec(dllimport) #endif namespace DIOS::Dev::Detail::Detector { static const char* DetectorDriverType = "{18CAB88A-C61C-4BB2-AC28-184FDD4FD160}"; static const char* DetectorUnitType = "{A209866C-A049-4A17-B5C9-421974E59D68}"; //----------------------------------------------------------------------------- // AcqUnit //----------------------------------------------------------------------------- namespace nsDev = DIOS::Dev; class _DIOSDEVFPDDEVICEMOULD_API AcqUnit : public IOLogicUnit { string m_strEcomFPDState; string m_strNoNeedWaitImage; string m_strLastImage; DWORD m_nFullWidth; DWORD m_nFullHeight; DWORD m_nPrevWidth; DWORD m_nPrevHeight; DWORD m_nBits; PVOID m_pFullImageQueue; PVOID m_pPrevImageData; protected: std::shared_ptr m_EventCenter; public: AcqUnit(); ~AcqUnit(); void OEM_IF SetEventCenter(std::shared_ptr EventCenter); nsDev::RET_STATUS JSSetAcqMode(std::string in, std::string & out); nsDev::RET_STATUS JSSetGainMode(std::string in, std::string & out); nsDev::RET_STATUS JSSetBinningMode(std::string in, std::string & out); nsDev::RET_STATUS JSSetZoomMode(std::string in, std::string & out); nsDev::RET_STATUS JSSetDemoImage(std::string in, std::string & out); nsDev::RET_STATUS JSGetEcomFPDState(std::string & out); bool OEM_IF SetEcomFPDState(ECOM_FPD_STATE state); nsDev::RET_STATUS JSGetNoNeedWaitImage(std::string & out); void OEM_NOTIFY SendNoNeedWaitImage(bool bflag); nsDev::RET_STATUS JSGetLastImage(std::string & out); nsDev::RET_STATUS OEM_IF AddFrameWithRawHead(IMAGE_VIEW_TYPE Type, string ImageHead, WORD* pFrameBuff, DWORD FrameSize); bool OEM_IF SetMaxBlockSize(const char *pQueName, DWORD BlockSize, DWORD FulBlockCount, DWORD PrevBlockCount); bool OEM_IF SetFulImageInfo(DWORD Height, DWORD Width, DWORD Bits, bool FetchFlag); bool OEM_IF SetPrevImageInfo(bool Support, DWORD Height, DWORD Width, bool FetchFlag); DWORD AddFrame(IMAGE_VIEW_TYPE Type, string ImageHead, WORD* pFrameBuff, DWORD FrameSize); bool OEM_IF FlipX(WORD* pData, UINT nWidth, UINT nHeight); bool OEM_IF FlipY(WORD* pData, UINT nWidth, UINT nHeight); bool OEM_IF RotateImage(WORD* imageBuffer, int nImageHeight, int nImageWidth, int nAngle); protected: virtual nsDev::RET_STATUS SetAcqMode(int mode) = 0; }; //----------------------------------------------------------------------------- // SyncUnit //----------------------------------------------------------------------------- class _DIOSDEVFPDDEVICEMOULD_API SyncUnit : public IOLogicUnit { string m_strReady4EXP; string m_strXwindowStatus; protected: std::shared_ptr m_EventCenter; public: SyncUnit(); ~SyncUnit(); void OEM_IF SetEventCenter(std::shared_ptr EventCenter); nsDev::RET_STATUS JSSetSyncMode(std::string in, std::string & out); nsDev::RET_STATUS JSSetXwindowSize(std::string in, std::string & out); nsDev::RET_STATUS JSPrepareAcquisition(std::string in, std::string& out); nsDev::RET_STATUS JSStartAcquisition(std::string in, std::string& out); nsDev::RET_STATUS JSStopAcquisition(std::string in, std::string& out); nsDev::RET_STATUS JSGetFPDReady(std::string & out); void OEM_NOTIFY FPDReadyNotify(bool bReady); nsDev::RET_STATUS JSGetXWindowStatus(std::string & out); void OEM_NOTIFY XWindowOnNotify(); void OEM_NOTIFY XWindowOffNotify(); nsDev::RET_STATUS JSGetImageReadingStatus(std::string & out); void OEM_NOTIFY ImageReadingNotify(); protected: virtual nsDev::RET_STATUS SetSyncMode(SYNC_MODE nSyncMode, HARDWARE_TRIGGER_MODE TriggerMode) = 0; virtual nsDev::RET_STATUS SetXwindow(float XwindowSize) = 0; virtual nsDev::RET_STATUS PrepareAcquisition() = 0; virtual nsDev::RET_STATUS StartAcquisition() = 0; virtual nsDev::RET_STATUS StopAcquisition() = 0; }; //----------------------------------------------------------------------------- // CalibUnit //----------------------------------------------------------------------------- class _DIOSDEVFPDDEVICEMOULD_API CalibUnit : public IOLogicUnit { DIOS_CALIBRATION_TYPE m_CurrentCalibType; DIOS_CALIBRATION_STATUS m_CalibStatus; string m_strCalibProgress; string m_strUploadCalibrationFilesResult; protected: std::shared_ptr m_EventCenter; public: CalibUnit(); ~CalibUnit(); void OEM_IF SetEventCenter(std::shared_ptr EventCenter); nsDev::RET_STATUS JSActiveCalibration(std::string in, std::string & out); nsDev::RET_STATUS JSGetRequestedDose(std::string & out); nsDev::RET_STATUS JSPrepareCalibration(std::string in, std::string& out); nsDev::RET_STATUS JSStartCalibration(std::string in, std::string& out); nsDev::RET_STATUS JSStopCalibration(std::string in, std::string& out); nsDev::RET_STATUS OEM_IF PauseCalibration(); nsDev::RET_STATUS JSSetSID(std::string in, std::string& out); nsDev::RET_STATUS JSSetCorrectionType(std::string in, std::string & out); nsDev::RET_STATUS JSUploadCalibrationFiles(std::string in, std::string & out); DIOS_CALIBRATION_STATUS OEM_IF GetCalibrationStatus(); void OEM_IF SetCalibrationStatus(DIOS_CALIBRATION_STATUS Status); nsDev::RET_STATUS JSGetCalibStatus(std::string & out); void OEM_IF SetCalibrationProgress(DWORD progress); nsDev::RET_STATUS JSGetCalibProgress(std::string & out); DIOS_CALIBRATION_TYPE OEM_IF GetCalibrationType(); nsDev::RET_STATUS JSGetUploadCalibrationFilesResult(std::string & out); void OEM_IF SetUploadCalibrationFilesResult(bool bResult); protected: virtual nsDev::RET_STATUS SetSID(int nSID) = 0; virtual nsDev::RET_STATUS ActiveCalibration(DIOS_CALIBRATION_TYPE in) = 0; virtual nsDev::RET_STATUS PrepareCalibration() = 0; virtual nsDev::RET_STATUS GetRequestedDose(float& fDose) = 0; virtual nsDev::RET_STATUS StartCalibration() = 0; virtual nsDev::RET_STATUS StopCalibration() = 0; virtual nsDev::RET_STATUS SetCorrectionType(DIOS_CORRECTION_TYPE in) = 0; virtual nsDev::RET_STATUS UploadCalibrationFiles(string strFileName) = 0; }; //----------------------------------------------------------------------------- // CalibUnit //----------------------------------------------------------------------------- class _DIOSDEVFPDDEVICEMOULD_API DetectorCtrlUnit : public IOLogicUnit { DETECTOR_STATUS m_DetectorStatus; DETECTOR_SHARE_STATUS m_DetectorConnectStatus; string m_strUpdateFWStatus; string m_strInitialStatus; string m_strAttachStatus; string m_strAttachResult; string m_strShockSensor; string m_strRecoverImageState; string m_strRecoverImageEvent; string m_strFieldofViewShape; string m_strFieldofViewDimension; string m_strDetectorType; string m_strDescription; string m_strDetectorID; string m_strDateofLastDetectorCalibration; string m_strTimeofLastDetectorCalibration; string m_strDetectorConditionsNominalFlag; string m_strFPDCoef; string m_strPixelData; string m_strTargetEXI; protected: std::shared_ptr m_EventCenter; public: DetectorCtrlUnit(); ~DetectorCtrlUnit(); void OEM_IF SetEventCenter(std::shared_ptr EventCenter); nsDev::RET_STATUS JSRESET(std::string in, std::string& out); nsDev::RET_STATUS JSActiveDetector(std::string in, std::string & out); nsDev::RET_STATUS JSWakeupDetector(std::string in, std::string & out); nsDev::RET_STATUS JSEnterExam(std::string in, std::string & out); nsDev::RET_STATUS JSExitExam(std::string in, std::string& out); nsDev::RET_STATUS JSAttachConnect(std::string in, std::string& out); nsDev::RET_STATUS JSCancelAttach(std::string in, std::string& out); nsDev::RET_STATUS JSGetDetectorInfo(std::string in, std::string & out); nsDev::RET_STATUS JSResetConnect(std::string in, std::string& out); nsDev::RET_STATUS JSDisConnectFPD(std::string in, std::string& out); nsDev::RET_STATUS JSUpdateFirmware(std::string in, std::string& out); nsDev::RET_STATUS JSRecoverImage(std::string in, std::string & out); nsDev::RET_STATUS JSSaveSensitivity(std::string in, std::string& out); nsDev::RET_STATUS JSSetXrayOnNum(std::string in, std::string& out); nsDev::RET_STATUS JSSetExposureTimes(std::string in, std::string& out); nsDev::RET_STATUS JSGetRecoverImageState(std::string in, std::string& out); DETECTOR_STATUS OEM_IF GetDetectorStatus(); nsDev::RET_STATUS OEM_IF SetDetectorStatus(DETECTOR_STATUS status); nsDev::RET_STATUS JSGetFPDStatus(std::string & out); nsDev::RET_STATUS OEM_IF SetConnectStatus(DETECTOR_SHARE_STATUS nStatus); nsDev::RET_STATUS JSGetConnectStatus(std::string & out); nsDev::RET_STATUS OEM_IF SetAttachResult(bool result, const char* DetectorType, const char* DetectorSN); nsDev::RET_STATUS JSGetAttachResult(std::string & out); nsDev::RET_STATUS OEM_IF SetAttachStatus(int nStatus); nsDev::RET_STATUS JSGetAttachStatus(std::string & out); nsDev::RET_STATUS OEM_IF SetInitialStatus(int nStatus); nsDev::RET_STATUS JSGetInitialStatus(std::string & out); nsDev::RET_STATUS OEM_IF SetUpdateFWStatus(int nStatus); nsDev::RET_STATUS JSGetUpdateFWStatus(std::string & out); nsDev::RET_STATUS OEM_IF SetShockSensorInfo(string nStatus); nsDev::RET_STATUS JSGetShockSensorInfo(std::string & out); nsDev::RET_STATUS OEM_IF SetRecoverImageState(string nStatus); nsDev::RET_STATUS JSGetRecoverImageState(std::string & out); nsDev::RET_STATUS OEM_IF SetRecoverImageEvent(int nStatus); nsDev::RET_STATUS JSGetRecoverImageEvent(std::string & out); nsDev::RET_STATUS OEM_IF SetFieldofViewShape(string nStatus); nsDev::RET_STATUS JSGetFieldofViewShape(std::string & out); nsDev::RET_STATUS OEM_IF SetFieldofViewDimension(string nStatus); nsDev::RET_STATUS JSGetFieldofViewDimension(std::string & out); nsDev::RET_STATUS OEM_IF SetDetectorType(string nStatus); nsDev::RET_STATUS JSGetDetectorType(std::string & out); nsDev::RET_STATUS OEM_IF SetDescription(string nStatus); nsDev::RET_STATUS JSGetDescription(std::string & out); nsDev::RET_STATUS OEM_IF SetDetectorID(string nStatus); nsDev::RET_STATUS JSGetDetectorID(std::string & out); nsDev::RET_STATUS OEM_IF SetDateofLastDetectorCalibration(string nStatus); nsDev::RET_STATUS JSGetDateofLastDetectorCalibration(std::string & out); nsDev::RET_STATUS OEM_IF SetTimeofLastDetectorCalibration(string nStatus); nsDev::RET_STATUS JSGetTimeofLastDetectorCalibration(std::string & out); nsDev::RET_STATUS OEM_IF SetDetectorConditionsNominalFlag(string nStatus); nsDev::RET_STATUS JSGetDetectorConditionsNominalFlag(std::string & out); nsDev::RET_STATUS OEM_IF SetFPDCoef(string nStatus); nsDev::RET_STATUS JSGetFPDCoef(std::string & out); nsDev::RET_STATUS OEM_IF SetPixelData(string nStatus); nsDev::RET_STATUS JSGetPixelData(std::string & out); nsDev::RET_STATUS OEM_IF SetTargetEXI(string nStatus); nsDev::RET_STATUS JSGetTargetEXI(std::string & out); protected: virtual nsDev::RET_STATUS ActiveDetector() = 0; virtual nsDev::RET_STATUS EnterExam(int nExamStatus) = 0; virtual nsDev::RET_STATUS GetDetectorInfo(string& strFDI) = 0; virtual nsDev::RET_STATUS RESET(); virtual nsDev::RET_STATUS WakeupDetector(); virtual nsDev::RET_STATUS ExitExam(); virtual nsDev::RET_STATUS AttachConnect(); virtual nsDev::RET_STATUS CancelAttach(); virtual nsDev::RET_STATUS ResetConnect(); virtual nsDev::RET_STATUS DisConnectFPD(); virtual nsDev::RET_STATUS UpdateFirmware(); virtual nsDev::RET_STATUS RecoverImage(bool bRecoverIt); virtual nsDev::RET_STATUS SaveSensitivity(); virtual nsDev::RET_STATUS SetXrayOnNum(); virtual nsDev::RET_STATUS SetExposureTimes(int nTimes); virtual nsDev::RET_STATUS GetRecoverImageState(string & strREI); }; namespace ConfKey { static const char* DiosDetectorType = "DetectorVender"; static const char* DiosDetectorModel = "DetectorModel"; static const char* DiosDetectorConfig = "DeviceConfig"; static const char* DiosDetectorAttribute = "Attribute"; static const char* DiosDetectorDescription = "Description"; static const char* DiosDetectorSerialNumber = "SerialNumber"; static const char* DiosWiredIP = "WiredIP"; static const char* DiosWirelessIP = "WirelessIP"; static const char* DiosLocalIP = "LocalIP"; static const char* DiosSyncType = "SyncType"; static const char* DiosWorkStation = "WorkStation"; static const char* DiosTempMaxLimit = "TempMaxLimit"; static const char* DiosTempUpperLimit = "TempUpperLimit"; static const char* DiosTempLowerLimit = "TempLowerLimit"; static const char* DiosTempMinLimit = "TempMinLimit"; static const char* DiosBatLowerLimit = "BatLowerLimit"; static const char* DiosBatMiniLimit = "BatMiniLimit"; static const char* DiosWifiLowerLimit = "WifiLowerLimit"; static const char* DiosWifiMiniLimit = "WifiMiniLimit"; static const char* DiosImageFullWidth = "ImageFullWidth"; static const char* DiosImageFullHeight = "ImageFullHeight"; static const char* DiosShowTemperature = "ShowTemperature"; static const char* DiosShowWifi = "ShowWifi"; static const char* DiosShowBattery = "ShowBattery"; static const char* DiosShowBluetooth = "ShowBluetooth"; static const char* DiosIsConnect = "IsConnect"; } namespace ActionKey { //DetecorCtrl static const char* GetDetectorInfo = "GetFPDinformation"; static const char* DiosActiveDetector = "ActiveDetector"; static const char* RESET = "RESET"; static const char* EnterExam = "EnterExam"; static const char* ExitExam = "ExitExam"; static const char* AttachConnect = "AttachConnect"; static const char* CancelAttach = "CancelAttach"; static const char* RecoverImage = "RecoverImage"; static const char* ResetConnect = "ResetConnect"; static const char* DisConnectFPD = "DisConnectFPD"; static const char* UpdateFirmware = "UpdateFirmware"; static const char* SaveSensitivity = "SaveSensitivity"; //Synchronization static const char* SetAcqMode = "SetAcqMode"; static const char* SetSyncMode = "SetSyncMode"; static const char* SetXwindowSize = "SetXwindowSize"; static const char* PrepareAcquisition = "PrepareAcquisition"; static const char* StartAcquisition = "StartAcquisition"; static const char* StopAcquisition = "StopAcquisition"; //Calibration static const char* SetSID = "SetSID"; static const char* ActiveCalibration = "ActiveCalibration"; static const char* PrepareCalibration = "PrepareCalibration"; static const char* StartCalibration = "StartCalibration"; static const char* StopCalibration = "StopCalibration"; static const char* SetCorrectionType = "SetCorrectionType"; static const char* UploadCalibrationFiles = "UploadCalibrationFiles"; } namespace AttrKey { //sensor status static const char* GetTemperatureValue = "GetTemperatureValue"; static const char* GetRemainPowerValue = "GetRemainPowerValue"; static const char* GetWifiStrengthValue = "GetWifiStrengthValue"; //DetecorCtrl static const char* DetectorStatus = "DetectorStatus"; static const char* DetectorConnectStatus = "DetectorConnectStatus"; static const char* DetectorAttach = "DetectorAttach"; static const char* DetectorAttachedFlag = "FPDAttached"; static const char* DetectorInitialStatus = "DetectorInitialStatus"; static const char* DetectorUpdateFWStatus = "DetectorUpdateFWStatus"; static const char* FPDShockSensorInfo = "FPDShockSensorInfo"; //Calibration static const char* CalibrationStatus = "CalibrationStatus"; static const char* CalibrationProgress = "CalibrationProgress"; static const char* UploadCalibrationFilesResult = "UploadCalibrationFilesResult"; //Synchronization static const char* FPDReadyStatus = "FPDReadyStatus"; static const char* XwindowStatus = "XwindowStatus"; static const char* ImageReadingStatus = "ImageReadingStatus"; static const char* EcomFPDState = "EcomFPDState"; //Acquisition static const char* NoNeedWaitImage = "NoNeedWaitImage"; static const char* ImgDataInfo = "ImgDataInfo"; //DICOM static const char* DetectorType = "DetectorType"; static const char* Description = "Description"; static const char* DetectorID = "DetectorID"; static const char* FieldofViewShape = "FieldofViewShape"; static const char* FieldofViewDimension = "FieldofViewDimension"; static const char* DateofLastDetectorCalibration = "DateofLastDetectorCalibration"; static const char* TimeofLastDetectorCalibration = "TimeofLastDetectorCalibration"; static const char* DetectorConditionsNominalFlag = "DetectorConditionsNominalFlag"; static const char* FPDCoef = "FPDCoef"; static const char* PixelData = "PixelData"; static const char* TargetEXI = "TargetEXI"; } class _DIOSDEVFPDDEVICEMOULD_API ConfigInfo { public: ConfigInfo(const char* Key, const char* strType, const char* strAccess, const char* strRequired, const char* strDefaultValue); virtual ~ConfigInfo(); void SetList(const char* str); void SetRange(const char* strmin, const char* strmax); const char* GetCurrentValue(); void SetCurrentValue(const char* res); const char* GetDescription(); const char* GetKey(); private: std::string strConfKey; std::string resValue; std::string resDescription; }; //----------------------------------------------------------------------------- // FPDDeviceMould //----------------------------------------------------------------------------- class _DIOSDEVFPDDEVICEMOULD_API FPDDeviceMould/* : public IODeviceDetail*/ { //using super = IODeviceDetail; public: FPDDeviceMould(/*std::shared_ptr center*/); ~FPDDeviceMould(); //protected: // virtual void RegisterCtrl(); // virtual void RegisterAcq(); // virtual void RegisterSync(); // virtual void RegisterCalib(); // virtual void RegisterOthers(); }; } namespace DIOS::Dev::Detail::Detector { class _DIOSDEVFPDDEVICEMOULD_API FPDDriverMould : public DIOS::Dev::IODriver { public: FPDDriverMould(); ~FPDDriverMould(); public: virtual std::string GetGUID() const; //virtual void Prepare() override; //virtual int Connect() override; //virtual void Disconnect() override; //virtual bool isConnected() const override; //virtual void FireNotify(int code, std::string key, std::string content) override; //virtual auto CreateDevice(int index)->std::unique_ptr override; //virtual std::string DriverProbe() override; //virtual std::string GetResource() override; //virtual std::string DeviceProbe() override; void AddConfig(ConfigInfo config); protected: std::list m_ConfigInfo; }; }