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_HDI_USB_GADGET_MTP_V1_0_USBFNMTPINTERFACESTUB_H 17#define OHOS_HDI_USB_GADGET_MTP_V1_0_USBFNMTPINTERFACESTUB_H 18 19#include <ipc_object_stub.h> 20#include <message_option.h> 21#include <message_parcel.h> 22#include <object_collector.h> 23#include <refbase.h> 24#include "v1_0/iusbfn_mtp_interface.h" 25 26namespace OHOS { 27namespace HDI { 28namespace Usb { 29namespace Gadget { 30namespace Mtp { 31namespace V1_0 { 32 33using namespace OHOS; 34class UsbfnMtpInterfaceStub : public IPCObjectStub { 35public: 36 explicit UsbfnMtpInterfaceStub(const sptr<IUsbfnMtpInterface> &impl); 37 virtual ~UsbfnMtpInterfaceStub(); 38 39 int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 40 41 static int32_t UsbfnMtpInterfaceStubStart_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 42 43 static int32_t UsbfnMtpInterfaceStubStop_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 44 45 static int32_t UsbfnMtpInterfaceStubRead_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 46 47 static int32_t UsbfnMtpInterfaceStubWrite_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 48 49 static int32_t UsbfnMtpInterfaceStubReceiveFile_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 50 51 static int32_t UsbfnMtpInterfaceStubSendFile_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 52 53 static int32_t UsbfnMtpInterfaceStubSendEvent_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 54 55 static int32_t UsbfnMtpInterfaceStubInit_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 56 57 static int32_t UsbfnMtpInterfaceStubRelease_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 58 59 static int32_t UsbfnMtpInterfaceStubGetVersion_(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption, sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl); 60 61private: 62 int32_t UsbfnMtpInterfaceStubStart(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 63 64 int32_t UsbfnMtpInterfaceStubStop(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 65 66 int32_t UsbfnMtpInterfaceStubRead(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 67 68 int32_t UsbfnMtpInterfaceStubWrite(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 69 70 int32_t UsbfnMtpInterfaceStubReceiveFile(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 71 72 int32_t UsbfnMtpInterfaceStubSendFile(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 73 74 int32_t UsbfnMtpInterfaceStubSendEvent(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 75 76 int32_t UsbfnMtpInterfaceStubInit(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 77 78 int32_t UsbfnMtpInterfaceStubRelease(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 79 80 int32_t UsbfnMtpInterfaceStubGetVersion(MessageParcel& usbfnMtpInterfaceData, MessageParcel& usbfnMtpInterfaceReply, MessageOption& usbfnMtpInterfaceOption); 81 82 83 static inline ObjectDelegator<OHOS::HDI::Usb::Gadget::Mtp::V1_0::UsbfnMtpInterfaceStub, OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> objDelegator_; 84 sptr<OHOS::HDI::Usb::Gadget::Mtp::V1_0::IUsbfnMtpInterface> impl_; 85}; 86} // V1_0 87} // Mtp 88} // Gadget 89} // Usb 90} // HDI 91} // OHOS 92 93#endif // OHOS_HDI_USB_GADGET_MTP_V1_0_USBFNMTPINTERFACESTUB_H 94 95