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_CONTROLLER_STUB_H 17 #define OHOS_AVSESSION_CONTROLLER_STUB_H 18 19 #include "iavsession_controller.h" 20 #include "iremote_stub.h" 21 22 namespace OHOS::AVSession { 23 class AVSessionControllerStub : public IRemoteStub<IAVSessionController> { 24 public: 25 int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; 26 RegisterCallback(const std::shared_ptr<AVControllerCallback> & callback)27 int32_t RegisterCallback(const std::shared_ptr<AVControllerCallback>& callback) override 28 { 29 return 0; 30 } 31 GetRealPlaybackPosition()32 int64_t GetRealPlaybackPosition() override 33 { 34 return 0; 35 } 36 IsDestroy()37 bool IsDestroy() override 38 { 39 return true; 40 } 41 42 private: 43 int32_t HandleRegisterCallbackInner(MessageParcel& data, MessageParcel& reply); 44 45 int32_t HandleDestroy(MessageParcel& data, MessageParcel& reply); 46 47 int32_t HandleGetAVPlaybackState(MessageParcel& data, MessageParcel& reply); 48 49 int32_t HandleSendControlCommand(MessageParcel& data, MessageParcel& reply); 50 51 int32_t HandleSendCommonCommand(MessageParcel& data, MessageParcel& reply); 52 53 int32_t HandleGetAVMetaData(MessageParcel& data, MessageParcel& reply); 54 55 int32_t HandleGetAVQueueItems(MessageParcel& data, MessageParcel& reply); 56 57 int32_t HandleGetAVQueueTitle(MessageParcel& data, MessageParcel& reply); 58 59 int32_t HandleSkipToQueueItem(MessageParcel& data, MessageParcel& reply); 60 61 int32_t HandleGetExtras(MessageParcel& data, MessageParcel& reply); 62 63 int32_t HandleSendAVKeyEvent(MessageParcel& data, MessageParcel& reply); 64 65 int32_t HandleGetLaunchAbility(MessageParcel& data, MessageParcel& reply); 66 67 int32_t HandleGetValidCommands(MessageParcel& data, MessageParcel& reply); 68 69 int32_t HandleSetMetaFilter(MessageParcel& data, MessageParcel& reply); 70 71 int32_t HandleSetPlaybackFilter(MessageParcel& data, MessageParcel& reply); 72 73 int32_t HandleIsSessionActive(MessageParcel& data, MessageParcel& reply); 74 75 int32_t HandleGetSessionId(MessageParcel& data, MessageParcel& reply); 76 77 static bool CheckInterfaceToken(MessageParcel& data); 78 79 using HandlerFunc = int32_t (AVSessionControllerStub::*)(MessageParcel& data, MessageParcel& reply); 80 static inline HandlerFunc handlers[] = { 81 &AVSessionControllerStub::HandleRegisterCallbackInner, 82 &AVSessionControllerStub::HandleDestroy, 83 &AVSessionControllerStub::HandleGetAVPlaybackState, 84 &AVSessionControllerStub::HandleGetAVMetaData, 85 &AVSessionControllerStub::HandleSendAVKeyEvent, 86 &AVSessionControllerStub::HandleGetLaunchAbility, 87 &AVSessionControllerStub::HandleGetValidCommands, 88 &AVSessionControllerStub::HandleSendControlCommand, 89 &AVSessionControllerStub::HandleSendCommonCommand, 90 &AVSessionControllerStub::HandleSetMetaFilter, 91 &AVSessionControllerStub::HandleSetPlaybackFilter, 92 &AVSessionControllerStub::HandleIsSessionActive, 93 &AVSessionControllerStub::HandleGetSessionId, 94 &AVSessionControllerStub::HandleGetAVQueueItems, 95 &AVSessionControllerStub::HandleGetAVQueueTitle, 96 &AVSessionControllerStub::HandleSkipToQueueItem, 97 &AVSessionControllerStub::HandleGetExtras, 98 }; 99 }; 100 } // namespace OHOS::AVSession 101 #endif // OHOS_AVSESSION_CONTROLLER_STUB_H