123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #pragma once
- #include "CommonFun.h"
- #include "IODeviceWithSCF.tlh"
- #include "IODeviceWithSCF.tli"
- #include "DIOS.Dev.SYNBOX.Mould.hpp"
- #include "2000TBoxDevice.hpp"
- #include "CollimatorDevice.h"
- #ifdef DIOSDEVSYNDYN_EXPORTS
- #define _DIOSDEVDYNBOX_API __declspec(dllexport)
- #else
- #define _DIOSDEVDYNBOX_API __declspec(dllimport)
- #endif
- namespace DIOS::Dev::Detail::SYNBOX
- {
- class _DIOSDEVDYNBOX_API SyncBoxDevice :public IODeviceWithSCF <IODeviceDetail>
- {
- using super = IODeviceWithSCF <IODeviceDetail>;
- public:
- SyncBoxDevice(std::shared_ptr <IOEventCenter> center, nsSCF::SCF SCF);
- SyncBoxDevice(std::shared_ptr <IOEventCenter> center, nsSCF::SCF SCF, string configfile);
-
- ~SyncBoxDevice();
- virtual std::string GetGUID() const override;
- protected:
- void Register();
- void OnCallBack();
- public:
- std::unique_ptr<nsDetail::MSGUnit> m_MSGUnit;
- std::unique_ptr<DynBoxDevice> m_DynBoxDevice;
- std::unique_ptr<CollimatorDevice> m_CollimatorDevice;
- string m_strConfigPath;
- ResDataObject m_Config;
- };
- }
- //-----------------------------------------------------------------------------
- // DynBoxDriver
- //-----------------------------------------------------------------------------
- namespace DIOS::Dev::Detail::SYNBOX
- {
- class _DIOSDEVDYNBOX_API DynBoxDriver : public IODriverWithSCF <DriverMould>
- {
- using super = IODriverWithSCF <DriverMould>;
- public:
- DynBoxDriver ();
- virtual ~DynBoxDriver ();
- public:
- 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 bool GetDeviceConfig(std::string& Cfg) override;
- virtual bool SetDeviceConfig(std::string Cfg) override;
- virtual std::string DriverProbe () override;
- virtual std::string GetResource () override;
- virtual std::string DeviceProbe () override;
- private:
- static PACKET_RET callbackPackageProcess (const char* RecData, DWORD nLength, DWORD& PacketLength);
- void CanShakeHand();
- void SetCANState(bool state);
- bool m_bDemoConnected; // 在 DEMO 模式下, 调用过 Connect 吗?
- SyncBoxDevice* m_p2000tDevice{ nullptr };
- //std::unique_ptr <DynBoxDevice> pSDCDevice;
- 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);
- //
- void ReadVersion();
- };
- }
|