#define CCOSDEVFPDDEMO_API #define CCOSDEVFPDDEMO_C_API extern "C" #include #include #include "CcosLock.h" #include "CCOS.Dev.FPDDeviceMould.hpp" #include "TemperatureMould.hpp" #include "OEM.Acq.h" #include "OEM.Sync.h" #include "OEM.Calib.h" #include "OEM.DetectorCtrl.h" #include "DetectorConfiguration.h" #include "FPDCtrlDefinition.h" #include "SeqImages.h" //#include "FPDErrorWarningProcess.h" namespace CCOS::Dev::Detail::Detector { class CCOSDEVFPDDEMO_API FPDDemoDriver : public FPDDriverMould { using super = FPDDriverMould; FPDDemoDevice* dev; bool m_bConnect; ResDataObject m_ConfigAll; ResDataObject m_Configurations; ResDataObject m_DeviceConfig; std::unique_ptr m_pAttribute; std::unique_ptr m_pDescription; public: FPDDemoDriver(); virtual ~FPDDemoDriver(); virtual void Prepare() override; virtual bool Connect() override; virtual void Disconnect(); virtual bool isConnected() const 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; 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 nDetail = CCOS::Dev::Detail; class CCOSDEVFPDDEMO_API FPDDemoDevice : public FPDDeviceMould, public CcosLock { enum DEMOEXAMMODE { DEMOEXAMMODE_RAD, DEMOEXAMMODE_PREVIEW, DEMOEXAMMODE_AEC_PREVIEW, DEMOEXAMMODE_FLU, DEMOEXAMMODE_MAX, }; enum Mode750MT { modePreview, modeFULL, } m_mode750MT; using super = IODeviceDetail; std::unique_ptr m_AcqUnit; std::unique_ptr m_SyncUnit; std::unique_ptr m_CalibUnit; std::unique_ptr m_DetectorCtrlUnit; std::unique_ptr m_Temperature; std::unique_ptr m_Battery; std::unique_ptr m_Wifi; std::unique_ptr m_DetectorConfiguration; //std::unique_ptr m_WarnAndError; std::string m_strWorkPath; ResDataObject m_ACQMODElist; DeviceIndexStruct m_stDeviceConfig; APP_STATUS m_eAppStatus; //APP的当前状态,检查/校正/ATTACH界面 GlobalTime m_stImgCreateTime; CCOS_CALIBRATION_TYPE m_nCalibrationType; SeqImages* m_pSeqList;//for multiple acq mode DETECTOR_WORK_STATUS m_eWorkStatus; //存储DPC的workstatus,该值自己判断 std::vector m_vDemoImagePath;//存储DemoImage的路径 ResDataObject m_ConfigAll; //存储所有配置信息 ResDataObject m_Configurations; //存储配置信息CONFIGURATION部分 ResDataObject* m_pPreviewImageHead; ResDataObject* m_pFullImageHead; int m_nCurrentLogicMode;//当前采集模式 bool m_bPreviewEnable; int m_nPreviewWidth; int m_nPreviewHeight; int m_nFullWidth; int m_nFullHeight; int m_nBits; int m_nPixelSpacing; int m_nFrameRate; int m_nTotalFrameNum;//m_pSeqList中图像的总张数 int m_nSendImageCountInStitch; unsigned short* pRadImgBuffer; bool m_bDcmLoaded; bool m_bIsSendFluFrame;//透视模式发送图片的flag true-发送 false-停止发送 bool m_bRadMode;//true:rad模式 bool m_bFluMode;//true:透视模式 int m_nSendImageInterval;//透视时发送图像的间隔 bool m_bFor750MT; float m_fFluPPS;//透视时发送图片的帧率(以秒为单位,例 60/s) pthread_t m_hFPDScanThread; //辅助线程,执行开窗、关窗等通知 std::shared_ptr m_AcqReqEvt; std::shared_ptr m_StopReqEvt; std::shared_ptr m_Exit; std::shared_ptr m_SendFluFrame;//透视模式发送图片 std::shared_ptr m_hToggleEvent; DWORD m_AcqLoopCount;//当前模式下的需要采集的张数 DWORD m_AcquiredCount;//当前模式下的已采集张数 DWORD m_CalibrationRoundCount; DWORD m_CalibrationExpCount;//当前校正模式下的已采集张数 bool Acq_Proc(); bool LoadConfig(); RET_STATUS StopAcquisition_Inside(); RET_STATUS PauseCalibration(); static void* onFPDScanThread(PVOID pvoid); bool MakeFrame(DEMOEXAMMODE eExamMode = DEMOEXAMMODE_MAX); bool ResetFrame(); void SendFluFrame(); bool LoadRadDemo(const char* pPath, int nImgSizeX, int nImgSizeY, int nBits = 16, int nPixelSpacing = 310); //Bits Pixel全用假值 bool LoadDCMDemo(const char* pPath); RET_STATUS AddFrameWithRawHead(IMAGE_VIEW_TYPE Type, unsigned short* pFrameBuff, DWORD FrameSize); string MakeImageHead(IMAGE_VIEW_TYPE Type); void NotifyWindowOnAndOff(); bool GetLogicMode(string& strAcqMode, int & nLogicMode); protected: void RegisterCtrl(nDetail::Dispatch* Dispatch); void RegisterAcq(nDetail::Dispatch* Dispatch); void RegisterSync(nDetail::Dispatch* Dispatch); void RegisterCalib(nDetail::Dispatch* Dispatch); void RegisterOthers(nDetail::Dispatch* Dispatch); public: FPDDemoDevice(std::shared_ptr center, string ConfigPath); ~FPDDemoDevice(); void Register(); virtual std::string GetGUID() const override; virtual bool Prepare() override; bool CreateDevice(); RET_STATUS Connect(); RET_STATUS DisConnect(); RET_STATUS SetAcqMode(string strAcqMode); 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(std::string& strout); RET_STATUS StartCalibration(); RET_STATUS StopCalibration(); RET_STATUS SetCorrectionType(CCOS_CORRECTION_TYPE in); RET_STATUS EnterExam(int nExamStatus); RET_STATUS GetDetectorInfo(string& strFDI); RET_STATUS SetFluPPS(float fFluPPS); RET_STATUS SetDemoImage(string& strPath1, string& strPath2, string& strPath3); RET_STATUS ResetError(); RET_STATUS ActiveSyncMode(int nSyncMode); void SendInfoLog(string strLogKey, float fValue); void SendInfoLog(string strLogKey, int nValue); void SendInfoLog(string strLogKey, bool bRealSN); void SendInfoLog(string strLogKey, string strValue = ""); void SendLog(string strLogKey, string strLogLevel, bool bRealSN, string strValue = ""); }; }