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 /** 17 * @addtogroup HdiUsb 18 * @ 19 * 20 * @brief Provides unified APIs for usb services to access usb drivers. 21 * 22 * A usb service can obtain a usb driver object or agent and then call APIs provided by this object or agent to 23 * access different types of usb devices based on the usb IDs, thereby obtaining usb information, 24 * subscribing to or unsubscribing from usb data, enabling or disabling a usb, 25 * setting the usb data reporting mode, and setting usb options such as the accuracy and measurement range. 26 * 27 * @since 5.1 28 * @version 1.0 29 */ 30 31/** 32 * @file UsbTypes.idl 33 * 34 * @brief Defines the data used by the usb module, including the usb information, 35 * and reported usb data. 36 * 37 * @since 5.1 38 * @version 1.0 39 */ 40 41package ohos.hdi.usb.v2_0; 42 43/** 44 * @brief Defines the ControlTransfer Params, which is used by {@link IUsbHostInterface::ControlTransferReadwithLength}. 45 * @since 5.1 46 * @version 1.0 47 */ 48struct UsbCtrlTransferParams { 49 int requestType; 50 int requestCmd; 51 int value; 52 int index; 53 int length; 54 int timeout; 55}; 56 57/** 58 * @brief Defines the UsbDev Params. 59 * @since 5.1 60 * @version 1.0 61 */ 62struct UsbDev { 63 unsigned char busNum; 64 unsigned char devAddr; 65}; 66 67/** 68 * @brief Defines the UsbPipe Params. 69 * @since 5.1 70 * @version 1.0 71 */ 72struct UsbPipe { 73 unsigned char intfId; 74 unsigned char endpointId; 75}; 76 77/** 78 * @brief Defines the UsbCtrlTransfer Params. 79 * @since 5.1 80 * @version 1.0 81 */ 82struct UsbCtrlTransfer { 83 int requestType; 84 int requestCmd; 85 int value; 86 int index; 87 int timeout; 88}; 89 90/** 91 * @brief Defines the USBDeviceInfo Params. 92 * @since 5.1 93 * @version 1.0 94 */ 95struct USBDeviceInfo { 96 int status; 97 int busNum; 98 int devNum; 99}; 100 101/** 102 * @brief Defines the PortInfo Params. 103 * @since 5.1 104 * @version 1.0 105 */ 106struct PortInfo { 107 int portId; 108 int powerRole; 109 int dataRole; 110 int mode; 111 int supportedModes; 112}; 113 114/** 115 * @brief Defines the UsbPortStatus Params. 116 * @since 5.1 117 * @version 1.0 118 */ 119struct UsbPortStatus { 120 int currentMode; 121 int currentPowerRole; 122 int currentDataRole; 123}; 124 125/** 126 * @brief Defines the UsbPort Params. 127 * @since 5.1 128 * @version 1.0 129 */ 130struct UsbPort { 131 int id; 132 int supportedModes; 133 UsbPortStatus usbPortStatus; 134}; 135 136/** 137 * @brief Defines the USB iso packet descriptor params. 138 * @since 5.1 139 * @version 1.0 140 */ 141struct UsbIsoPacketDescriptor { 142 int isoLength; 143 int isoActualLength; 144 int isoStatus; 145}; 146 147/** 148 * @brief Defines the USB transferInfo Params. 149 * @since 5.1 150 * @version 1.0 151 */ 152struct USBTransferInfo { 153 int endpoint; 154 int flags; 155 int type; 156 int timeOut; 157 int length; 158 unsigned long userData; 159 unsigned int numIsoPackets; 160}; 161