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