123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- #pragma once
- #include <memory>
- #include <string>
- //#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<int,std::string,std::string,std::string &>”需要有 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 <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 _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 <IOEventCenter> 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 <IOEventCenter> EventCenter;
- string GetDevicePath() {
- return m_strIODevicePath;
- }
- protected:
- struct Dispatch Dispatch;
- // ExclusiveHolder <Dispatch> Dispatch;
- string m_strIODevicePath;
- };
- //-----------------------------------------------------------------------------
- // IOLogicUnit
- // The root / base class for any IOLogicUnit
- //-----------------------------------------------------------------------------
- class _DIOSLogicDevice_API IOLogicUnit
- {
- public:
- IOLogicUnit () {}
- virtual ~IOLogicUnit () {}
- };
- }
|