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 CreateSessionInnerWithExtra(const std::string & tag,int32_t type,const std::string & extraInfo,const AppExecFwk::ElementName & elementName,sptr<IRemoteObject> & object)42 int32_t CreateSessionInnerWithExtra(const std::string& tag, int32_t type, const std::string& extraInfo, 43 const AppExecFwk::ElementName& elementName, sptr<IRemoteObject>& object) override 44 { 45 return AVSESSION_SUCCESS; 46 } 47 GetAllSessionDescriptors(std::vector<AVSessionDescriptor> & descriptors)48 int32_t GetAllSessionDescriptors(std::vector<AVSessionDescriptor>& descriptors) override 49 { 50 return AVSESSION_SUCCESS; 51 } 52 GetSessionDescriptorsBySessionId(const std::string & sessionId,AVSessionDescriptor & descriptor)53 int32_t GetSessionDescriptorsBySessionId(const std::string& sessionId, AVSessionDescriptor& descriptor) override 54 { 55 return AVSESSION_SUCCESS; 56 } 57 GetHistoricalSessionDescriptors(int32_t maxSize,std::vector<AVSessionDescriptor> & descriptors)58 int32_t GetHistoricalSessionDescriptors(int32_t maxSize, std::vector<AVSessionDescriptor>& descriptors) override 59 { 60 return AVSESSION_SUCCESS; 61 } 62 GetHistoricalAVQueueInfos(int32_t maxSize,int32_t maxAppSize,std::vector<AVQueueInfo> & avQueueInfo)63 int32_t GetHistoricalAVQueueInfos(int32_t maxSize, int32_t maxAppSize, 64 std::vector<AVQueueInfo>& avQueueInfo) override 65 { 66 return AVSESSION_SUCCESS; 67 } 68 StartAVPlayback(const std::string & bundleName,const std::string & assetId)69 int32_t StartAVPlayback(const std::string& bundleName, const std::string& assetId) override 70 { 71 return AVSESSION_SUCCESS; 72 } 73 CreateControllerInner(const std::string & sessionId,sptr<IRemoteObject> & object)74 int32_t CreateControllerInner(const std::string& sessionId, sptr<IRemoteObject>& object) override 75 { 76 return AVSESSION_SUCCESS; 77 } 78 79 #ifdef CASTPLUS_CAST_ENGINE_ENABLE GetAVCastControllerInner(const std::string & sessionId,sptr<IRemoteObject> & object)80 int32_t GetAVCastControllerInner(const std::string& sessionId, sptr<IRemoteObject>& object) override 81 { 82 return AVSESSION_SUCCESS; 83 } 84 #endif 85 RegisterSessionListener(const sptr<ISessionListener> & listener)86 int32_t RegisterSessionListener(const sptr<ISessionListener>& listener) override 87 { 88 return AVSESSION_SUCCESS; 89 } 90 RegisterSessionListenerForAllUsers(const sptr<ISessionListener> & listener)91 int32_t RegisterSessionListenerForAllUsers(const sptr<ISessionListener>& listener) override 92 { 93 return AVSESSION_SUCCESS; 94 } 95 SendSystemAVKeyEvent(const MMI::KeyEvent & keyEvent)96 int32_t SendSystemAVKeyEvent(const MMI::KeyEvent& keyEvent) override 97 { 98 return AVSESSION_SUCCESS; 99 } 100 SendSystemAVKeyEvent(const MMI::KeyEvent & keyEvent,const AAFwk::Want & wantParam)101 int32_t SendSystemAVKeyEvent(const MMI::KeyEvent& keyEvent, const AAFwk::Want &wantParam) override 102 { 103 return AVSESSION_SUCCESS; 104 } 105 SendSystemControlCommand(const AVControlCommand & command)106 int32_t SendSystemControlCommand(const AVControlCommand& command) override 107 { 108 return AVSESSION_SUCCESS; 109 } 110 RegisterClientDeathObserver(const sptr<IClientDeath> & observer)111 int32_t RegisterClientDeathObserver(const sptr<IClientDeath>& observer) override 112 { 113 return AVSESSION_SUCCESS; 114 } 115 CastAudio(const SessionToken & token,const std::vector<AudioStandard::AudioDeviceDescriptor> & descriptors)116 int32_t CastAudio(const SessionToken& token, 117 const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) override 118 { 119 return AVSESSION_SUCCESS; 120 } 121 CastAudioForAll(const std::vector<AudioStandard::AudioDeviceDescriptor> & descriptors)122 int32_t CastAudioForAll(const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) override 123 { 124 return AVSESSION_SUCCESS; 125 } 126 127 int32_t ProcessCastAudioCommand(const RemoteServiceCommand command, const std::string& input, 128 std::string& output) override; 129 130 #ifdef CASTPLUS_CAST_ENGINE_ENABLE StartCast(const SessionToken & sessionToken,const OutputDeviceInfo & outputDeviceInfo)131 int32_t StartCast(const SessionToken& sessionToken, const OutputDeviceInfo& outputDeviceInfo) override 132 { 133 return AVSESSION_SUCCESS; 134 } 135 StopCast(const SessionToken & sessionToken)136 int32_t StopCast(const SessionToken& sessionToken) override 137 { 138 return AVSESSION_SUCCESS; 139 } 140 checkEnableCast(bool enable)141 int32_t checkEnableCast(bool enable) override 142 { 143 return AVSESSION_SUCCESS; 144 } 145 #endif 146 Close(void)147 int32_t Close(void) override 148 { 149 return AVSESSION_SUCCESS; 150 } 151 GetDistributedSessionControllersInner(const DistributedSessionType & sessionType,std::vector<sptr<IRemoteObject>> & sessionControllers)152 int32_t GetDistributedSessionControllersInner(const DistributedSessionType& sessionType, 153 std::vector<sptr<IRemoteObject>>& sessionControllers) override 154 { 155 return AVSESSION_SUCCESS; 156 } 157 private: 158 static sptr<IRemoteObject>& impl_; 159 static inline BrokerDelegator<RemoteSessionCommandProcess> delegator_; 160 }; 161 } // namespace OHOS::AVSession 162 #endif // OHOS_REMOTE_SESSION_COMMAND_PROCESS_H