• 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 USBMGR_USBD_TRANSFER_CALLBACK_IMPL_H
17 #define USBMGR_USBD_TRANSFER_CALLBACK_IMPL_H
18 
19 #include <refbase.h>
20 #include "iremote_object.h"
21 #include "v2_0/iusbd_transfer_callback.h"
22 #include "v2_0/usb_types.h"
23 
24 namespace OHOS {
25 namespace USB {
26 class UsbTransferCallbackImpl : public HDI::Usb::V2_0::IUsbdTransferCallback {
27 public:
UsbTransferCallbackImpl(const OHOS::sptr<OHOS::IRemoteObject> & cb)28     explicit UsbTransferCallbackImpl(const OHOS::sptr<OHOS::IRemoteObject> &cb) : remote_(cb) {}
29     UsbTransferCallbackImpl() = default;
30 
31     int32_t OnTransferWriteCallback(int32_t status, int32_t actLength,
32         const std::vector<HDI::Usb::V2_0::UsbIsoPacketDescriptor> &isoInfo, const uint64_t userData) override;
33     int32_t OnTransferReadCallback(int32_t status, int32_t actLength,
34         const std::vector<HDI::Usb::V2_0::UsbIsoPacketDescriptor> &isoInfo, const uint64_t userData) override;
35 private:
36     sptr<IRemoteObject> remote_ = nullptr;
37 };
38 } // namespace USB
39 } // namespace OHOS
40 #endif // USBMGR_USBD_TRANSFER_CALLBACK_IMPL_H
41