1 /* 2 * Copyright (c) 2022-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 */ 15 16 #ifndef OHOS_IAVSESSION_SERVICE_H 17 #define OHOS_IAVSESSION_SERVICE_H 18 19 #include "audio_system_manager.h" 20 #include "iremote_broker.h" 21 #include "iav_session.h" 22 #include "iavsession_service_ipc_interface_code.h" 23 #include "iclient_death.h" 24 #include "isession_listener.h" 25 #include "key_event.h" 26 27 namespace OHOS::AVSession { 28 class IAVSessionService : public IRemoteBroker { 29 public: 30 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.avsession.IAVSessionService"); 31 32 enum RemoteServiceCommand { 33 COMMAND_INVALID = -1, 34 COMMAND_CAST_AUDIO = 0, 35 COMMAND_CANCEL_CAST_AUDIO = 1, 36 COMMAND_MAX = 2 37 }; 38 39 virtual sptr<IRemoteObject> CreateSessionInner(const std::string& tag, int32_t type, 40 const AppExecFwk::ElementName& elementName) = 0; 41 42 virtual int32_t GetAllSessionDescriptors(std::vector<AVSessionDescriptor>& descriptors) = 0; 43 44 virtual int32_t GetSessionDescriptorsBySessionId(const std::string& sessionId, 45 AVSessionDescriptor& descriptor) = 0; 46 47 virtual int32_t GetHistoricalSessionDescriptors(int32_t maxSize, std::vector<AVSessionDescriptor>& descriptors) = 0; 48 49 virtual int32_t CreateControllerInner(const std::string& sessionId, sptr<IRemoteObject>& object) = 0; 50 51 #ifdef CASTPLUS_CAST_ENGINE_ENABLE 52 virtual int32_t GetAVCastControllerInner(const std::string& sessionId, sptr<IRemoteObject>& object) = 0; 53 #endif 54 55 virtual int32_t RegisterSessionListener(const sptr<ISessionListener>& listener) = 0; 56 57 virtual int32_t SendSystemAVKeyEvent(const MMI::KeyEvent& keyEvent) = 0; 58 59 virtual int32_t SendSystemControlCommand(const AVControlCommand& command) = 0; 60 61 virtual int32_t RegisterClientDeathObserver(const sptr<IClientDeath>& observer) = 0; 62 63 virtual int32_t CastAudio(const SessionToken& token, 64 const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) = 0; 65 66 virtual int32_t CastAudioForAll(const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) = 0; 67 68 virtual int32_t ProcessCastAudioCommand(const RemoteServiceCommand command, const std::string& input, 69 std::string& output) = 0; 70 71 #ifdef CASTPLUS_CAST_ENGINE_ENABLE 72 virtual int32_t StartCast(const SessionToken& sessionToken, const OutputDeviceInfo& outputDeviceInfo) = 0; 73 74 virtual int32_t StopCast(const SessionToken& sessionToken) = 0; 75 #endif 76 }; 77 } // namespace OHOS::AVSession 78 #endif // OHOS_IAVSESSION_SERVICE_H 79