12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #pragma once
- #include "LogicClient.h"
- #define CONTAINERDPC_API
- #define CONTAINERDPC_C_API extern "C"
- class GrpcDeviceClient;
- class CONTAINERDPC_API ModuleClient :
- public LogicClient
- {
- protected:
- GrpcDeviceClient* m_pGrpcClient;
- int m_nWaitResultCount;
- map<string, unsigned long> m_mpNotifyIdx;
- public :
- ModuleClient(string szClientName, string szTransaction, string szType = "", bool bNeedNotify = false);
- virtual ~ModuleClient();
- RET_STATUS ConnectGrpc(string strDevHost, string devPath="");
-
- RET_STATUS ModuleReq(PACKET_CMD cmd, const char* pszResource, ResDataObject* pReqParam, ResDataObject& pResponse, const char* pszDevPath = nullptr);
- virtual RET_STATUS DevGet(const char* pszPropties, ResDataObject& pResponse, const char* pszDevPath = nullptr);
- virtual RET_STATUS DevSet(const char* pszPropties, ResDataObject* pNewValue, ResDataObject& pResponse, const char* pszDevPath = nullptr);
- virtual RET_STATUS DevAdd(const char* pszPropties, ResDataObject* pAddValue, ResDataObject& pResponse, const char* pszDevPath = nullptr);
- virtual RET_STATUS DevDel(const char* pszPropties, ResDataObject* pDelValue, ResDataObject& pResponse, const char* pszDevPath = nullptr);
- virtual RET_STATUS DevAction(const char* pszActionName, ResDataObject* pReqParam, ResDataObject& pResponse, const char* pszDevPath = nullptr);
- virtual RET_STATUS DevMessage(const char* pszTopics, ResDataObject* pMessage, ResDataObject& pResponse, const char* pszDevPath = nullptr);
-
- virtual int BeginAyncWait();
- virtual void WaitAllComplete();
- virtual int GetAsyncResult(int idx, string& devResource, string& devRes, string& calResMsg);
- virtual void EndAync();
- virtual int AsyncAction(string devResource, ResDataObject* pReqParam,
- string devUri = "", string calSection = "",
- string calClientID = "");
- virtual int AsyncMessage(string devResource, ResDataObject* pReqParam,
- string devUri = "", string calSection = "",
- string calClientID = "");
- bool SupportGrpc() { return m_pGrpcClient != nullptr; }
- int WaitingResultCount() { return m_nWaitResultCount; }
- int ClearFilter();
- int InstallFilterNotify(string strKey, bool install);
- void SplitCcosDevicePath(string DevicePath, vector<string>& resTopicParams);
- PACKET_CMD ReadFilterNotify(ResDataObject& CmdObject);
- int Notify(const char* pszTopic, const char* pszSender, const char *pszType, const char* pszCmd, const char* pMsg);
- };
|