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_REMOTE_SESSION_COMMAND_PROCESS_H 17 #define OHOS_REMOTE_SESSION_COMMAND_PROCESS_H 18 19 #include "iavsession_service.h" 20 #include "iremote_proxy.h" 21 #include "av_session.h" 22 #include "avsession_controller.h" 23 #include "avsession_errors.h" 24 25 namespace OHOS::AVSession { 26 class RemoteSessionCommandProcess : public IRemoteProxy<IAVSessionService> { 27 public: 28 explicit RemoteSessionCommandProcess(const sptr<IRemoteObject>& impl); 29 CreateSessionInner(const std::string & tag,int32_t type,const AppExecFwk::ElementName & elementName)30 sptr<IRemoteObject> CreateSessionInner(const std::string& tag, int32_t type, 31 const AppExecFwk::ElementName& elementName) override 32 { 33 return nullptr; 34 } 35 CreateSessionInner(const std::string & tag,int32_t type,const AppExecFwk::ElementName & elementName,sptr<IRemoteObject> & object)36 int32_t CreateSessionInner(const std::string& tag, int32_t type, 37 const AppExecFwk::ElementName& elementName, sptr<IRemoteObject>& object) override 38 { 39 return AVSESSION_SUCCESS; 40 } 41 GetAllSessionDescriptors(std::vector<AVSessionDescriptor> & descriptors)42 int32_t GetAllSessionDescriptors(std::vector<AVSessionDescriptor>& descriptors) override 43 { 44 return AVSESSION_SUCCESS; 45 } 46 GetSessionDescriptorsBySessionId(const std::string & sessionId,AVSessionDescriptor & descriptor)47 int32_t GetSessionDescriptorsBySessionId(const std::string& sessionId, AVSessionDescriptor& descriptor) override 48 { 49 return AVSESSION_SUCCESS; 50 } 51 GetHistoricalSessionDescriptors(int32_t maxSize,std::vector<AVSessionDescriptor> & descriptors)52 int32_t GetHistoricalSessionDescriptors(int32_t maxSize, std::vector<AVSessionDescriptor>& descriptors) override 53 { 54 return AVSESSION_SUCCESS; 55 } 56 GetHistoricalAVQueueInfos(int32_t maxSize,int32_t maxAppSize,std::vector<AVQueueInfo> & avQueueInfo)57 int32_t GetHistoricalAVQueueInfos(int32_t maxSize, int32_t maxAppSize, 58 std::vector<AVQueueInfo>& avQueueInfo) override 59 { 60 return AVSESSION_SUCCESS; 61 } 62 StartAVPlayback(const std::string & bundleName,const std::string & assetId)63 int32_t StartAVPlayback(const std::string& bundleName, const std::string& assetId) override 64 { 65 return AVSESSION_SUCCESS; 66 } 67 CreateControllerInner(const std::string & sessionId,sptr<IRemoteObject> & object)68 int32_t CreateControllerInner(const std::string& sessionId, sptr<IRemoteObject>& object) override 69 { 70 return AVSESSION_SUCCESS; 71 } 72 73 #ifdef CASTPLUS_CAST_ENGINE_ENABLE GetAVCastControllerInner(const std::string & sessionId,sptr<IRemoteObject> & object)74 int32_t GetAVCastControllerInner(const std::string& sessionId, sptr<IRemoteObject>& object) override 75 { 76 return AVSESSION_SUCCESS; 77 } 78 #endif 79 RegisterSessionListener(const sptr<ISessionListener> & listener)80 int32_t RegisterSessionListener(const sptr<ISessionListener>& listener) override 81 { 82 return AVSESSION_SUCCESS; 83 } 84 RegisterSessionListenerForAllUsers(const sptr<ISessionListener> & listener)85 int32_t RegisterSessionListenerForAllUsers(const sptr<ISessionListener>& listener) override 86 { 87 return AVSESSION_SUCCESS; 88 } 89 SendSystemAVKeyEvent(const MMI::KeyEvent & keyEvent)90 int32_t SendSystemAVKeyEvent(const MMI::KeyEvent& keyEvent) override 91 { 92 return AVSESSION_SUCCESS; 93 } 94 SendSystemControlCommand(const AVControlCommand & command)95 int32_t SendSystemControlCommand(const AVControlCommand& command) override 96 { 97 return AVSESSION_SUCCESS; 98 } 99 RegisterClientDeathObserver(const sptr<IClientDeath> & observer)100 int32_t RegisterClientDeathObserver(const sptr<IClientDeath>& observer) override 101 { 102 return AVSESSION_SUCCESS; 103 } 104 CastAudio(const SessionToken & token,const std::vector<AudioStandard::AudioDeviceDescriptor> & descriptors)105 int32_t CastAudio(const SessionToken& token, 106 const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) override 107 { 108 return AVSESSION_SUCCESS; 109 } 110 CastAudioForAll(const std::vector<AudioStandard::AudioDeviceDescriptor> & descriptors)111 int32_t CastAudioForAll(const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) override 112 { 113 return AVSESSION_SUCCESS; 114 } 115 116 int32_t ProcessCastAudioCommand(const RemoteServiceCommand command, const std::string& input, 117 std::string& output) override; 118 119 #ifdef CASTPLUS_CAST_ENGINE_ENABLE StartCast(const SessionToken & sessionToken,const OutputDeviceInfo & outputDeviceInfo)120 int32_t StartCast(const SessionToken& sessionToken, const OutputDeviceInfo& outputDeviceInfo) override 121 { 122 return AVSESSION_SUCCESS; 123 } 124 StopCast(const SessionToken & sessionToken)125 int32_t StopCast(const SessionToken& sessionToken) override 126 { 127 return AVSESSION_SUCCESS; 128 } 129 checkEnableCast(bool enable)130 int32_t checkEnableCast(bool enable) override 131 { 132 return AVSESSION_SUCCESS; 133 } 134 #endif 135 Close(void)136 int32_t Close(void) override 137 { 138 return AVSESSION_SUCCESS; 139 } 140 private: 141 static sptr<IRemoteObject>& impl_; 142 static inline BrokerDelegator<RemoteSessionCommandProcess> delegator_; 143 }; 144 } // namespace OHOS::AVSession 145 #endif // OHOS_REMOTE_SESSION_COMMAND_PROCESS_H