• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_AVSESSION_SERVICE_PROXY_H
17 #define OHOS_AVSESSION_SERVICE_PROXY_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 AVSessionServiceProxy : public IRemoteProxy<IAVSessionService> {
27 public:
28     explicit AVSessionServiceProxy(const sptr<IRemoteObject>& impl);
29 
30     std::shared_ptr<AVSession> CreateSession(const std::string& tag, int32_t type,
31                                              const AppExecFwk::ElementName& elementName);
32 
33     sptr<IRemoteObject> CreateSessionInner(const std::string& tag, int32_t type,
34                                            const AppExecFwk::ElementName& elementName) override;
35 
36     int32_t GetAllSessionDescriptors(std::vector<AVSessionDescriptor>& descriptors) override;
37 
38     int32_t GetSessionDescriptorsBySessionId(const std::string& sessionId, AVSessionDescriptor& descriptor) override;
39 
40     int32_t CreateController(const std::string& sessionId, std::shared_ptr<AVSessionController>& controller);
41 
42     int32_t CreateControllerInner(const std::string& sessionId, sptr<IRemoteObject>& object) override;
43 
44     int32_t RegisterSessionListener(const sptr<ISessionListener>& listener) override;
45 
46     int32_t SendSystemAVKeyEvent(const MMI::KeyEvent& keyEvent) override;
47 
48     int32_t SendSystemControlCommand(const AVControlCommand& command) override;
49 
50     int32_t RegisterClientDeathObserver(const sptr<IClientDeath>& observer) override;
51 
52     int32_t CastAudio(const SessionToken& token,
53                       const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) override;
54 
55     int32_t CastAudioForAll(const std::vector<AudioStandard::AudioDeviceDescriptor>& descriptors) override;
56 
ProcessCastAudioCommand(const RemoteServiceCommand command,const std::string & input,std::string & output)57     int32_t ProcessCastAudioCommand(const RemoteServiceCommand command, const std::string& input,
58                                     std::string& output) override
59     {
60         return AVSESSION_SUCCESS;
61     }
62 
63 private:
64     static inline BrokerDelegator<AVSessionServiceProxy> delegator_;
65 };
66 } // namespace OHOS
67 #endif // OHOS_AVSESSION_SERVICE_PROXY_H