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_CALLBACK_SERVER_H 17 #define USBD_CALLBACK_SERVER_H 18 19 #include "iusb_srv.h" 20 #include "usbd_callback_stub.h" 21 #include "v1_2/usb_types.h" 22 23 namespace OHOS::USB { 24 class UsbdCallBackServer : public UsbdStubCallBack { 25 public: UsbdCallBackServer(const TransferCallback & callback)26 explicit UsbdCallBackServer(const TransferCallback &callback) : callback_(callback) {} 27 UsbdCallBackServer() = default; 28 ~UsbdCallBackServer() = default; 29 30 int32_t OnTransferWriteCallback(int32_t status, int32_t actLength, 31 std::vector<HDI::Usb::V1_2::UsbIsoPacketDescriptor> &isoInfo, uint64_t userData) override; 32 int32_t OnTransferReadCallback(int32_t status, int32_t actLength, 33 std::vector<HDI::Usb::V1_2::UsbIsoPacketDescriptor> &isoInfo, uint64_t userData) override; 34 35 private: 36 std::vector<HDI::Usb::V1_2::UsbIsoPacketDescriptor> isoInfo_; 37 TransferCallbackInfo info_; 38 TransferCallback callback_; 39 }; 40 } // namespace OHOS::USB 41 #endif 42