123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- #pragma once
- #include <string>
- #include <deque>
- #include "DIOS.Dev.IODevice.Detail.hpp"
- #include "DiosThread.h"
- #include "IODeviceWithSCF.tlh"
- #include "IODeviceWithSCF.tli"
- #include "DIOS.Dev.MSGMould.hpp"
- #include "DIOS.Dev.MECH.Mould.hpp"
- //#include "ATLComTime.h"
- #include "DeliverModule.h"
- #ifdef DIOSDEVMECHOTCSTITCH_EXPORTS
- #define _DIOSDEVMECHOTCSTITCH_API __declspec(dllexport)
- #else
- #define _DIOSDEVMECHOTCSTITCH_API __declspec(dllimport)
- #endif
- namespace DIOS::Dev::Detail::MECH
- {
- enum OTC_MG_REGULATION_LEVEL { //故障等级
- REG_ERRO,
- REG_WARN
- };
- enum StitchingDirection //拼接方向
- {
- UP_TO_DOWN = 1, // 上->下
- DOWN_TO_UP = 2 // 下->上
- };
- namespace nsDev = DIOS::Dev;
- namespace nsSerialGPM = DIOS::Dev::MODLE::SerialGPM;
-
- class _DIOSDEVMECHOTCSTITCH_API OTCStitchDevice : public IODeviceWithSCF <IODeviceDetail>, public MECHMould
- {
- using super = IODeviceWithSCF <IODeviceDetail>;
- using superMech = MECHMould;
- public:
- OTCStitchDevice(std::shared_ptr <IOEventCenter> center, nsSCF::SCF SCF,string configfile="");
- ~OTCStitchDevice();
- virtual std::string GetGUID() const override;
- static void __stdcall ProcessClientData(const char* pData, unsigned long DataLength, void* lparam);
- static void __stdcall WriteLog(const char* pData, nsSerialGPM::LOG_V2_LEVEL level);
- int FormatCommand(string& command);
- int FormatCommand(string inuputcommand, char* poutputcommand);
- virtual RET_STATUS SetStudyInfo(ResDataObject& pParam) override;
- virtual RET_STATUS SetPatientInfo(ResDataObject& pParam) override;
- virtual RET_STATUS SetViewInfo(ResDataObject& pParam) override;
- virtual RET_STATUS SetSID(float value) override;
- virtual RET_STATUS BeginStitching() override;
- virtual RET_STATUS EndStitching() override;
- virtual RET_STATUS SetupStitching(string& value) override;
- virtual RET_STATUS AcceptStitchingImage() override;
- virtual RET_STATUS RejectStitchingImage() override;
- virtual RET_STATUS CancelStitching() override;
- virtual RET_STATUS CompleteStitching() override;
- virtual RET_STATUS NewExtraView() override;
- virtual RET_STATUS RepeatStitching() override;
- virtual RET_STATUS SetAutoPosiitonNo(int nPN) override;
- virtual RET_STATUS SetExpEnable(bool nExpEnabled) override;
- virtual RET_STATUS SetWS(int nWS) override;
- virtual RET_STATUS SetFO(int nFO) override;
- virtual RET_STATUS SetTechMode(int nET) override;
- virtual RET_STATUS SetKV(int nKV) override;
- virtual RET_STATUS SetMA(float fMA) override;
- virtual RET_STATUS SetMS(float fMS) override;
- virtual RET_STATUS SetMAS(float fMAS) override;
- virtual RET_STATUS SetAECField(int nAECFieldSel) override;
- virtual RET_STATUS SetDensity(float nAECDensity) override;
- virtual RET_STATUS SetCollimator(ECOM_COLLIMATOR_INFO& curCollimator) override;
- virtual RET_STATUS SetFilter(int nFilter) override;
- nsSerialGPM::CDeliverModule Delivermodule;
- ECOM_COLLIMATOR_INFO m_Collimator;
- string m_strOTCType;
- string m_strcurrentcmd;
- int m_nImageCount; // total number of stitching images
- int m_nCurrentImage; //Current stitching procedure image
- bool m_bStitchingInProgress;
- string m_strOTCError;
- string m_strOTCWarning;
-
- private:
- void OnCallBack(); //处理指令回调函数
- void Register(); //注册对外提供的属性、方法
- //bool StartHardwareStatusThread(); //启动轮询线程
- //static DWORD HardwareStatusThread(LPVOID pParam); //定时查询状态信息
- void FireNotify(std::string key, std::string context); //向上层上报消息
- void FireNotify(std::string key, int context); //向上层上报消息
- void FireErrorMessage(const bool Act, const int Code, const char* ResInfo = ""); //上报错误消息
- void FireWarnMessage(const bool Act, const int Code, const char* ResInfo = ""); //上报告警消息
- std::unique_ptr<nsDetail::MSGUnit> m_MSGUnit;
- int m_ConvertFlag; // is m_strReserved2 in V2
- protected:
- void Convert(const char* strIn, string& strOut, int sourceCodepage, int targetCodepage);
- std::shared_ptr <DIOS::Dev::IOEventCenter> m_EventCenter;
- ResDataObject m_GenConfig;
- ECOM_PATIENT m_sPATIENTInfo;
- vector<ECOM_PROCEDURE_VIEW> m_tempProcedureViewList;
- };
- }
- //-----------------------------------------------------------------------------
- // DEMODriver
- //-----------------------------------------------------------------------------
- namespace DIOS::Dev::Detail::MECH
- {
- class _DIOSDEVMECHOTCSTITCH_API OTCStitchDriver : public IODriverWithSCF <DriverMould>
- {
- using super = IODriverWithSCF <DriverMould>;
- ResDataObject m_GenConfig;
- public:
- OTCStitchDriver();
- virtual ~OTCStitchDriver();
- virtual void Prepare() override;
- virtual bool Connect() override;
- virtual void Disconnect() override;
- virtual bool isConnected() const override;
- virtual void Dequeue(const char* Packet, DWORD Length) override;
- virtual void FireNotify(int code, std::string key, std::string content) 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;
- OTCStitchDevice* m_pDriGenDev;// = nullptr;
- private:
- static PACKET_RET callbackPackageProcess(const char* RecData, DWORD nLength, DWORD& PacketLength);
- bool m_bDemoInitDataFlag; //是否存在初始化数据
- ResDataObject m_InitDataFile;
- //for webconfig
- ResDataObject m_DeviceConfigSend;
- ResDataObject m_DeviceConfig;
- string g_strAppPath;
- ResDataObject m_ConfigAll; //存储当前的配置,用于修改配置时写回文件
- ResDataObject m_Configurations; //存储当前配置中“CONFIGURATION”节点的内容
- std::unique_ptr <ResDataObject> m_pAttribute;
- std::unique_ptr <ResDataObject> m_pDescription;
- 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);
- };
- }
|