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