1 /* 2 * Copyright (C) 2023-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * Description: supply Cast session definition. 15 * Author: zhangge 16 * Create: 2022-06-15 17 */ 18 19 #ifndef CAST_SESSION_H 20 #define CAST_SESSION_H 21 22 #include "cast_engine_common.h" 23 #include "i_cast_session.h" 24 #include "i_cast_session_impl.h" 25 #include "oh_remote_control_event.h" 26 27 namespace OHOS { 28 namespace CastEngine { 29 namespace CastEngineClient { 30 class CastSession : public ICastSession { 31 public: CastSession(sptr<ICastSessionImpl> proxy)32 CastSession(sptr<ICastSessionImpl> proxy) : proxy_(proxy) {}; 33 ~CastSession() override; 34 35 int32_t RegisterListener(std::shared_ptr<ICastSessionListener> listener) override; 36 int32_t UnregisterListener() override; 37 38 int32_t AddDevice(const CastRemoteDevice &remoteDevice) override; 39 int32_t RemoveDevice(const std::string &deviceId, 40 const DeviceRemoveAction &actionType = DeviceRemoveAction::ACTION_DISCONNECT) override; 41 42 int32_t StartAuth(const AuthInfo &authInfo) override; 43 int32_t Release() override; 44 int32_t NotifyEvent(EventId eventId, std::string &jsonParam) override; 45 46 int32_t GetSessionId(std::string &sessionId) override; 47 int32_t GetRemoteDeviceInfo(std::string deviceId, CastRemoteDevice &remoteDevice) override; 48 49 int32_t SetSessionProperty(const CastSessionProperty &property) override; 50 int32_t SetSessionId(std::string sessionId); 51 int32_t SetCastMode(CastMode mode, std::string &jsonParam) override; 52 53 int32_t CreateMirrorPlayer(std::shared_ptr<IMirrorPlayer> &mirrorPlayer) override; 54 int32_t CreateStreamPlayer(std::shared_ptr<IStreamPlayer> &streamPlayer) override; 55 private: 56 sptr<ICastSessionImpl> proxy_; 57 std::string sessionId_{}; 58 }; 59 } // namespace CastEngineClient 60 } // namespace CastEngine 61 } // namespace OHOS 62 63 #endif 64