#pragma once #include #include //#include "AppLog.Interface.hpp" #include "ExclusiveHolder.h" #include "Dispatch.h" #define _CCOSLogicDevice_API namespace CCOS::Dev::Detail { #if 0 class _CCOSLogicDevice_API IOLog { public: static auto GetLog ()->ECOM::Log::ShareLog; }; #endif //----------------------------------------------------------------------------- // Dispatch //----------------------------------------------------------------------------- namespace nDev = CCOS::Dev; struct _CCOSLogicDevice_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 _CCOSLogicDevice_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 () const; virtual bool Prepare(); virtual void SubscribeSelf(ccos_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; protected: // struct Dispatch Dispatch; ExclusiveHolder m_Dispatch; }; //----------------------------------------------------------------------------- // IOLogicUnit // The root / base class for any IOLogicUnit //----------------------------------------------------------------------------- class _CCOSLogicDevice_API IOLogicUnit { public: IOLogicUnit () {} virtual ~IOLogicUnit () {} }; }