• 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_AVCONTROLLER_CALLBACK_STUB_H
17 #define OHOS_AVCONTROLLER_CALLBACK_STUB_H
18 
19 #include "iavcontroller_callback.h"
20 #include "iremote_stub.h"
21 
22 namespace OHOS::AVSession {
23 class AVControllerCallbackStub : public IRemoteStub<IAVControllerCallback> {
24 public:
25     int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
26 
27 private:
28 
29     int32_t HandleOnSessionDestroy(MessageParcel& data, MessageParcel& reply);
30 
31     int32_t HandleOnPlaybackStateChange(MessageParcel& data, MessageParcel& reply);
32 
33     int32_t HandleOnMetadataChange(MessageParcel& data, MessageParcel& reply);
34 
35     int32_t HandleOnActiveStateChange(MessageParcel& data, MessageParcel& reply);
36 
37     int32_t HandleOnValidCommandChange(MessageParcel& data, MessageParcel& reply);
38 
39     int32_t HandleOnOutputDeviceChange(MessageParcel& data, MessageParcel& reply);
40 
41     static bool CheckInterfaceToken(MessageParcel& data);
42 
43     using HanlerFunc = int32_t (AVControllerCallbackStub::*)(MessageParcel& data, MessageParcel& reply);
44     static inline HanlerFunc handlers[] = {
45         [CONTROLLER_CMD_ON_SESSION_DESTROY] = &AVControllerCallbackStub::HandleOnSessionDestroy,
46         [CONTROLLER_CMD_ON_PLAYBACK_STATE_CHANGE] = &AVControllerCallbackStub::HandleOnPlaybackStateChange,
47         [CONTROLLER_CMD_ON_METADATA_CHANGE] = &AVControllerCallbackStub::HandleOnMetadataChange,
48         [CONTROLLER_CMD_ON_ACTIVE_STATE_CHANGE] = &AVControllerCallbackStub::HandleOnActiveStateChange,
49         [CONTROLLER_CMD_ON_VALID_COMMAND_CHANGE] = &AVControllerCallbackStub::HandleOnValidCommandChange,
50         [CONTROLLER_CMD_ON_OUTPUT_DEVICE_CHANGE] = &AVControllerCallbackStub::HandleOnOutputDeviceChange,
51     };
52 };
53 }
54 #endif // OHOS_AVCONTROLLER_CALLBACK_STUB_H