• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 USBD_STUB_CALLBACK_H
17 #define USBD_STUB_CALLBACK_H
18 
19 #include "ipc_object_stub.h"
20 #include "v1_2/usb_types.h"
21 
22 namespace OHOS::USB {
23 class UsbdStubCallBack : public OHOS::IPCObjectStub {
24 public:
25     enum {
26         CMD_USBD_TRANSFER_CALLBACK_READ,
27         CMD_USBD_TRANSFER_CALLBACK_WRITE,
28     };
29 
UsbdStubCallBack()30     explicit UsbdStubCallBack() : OHOS::IPCObjectStub(u"UsbdStubCallback.V1_2") {}
31     ~UsbdStubCallBack() override = default;
32     int32_t OnRemoteRequest(uint32_t code, OHOS::MessageParcel &data, OHOS::MessageParcel &reply,
33         OHOS::MessageOption &option) override;
34 
35     virtual int32_t OnTransferWriteCallback(int32_t status, int32_t actLength,
36         std::vector<HDI::Usb::V1_2::UsbIsoPacketDescriptor> &isoInfo, uint64_t userData) = 0;
37     virtual int32_t OnTransferReadCallback(int32_t status, int32_t actLength,
38         std::vector<HDI::Usb::V1_2::UsbIsoPacketDescriptor> &isoInfo, uint64_t userData) = 0;
39 
40     int32_t TransferWriteCallback(uint32_t code, OHOS::MessageParcel &data);
41     int32_t TransferReadCallback(uint32_t code, OHOS::MessageParcel &data);
42 };
43 } // namespace OHOS::USB
44 #endif // USBD_STUB_CALLBACK_H
45