12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #pragma once
- #include <memory>
- #include <string>
- //#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 <RET_STATUS, std::string, std::string, std::string &> Add;
- CXXHelper::Dispatch <RET_STATUS, std::string, std::string, std::string &> Delete;
- CXXHelper::Dispatch <RET_STATUS, std::string, std::string, std::string &> Update;
- CXXHelper::Dispatch <RET_STATUS, std::string, std::string, std::string &> Action;
- CXXHelper::Dispatch <RET_STATUS, std::string, std::string&> Get;
- CXXHelper::Dispatch <RET_STATUS, std::string, std::string> 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 <IOEventCenter> 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 <IOEventCenter> EventCenter;
- protected:
- // struct Dispatch Dispatch;
- ExclusiveHolder <Dispatch> m_Dispatch;
- };
- //-----------------------------------------------------------------------------
- // IOLogicUnit
- // The root / base class for any IOLogicUnit
- //-----------------------------------------------------------------------------
- class _CCOSLogicDevice_API IOLogicUnit
- {
- public:
- IOLogicUnit () {}
- virtual ~IOLogicUnit () {}
- };
- }
|