• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_AVSESSION_SERVICE_STUB_H
17 #define OHOS_AVSESSION_SERVICE_STUB_H
18 
19 #include "iavsession_service.h"
20 #include "iremote_stub.h"
21 
22 namespace OHOS::AVSession {
23 class AVSessionServiceStub : public IRemoteStub<IAVSessionService> {
24 public:
25     int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
26 
27 private:
28     int32_t HandleCreateSessionInner(MessageParcel& data, MessageParcel& reply);
29     int32_t HandleGetAllSessionDescriptors(MessageParcel& data, MessageParcel& reply);
30     int32_t HandleGetSessionDescriptorsById(MessageParcel& data, MessageParcel& reply);
31     int32_t HandleGetHistoricalSessionDescriptors(MessageParcel& data, MessageParcel& reply);
32     int32_t HandleCreateControllerInner(MessageParcel& data, MessageParcel& reply);
33     int32_t HandleGetAVCastControllerInner(MessageParcel& data, MessageParcel& reply);
34     int32_t HandleRegisterSessionListener(MessageParcel& data, MessageParcel& reply);
35     int32_t HandleSendSystemAVKeyEvent(MessageParcel& data, MessageParcel& reply);
36     int32_t HandleSendSystemControlCommand(MessageParcel& data, MessageParcel& reply);
37     int32_t HandleRegisterClientDeathObserver(MessageParcel& data, MessageParcel& reply);
38     int32_t HandleCastAudio(MessageParcel& data, MessageParcel& reply);
39     int32_t HandleCastAudioForAll(MessageParcel& data, MessageParcel& reply);
40     int32_t HandleRemoteCastAudio(MessageParcel& data, MessageParcel& reply);
41     int32_t HandleStartCastDiscovery(MessageParcel& data, MessageParcel& reply);
42     int32_t HandleStopCastDiscovery(MessageParcel& data, MessageParcel& reply);
43     int32_t HandleSetDiscoverable(MessageParcel& data, MessageParcel& reply);
44     int32_t HandleStartCast(MessageParcel& data, MessageParcel& reply);
45     int32_t HandleStopCast(MessageParcel& data, MessageParcel& reply);
46     static bool CheckInterfaceToken(MessageParcel& data);
47 
48     using HandlerFunc = int32_t(AVSessionServiceStub::*)(MessageParcel&, MessageParcel&);
49     static inline HandlerFunc handlers[] = {
50         &AVSessionServiceStub::HandleCreateSessionInner,
51         &AVSessionServiceStub::HandleGetAllSessionDescriptors,
52         &AVSessionServiceStub::HandleGetSessionDescriptorsById,
53         &AVSessionServiceStub::HandleGetHistoricalSessionDescriptors,
54         &AVSessionServiceStub::HandleCreateControllerInner,
55         &AVSessionServiceStub::HandleGetAVCastControllerInner,
56         &AVSessionServiceStub::HandleRegisterSessionListener,
57         &AVSessionServiceStub::HandleSendSystemAVKeyEvent,
58         &AVSessionServiceStub::HandleSendSystemControlCommand,
59         &AVSessionServiceStub::HandleRegisterClientDeathObserver,
60         &AVSessionServiceStub::HandleCastAudio,
61         &AVSessionServiceStub::HandleCastAudioForAll,
62         &AVSessionServiceStub::HandleRemoteCastAudio,
63         &AVSessionServiceStub::HandleStartCastDiscovery,
64         &AVSessionServiceStub::HandleStopCastDiscovery,
65         &AVSessionServiceStub::HandleSetDiscoverable,
66         &AVSessionServiceStub::HandleStartCast,
67         &AVSessionServiceStub::HandleStopCast,
68     };
69 
70     static constexpr int32_t RECEIVE_DEVICE_NUM_MAX = 10;
71 };
72 } // namespace OHOS::AVSession
73 #endif // OHOS_AVSESSION_SERVICE_STUB_H
74