1 /* 2 * Copyright (c) 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_AVCAST_CONTROLLER_STUB_H 17 #define OHOS_AVCAST_CONTROLLER_STUB_H 18 19 #include "iavcast_controller.h" 20 #include "iremote_stub.h" 21 22 namespace OHOS::AVSession { 23 class AVCastControllerStub : public IRemoteStub<IAVCastController> { 24 public: 25 int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; 26 RegisterCallback(const std::shared_ptr<AVCastControllerCallback> & callback)27 int32_t RegisterCallback(const std::shared_ptr<AVCastControllerCallback>& callback) override 28 { 29 return 0; 30 } 31 32 private: 33 int32_t HandleSendControlCommand(MessageParcel& data, MessageParcel& reply); 34 35 int32_t HandleStart(MessageParcel& data, MessageParcel& reply); 36 37 int32_t HandlePrepare(MessageParcel& data, MessageParcel& reply); 38 39 int32_t HandleGetDuration(MessageParcel& data, MessageParcel& reply); 40 41 int32_t HandleGetCastAVPlayBackState(MessageParcel& data, MessageParcel& reply); 42 43 int32_t HandleGetCurrentItem(MessageParcel& data, MessageParcel& reply); 44 45 int32_t HandleGetValidCommands(MessageParcel& data, MessageParcel& reply); 46 47 int32_t HandleSetDisplaySurface(MessageParcel& data, MessageParcel& reply); 48 49 int32_t HandleSetCastPlaybackFilter(MessageParcel& data, MessageParcel& reply); 50 51 int32_t HandleRegisterCallbackInner(MessageParcel& data, MessageParcel& reply); 52 53 int32_t HandleAddAvailableCommand(MessageParcel& data, MessageParcel& reply); 54 55 int32_t HandleRemoveAvailableCommand(MessageParcel& data, MessageParcel& reply); 56 57 int32_t HandleDestroy(MessageParcel& data, MessageParcel& reply); 58 59 static bool CheckInterfaceToken(MessageParcel& data); 60 61 using HandlerFunc = int32_t (AVCastControllerStub::*)(MessageParcel& data, MessageParcel& reply); 62 static inline HandlerFunc handlers[] = { 63 &AVCastControllerStub::HandleSendControlCommand, 64 &AVCastControllerStub::HandleStart, 65 &AVCastControllerStub::HandlePrepare, 66 &AVCastControllerStub::HandleGetDuration, 67 &AVCastControllerStub::HandleGetCastAVPlayBackState, 68 &AVCastControllerStub::HandleGetCurrentItem, 69 &AVCastControllerStub::HandleGetValidCommands, 70 &AVCastControllerStub::HandleSetDisplaySurface, 71 &AVCastControllerStub::HandleSetCastPlaybackFilter, 72 &AVCastControllerStub::HandleRegisterCallbackInner, 73 &AVCastControllerStub::HandleDestroy, 74 &AVCastControllerStub::HandleAddAvailableCommand, 75 &AVCastControllerStub::HandleRemoveAvailableCommand, 76 }; 77 }; 78 } // namespace OHOS::AVSession 79 #endif // OHOS_AVCAST_CONTROLLER_STUB_H 80