IdeaHub-自定义通知回调类

时间:2023-11-01 16:15:17

自定义通知回调类

示例代码

继承Huawei::Idea::IEventHandler,参见IEventHandler.h

IShareServiceController.h

#include "IShareServiceController.h"   #include "IdeaShareDef.h"      class IDEA_SHARE_API IShareEventHandler : public Huawei::Idea::IEventHandler{   public:       ~IShareEventHandler();       void OnError(ShareAppErr errorCode, std::string errorMsg, void* extralInfo);       void OnDiscoverResult(DiscoverResult* discoverResult);       void OnConnectResult(DeviceInfo* deviceInfo);       void OnDisconnectResult(int reason);       void OnSharePlayResult();       void OnShareStopResult(int reason);       ....   }

ShareEventHandler.cpp 实现

#include "IShareServiceController.h"   #include "IdeaShareDef.h"      IShareEventHandler::~IShareEventHandler() {}      void IShareEventHandler::OnError(ShareAppErr errorCode, std::string errorMsg, void* extralInfo   {     // 错误事件上报   }   void IShareEventHandler::OnDiscoverResult(DiscoverResult* discoverResult)   {     //投屏码查询   }   void IShareEventHandler::OnConnectResult(DeviceInfo* deviceInfo)   {      // 连接事件上报   }   void IShareEventHandler::OnDisconnectResult(int reason)   {      //断开连接事件上报   }   void IShareEventHandler::OnSharePlayResult()   {     // 开始共享事件上报   }   void IShareEventHandler::OnShareStopResult(int reason)   {      //结束共享事件上报   }   .....

详情参见4.6.4 通知参考。

support.huaweicloud.com/ideahub-IdeaShare-SDK/win-sdk-0008.html