#pragma once #include #include //#include "AppLog.Interface.hpp" #include "ExclusiveHolder.tlh" #include "ExclusiveHolder.tli" #include "Dispatch.tlh" #include "DIOS.Dev.IODevice.hpp" #pragma warning (disable:4251) // warning C4251: “DIOS::Dev::Detail::Dispatch::Add”: class“CXXHelper::Dispatch”需要有 dll 接口由 struct“DIOS::Dev::Detail::Dispatch”的客户端使用 #ifdef DIOSLOGICDEVICE_EXPORTS #define _DIOSLogicDevice_API __declspec(dllexport) #else #define _DIOSLogicDevice_API __declspec(dllimport) #endif namespace DIOS::Dev::Detail { #if 0 class _DIOSLogicDevice_API IOLog { public: static auto GetLog ()->ECOM::Log::ShareLog; }; #endif //----------------------------------------------------------------------------- // Dispatch //----------------------------------------------------------------------------- namespace nDev = DIOS::Dev; struct _DIOSLogicDevice_API Dispatch { CXXHelper::Dispatch Add; CXXHelper::Dispatch Delete; CXXHelper::Dispatch Update; CXXHelper::Dispatch Action; CXXHelper::Dispatch Get; CXXHelper::Dispatch Set; }; //----------------------------------------------------------------------------- // IODeviceDetail // The root / base class for any IODeviceDetail //----------------------------------------------------------------------------- class _DIOSLogicDevice_API IODeviceDetail { using JSONString = std::string; IODeviceDetail (const IODeviceDetail &) = delete; IODeviceDetail (IODeviceDetail &&) = delete; IODeviceDetail & operator = (const IODeviceDetail &) = delete; IODeviceDetail & operator = (IODeviceDetail &&) = delete; public: IODeviceDetail (std::shared_ptr center = nullptr); virtual ~IODeviceDetail (); virtual std::string GetGUID () const = 0; std::string GetResource (); virtual bool Prepare(); virtual void SubscribeSelf(dios_mqtt_connection* conn) ; RET_STATUS Add (const std::string funcName, JSONString In, JSONString & Out); RET_STATUS Delete (const std::string funcName, JSONString In, JSONString & Out); RET_STATUS Update (const std::string funcName, JSONString In, JSONString & Out); RET_STATUS Action (const std::string funcName, JSONString In, JSONString & Out); RET_STATUS Get (const std::string funcName, JSONString& Out); RET_STATUS Set (const std::string funcName, JSONString In); public: std::shared_ptr EventCenter; string GetDevicePath() { return m_strIODevicePath; } protected: struct Dispatch Dispatch; // ExclusiveHolder Dispatch; string m_strIODevicePath; }; //----------------------------------------------------------------------------- // IOLogicUnit // The root / base class for any IOLogicUnit //----------------------------------------------------------------------------- class _DIOSLogicDevice_API IOLogicUnit { public: IOLogicUnit () {} virtual ~IOLogicUnit () {} }; }