• 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 #include "usbd_callback_server.h"
17 
18 #include "hilog_wrapper.h"
19 #include "usb_errors.h"
20 
21 namespace OHOS::USB {
22 
OnTransferWriteCallback(int32_t status,int32_t actualLength,std::vector<HDI::Usb::V1_2::UsbIsoPacketDescriptor> & isoInfo,uint64_t userData)23 int32_t UsbdCallBackServer::OnTransferWriteCallback(int32_t status, int32_t actualLength,
24     std::vector<HDI::Usb::V1_2::UsbIsoPacketDescriptor> &isoInfo, uint64_t userData)
25 {
26     info_.status = status;
27     info_.actualLength = actualLength;
28     if (!isoInfo.empty()) {
29         this->isoInfo_ = isoInfo;
30     }
31     callback_(info_, isoInfo_, userData);
32     return UEC_OK;
33 }
34 
OnTransferReadCallback(int32_t status,int32_t actualLength,std::vector<HDI::Usb::V1_2::UsbIsoPacketDescriptor> & isoInfo,uint64_t userData)35 int32_t UsbdCallBackServer::OnTransferReadCallback(int32_t status, int32_t actualLength,
36     std::vector<HDI::Usb::V1_2::UsbIsoPacketDescriptor> &isoInfo, uint64_t userData)
37 {
38     info_.status = status;
39     info_.actualLength = actualLength;
40     if (!isoInfo.empty()) {
41         this->isoInfo_ = isoInfo;
42     }
43     callback_(info_, isoInfo_, userData);
44     return UEC_OK;
45 }
46 
47 } // namespace OHOS::USB
48