123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- #pragma once
- #include "DIOS.Dev.Collimator.Mould.hpp"
- #include "IODeviceWithSCF.tlh"
- #include "IODeviceWithSCF.tli"
- #include "DIOS.Dev.MSGMould.hpp"
- #ifndef DIOSCOLLIAMTORDEMO_EXPORTS
- #ifdef _WIN64
- #ifdef _DEBUG
- #pragma comment(lib, "DIOS.Dev.Collimator.Demo64D.lib")
- #else
- #pragma comment(lib, "DIOS.Dev.Collimator.Demo64.lib")
- #endif
- #else
- #ifdef _DEBUG
- #pragma comment(lib, "DIOS.Dev.Collimator.DemoD.lib")
- #else
- #pragma comment(lib, "DIOS.Dev.Collimator.Demo.lib")
- #endif
- #endif
- #endif
- #ifdef DIOSCOLLIAMTORDEMO_EXPORTS
- #define _DIOSCOLLIAMTORDEMO_API __declspec(dllexport)
- #else
- #define _DIOSCOLLIAMTORDEMO_API __declspec(dllimport)
- #endif
- namespace DIOS::Dev::Detail::Collimator
- {
- typedef struct tagDemoCommand
- {
- UINT8 nFrameHeader1;
- UINT8 nFrameHeader2;
- UINT8 nCommand;
- UINT8 nData;
- UINT8 nCheckSum;
- UINT8 nEndFlag;
- }DemoCOMMAND;
- //-----------------------------------------------------------------------------
- // CollimatorDevice
- //-----------------------------------------------------------------------------
- namespace nDev = DIOS::Dev;
- class _DIOSCOLLIAMTORDEMO_API DemoDevice : public IODeviceDetail,public ColliamtorMould
- {
- using super = IODeviceDetail;
- using superColl = ColliamtorMould;
-
- public:
- DemoDevice (std::shared_ptr <IOEventCenter> center, std::string configfile);
- ~DemoDevice ();
- virtual std::string GetGUID() const override;
- virtual RET_STATUS SetCollimatorSize(unsigned short xsize, unsigned short ysize) override;
- virtual RET_STATUS SetCollimatorSID(unsigned short sid) override;
- virtual RET_STATUS SetCollimatorFilter(unsigned short pParams) override;
- virtual RET_STATUS SetCollimatorAngle(float pParams) override;
- virtual RET_STATUS SetCollimatorMode(unsigned short pParams) override;
- virtual int GetCollimatorLight();
- virtual RET_STATUS SetCollimatorLight(unsigned short pParams) override;
- void OnCallBack(const char* strPackage, DWORD Length);
- private:
- void Register();
- void FireNotify (std::string key, std::string context);
- };
- }
- //-----------------------------------------------------------------------------
- // CollimatorDriver
- //-----------------------------------------------------------------------------
- namespace DIOS::Dev::Detail::Collimator
- {
- class _DIOSCOLLIAMTORDEMO_API DemoDriver : public IODriverWithSCF <DriverMould>
- {
- using super = IODriverWithSCF <DriverMould>;
- public:
- DemoDriver ();
- virtual ~DemoDriver ();
- public:
- virtual void Prepare () override;
- virtual bool DATA_ACTION 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;
- private:
- bool SaveConfigFile(bool bSendNotify);
- virtual bool GetDeviceConfig(std::string& Cfg) override;
- virtual bool SetDeviceConfig(std::string Cfg) override;
- bool GetDeviceConfigValue(ResDataObject config, const char* pInnerKey, int nPathID, string& strValue);
- bool SetDeviceConfigValue(ResDataObject& config, const char* pInnerKey, int nPathID, const char* szValue);
- static PACKET_RET callbackPackageProcess (const char* RecData, DWORD nLength, DWORD& PacketLength);
- bool m_bDemoMode; // DEMO 模式
- bool m_bDemoConnected; // 在 DEMO 模式下, 是否调用过 Connect
- //webconfig使用
- ResDataObject m_DeviceConfig;
- ResDataObject m_ConfigAll; //存储当前的配置,用于修改配置时写回文件
- ResDataObject m_Configurations; //存储当前配置中“CONFIGURATION”节点的内容
- ResDataObject m_DeviceConfigSend;
- std::unique_ptr <ResDataObject> m_pAttribute;
- std::unique_ptr <ResDataObject> m_pDescription;
- DemoDevice* m_pDevice {nullptr};
- };
- }
|