更新时间:2022-03-21 GMT+08:00
分享

IShareServiceController.h

SDK API 和 通知定义文件

//   
//  Huawei IdeaShare SDK Engine SDK   
//   
//  Copyright (c) 2020 Huawei.io. All rights reserved.   
//   
   
#ifndef IDEA_ENGINE_H   
#define IDEA_ENGINE_HS   
   
#ifndef IDEA_SHARE_EXPORT   
#define IDEA_SHARE_EXPORT   
#endif   
   
   
#include "IServiceController.h"  
#include "IEventHandler.h"  
#include <string>  
#include <list>  
#include <atomic>  
#include "IdeaShareDef.h"  
using namespace std;   
   
namespace Huawei {   
    namespace Idea {   
   
        class IDEA_SHARE_API IShareEventHandler : public IEventHandler {   
        public:   
            virtual ~IShareEventHandler() {}  
            /* Discover接口的回调接口 */  
            virtual void OnDiscoverResult(DiscoverResult* discoverResult) {}  
            virtual void OnDiscoverFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* Connect接口的回调接口 */  
            virtual void OnConnectResult(DeviceInfo* deviceInfo) {}  
            virtual void OnConnectFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* Disconnect接口的回调接口 */  
            virtual void OnDisconnectResult(int reason) {}  
            virtual void OnDisconnectFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* StartSharing接口的回到接口 */  
            virtual void OnSharePlayResult() {}  
            virtual void OnSharePlayFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* StopSharing接口的回调接口 */  
            virtual void OnShareStopResult(int reason) {}  
            virtual void OnShareStopFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* GetRemoteServiceStatus接口的回调接口 */  
            virtual void OnGetRemoteServiceStatusResult(RemoteServiceStatus* remoteServiceStatus) {}  
            virtual void OnGetRemoteServiceStatusFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* SetRemoteMicMute接口的回调接口 */  
            virtual void OnSetRemoteMicMuteResult(int result) {}  
            virtual void OnSetRemoteMicMuteFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* SetRemoteSpeakerVolume接口的回调接口 */  
            virtual void OnSetRemoteSpeakerVolumeResult(int result) {}  
            virtual void OnSetRemoteSpeakerVolumeFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* SetRemoteSpeakerMute接口的回调接口 */  
            virtual void OnSetRemoteSpeakerMuteResult(int result) {}  
            virtual void OnSetRemoteSpeakerMuteFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* SetRemoteCameraMute接口的回调接口 */  
            virtual void OnSetRemoteCameraMuteResult(int result) {}  
            virtual void OnSetRemoteCameraMuteFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* LeaveConference接口的回调接口 */  
            virtual void OnSetLeaveConferenceResult(int result) {}  
            virtual void OnSetLeaveConferenceFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* EndConference接口的回调接口 */  
            virtual void OnSetEndConferenceResult(int result) {}  
            virtual void OnSetEndConferenceFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* GetSDKLatestVersion接口的回调接口 */  
            virtual void OnGetSDKLatestVersionResult(std::string version) {}  
            virtual void OnGetSDKLatestVersionFailed(ShareAppErr errorCode, std::string errorMsg) {}  
  
            /* 大屏状态信息变化通知事件 */  
            virtual void OnRemoteServiceStatusChangedNotify(RemoteServiceStatus *remoteServiceStatus, int index) {}  
  
            /* 当前IdeaHub会议状态事件上报接口 */  
            virtual void OnDevConfStateNotify(ConfSate confState, AuxState auxState) {}  
  
            /* 投屏状态发生变化通知上报接口 */  
            virtual void OnShareStatusChangedNotify(ShareAppServerStatus status, ShareAppErr reason) {}  
  
            /* 各种事件失败时统一会上报的接口 */  
            virtual void OnError(ShareAppErr errorCode, std::string errorMsg, void* extralInfo) {}  
        };   
   
        class IDEA_SHARE_API ShareServiceController : public IServiceController {   
        public:   
            static ShareServiceController* GetInstance();  
            ~ShareServiceController();  
            /* 日志设置 */  
            int SetLog(const LogInfo &logInfo);  
            /* TLS设置 */  
            int SetTLS(const ShareTlsInfo &tlsInfo);  
            /* 初始化 */  
            int Create(const AppInfo &appInfo, IEventHandler* eventHandler);  
            /* 去初始化 */  
            int Destory();  
            /* 设置投屏设备类型 */  
            int SetDeviceType(ShareDeviceType shareDeviceType);  
            /* 设置投屏策略 */  
            int SetPolicy(const SharePolicy& sharePolicy);  
            /* 投屏码解析ip请求 */  
            int Discover(std::string castCode, std::string address, int port);  
            /* 连接 */  
            int Connect(list<std::string>addressList, int port, std::string password);  
            /* 断开连接 */  
            int Disconnect();  
            /* 设置投屏对象 */  
            int SetDisplayScreen(ShareAppScreenType screenChoice);  
            /* 开始投屏 */  
            int StartSharing();  
            /* 停止投屏 */  
            int StopSharing();  
            /* 获取远程服务状态信息 */  
            int GetRemoteServiceStatus();  
            /* 打开\关闭麦克风 */  
            int SetRemoteMicMute(bool isMute);  
            /* 调节扬声器音量 */  
            int SetRemoteSpeakerVolume(int volume);  
            /* 打开\关闭扬声器 */  
            int SetRemoteSpeakerMute(bool isSpeakerMute);  
            /* 打开\关闭摄像机 */  
            int SetRemoteCameraMute(bool isCameraMute);  
            /* 离开会议 */  
            int LeaveConference();  
            /* 结束会议 */  
            int EndConference();  
            /* 获取投屏状态 */  
            int GetShareStatus();  
            /* 获取SDK版本 */  
            std::string GetSDKVersion();  
            /* 获取最新的服务器版本信息 */  
            int GetSDKLatestVersion();  
            /* 全局事件回调 */  
            IShareEventHandler* mEventHandler;  
            /* 友元函数 */  
            friend void ProcessNotifyCallback(uint32_t msgid, uint32_t param1, uint32_t param2, void *data);  
            /* 全局回调*/  
            void NotifyCallback(uint32_t msgid, uint32_t param1, uint32_t param2, void *data);  
        private:   
            /* 私有构造方法*/  
            ShareServiceController();  
            /* 全局事件回调 */  
            static ShareServiceController *mControllerInstance;  
            /* 是否正在共享 */  
            std::atomic<bool> m_IsSharing{ false };  
        };   
    } // namespace Idea   
}// namespace Huawei   
   
#endif

相关文档