• 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/* *
17 * @addtogroup HdiUsb
18 *
19 * @brief Provides unified APIs for usb services to access usb drivers.
20 *
21 * A usb service can obtain a usb driver object or agent and then call APIs provided by this object or agent to
22 * access different types of usb devices based on the usb IDs, thereby obtaining usb information,
23 * subscribing to or unsubscribing from usb data, enabling or disabling a usb,
24 * setting the usb data reporting mode, and setting usb options such as the accuracy and measurement range.
25 *
26 * @since 5.1
27 */
28
29/* *
30 * @file IUsbInterface.idl
31 *
32 * @brief Declares the APIs provided by the usb module for obtaining usb information, subscribing to or
33 * unsubscribing from usb data, enabling or disabling a usb, setting the usb data reporting mode,
34 * and setting usb options such as the accuracy and measurement range.
35 *
36 * @since 5.1
37 * @version 1.0
38 */
39
40package ohos.hdi.usb.v1_2;
41
42import ohos.hdi.usb.v1_2.UsbTypes;
43import ohos.hdi.usb.v1_2.IUsbdTransferCallback;
44import ohos.hdi.usb.v1_1.UsbTypes;
45import ohos.hdi.usb.v1_1.IUsbInterface;
46
47/* *
48 * @brief Defines the functions for performing basic operations on usb.
49 *
50 * The operations include obtaining usb information, subscribing to or unsubscribing from usb data,
51 * enabling or disabling a usb, setting the usb data reporting mode, and setting usb options such as
52 * the accuracy and measurement range.
53 */
54interface IUsbInterface extends ohos.hdi.usb.v1_1.IUsbInterface{
55
56    /* *
57     * @brief Submit usb async transfer.
58     *
59     * @param dev Indicates the USB device address.
60     * @param info Indicates the param info of the USB transfer.
61     * @param cb Indicates the callback function of base.
62     * @param ashmem Indicates the object of share memory
63     *
64     * @return Returns <b>0</b> if the operation is successful; returns a non-0 value if the operation fails.
65     * @since 5.1
66     * @version 1.0
67     */
68    UsbSubmitTransfer([in] struct UsbDev dev, [in] USBTransferInfo info, [in] IUsbdTransferCallback cb, [in] Ashmem ashmem);
69
70    /* *
71     * @brief Cancels the usb async transfer by endpoint.
72     *
73     * @param dev Indicates the USB device address.
74     * @param endpoint Indicates the endpoint address.
75     *
76     * @return Returns <b>0</b> if the operation is successful; returns a non-0 value if the operation fails.
77     * @since 5.1
78     * @version 1.0
79     */
80    UsbCancelTransfer([in] struct UsbDev dev, [in] int endpoint);
81}