• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2024 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 * @file
18 * @kit BasicServicesKit
19 */
20
21import { AsyncCallback } from './@ohos.base';
22
23/**
24 * This module provides the capability of manage USB device.
25 *
26 * @namespace usbManager
27 * @syscap SystemCapability.USB.USBManager
28 * @since arkts {'1.1':'9', '1.2':'20'}
29 * @arkts 1.1&1.2
30 */
31declare namespace usbManager {
32  /**
33   * Obtains the USB device list.
34   *
35   * @returns { Array<Readonly<USBDevice>> } USB device list.
36   * @syscap SystemCapability.USB.USBManager
37   * @since 9
38   */
39  /**
40   * Obtains the USB device list.
41   *
42   * @returns { Array<Readonly<USBDevice>> } USB device list.
43   * @throws { BusinessError } 801 - Capability not supported.
44   * @syscap SystemCapability.USB.USBManager
45   * @since arkts {'1.1':'18', '1.2':'20'}
46   * @arkts 1.1&1.2
47   */
48  function getDevices(): Array<Readonly<USBDevice>>;
49
50  /**
51   * Connects to the USB device based on the device information returned by getDevices().
52   *
53   * @param { USBDevice } device - USB device on the device list returned by getDevices(). It cannot be empty.
54   * @returns { Readonly<USBDevicePipe> } object for data transfer.
55   * @throws { BusinessError } 401 - Parameter error. Possible causes:
56   * <br>1.Mandatory parameters are left unspecified.
57   * <br>2.Incorrect parameter types.
58   * @throws { BusinessError } 14400001 - Access right denied. Call requestRight to get the USBDevicePipe access right first.
59   * @syscap SystemCapability.USB.USBManager
60   * @since 9
61   */
62  /**
63   * Connects to the USB device based on the device information returned by getDevices().
64   *
65   * @param { USBDevice } device - USB device on the device list returned by getDevices(). It cannot be empty.
66   * @returns { Readonly<USBDevicePipe> } object for data transfer.
67   * @throws { BusinessError } 401 - Parameter error. Possible causes:
68   * <br>1.Mandatory parameters are left unspecified.
69   * <br>2.Incorrect parameter types.
70   * @throws { BusinessError } 801 - Capability not supported.
71   * @throws { BusinessError } 14400001 - Access right denied. Call requestRight to get the USBDevicePipe access right first.
72   * @syscap SystemCapability.USB.USBManager
73   * @since arkts {'1.1':'18', '1.2':'20'}
74   * @arkts 1.1&1.2
75   */
76  function connectDevice(device: USBDevice): Readonly<USBDevicePipe>;
77
78  /**
79   * Checks whether the application has the permission to access the device.
80   *
81   * @param { string } deviceName - device name defined by USBDevice.name. It cannot be empty.
82   * @returns { boolean } indicates if the user has the permission to access the device.
83   * @throws { BusinessError } 401 - Parameter error. Possible causes:
84   * <br>1.Mandatory parameters are left unspecified.
85   * <br>2.Incorrect parameter types.
86   * @syscap SystemCapability.USB.USBManager
87   * @since 9
88   */
89  /**
90   * Checks whether the application has the permission to access the device.
91   *
92   * @param { string } deviceName - device name defined by USBDevice.name. It cannot be empty.
93   * @returns { boolean } indicates if the user has the permission to access the device.
94   * @throws { BusinessError } 401 - Parameter error. Possible causes:
95   * <br>1.Mandatory parameters are left unspecified.
96   * <br>2.Incorrect parameter types.
97   * @throws { BusinessError } 801 - Capability not supported.
98   * @syscap SystemCapability.USB.USBManager
99   * @since arkts {'1.1':'18', '1.2':'20'}
100   * @arkts 1.1&1.2
101   */
102  function hasRight(deviceName: string): boolean;
103
104  /**
105   * Requests the permission for a given application to access the USB device.
106   * The system application has access to the device by default, and there is no need to call this interface to apply.
107   *
108   * @param { string } deviceName - device name defined by USBDevice.name. It cannot be empty.
109   * @returns { Promise<boolean> } indicates if the device access permissions are granted.
110   * @throws { BusinessError } 401 - Parameter error. Possible causes:
111   * <br>1.Mandatory parameters are left unspecified.
112   * <br>2.Incorrect parameter types.
113   * @syscap SystemCapability.USB.USBManager
114   * @since 9
115   */
116  /**
117   * Requests the permission for a given application to access the USB device.
118   * The system application has access to the device by default, and there is no need to call this interface to apply.
119   *
120   * @param { string } deviceName - device name defined by USBDevice.name. It cannot be empty.
121   * @returns { Promise<boolean> } indicates if the device access permissions are granted.
122   * @throws { BusinessError } 401 - Parameter error. Possible causes:
123   * <br>1.Mandatory parameters are left unspecified.
124   * <br>2.Incorrect parameter types.
125   * @throws { BusinessError } 801 - Capability not supported.
126   * @syscap SystemCapability.USB.USBManager
127   * @since arkts {'1.1':'18', '1.2':'20'}
128   * @arkts 1.1&1.2
129   */
130  function requestRight(deviceName: string): Promise<boolean>;
131
132  /**
133   * Remove the permission for a given application to access the USB device.
134   * The system application has access to the device by default, and calling this interface will not have any impact.
135   *
136   * @param { string } deviceName - device name defined by USBDevice.name. It cannot be empty.
137   * @returns { boolean } indicates if the device access permissions are removed.
138   * @throws { BusinessError } 401 - Parameter error. Possible causes:
139   * <br>1.Mandatory parameters are left unspecified.
140   * <br>2.Incorrect parameter types.
141   * @syscap SystemCapability.USB.USBManager
142   * @since 9
143   */
144  /**
145   * Remove the permission for a given application to access the USB device.
146   * The system application has access to the device by default, and calling this interface will not have any impact.
147   *
148   * @param { string } deviceName - device name defined by USBDevice.name. It cannot be empty.
149   * @returns { boolean } indicates if the device access permissions are removed.
150   * @throws { BusinessError } 401 - Parameter error. Possible causes:
151   * <br>1.Mandatory parameters are left unspecified.
152   * <br>2.Incorrect parameter types.
153   * @throws { BusinessError } 801 - Capability not supported.
154   * @syscap SystemCapability.USB.USBManager
155   * @since arkts {'1.1':'18', '1.2':'20'}
156   * @arkts 1.1&1.2
157   */
158  function removeRight(deviceName: string): boolean;
159
160  /**
161   * Add device access permission.
162   * The system application has access to the device by default, and calling this interface will not have any impact.
163   *
164   * @param { string } bundleName - refers to application that require access permissions. It cannot be empty.
165   * @param { string } deviceName - device name defined by USBDevice.name. It cannot be empty.
166   * @returns { boolean } value to indicate whether the permission is granted.
167   * @throws { BusinessError } 401 - Parameter error. Possible causes:
168   * <br>1.Mandatory parameters are left unspecified.
169   * <br>2.Incorrect parameter types.
170   * @syscap SystemCapability.USB.USBManager
171   * @systemapi
172   * @since 9
173   * @deprecated since 12
174   * @useinstead ohos.usbManager/usbManager#addDeviceAccessRight
175   */
176  function addRight(bundleName: string, deviceName: string): boolean;
177
178  /**
179   * Converts the string descriptor of a given USB function list to a numeric mask combination.
180   *
181   * @param { string } funcs - descriptor of the supported function list. It cannot be empty.
182   * @returns { number } the numeric mask combination of the function list.
183   * @throws { BusinessError } 401 - Parameter error. Possible causes:
184   * <br>1.Mandatory parameters are left unspecified.
185   * <br>2.Incorrect parameter types.
186   * @syscap SystemCapability.USB.USBManager
187   * @systemapi
188   * @since 9
189   * @deprecated since 12
190   * @useinstead ohos.usbManager/usbManager#getFunctionsFromString
191   */
192  function usbFunctionsFromString(funcs: string): number;
193
194  /**
195   * Converts the numeric mask combination of a given USB function list to a string descriptor.
196   *
197   * @param { FunctionType } funcs - numeric mask combination of the function list. The type of funcs must be number. It cannot be empty.
198   * @returns { string } - descriptor of the supported function list.
199   * @throws { BusinessError } 401 - Parameter error. Possible causes:
200   * <br>1.Mandatory parameters are left unspecified.
201   * <br>2.Incorrect parameter types.
202   * @syscap SystemCapability.USB.USBManager
203   * @systemapi
204   * @since 9
205   * @deprecated since 12
206   * @useinstead ohos.usbManager/usbManager#getStringFromFunctions
207   */
208  function usbFunctionsToString(funcs: FunctionType): string;
209
210  /**
211   * Sets the current USB function list in Device mode.
212   *
213   * @param { FunctionType } funcs - numeric mask combination of the supported function list. It cannot be empty.
214   * @returns { Promise<void> } the promise returned by the function.
215   * @throws { BusinessError } 401 - Parameter error. Possible causes:
216   * <br>1.Mandatory parameters are left unspecified.
217   * <br>2.Incorrect parameter types.
218   * @throws { BusinessError } 14400002 - Permission denied. The HDC is disabled by the system.
219   * @syscap SystemCapability.USB.USBManager
220   * @systemapi
221   * @since 9
222   * @deprecated since 12
223   * @useinstead ohos.usbManager/usbManager#setDeviceFunctions
224   */
225  function setCurrentFunctions(funcs: FunctionType): Promise<void>;
226
227  /**
228   * Obtains the numeric mask combination for the current USB function list in Device mode.
229   *
230   * @returns { FunctionType } the numeric mask combination for the current USB function list in FunctionType.
231   * @syscap SystemCapability.USB.USBManager
232   * @systemapi
233   * @since 9
234   * @deprecated since 12
235   * @useinstead ohos.usbManager/usbManager#getDeviceFunctions
236   */
237  function getCurrentFunctions(): FunctionType;
238  /* usb port functions begin */
239  /**
240   * Obtains the USBPort list.
241   *
242   * @returns { Array<USBPort> } the USBPort list.
243   * @syscap SystemCapability.USB.USBManager
244   * @systemapi
245   * @since 9
246   * @deprecated since 12
247   * @useinstead ohos.usbManager/usbManager#getPortList
248   */
249  function getPorts(): Array<USBPort>;
250
251  /**
252   * Gets the mask combination for the supported mode list of the specified USBPort.
253   *
254   * @param { number } portId - unique ID of the port. It cannot be empty.
255   * @returns { PortModeType } the mask combination for the supported mode list in PortModeType.
256   * @throws { BusinessError } 401 - Parameter error. Possible causes:
257   * <br>1.Mandatory parameters are left unspecified.
258   * <br>2.Incorrect parameter types.
259   * @syscap SystemCapability.USB.USBManager
260   * @systemapi
261   * @since 9
262   * @deprecated since 12
263   * @useinstead ohos.usbManager/usbManager#getPortSupportModes
264   */
265  function getSupportedModes(portId: number): PortModeType;
266
267  /**
268   * Sets the role types supported by the specified USBPort, which can be powerRole (for charging) and dataRole (for data transfer).
269   *
270   * @param { number } portId - unique ID of the port. It cannot be empty.
271   * @param { PowerRoleType } powerRole - charging role. It cannot be empty.
272   * @param { DataRoleType } dataRole - data role. It cannot be empty.
273   * @returns { Promise<void> } the promise returned by the function.
274   * @throws { BusinessError } 401 - Parameter error. Possible causes:
275   * <br>1.Mandatory parameters are left unspecified.
276   * <br>2.Incorrect parameter types.
277   * @syscap SystemCapability.USB.USBManager
278   * @systemapi
279   * @since 9
280   * @deprecated since 12
281   * @useinstead ohos.usbManager/usbManager#setPortRoleTypes
282   */
283  function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise<void>;
284
285  /**
286   * Add USB device access right.
287   * The system application has access to the device by default, and calling this interface will not have any impact.
288   *
289   * @permission ohos.permission.MANAGE_USB_CONFIG
290   * @param { string } tokenId - refers to application that require access permissions. It cannot be empty.
291   * @param { string } deviceName - device name defined by USBDevice.name. It cannot be empty.
292   * @returns { boolean } value to indicate whether the permission is granted.
293   * @throws { BusinessError } 401 - Parameter error. Possible causes:
294   * <br>1.Mandatory parameters are left unspecified.
295   * <br>2.Incorrect parameter types.
296   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
297   * @syscap SystemCapability.USB.USBManager
298   * @systemapi
299   * @since 12
300   */
301  /**
302   * Add USB device access right.
303   * The system application has access to the device by default, and calling this interface will not have any impact.
304   *
305   * @permission ohos.permission.MANAGE_USB_CONFIG
306   * @param { string } tokenId - refers to application that require access permissions. It cannot be empty.
307   * @param { string } deviceName - device name defined by USBDevice.name. It cannot be empty.
308   * @returns { boolean } value to indicate whether the permission is granted.
309   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
310   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
311   * @throws { BusinessError } 401 - Parameter error. Possible causes:
312   * <br>1.Mandatory parameters are left unspecified.
313   * <br>2.Incorrect parameter types.
314   * @throws { BusinessError } 801 - Capability not supported.
315   * @syscap SystemCapability.USB.USBManager
316   * @systemapi
317   * @since arkts {'1.1':'18', '1.2':'20'}
318   * @arkts 1.1&1.2
319   */
320  function addDeviceAccessRight(tokenId: string, deviceName: string): boolean;
321
322  /**
323   * Converts the string descriptor of a given USB function list to a numeric mask combination.
324   *
325   * @permission ohos.permission.MANAGE_USB_CONFIG
326   * @param { string } funcs - descriptor of the supported function list. It cannot be empty.
327   * @returns { number } the numeric mask combination of the function list.
328   * @throws { BusinessError } 401 - Parameter error. Possible causes:
329   * <br>1.Mandatory parameters are left unspecified.
330   * <br>2.Incorrect parameter types.
331   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
332   * @syscap SystemCapability.USB.USBManager
333   * @systemapi
334   * @since 12
335   */
336  /**
337   * Converts the string descriptor of a given USB function list to a numeric mask combination.
338   *
339   * @permission ohos.permission.MANAGE_USB_CONFIG
340   * @param { string } funcs - descriptor of the supported function list. It cannot be empty.
341   * @returns { int } the numeric mask combination of the function list.
342   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
343   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
344   * @throws { BusinessError } 401 - Parameter error. Possible causes:
345   * <br>1.Mandatory parameters are left unspecified.
346   * <br>2.Incorrect parameter types.
347   * @throws { BusinessError } 801 - Capability not supported.
348   * @syscap SystemCapability.USB.USBManager
349   * @systemapi
350   * @since arkts {'1.1':'18', '1.2':'20'}
351   * @arkts 1.1&1.2
352   */
353  function getFunctionsFromString(funcs: string): int;
354
355  /**
356   * Converts the numeric mask combination of a given USB function list to a string descriptor.
357   *
358   * @permission ohos.permission.MANAGE_USB_CONFIG
359   * @param { FunctionType } funcs - numeric mask combination of the function list. It cannot be empty.
360   * @returns { string } - descriptor of the supported function list.
361   * @throws { BusinessError } 401 - Parameter error. Possible causes:
362   * <br>1.Mandatory parameters are left unspecified.
363   * <br>2.Incorrect parameter types.
364   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
365   * @syscap SystemCapability.USB.USBManager
366   * @systemapi
367   * @since 12
368   */
369  /**
370   * Converts the numeric mask combination of a given USB function list to a string descriptor.
371   *
372   * @permission ohos.permission.MANAGE_USB_CONFIG
373   * @param { FunctionType } funcs - numeric mask combination of the function list. It cannot be empty.
374   * @returns { string } - descriptor of the supported function list.
375   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
376   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
377   * @throws { BusinessError } 401 - Parameter error. Possible causes:
378   * <br>1.Mandatory parameters are left unspecified.
379   * <br>2.Incorrect parameter types.
380   * @throws { BusinessError } 801 - Capability not supported.
381   * @syscap SystemCapability.USB.USBManager
382   * @systemapi
383   * @since arkts {'1.1':'18', '1.2':'20'}
384   * @arkts 1.1&1.2
385   */
386  function getStringFromFunctions(funcs: FunctionType): string;
387
388  /**
389   * Sets the current USB function list in Device mode.
390   *
391   * @permission ohos.permission.MANAGE_USB_CONFIG
392   * @param { FunctionType } funcs - numeric mask combination of the supported function list. It cannot be empty.
393   * @returns { Promise<void> } the promise returned by the function.
394   * @throws { BusinessError } 401 - Parameter error. Possible causes:
395   * <br>1.Mandatory parameters are left unspecified.
396   * <br>2.Incorrect parameter types.
397   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
398   * @throws { BusinessError } 14400002 - Permission denied. The HDC is disabled by the system.
399   * @throws { BusinessError } 14400006 - Unsupported operation. The function is not supported.
400   * @syscap SystemCapability.USB.USBManager
401   * @systemapi
402   * @since 12
403   */
404  /**
405   * Sets the current USB function list in Device mode.
406   *
407   * @permission ohos.permission.MANAGE_USB_CONFIG
408   * @param { FunctionType } funcs - numeric mask combination of the supported function list. It cannot be empty.
409   * @returns { Promise<void> } the promise returned by the function.
410   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
411   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
412   * @throws { BusinessError } 401 - Parameter error. Possible causes:
413   * <br>1.Mandatory parameters are left unspecified.
414   * <br>2.Incorrect parameter types.
415   * @throws { BusinessError } 801 - Capability not supported.
416   * @throws { BusinessError } 14400002 - Permission denied. The HDC is disabled by the system.
417   * @throws { BusinessError } 14400006 - Unsupported operation. The function is not supported.
418   * @syscap SystemCapability.USB.USBManager
419   * @systemapi
420   * @since arkts {'1.1':'18', '1.2':'20'}
421   * @arkts 1.1&1.2
422   */
423  function setDeviceFunctions(funcs: FunctionType): Promise<void>;
424
425  /**
426   * Obtains the numeric mask combination for the current USB function list in Device mode.
427   *
428   * @permission ohos.permission.MANAGE_USB_CONFIG
429   * @returns { FunctionType } the numeric mask combination for the current USB function list in FunctionType.
430   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
431   * @syscap SystemCapability.USB.USBManager
432   * @systemapi
433   * @since 12
434   */
435  /**
436   * Obtains the numeric mask combination for the current USB function list in Device mode.
437   *
438   * @permission ohos.permission.MANAGE_USB_CONFIG
439   * @returns { FunctionType } the numeric mask combination for the current USB function list in FunctionType.
440   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
441   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
442   * @throws { BusinessError } 801 - Capability not supported.
443   * @syscap SystemCapability.USB.USBManager
444   * @systemapi
445   * @since arkts {'1.1':'18', '1.2':'20'}
446   * @arkts 1.1&1.2
447   */
448  function getDeviceFunctions(): FunctionType;
449  /* usb port functions begin */
450  /**
451   * Obtains the USBPort list.
452   *
453   * @permission ohos.permission.MANAGE_USB_CONFIG
454   * @returns { Array<USBPort> } the USBPort list.
455   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
456   * @syscap SystemCapability.USB.USBManager
457   * @systemapi
458   * @since 12
459   */
460  /* usb port functions begin */
461  /**
462   * Obtains the USBPort list.
463   *
464   * @permission ohos.permission.MANAGE_USB_CONFIG
465   * @returns { Array<USBPort> } the USBPort list.
466   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
467   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
468   * @throws { BusinessError } 801 - Capability not supported.
469   * @syscap SystemCapability.USB.USBManager
470   * @systemapi
471   * @since arkts {'1.1':'18', '1.2':'20'}
472   * @arkts 1.1&1.2
473   */
474  function getPortList(): Array<USBPort>;
475
476  /**
477   * Gets the mask combination for the supported mode list of the specified USBPort.
478   *
479   * @permission ohos.permission.MANAGE_USB_CONFIG
480   * @param { number } portId - unique ID of the port. It cannot be empty.
481   * @returns { PortModeType } the mask combination for the supported mode list in PortModeType.
482   * @throws { BusinessError } 401 - Parameter error. Possible causes:
483   * <br>1.Mandatory parameters are left unspecified.
484   * <br>2.Incorrect parameter types.
485   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
486   * @syscap SystemCapability.USB.USBManager
487   * @systemapi
488   * @since 12
489   */
490  /**
491   * Gets the mask combination for the supported mode list of the specified USBPort.
492   *
493   * @permission ohos.permission.MANAGE_USB_CONFIG
494   * @param { int } portId - unique ID of the port. It cannot be empty.
495   * @returns { PortModeType } the mask combination for the supported mode list in PortModeType.
496   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
497   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
498   * @throws { BusinessError } 401 - Parameter error. Possible causes:
499   * <br>1.Mandatory parameters are left unspecified.
500   * <br>2.Incorrect parameter types.
501   * @throws { BusinessError } 801 - Capability not supported.
502   * @syscap SystemCapability.USB.USBManager
503   * @systemapi
504   * @since arkts {'1.1':'18', '1.2':'20'}
505   * @arkts 1.1&1.2
506   */
507  function getPortSupportModes(portId: int): PortModeType;
508
509  /**
510   * Sets the role types supported by the specified USBPort, which can be powerRole (for charging) and dataRole (for data transfer).
511   *
512   * @permission ohos.permission.MANAGE_USB_CONFIG
513   * @param { number } portId - unique ID of the port. It cannot be empty.
514   * @param { PowerRoleType } powerRole - charging role. It cannot be empty.
515   * @param { DataRoleType } dataRole - data role. It cannot be empty.
516   * @returns { Promise<void> } the promise returned by the function.
517   * @throws { BusinessError } 401 - Parameter error. Possible causes:
518   * <br>1.Mandatory parameters are left unspecified.
519   * <br>2.Incorrect parameter types.
520   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
521   * @throws { BusinessError } 14400003 - Unsupported operation. The current device does not support port role switching.
522   * @syscap SystemCapability.USB.USBManager
523   * @systemapi
524   * @since 12
525   */
526  /**
527   * Sets the role types supported by the specified USBPort, which can be powerRole (for charging) and dataRole (for data transfer).
528   *
529   * @permission ohos.permission.MANAGE_USB_CONFIG
530   * @param { int } portId - unique ID of the port. It cannot be empty.
531   * @param { PowerRoleType } powerRole - charging role. It cannot be empty.
532   * @param { DataRoleType } dataRole - data role. It cannot be empty.
533   * @returns { Promise<void> } the promise returned by the function.
534   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
535   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
536   * @throws { BusinessError } 401 - Parameter error. Possible causes:
537   * <br>1.Mandatory parameters are left unspecified.
538   * <br>2.Incorrect parameter types.
539   * @throws { BusinessError } 801 - Capability not supported.
540   * @throws { BusinessError } 14400003 - Unsupported operation. The current device does not support port role switching.
541   * @syscap SystemCapability.USB.USBManager
542   * @systemapi
543   * @since arkts {'1.1':'18', '1.2':'20'}
544   * @arkts 1.1&1.2
545   */
546  function setPortRoleTypes(portId: int, powerRole: PowerRoleType, dataRole: DataRoleType): Promise<void>;
547
548  /**
549   * Adds USB accessory access right.
550   *
551   * @permission ohos.permission.MANAGE_USB_CONFIG
552   * @param { number } tokenId - refers to application that require access permissions. It cannot be empty.
553   * @param { USBAccessory } accessory - USB accessory. It cannot be empty.
554   * @throws { BusinessError } 201 - The permission check failed.
555   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
556   * @throws { BusinessError } 401 - Parameter error. Possible causes:
557   * <br>1. Mandatory parameters are left unspecified.
558   * <br>2. Incorrect parameter types.
559   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
560   * <br>1. No accessory is plugged in.
561   * @throws { BusinessError } 14400005 - Database operation exception.
562   * @syscap SystemCapability.USB.USBManager
563   * @systemapi
564   * @since 14
565   */
566  /**
567   * Adds USB accessory access right.
568   *
569   * @permission ohos.permission.MANAGE_USB_CONFIG
570   * @param { int } tokenId - refers to application that require access permissions. It cannot be empty.
571   * @param { USBAccessory } accessory - USB accessory. It cannot be empty.
572   * @throws { BusinessError } 201 - The permission check failed.
573   * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api.
574   * @throws { BusinessError } 401 - Parameter error. Possible causes:
575   * <br>1. Mandatory parameters are left unspecified.
576   * <br>2. Incorrect parameter types.
577   * @throws { BusinessError } 801 - Capability not supported.
578   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
579   * <br>1. No accessory is plugged in.
580   * @throws { BusinessError } 14400005 - Database operation exception.
581   * @syscap SystemCapability.USB.USBManager
582   * @systemapi
583   * @since arkts {'1.1':'18', '1.2':'20'}
584   * @arkts 1.1&1.2
585   */
586  function addAccessoryRight(tokenId: int, accessory: USBAccessory): void;
587  /* usb pipe functions begin */
588  /**
589   * Claims a USB interface.
590   *
591   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
592   * @param { USBInterface } iface - USB interface, which is used to determine the interface to claim. It cannot be empty.
593   * @param { boolean } [force] - optional parameter that determines whether to forcibly claim the USB interface.
594   * @returns { number } returns **0** if the USB interface is successfully claimed; returns an error code otherwise.
595   * @throws { BusinessError } 401 - Parameter error. Possible causes:
596   * <br>1.Mandatory parameters are left unspecified.
597   * <br>2.Incorrect parameter types.
598   * @syscap SystemCapability.USB.USBManager
599   * @since 9
600   */
601  /**
602   * Claims a USB interface.
603   *
604   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
605   * @param { USBInterface } iface - USB interface, which is used to determine the interface to claim. It cannot be empty.
606   * @param { boolean } [force] - optional parameter that determines whether to forcibly claim the USB interface.
607   * @returns { int } returns **0** if the USB interface is successfully claimed; returns an error code otherwise.
608   * @throws { BusinessError } 401 - Parameter error. Possible causes:
609   * <br>1.Mandatory parameters are left unspecified.
610   * <br>2.Incorrect parameter types.
611   * @throws { BusinessError } 801 - Capability not supported.
612   * @syscap SystemCapability.USB.USBManager
613   * @since arkts {'1.1':'18', '1.2':'20'}
614   * @arkts 1.1&1.2
615   */
616  function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): int;
617
618  /**
619   * Releases a USB interface.
620   *
621   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
622   * @param { USBInterface } iface - USB interface, which is used to determine the interface to release. It cannot be empty.
623   * @returns { number } returns **0** if the USB interface is successfully released; returns an error code otherwise.
624   * @throws { BusinessError } 401 - Parameter error. Possible causes:
625   * <br>1.Mandatory parameters are left unspecified.
626   * <br>2.Incorrect parameter types.
627   * @syscap SystemCapability.USB.USBManager
628   * @since 9
629   */
630  /**
631   * Releases a USB interface.
632   *
633   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
634   * @param { USBInterface } iface - USB interface, which is used to determine the interface to release. It cannot be empty.
635   * @returns { int } returns **0** if the USB interface is successfully released; returns an error code otherwise.
636   * @throws { BusinessError } 401 - Parameter error. Possible causes:
637   * <br>1.Mandatory parameters are left unspecified.
638   * <br>2.Incorrect parameter types.
639   * @throws { BusinessError } 801 - Capability not supported.
640   * @syscap SystemCapability.USB.USBManager
641   * @since arkts {'1.1':'18', '1.2':'20'}
642   * @arkts 1.1&1.2
643   */
644  function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): int;
645
646  /**
647   * Sets the device configuration.
648   *
649   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
650   * @param { USBConfiguration } config - device configuration. It cannot be empty.
651   * @returns { number } returns **0** if the device configuration is successfully set; returns an error code otherwise.
652   * @throws { BusinessError } 401 - Parameter error. Possible causes:
653   * <br>1.Mandatory parameters are left unspecified.
654   * <br>2.Incorrect parameter types.
655   * @syscap SystemCapability.USB.USBManager
656   * @since 9
657   */
658  /**
659   * Sets the device configuration.
660   *
661   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
662   * @param { USBConfiguration } config - device configuration. It cannot be empty.
663   * @returns { int } returns **0** if the device configuration is successfully set; returns an error code otherwise.
664   * @throws { BusinessError } 401 - Parameter error. Possible causes:
665   * <br>1.Mandatory parameters are left unspecified.
666   * <br>2.Incorrect parameter types.
667   * @throws { BusinessError } 801 - Capability not supported.
668   * @syscap SystemCapability.USB.USBManager
669   * @since arkts {'1.1':'18', '1.2':'20'}
670   * @arkts 1.1&1.2
671   */
672  function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): int;
673
674  /**
675   * Sets a USB interface.
676   *
677   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
678   * @param { USBInterface } iface - USB interface, which is used to determine the interface to set. It cannot be empty.
679   * @returns { number } returns **0** if the USB interface is successfully set; return an error code otherwise.
680   * @throws { BusinessError } 401 - Parameter error. Possible causes:
681   * <br>1.Mandatory parameters are left unspecified.
682   * <br>2.Incorrect parameter types.
683   * @syscap SystemCapability.USB.USBManager
684   * @since 9
685   */
686  /**
687   * Sets a USB interface.
688   *
689   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
690   * @param { USBInterface } iface - USB interface, which is used to determine the interface to set. It cannot be empty.
691   * @returns { int } returns **0** if the USB interface is successfully set; return an error code otherwise.
692   * @throws { BusinessError } 401 - Parameter error. Possible causes:
693   * <br>1.Mandatory parameters are left unspecified.
694   * <br>2.Incorrect parameter types.
695   * @throws { BusinessError } 801 - Capability not supported.
696   * @syscap SystemCapability.USB.USBManager
697   * @since arkts {'1.1':'18', '1.2':'20'}
698   * @arkts 1.1&1.2
699   */
700  function setInterface(pipe: USBDevicePipe, iface: USBInterface): int;
701
702  /**
703   * Obtains the raw USB descriptor.
704   *
705   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
706   * @returns { Uint8Array } returns the raw descriptor data.
707   * @throws { BusinessError } 401 - Parameter error. Possible causes:
708   * <br>1.Mandatory parameters are left unspecified.
709   * <br>2.Incorrect parameter types.
710   * @syscap SystemCapability.USB.USBManager
711   * @since 9
712   */
713  /**
714   * Obtains the raw USB descriptor.
715   *
716   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty.
717   * @returns { Uint8Array } returns the raw descriptor data.
718   * @throws { BusinessError } 401 - Parameter error. Possible causes:
719   * <br>1.Mandatory parameters are left unspecified.
720   * <br>2.Incorrect parameter types.
721   * @throws { BusinessError } 801 - Capability not supported.
722   * @syscap SystemCapability.USB.USBManager
723   * @since arkts {'1.1':'18', '1.2':'20'}
724   * @arkts 1.1&1.2
725   */
726  function getRawDescriptor(pipe: USBDevicePipe): Uint8Array;
727
728  /**
729   * Obtains the file descriptor.
730   *
731   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty.
732   * @returns { number } returns the file descriptor of the USB device.
733   * @throws { BusinessError } 401 - Parameter error. Possible causes:
734   * <br>1.Mandatory parameters are left unspecified.
735   * <br>2.Incorrect parameter types.
736   * @syscap SystemCapability.USB.USBManager
737   * @since 9
738   */
739  /**
740   * Obtains the file descriptor.
741   *
742   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty.
743   * @returns { int } returns the file descriptor of the USB device.
744   * @throws { BusinessError } 401 - Parameter error. Possible causes:
745   * <br>1.Mandatory parameters are left unspecified.
746   * <br>2.Incorrect parameter types.
747   * @throws { BusinessError } 801 - Capability not supported.
748   * @syscap SystemCapability.USB.USBManager
749   * @since arkts {'1.1':'18', '1.2':'20'}
750   * @arkts 1.1&1.2
751   */
752  function getFileDescriptor(pipe: USBDevicePipe): int;
753
754  /**
755   * Performs control transfer.
756   *
757   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty.
758   * @param { USBControlParams } controlparam - control transfer parameters. It cannot be empty.
759   * @param { number } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout.
760   * @returns { Promise<number> } returns the size of the transmitted or received data block if the control transfer is successful;
761   * return -1 if an exception occurs.
762   * @throws { BusinessError } 401 - Parameter error. Possible causes:
763   * <br>1.Mandatory parameters are left unspecified.
764   * <br>2.Incorrect parameter types.
765   * @syscap SystemCapability.USB.USBManager
766   * @since 9
767   * @deprecated since 12
768   * @useinstead ohos.usbManager/usbManager#usbControlTransfer
769   */
770  function controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout?: number): Promise<number>;
771
772  /**
773   * Performs usb control transfer.
774   *
775   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty.
776   * @param { USBDeviceRequestParams } requestparam - control transfer parameters. It cannot be empty.
777   * @param { number } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout.
778   * @returns { Promise<number> } returns the size of the transmitted or received data block if the control transfer is successful;
779   * return -1 if an exception occurs.
780   * @throws { BusinessError } 401 - Parameter error. Possible causes:
781   * <br>1.Mandatory parameters are left unspecified.
782   * <br>2.Incorrect parameter types.
783   * @syscap SystemCapability.USB.USBManager
784   * @since 12
785   */
786  /**
787   * Performs usb control transfer.
788   *
789   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty.
790   * @param { USBDeviceRequestParams } requestparam - control transfer parameters. It cannot be empty.
791   * @param { int } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout.
792   * @returns { Promise<int> } returns the size of the transmitted or received data block if the control transfer is successful;
793   * return -1 if an exception occurs.
794   * @throws { BusinessError } 401 - Parameter error. Possible causes:
795   * <br>1.Mandatory parameters are left unspecified.
796   * <br>2.Incorrect parameter types.
797   * @throws { BusinessError } 801 - Capability not supported.
798   * @syscap SystemCapability.USB.USBManager
799   * @since arkts {'1.1':'18', '1.2':'20'}
800   * @arkts 1.1&1.2
801   */
802  function usbControlTransfer(pipe: USBDevicePipe, requestparam: USBDeviceRequestParams, timeout?: int): Promise<int>;
803
804  /**
805   * Performs bulk transfer.
806   *
807   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty.
808   * @param { USBEndpoint } endpoint - USB endpoint, which is used to determine the USB port for data transfer. It cannot be empty.
809   * @param { Uint8Array } buffer - buffer for writing or reading data. It cannot be empty.
810   * @param { number } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout.
811   * @returns { Promise<number> } the size of the transmitted or received data block if the control transfer is successful;
812   * return -1 if an exception occurs.
813   * @throws { BusinessError } 401 - Parameter error. Possible causes:
814   * <br>1.Mandatory parameters are left unspecified.
815   * <br>2.Incorrect parameter types.
816   * @syscap SystemCapability.USB.USBManager
817   * @since 9
818   */
819  /**
820   * Performs bulk transfer.
821   *
822   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty.
823   * @param { USBEndpoint } endpoint - USB endpoint, which is used to determine the USB port for data transfer. It cannot be empty.
824   * @param { Uint8Array } buffer - buffer for writing or reading data. It cannot be empty.
825   * @param { int } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout.
826   * @returns { Promise<int> } the size of the transmitted or received data block if the control transfer is successful;
827   * return -1 if an exception occurs.
828   * @throws { BusinessError } 401 - Parameter error. Possible causes:
829   * <br>1.Mandatory parameters are left unspecified.
830   * <br>2.Incorrect parameter types.
831   * @throws { BusinessError } 801 - Capability not supported.
832   * @syscap SystemCapability.USB.USBManager
833   * @since arkts {'1.1':'18', '1.2':'20'}
834   * @arkts 1.1&1.2
835   */
836  function bulkTransfer(
837    pipe: USBDevicePipe,
838    endpoint: USBEndpoint,
839    buffer: Uint8Array,
840    timeout?: int
841  ): Promise<int>;
842
843  /**
844   * Closes a USB device pipe.
845   *
846   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty.
847   * @returns { number } returns **0** if the USB device pipe is closed successfully; return an error code otherwise.
848   * @throws { BusinessError } 401 - Parameter error. Possible causes:
849   * <br>1.Mandatory parameters are left unspecified.
850   * <br>2.Incorrect parameter types.
851   * @syscap SystemCapability.USB.USBManager
852   * @since 9
853   */
854  /**
855   * Closes a USB device pipe.
856   *
857   * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty.
858   * @returns { int } returns **0** if the USB device pipe is closed successfully; return an error code otherwise.
859   * @throws { BusinessError } 401 - Parameter error. Possible causes:
860   * <br>1.Mandatory parameters are left unspecified.
861   * <br>2.Incorrect parameter types.
862   * @throws { BusinessError } 801 - Capability not supported.
863   * @syscap SystemCapability.USB.USBManager
864   * @since arkts {'1.1':'18', '1.2':'20'}
865   * @arkts 1.1&1.2
866   */
867  function closePipe(pipe: USBDevicePipe): int;
868
869  /**
870   * Checks whether the application has the right to access the USB accessory.
871   *
872   * @param { USBAccessory } accessory - USB accessory. It cannot be empty.
873   * @returns { boolean } indicates if the user has the right to access the USB accessory.
874   * @throws { BusinessError } 401 - Parameter error. Possible causes:
875   * <br>1. Mandatory parameters are left unspecified.
876   * <br>2. Incorrect parameter types.
877   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
878   * <br>1. No accessory is plugged in.
879   * @throws { BusinessError } 14400005 - Database operation exception.
880   * @throws { BusinessError } 14401001 - The target USBAccessory not matched.
881   * @syscap SystemCapability.USB.USBManager
882   * @since 14
883   */
884  /**
885   * Checks whether the application has the right to access the USB accessory.
886   *
887   * @param { USBAccessory } accessory - USB accessory. It cannot be empty.
888   * @returns { boolean } indicates if the user has the right to access the USB accessory.
889   * @throws { BusinessError } 401 - Parameter error. Possible causes:
890   * <br>1. Mandatory parameters are left unspecified.
891   * <br>2. Incorrect parameter types.
892   * @throws { BusinessError } 801 - Capability not supported.
893   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
894   * <br>1. No accessory is plugged in.
895   * @throws { BusinessError } 14400005 - Database operation exception.
896   * @throws { BusinessError } 14401001 - The target USBAccessory not matched.
897   * @syscap SystemCapability.USB.USBManager
898   * @since arkts {'1.1':'18', '1.2':'20'}
899   * @arkts 1.1&1.2
900   */
901  function hasAccessoryRight(accessory: USBAccessory): boolean;
902
903  /**
904   * Requests the right for a given application to access the USB accessory.
905   *
906   * @param { USBAccessory } accessory - USB accessory. It cannot be empty.
907   * @returns { Promise<boolean> } indicates if the USB accessory access right are granted.
908   * @throws { BusinessError } 401 - Parameter error. Possible causes:
909   * <br>1. Mandatory parameters are left unspecified.
910   * <br>2. Incorrect parameter types.
911   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
912   * <br>1. No accessory is plugged in.
913   * @throws { BusinessError } 14400005 - Database operation exception.
914   * @throws { BusinessError } 14401001 - The target USBAccessory not matched.
915   * @syscap SystemCapability.USB.USBManager
916   * @since 14
917   */
918  /**
919   * Requests the right for a given application to access the USB accessory.
920   *
921   * @param { USBAccessory } accessory - USB accessory. It cannot be empty.
922   * @returns { Promise<boolean> } indicates if the USB accessory access right are granted.
923   * @throws { BusinessError } 401 - Parameter error. Possible causes:
924   * <br>1. Mandatory parameters are left unspecified.
925   * <br>2. Incorrect parameter types.
926   * @throws { BusinessError } 801 - Capability not supported.
927   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
928   * <br>1. No accessory is plugged in.
929   * @throws { BusinessError } 14400005 - Database operation exception.
930   * @throws { BusinessError } 14401001 - The target USBAccessory not matched.
931   * @syscap SystemCapability.USB.USBManager
932   * @since arkts {'1.1':'18', '1.2':'20'}
933   * @arkts 1.1&1.2
934   */
935  function requestAccessoryRight(accessory: USBAccessory): Promise<boolean>;
936
937  /**
938   * Cancels the right for a given application to access the USB accessory.
939   *
940   * @param { USBAccessory } accessory - USB accessory. It cannot be empty.
941   * @throws { BusinessError } 401 - Parameter error. Possible causes:
942   * <br>1. Mandatory parameters are left unspecified.
943   * <br>2. Incorrect parameter types.
944   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
945   * <br>1. No accessory is plugged in.
946   * @throws { BusinessError } 14400005 - Database operation exception.
947   * @throws { BusinessError } 14401001 - The target USBAccessory not matched.
948   * @syscap SystemCapability.USB.USBManager
949   * @since 14
950   */
951  /**
952   * Cancels the right for a given application to access the USB accessory.
953   *
954   * @param { USBAccessory } accessory - USB accessory. It cannot be empty.
955   * @throws { BusinessError } 401 - Parameter error. Possible causes:
956   * <br>1. Mandatory parameters are left unspecified.
957   * <br>2. Incorrect parameter types.
958   * @throws { BusinessError } 801 - Capability not supported.
959   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
960   * <br>1. No accessory is plugged in.
961   * @throws { BusinessError } 14400005 - Database operation exception.
962   * @throws { BusinessError } 14401001 - The target USBAccessory not matched.
963   * @syscap SystemCapability.USB.USBManager
964   * @since arkts {'1.1':'18', '1.2':'20'}
965   * @arkts 1.1&1.2
966   */
967  function cancelAccessoryRight(accessory: USBAccessory): void;
968
969  /**
970   * Obtains the USB Accessory list.
971   *
972   * @returns { Array<Readonly<USBAccessory>> } USB accessory list.
973   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
974   * <br>1. No accessory is plugged in.
975   * @syscap SystemCapability.USB.USBManager
976   * @since 14
977   */
978  /**
979   * Obtains the USB Accessory list.
980   *
981   * @returns { Array<Readonly<USBAccessory>> } USB accessory list.
982   * @throws { BusinessError } 801 - Capability not supported.
983   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
984   * <br>1. No accessory is plugged in.
985   * @syscap SystemCapability.USB.USBManager
986   * @since arkts {'1.1':'18', '1.2':'20'}
987   * @arkts 1.1&1.2
988   */
989  function getAccessoryList(): Array<Readonly<USBAccessory>>;
990
991  /**
992   * Obtains the accessory handle and opens accessory file descriptor.
993   *
994   * @param { USBAccessory } accessory - accessory, which is used to determine the accessory. It cannot be empty.
995   * @returns { USBAccessoryHandle } returns the handle of the accessory.
996   * @throws { BusinessError } 401 - Parameter error. Possible causes:
997   * <br>1. Mandatory parameters are left unspecified.
998   * <br>2. Incorrect parameter types.
999   * @throws { BusinessError } 14400001 - Access right denied. Call requestRight to get the USBDevicePipe access right first.
1000   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
1001   * <br>1. No accessory is plugged in.
1002   * @throws { BusinessError } 14401001 - The target USBAccessory not matched.
1003   * @throws { BusinessError } 14401002 - Failed to open the native accessory node.
1004   * @throws { BusinessError } 14401003 - Cannot reopen the accessory.
1005   * @syscap SystemCapability.USB.USBManager
1006   * @since 14
1007   */
1008  /**
1009   * Obtains the accessory handle and opens accessory file descriptor.
1010   *
1011   * @param { USBAccessory } accessory - accessory, which is used to determine the accessory. It cannot be empty.
1012   * @returns { USBAccessoryHandle } returns the handle of the accessory.
1013   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1014   * <br>1. Mandatory parameters are left unspecified.
1015   * <br>2. Incorrect parameter types.
1016   * @throws { BusinessError } 801 - Capability not supported.
1017   * @throws { BusinessError } 14400001 - Access right denied. Call requestRight to get the USBDevicePipe access right first.
1018   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
1019   * <br>1. No accessory is plugged in.
1020   * @throws { BusinessError } 14401001 - The target USBAccessory not matched.
1021   * @throws { BusinessError } 14401002 - Failed to open the native accessory node.
1022   * @throws { BusinessError } 14401003 - Cannot reopen the accessory.
1023   * @syscap SystemCapability.USB.USBManager
1024   * @since arkts {'1.1':'18', '1.2':'20'}
1025   * @arkts 1.1&1.2
1026   */
1027  function openAccessory(accessory: USBAccessory): USBAccessoryHandle;
1028
1029  /**
1030   * Closes the accessory file descriptor.
1031   *
1032   * @param { USBAccessoryHandle } accessoryHandle - Accessory handle to be closed.
1033   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1034   * <br>1. Mandatory parameters are left unspecified.
1035   * <br>2. Incorrect parameter types.
1036   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
1037   * <br>1. No accessory is plugged in.
1038   * @syscap SystemCapability.USB.USBManager
1039   * @since 14
1040   */
1041  /**
1042   * Closes the accessory file descriptor.
1043   *
1044   * @param { USBAccessoryHandle } accessoryHandle - Accessory handle to be closed.
1045   * @throws { BusinessError } 401 - Parameter error. Possible causes:
1046   * <br>1. Mandatory parameters are left unspecified.
1047   * <br>2. Incorrect parameter types.
1048   * @throws { BusinessError } 801 - Capability not supported.
1049   * @throws { BusinessError } 14400004 - Service exception. Possible causes:
1050   * <br>1. No accessory is plugged in.
1051   * @syscap SystemCapability.USB.USBManager
1052   * @since arkts {'1.1':'18', '1.2':'20'}
1053   * @arkts 1.1&1.2
1054   */
1055  function closeAccessory(accessoryHandle: USBAccessoryHandle): void;
1056
1057  /**
1058   * Represents the USB endpoint from which data is sent or received. You can obtain the USB endpoint through USBInterface.
1059   *
1060   * @typedef USBEndpoint
1061   * @syscap SystemCapability.USB.USBManager
1062   * @since arkts {'1.1':'9', '1.2':'20'}
1063   * @arkts 1.1&1.2
1064   */
1065  interface USBEndpoint {
1066    /**
1067     * Endpoint address
1068     *
1069     * @type { int }
1070     * @syscap SystemCapability.USB.USBManager
1071     * @since arkts {'1.1':'9', '1.2':'20'}
1072     * @arkts 1.1&1.2
1073     */
1074    address: int;
1075
1076    /**
1077     * Endpoint attributes
1078     *
1079     * @type { int }
1080     * @syscap SystemCapability.USB.USBManager
1081     * @since arkts {'1.1':'9', '1.2':'20'}
1082     * @arkts 1.1&1.2
1083     */
1084    attributes: int;
1085
1086    /**
1087     * Endpoint interval
1088     *
1089     * @type { int }
1090     * @syscap SystemCapability.USB.USBManager
1091     * @since arkts {'1.1':'9', '1.2':'20'}
1092     * @arkts 1.1&1.2
1093     */
1094    interval: int;
1095
1096    /**
1097     * Maximum size of data packets on the endpoint
1098     *
1099     * @type { int }
1100     * @syscap SystemCapability.USB.USBManager
1101     * @since arkts {'1.1':'9', '1.2':'20'}
1102     * @arkts 1.1&1.2
1103     */
1104    maxPacketSize: int;
1105
1106    /**
1107     * Endpoint direction
1108     *
1109     * @type { USBRequestDirection }
1110     * @syscap SystemCapability.USB.USBManager
1111     * @since arkts {'1.1':'9', '1.2':'20'}
1112     * @arkts 1.1&1.2
1113     */
1114    direction: USBRequestDirection;
1115
1116    /**
1117     * Endpoint number
1118     *
1119     * @type { number }
1120     * @syscap SystemCapability.USB.USBManager
1121     * @since 9
1122     */
1123    number: number;
1124
1125    /**
1126     * Endpoint address
1127     *
1128     * @type { int }
1129     * @syscap SystemCapability.USB.USBManager
1130     * @since 20
1131     * @arkts 1.2
1132     */
1133    endpointAddr: int;
1134
1135    /**
1136     * Endpoint type
1137     *
1138     * @type { int }
1139     * @syscap SystemCapability.USB.USBManager
1140     * @since arkts {'1.1':'9', '1.2':'20'}
1141     * @arkts 1.1&1.2
1142     */
1143    type: int;
1144
1145    /**
1146     * Unique ID defined by USBInterface.id, which indicates the interface to which the endpoint belongs
1147     *
1148     * @type { int }
1149     * @syscap SystemCapability.USB.USBManager
1150     * @since arkts {'1.1':'9', '1.2':'20'}
1151     * @arkts 1.1&1.2
1152     */
1153    interfaceId: int;
1154
1155
1156
1157  }
1158
1159  /**
1160   * Represents a USB interface. One config can contain multiple **USBInterface** instances, each providing a specific function.
1161   *
1162   * @typedef USBInterface
1163   * @syscap SystemCapability.USB.USBManager
1164   * @since arkts {'1.1':'9', '1.2':'20'}
1165   * @arkts 1.1&1.2
1166   */
1167  interface USBInterface {
1168    /**
1169     * Unique ID of the USB interface
1170     *
1171     * @type { int }
1172     * @syscap SystemCapability.USB.USBManager
1173     * @since arkts {'1.1':'9', '1.2':'20'}
1174     * @arkts 1.1&1.2
1175     */
1176    id: int;
1177
1178    /**
1179     * Interface protocol
1180     *
1181     * @type { int }
1182     * @syscap SystemCapability.USB.USBManager
1183     * @since arkts {'1.1':'9', '1.2':'20'}
1184     * @arkts 1.1&1.2
1185     */
1186    protocol: int;
1187
1188    /**
1189     * Device type
1190     *
1191     * @type { int }
1192     * @syscap SystemCapability.USB.USBManager
1193     * @since arkts {'1.1':'9', '1.2':'20'}
1194     * @arkts 1.1&1.2
1195     */
1196    clazz: int;
1197
1198    /**
1199     * Device subclass
1200     *
1201     * @type { int }
1202     * @syscap SystemCapability.USB.USBManager
1203     * @since arkts {'1.1':'9', '1.2':'20'}
1204     * @arkts 1.1&1.2
1205     */
1206    subClass: int;
1207
1208    /**
1209     * Alternation between descriptors of the same USB interface
1210     *
1211     * @type { int }
1212     * @syscap SystemCapability.USB.USBManager
1213     * @since arkts {'1.1':'9', '1.2':'20'}
1214     * @arkts 1.1&1.2
1215     */
1216    alternateSetting: int;
1217
1218    /**
1219     * Interface name
1220     *
1221     * @type { string }
1222     * @syscap SystemCapability.USB.USBManager
1223     * @since arkts {'1.1':'9', '1.2':'20'}
1224     * @arkts 1.1&1.2
1225     */
1226    name: string;
1227
1228    /**
1229     * USBEndpoint that belongs to the USB interface
1230     *
1231     * @type { Array<USBEndpoint> }
1232     * @syscap SystemCapability.USB.USBManager
1233     * @since arkts {'1.1':'9', '1.2':'20'}
1234     * @arkts 1.1&1.2
1235     */
1236    endpoints: Array<USBEndpoint>;
1237  }
1238
1239  /**
1240   * USB configuration. One USBDevice can contain multiple USBConfiguration instances.
1241   *
1242   * @typedef USBConfiguration
1243   * @syscap SystemCapability.USB.USBManager
1244   * @since arkts {'1.1':'9', '1.2':'20'}
1245   * @arkts 1.1&1.2
1246   */
1247  interface USBConfiguration {
1248    /**
1249     * Unique ID of the USB configuration
1250     *
1251     * @type { int }
1252     * @syscap SystemCapability.USB.USBManager
1253     * @since arkts {'1.1':'9', '1.2':'20'}
1254     * @arkts 1.1&1.2
1255     */
1256    id: int;
1257
1258    /**
1259     * Configuration attributes
1260     *
1261     * @type { int }
1262     * @syscap SystemCapability.USB.USBManager
1263     * @since arkts {'1.1':'9', '1.2':'20'}
1264     * @arkts 1.1&1.2
1265     */
1266    attributes: int;
1267
1268    /**
1269     * Maximum power consumption, in mA
1270     *
1271     * @type { int }
1272     * @syscap SystemCapability.USB.USBManager
1273     * @since arkts {'1.1':'9', '1.2':'20'}
1274     * @arkts 1.1&1.2
1275     */
1276    maxPower: int;
1277
1278    /**
1279     * Configuration name, which can be left empty
1280     *
1281     * @type { string }
1282     * @syscap SystemCapability.USB.USBManager
1283     * @since arkts {'1.1':'9', '1.2':'20'}
1284     * @arkts 1.1&1.2
1285     */
1286    name: string;
1287
1288    /**
1289     * Support for remote wakeup
1290     *
1291     * @type { boolean }
1292     * @syscap SystemCapability.USB.USBManager
1293     * @since arkts {'1.1':'9', '1.2':'20'}
1294     * @arkts 1.1&1.2
1295     */
1296    isRemoteWakeup: boolean;
1297
1298    /**
1299     * Support for independent power supplies
1300     *
1301     * @type { boolean }
1302     * @syscap SystemCapability.USB.USBManager
1303     * @since arkts {'1.1':'9', '1.2':'20'}
1304     * @arkts 1.1&1.2
1305     */
1306    isSelfPowered: boolean;
1307
1308    /**
1309     * Supported interface attributes
1310     *
1311     * @type { Array<USBInterface> }
1312     * @syscap SystemCapability.USB.USBManager
1313     * @since arkts {'1.1':'9', '1.2':'20'}
1314     * @arkts 1.1&1.2
1315     */
1316    interfaces: Array<USBInterface>;
1317  }
1318
1319  /**
1320   * Represents a USB device.
1321   *
1322   * @typedef USBDevice
1323   * @syscap SystemCapability.USB.USBManager
1324   * @since arkts {'1.1':'9', '1.2':'20'}
1325   * @arkts 1.1&1.2
1326   */
1327  interface USBDevice {
1328    /**
1329     * Bus address
1330     *
1331     * @type { int }
1332     * @syscap SystemCapability.USB.USBManager
1333     * @since arkts {'1.1':'9', '1.2':'20'}
1334     * @arkts 1.1&1.2
1335     */
1336    busNum: int;
1337
1338    /**
1339     * Device address
1340     *
1341     * @type { int }
1342     * @syscap SystemCapability.USB.USBManager
1343     * @since arkts {'1.1':'9', '1.2':'20'}
1344     * @arkts 1.1&1.2
1345     */
1346    devAddress: int;
1347
1348    /**
1349     * Device SN
1350     *
1351     * @type { string }
1352     * @syscap SystemCapability.USB.USBManager
1353     * @since arkts {'1.1':'9', '1.2':'20'}
1354     * @arkts 1.1&1.2
1355     */
1356    serial: string;
1357
1358    /**
1359     * Device name
1360     *
1361     * @type { string }
1362     * @syscap SystemCapability.USB.USBManager
1363     * @since arkts {'1.1':'9', '1.2':'20'}
1364     * @arkts 1.1&1.2
1365     */
1366    name: string;
1367
1368    /**
1369     * Device manufacturer
1370     *
1371     * @type { string }
1372     * @syscap SystemCapability.USB.USBManager
1373     * @since arkts {'1.1':'9', '1.2':'20'}
1374     * @arkts 1.1&1.2
1375     */
1376    manufacturerName: string;
1377
1378    /**
1379     * Product information
1380     *
1381     * @type { string }
1382     * @syscap SystemCapability.USB.USBManager
1383     * @since arkts {'1.1':'9', '1.2':'20'}
1384     * @arkts 1.1&1.2
1385     */
1386    productName: string;
1387
1388    /**
1389     * Product version
1390     *
1391     * @type { string }
1392     * @syscap SystemCapability.USB.USBManager
1393     * @since arkts {'1.1':'9', '1.2':'20'}
1394     * @arkts 1.1&1.2
1395     */
1396    version: string;
1397
1398    /**
1399     * Vendor ID
1400     *
1401     * @type { int }
1402     * @syscap SystemCapability.USB.USBManager
1403     * @since arkts {'1.1':'9', '1.2':'20'}
1404     * @arkts 1.1&1.2
1405     */
1406    vendorId: int;
1407
1408    /**
1409     * Product ID
1410     *
1411     * @type { int }
1412     * @syscap SystemCapability.USB.USBManager
1413     * @since arkts {'1.1':'9', '1.2':'20'}
1414     * @arkts 1.1&1.2
1415     */
1416    productId: int;
1417
1418    /**
1419     * Device class
1420     *
1421     * @type { int }
1422     * @syscap SystemCapability.USB.USBManager
1423     * @since arkts {'1.1':'9', '1.2':'20'}
1424     * @arkts 1.1&1.2
1425     */
1426    clazz: int;
1427
1428    /**
1429     * Device subclass
1430     *
1431     * @type { int }
1432     * @syscap SystemCapability.USB.USBManager
1433     * @since arkts {'1.1':'9', '1.2':'20'}
1434     * @arkts 1.1&1.2
1435     */
1436    subClass: int;
1437
1438    /**
1439     * Device protocol code
1440     *
1441     * @type { int }
1442     * @syscap SystemCapability.USB.USBManager
1443     * @since arkts {'1.1':'9', '1.2':'20'}
1444     * @arkts 1.1&1.2
1445     */
1446    protocol: int;
1447
1448    /**
1449     * Device configuration descriptor information
1450     *
1451     * @type { Array<USBConfiguration> }
1452     * @syscap SystemCapability.USB.USBManager
1453     * @since arkts {'1.1':'9', '1.2':'20'}
1454     * @arkts 1.1&1.2
1455     */
1456    configs: Array<USBConfiguration>;
1457  }
1458
1459  /**
1460   * Represents a USB device pipe, which is used to determine the USB device.
1461   *
1462   * @typedef USBDevicePipe
1463   * @syscap SystemCapability.USB.USBManager
1464   * @since arkts {'1.1':'9', '1.2':'20'}
1465   * @arkts 1.1&1.2
1466   */
1467  interface USBDevicePipe {
1468    /**
1469     * Bus address.
1470     *
1471     * @type { int }
1472     * @syscap SystemCapability.USB.USBManager
1473     * @since arkts {'1.1':'9', '1.2':'20'}
1474     * @arkts 1.1&1.2
1475     */
1476    busNum: int;
1477
1478    /**
1479     * Device address
1480     *
1481     * @type { int }
1482     * @syscap SystemCapability.USB.USBManager
1483     * @since arkts {'1.1':'9', '1.2':'20'}
1484     * @arkts 1.1&1.2
1485     */
1486    devAddress: int;
1487  }
1488
1489  /**
1490   * Enumerates power role types.
1491   *
1492   * @enum { int }
1493   * @syscap SystemCapability.USB.USBManager
1494   * @systemapi
1495   * @since arkts {'1.1':'9', '1.2':'20'}
1496   * @arkts 1.1&1.2
1497   */
1498  export enum PowerRoleType {
1499    /**
1500     * None
1501     *
1502     * @syscap SystemCapability.USB.USBManager
1503     * @systemapi
1504     * @since arkts {'1.1':'9', '1.2':'20'}
1505     * @arkts 1.1&1.2
1506     */
1507    NONE = 0,
1508
1509    /**
1510     * External power supply
1511     *
1512     * @syscap SystemCapability.USB.USBManager
1513     * @systemapi
1514     * @since arkts {'1.1':'9', '1.2':'20'}
1515     * @arkts 1.1&1.2
1516     */
1517    SOURCE = 1,
1518
1519    /**
1520     * Internal power supply
1521     *
1522     * @syscap SystemCapability.USB.USBManager
1523     * @systemapi
1524     * @since arkts {'1.1':'9', '1.2':'20'}
1525     * @arkts 1.1&1.2
1526     */
1527    SINK = 2
1528  }
1529
1530  /**
1531   * Enumerates data role types.
1532   *
1533   * @enum { int }
1534   * @syscap SystemCapability.USB.USBManager
1535   * @systemapi
1536   * @since arkts {'1.1':'9', '1.2':'20'}
1537   * @arkts 1.1&1.2
1538   */
1539  export enum DataRoleType {
1540    /**
1541     * None
1542     *
1543     * @syscap SystemCapability.USB.USBManager
1544     * @systemapi
1545     * @since arkts {'1.1':'9', '1.2':'20'}
1546     * @arkts 1.1&1.2
1547     */
1548    NONE = 0,
1549
1550    /**
1551     * Host mode
1552     *
1553     * @syscap SystemCapability.USB.USBManager
1554     * @systemapi
1555     * @since arkts {'1.1':'9', '1.2':'20'}
1556     * @arkts 1.1&1.2
1557     */
1558    HOST = 1,
1559
1560    /**
1561     * Device mode
1562     *
1563     * @syscap SystemCapability.USB.USBManager
1564     * @systemapi
1565     * @since arkts {'1.1':'9', '1.2':'20'}
1566     * @arkts 1.1&1.2
1567     */
1568    DEVICE = 2
1569  }
1570
1571  /**
1572   * Enumerates port mode types
1573   *
1574   * @enum { int }
1575   * @syscap SystemCapability.USB.USBManager
1576   * @systemapi
1577   * @since arkts {'1.1':'9', '1.2':'20'}
1578   * @arkts 1.1&1.2
1579   */
1580  export enum PortModeType {
1581    /**
1582     * None
1583     *
1584     * @syscap SystemCapability.USB.USBManager
1585     * @systemapi
1586     * @since arkts {'1.1':'9', '1.2':'20'}
1587     * @arkts 1.1&1.2
1588     */
1589    NONE = 0,
1590
1591    /**
1592     * Upstream facing port, which functions as the sink of power supply
1593     *
1594     * @syscap SystemCapability.USB.USBManager
1595     * @systemapi
1596     * @since arkts {'1.1':'9', '1.2':'20'}
1597     * @arkts 1.1&1.2
1598     */
1599    UFP = 1,
1600
1601    /**
1602     * Downstream facing port, which functions as the source of power supply
1603     *
1604     * @syscap SystemCapability.USB.USBManager
1605     * @systemapi
1606     * @since arkts {'1.1':'9', '1.2':'20'}
1607     * @arkts 1.1&1.2
1608     */
1609    DFP = 2,
1610
1611    /**
1612     * Dynamic reconfiguration port (DRP), which can function as the DFP (host) or UFP (device). It is not supported currently.
1613     *
1614     * @syscap SystemCapability.USB.USBManager
1615     * @systemapi
1616     * @since arkts {'1.1':'9', '1.2':'20'}
1617     * @arkts 1.1&1.2
1618     */
1619    DRP = 3,
1620
1621    /**
1622     * Not supported currently
1623     *
1624     * @syscap SystemCapability.USB.USBManager
1625     * @systemapi
1626     * @since arkts {'1.1':'9', '1.2':'20'}
1627     * @arkts 1.1&1.2
1628     */
1629    NUM_MODES = 4
1630  }
1631
1632  /**
1633   * Enumerates USB device port roles.
1634   *
1635   * @typedef USBPortStatus
1636   * @syscap SystemCapability.USB.USBManager
1637   * @systemapi
1638   * @since arkts {'1.1':'9', '1.2':'20'}
1639   * @arkts 1.1&1.2
1640   */
1641  interface USBPortStatus {
1642    /**
1643     * USB mode
1644     *
1645     * @type { int }
1646     * @syscap SystemCapability.USB.USBManager
1647     * @systemapi
1648     * @since arkts {'1.1':'9', '1.2':'20'}
1649     * @arkts 1.1&1.2
1650     */
1651    currentMode: int;
1652
1653    /**
1654     * Power role
1655     *
1656     * @type { int }
1657     * @syscap SystemCapability.USB.USBManager
1658     * @systemapi
1659     * @since arkts {'1.1':'9', '1.2':'20'}
1660     * @arkts 1.1&1.2
1661     */
1662    currentPowerRole: int;
1663
1664    /**
1665     * Data role
1666     *
1667     * @type { int }
1668     * @syscap SystemCapability.USB.USBManager
1669     * @systemapi
1670     * @since arkts {'1.1':'9', '1.2':'20'}
1671     * @arkts 1.1&1.2
1672     */
1673    currentDataRole: int;
1674  }
1675
1676  /**
1677   * Represents a USB device port.
1678   *
1679   * @typedef USBPort
1680   * @syscap SystemCapability.USB.USBManager
1681   * @systemapi
1682   * @since arkts {'1.1':'9', '1.2':'20'}
1683   * @arkts 1.1&1.2
1684   */
1685  interface USBPort {
1686    /**
1687     * Unique ID of the USB port
1688     *
1689     * @type { int }
1690     * @syscap SystemCapability.USB.USBManager
1691     * @systemapi
1692     * @since arkts {'1.1':'9', '1.2':'20'}
1693     * @arkts 1.1&1.2
1694     */
1695    id: int;
1696
1697    /**
1698     * Mask combination for the supported mode list of the USB port
1699     *
1700     * @type { PortModeType }
1701     * @syscap SystemCapability.USB.USBManager
1702     * @systemapi
1703     * @since arkts {'1.1':'9', '1.2':'20'}
1704     * @arkts 1.1&1.2
1705     */
1706    supportedModes: PortModeType;
1707
1708    /**
1709     * USB port role
1710     *
1711     * @type { USBPortStatus }
1712     * @syscap SystemCapability.USB.USBManager
1713     * @systemapi
1714     * @since arkts {'1.1':'9', '1.2':'20'}
1715     * @arkts 1.1&1.2
1716     */
1717    status: USBPortStatus;
1718  }
1719
1720  /**
1721   * Represents control transfer parameters.
1722   *
1723   * @typedef USBControlParams
1724   * @syscap SystemCapability.USB.USBManager
1725   * @since 9
1726   * @deprecated since 18
1727   * @useinstead ohos.usbManager/usbManager#USBDeviceRequestParams
1728   */
1729  interface USBControlParams {
1730    /**
1731     * Request type
1732     *
1733     * @type { number }
1734     * @syscap SystemCapability.USB.USBManager
1735     * @since 9
1736     * @deprecated since 18
1737     */
1738    request: number;
1739
1740    /**
1741     * Request target type
1742     *
1743     * @type { USBRequestTargetType }
1744     * @syscap SystemCapability.USB.USBManager
1745     * @since 9
1746     * @deprecated since 18
1747     */
1748    target: USBRequestTargetType;
1749
1750    /**
1751     * Control request type
1752     *
1753     * @type { USBControlRequestType }
1754     * @syscap SystemCapability.USB.USBManager
1755     * @since 9
1756     * @deprecated since 18
1757     */
1758    reqType: USBControlRequestType;
1759
1760    /**
1761     * Request parameter value
1762     *
1763     * @type { number }
1764     * @syscap SystemCapability.USB.USBManager
1765     * @since 9
1766     * @deprecated since 18
1767     */
1768    value: number;
1769
1770    /**
1771     * Index of the parameter value
1772     *
1773     * @type { number }
1774     * @syscap SystemCapability.USB.USBManager
1775     * @since 9
1776     * @deprecated since 18
1777     */
1778    index: number;
1779
1780    /**
1781     * Data written to or read from the buffer
1782     *
1783     * @type { Uint8Array }
1784     * @syscap SystemCapability.USB.USBManager
1785     * @since 9
1786     * @deprecated since 18
1787     */
1788    data: Uint8Array;
1789  }
1790
1791  /**
1792   * Represents control transfer parameters.
1793   *
1794   * @typedef USBDeviceRequestParams
1795   * @syscap SystemCapability.USB.USBManager
1796   * @since arkts {'1.1':'12', '1.2':'20'}
1797   * @arkts 1.1&1.2
1798   */
1799  interface USBDeviceRequestParams {
1800    /**
1801     * Bit map request type
1802     *
1803     * @type { int }
1804     * @syscap SystemCapability.USB.USBManager
1805     * @since arkts {'1.1':'12', '1.2':'20'}
1806     * @arkts 1.1&1.2
1807     */
1808    bmRequestType: int;
1809
1810    /**
1811     * Byte request
1812     *
1813     * @type { int }
1814     * @syscap SystemCapability.USB.USBManager
1815     * @since arkts {'1.1':'12', '1.2':'20'}
1816     * @arkts 1.1&1.2
1817     */
1818    bRequest: int;
1819
1820    /**
1821     * Request parameter word value
1822     *
1823     * @type { int }
1824     * @syscap SystemCapability.USB.USBManager
1825     * @since arkts {'1.1':'12', '1.2':'20'}
1826     * @arkts 1.1&1.2
1827     */
1828    wValue: int;
1829
1830    /**
1831     * Word index of the parameter value
1832     *
1833     * @type { int }
1834     * @syscap SystemCapability.USB.USBManager
1835     * @since arkts {'1.1':'12', '1.2':'20'}
1836     * @arkts 1.1&1.2
1837     */
1838    wIndex: int;
1839
1840    /**
1841     * Word length of the parameter value
1842     *
1843     * @type { int }
1844     * @syscap SystemCapability.USB.USBManager
1845     * @since arkts {'1.1':'12', '1.2':'20'}
1846     * @arkts 1.1&1.2
1847     */
1848    wLength: int;
1849
1850    /**
1851     * Data written to or read from the buffer
1852     *
1853     * @type { Uint8Array }
1854     * @syscap SystemCapability.USB.USBManager
1855     * @since arkts {'1.1':'12', '1.2':'20'}
1856     * @arkts 1.1&1.2
1857     */
1858    data: Uint8Array;
1859  }
1860
1861  /**
1862   * Enumerates USB request target types.
1863   *
1864   * @enum { int }
1865   * @syscap SystemCapability.USB.USBManager
1866   * @since arkts {'1.1':'9', '1.2':'20'}
1867   * @arkts 1.1&1.2
1868   */
1869  export enum USBRequestTargetType {
1870    /**
1871     * USB device
1872     *
1873     * @syscap SystemCapability.USB.USBManager
1874     * @since arkts {'1.1':'9', '1.2':'20'}
1875     * @arkts 1.1&1.2
1876     */
1877    USB_REQUEST_TARGET_DEVICE = 0,
1878
1879    /**
1880     * USB interface
1881     *
1882     * @syscap SystemCapability.USB.USBManager
1883     * @since arkts {'1.1':'9', '1.2':'20'}
1884     * @arkts 1.1&1.2
1885     */
1886    USB_REQUEST_TARGET_INTERFACE = 1,
1887
1888    /**
1889     * Endpoint
1890     *
1891     * @syscap SystemCapability.USB.USBManager
1892     * @since arkts {'1.1':'9', '1.2':'20'}
1893     * @arkts 1.1&1.2
1894     */
1895    USB_REQUEST_TARGET_ENDPOINT = 2,
1896
1897    /**
1898     * Others
1899     *
1900     * @syscap SystemCapability.USB.USBManager
1901     * @since arkts {'1.1':'9', '1.2':'20'}
1902     * @arkts 1.1&1.2
1903     */
1904    USB_REQUEST_TARGET_OTHER = 3
1905  }
1906
1907  /**
1908   * Enumerates control request types.
1909   *
1910   * @enum { int }
1911   * @syscap SystemCapability.USB.USBManager
1912   * @since arkts {'1.1':'9', '1.2':'20'}
1913   * @arkts 1.1&1.2
1914   */
1915  export enum USBControlRequestType {
1916    /**
1917     * Standard
1918     *
1919     * @syscap SystemCapability.USB.USBManager
1920     * @since arkts {'1.1':'9', '1.2':'20'}
1921     * @arkts 1.1&1.2
1922     */
1923    USB_REQUEST_TYPE_STANDARD = 0,
1924
1925    /**
1926     * Class
1927     *
1928     * @syscap SystemCapability.USB.USBManager
1929     * @since arkts {'1.1':'9', '1.2':'20'}
1930     * @arkts 1.1&1.2
1931     */
1932    USB_REQUEST_TYPE_CLASS = 1,
1933
1934    /**
1935     * Vendor
1936     *
1937     * @syscap SystemCapability.USB.USBManager
1938     * @since arkts {'1.1':'9', '1.2':'20'}
1939     * @arkts 1.1&1.2
1940     */
1941    USB_REQUEST_TYPE_VENDOR = 2
1942  }
1943
1944  /**
1945   * Enumerates request directions.
1946   *
1947   * @enum { int }
1948   * @syscap SystemCapability.USB.USBManager
1949   * @since arkts {'1.1':'9', '1.2':'20'}
1950   * @arkts 1.1&1.2
1951   */
1952  export enum USBRequestDirection {
1953    /**
1954     * Request for writing data from the host to the device
1955     *
1956     * @syscap SystemCapability.USB.USBManager
1957     * @since arkts {'1.1':'9', '1.2':'20'}
1958     * @arkts 1.1&1.2
1959     */
1960    USB_REQUEST_DIR_TO_DEVICE = 0,
1961
1962    /**
1963     * Request for reading data from the device to the host
1964     *
1965     * @syscap SystemCapability.USB.USBManager
1966     * @since arkts {'1.1':'9', '1.2':'20'}
1967     * @arkts 1.1&1.2
1968     */
1969    USB_REQUEST_DIR_FROM_DEVICE = 0x80
1970  }
1971
1972  /**
1973   * Enumerates function modes.
1974   *
1975   * @enum { int }
1976   * @syscap SystemCapability.USB.USBManager
1977   * @systemapi
1978   * @since arkts {'1.1':'9', '1.2':'20'}
1979   * @arkts 1.1&1.2
1980   */
1981  export enum FunctionType {
1982    /**
1983     * None
1984     *
1985     * @syscap SystemCapability.USB.USBManager
1986     * @systemapi
1987     * @since arkts {'1.1':'9', '1.2':'20'}
1988     * @arkts 1.1&1.2
1989     */
1990    NONE = 0,
1991
1992    /**
1993     * Serial port device
1994     *
1995     * @syscap SystemCapability.USB.USBManager
1996     * @systemapi
1997     * @since arkts {'1.1':'9', '1.2':'20'}
1998     * @arkts 1.1&1.2
1999     */
2000    ACM = 1,
2001
2002    /**
2003     * Ethernet port device
2004     *
2005     * @syscap SystemCapability.USB.USBManager
2006     * @systemapi
2007     * @since arkts {'1.1':'9', '1.2':'20'}
2008     * @arkts 1.1&1.2
2009     */
2010    ECM = 2,
2011
2012    /**
2013     * HDC device
2014     *
2015     * @syscap SystemCapability.USB.USBManager
2016     * @systemapi
2017     * @since arkts {'1.1':'9', '1.2':'20'}
2018     * @arkts 1.1&1.2
2019     */
2020    HDC = 4,
2021
2022    /**
2023     * MTP device
2024     *
2025     * @syscap SystemCapability.USB.USBManager
2026     * @systemapi
2027     * @since arkts {'1.1':'9', '1.2':'20'}
2028     * @arkts 1.1&1.2
2029     */
2030    MTP = 8,
2031
2032    /**
2033     * PTP device
2034     *
2035     * @syscap SystemCapability.USB.USBManager
2036     * @systemapi
2037     * @since arkts {'1.1':'9', '1.2':'20'}
2038     * @arkts 1.1&1.2
2039     */
2040    PTP = 16,
2041
2042    /**
2043     * RNDIS device
2044     *
2045     * @syscap SystemCapability.USB.USBManager
2046     * @systemapi
2047     * @since arkts {'1.1':'9', '1.2':'20'}
2048     * @arkts 1.1&1.2
2049     */
2050    RNDIS = 32,
2051
2052    /**
2053     * MIDI device
2054     *
2055     * @syscap SystemCapability.USB.USBManager
2056     * @systemapi
2057     * @since arkts {'1.1':'9', '1.2':'20'}
2058     * @arkts 1.1&1.2
2059     */
2060    MIDI = 64,
2061
2062    /**
2063     * Audio source device
2064     *
2065     * @syscap SystemCapability.USB.USBManager
2066     * @systemapi
2067     * @since arkts {'1.1':'9', '1.2':'20'}
2068     * @arkts 1.1&1.2
2069     */
2070    AUDIO_SOURCE = 128,
2071
2072    /**
2073     * NCM device
2074     *
2075     * @syscap SystemCapability.USB.USBManager
2076     * @systemapi
2077     * @since arkts {'1.1':'9', '1.2':'20'}
2078     * @arkts 1.1&1.2
2079     */
2080    NCM = 256
2081  }
2082
2083  /**
2084   * Represents a USB Accessory.
2085   *
2086   * @typedef USBAccessory
2087   * @syscap SystemCapability.USB.USBManager
2088   * @since arkts {'1.1':'14', '1.2':'20'}
2089   * @arkts 1.1&1.2
2090   */
2091  interface USBAccessory {
2092    /**
2093     * The manufacturer name of the accessory.
2094     *
2095     * @type { string }
2096     * @syscap SystemCapability.USB.USBManager
2097     * @since arkts {'1.1':'14', '1.2':'20'}
2098     * @arkts 1.1&1.2
2099     */
2100    manufacturer: string;
2101
2102    /**
2103     * The product of the accessory.
2104     *
2105     * @type { string }
2106     * @syscap SystemCapability.USB.USBManager
2107     * @since arkts {'1.1':'14', '1.2':'20'}
2108     * @arkts 1.1&1.2
2109     */
2110    product: string;
2111
2112    /**
2113     * The user visible description of the accessory.
2114     *
2115     * @type { string }
2116     * @syscap SystemCapability.USB.USBManager
2117     * @since arkts {'1.1':'14', '1.2':'20'}
2118     * @arkts 1.1&1.2
2119     */
2120    description: string;
2121
2122    /**
2123     * The version of the accessory.
2124     *
2125     * @type { string }
2126     * @syscap SystemCapability.USB.USBManager
2127     * @since arkts {'1.1':'14', '1.2':'20'}
2128     * @arkts 1.1&1.2
2129     */
2130    version: string;
2131
2132    /**
2133     * The serial number of the accessory.
2134     *
2135     * @type { string }
2136     * @syscap SystemCapability.USB.USBManager
2137     * @since arkts {'1.1':'14', '1.2':'20'}
2138     * @arkts 1.1&1.2
2139     */
2140    serialNumber: string;
2141  }
2142
2143  /**
2144   * Handle of accessory.
2145   *
2146   * @typedef USBAccessoryHandle
2147   * @syscap SystemCapability.USB.USBManager
2148   * @since arkts {'1.1':'14', '1.2':'20'}
2149   * @arkts 1.1&1.2
2150   */
2151  interface USBAccessoryHandle {
2152    /**
2153     * The file descriptor of the accessory.The valid USBAccessoryHandle.accessoryFd is a positive value.
2154     *
2155     * @type { int }
2156     * @syscap SystemCapability.USB.USBManager
2157     * @since arkts {'1.1':'14', '1.2':'20'}
2158     * @arkts 1.1&1.2
2159     */
2160    accessoryFd: int;
2161  }
2162
2163  /**
2164   * Usb transfer flag.
2165   *
2166   * @enum { int }
2167   * @syscap SystemCapability.USB.USBManager
2168   * @since arkts {'1.1':'18', '1.2':'20'}
2169   * @arkts 1.1&1.2
2170   */
2171  export enum UsbTransferFlags {
2172    /**
2173     * Report short frames as errors
2174     *
2175     * @syscap SystemCapability.USB.USBManager
2176     * @since arkts {'1.1':'18', '1.2':'20'}
2177     * @arkts 1.1&1.2
2178     */
2179    USB_TRANSFER_SHORT_NOT_OK = 0,
2180
2181    /**
2182     * Automatically free transfer buffer
2183     *
2184     * @syscap SystemCapability.USB.USBManager
2185     * @since arkts {'1.1':'18', '1.2':'20'}
2186     * @arkts 1.1&1.2
2187     */
2188    USB_TRANSFER_FREE_BUFFER = 1,
2189
2190    /**
2191     * Automatically free transfer after callback returns
2192     *
2193     * @syscap SystemCapability.USB.USBManager
2194     * @since arkts {'1.1':'18', '1.2':'20'}
2195     * @arkts 1.1&1.2
2196     */
2197    USB_TRANSFER_FREE_TRANSFER = 2,
2198
2199    /**
2200     * Transmissions that are multiples of wMaxPacketSize will add an additional zero packet.
2201     *
2202     * @syscap SystemCapability.USB.USBManager
2203     * @since arkts {'1.1':'18', '1.2':'20'}
2204     * @arkts 1.1&1.2
2205     */
2206    USB_TRANSFER_ADD_ZERO_PACKET = 3
2207  }
2208
2209  /**
2210   * Usb transfer status.
2211   *
2212   * @enum { int }
2213   * @syscap SystemCapability.USB.USBManager
2214   * @since arkts {'1.1':'18', '1.2':'20'}
2215   * @arkts 1.1&1.2
2216   */
2217  export enum UsbTransferStatus {
2218    /**
2219     * Transfer completed
2220     *
2221     * @syscap SystemCapability.USB.USBManager
2222     * @since arkts {'1.1':'18', '1.2':'20'}
2223     * @arkts 1.1&1.2
2224     */
2225    TRANSFER_COMPLETED = 0,
2226
2227    /**
2228     * Transfer failed
2229     *
2230     * @syscap SystemCapability.USB.USBManager
2231     * @since arkts {'1.1':'18', '1.2':'20'}
2232     * @arkts 1.1&1.2
2233     */
2234    TRANSFER_ERROR = 1,
2235
2236    /**
2237     * Transfer timed out
2238     *
2239     * @syscap SystemCapability.USB.USBManager
2240     * @since arkts {'1.1':'18', '1.2':'20'}
2241     * @arkts 1.1&1.2
2242     */
2243    TRANSFER_TIMED_OUT = 2,
2244
2245    /**
2246     * Transfer was canceled
2247     *
2248     * @syscap SystemCapability.USB.USBManager
2249     * @since arkts {'1.1':'18', '1.2':'20'}
2250     * @arkts 1.1&1.2
2251     */
2252    TRANSFER_CANCELED = 3,
2253
2254    /**
2255     * For bulk/interrupt endpoints: halt condition detected (endpoint
2256     * stalled). For control endpoints: control request not supported.
2257     *
2258     * @syscap SystemCapability.USB.USBManager
2259     * @since arkts {'1.1':'18', '1.2':'20'}
2260     * @arkts 1.1&1.2
2261     */
2262    TRANSFER_STALL = 4,
2263
2264    /**
2265     * Device was disconnected
2266     *
2267     * @syscap SystemCapability.USB.USBManager
2268     * @since arkts {'1.1':'18', '1.2':'20'}
2269     * @arkts 1.1&1.2
2270     */
2271    TRANSFER_NO_DEVICE = 5,
2272
2273    /**
2274     * Device sent more data than requested
2275     *
2276     * @syscap SystemCapability.USB.USBManager
2277     * @since arkts {'1.1':'18', '1.2':'20'}
2278     * @arkts 1.1&1.2
2279     */
2280    TRANSFER_OVERFLOW = 6
2281  }
2282
2283  /**
2284   * USB DATA transfer type.
2285   *
2286   * @enum { int }
2287   * @syscap SystemCapability.USB.USBManager
2288   * @since arkts {'1.1':'18', '1.2':'20'}
2289   * @arkts 1.1&1.2
2290   */
2291  export enum UsbEndpointTransferType {
2292    /**
2293     * Isochronous endpoint
2294     *
2295     * @syscap SystemCapability.USB.USBManager
2296     * @since arkts {'1.1':'18', '1.2':'20'}
2297     * @arkts 1.1&1.2
2298     */
2299    TRANSFER_TYPE_ISOCHRONOUS = 0x1,
2300
2301    /**
2302     * Bulk endpoint
2303     *
2304     * @syscap SystemCapability.USB.USBManager
2305     * @since arkts {'1.1':'18', '1.2':'20'}
2306     * @arkts 1.1&1.2
2307     */
2308    TRANSFER_TYPE_BULK = 0x2,
2309
2310    /**
2311     * Interrupt endpoint
2312     *
2313     * @syscap SystemCapability.USB.USBManager
2314     * @since arkts {'1.1':'18', '1.2':'20'}
2315     * @arkts 1.1&1.2
2316     */
2317    TRANSFER_TYPE_INTERRUPT = 0x3
2318  }
2319
2320  /**
2321   * Isochronous packet descriptors, only for isochronous transfers.
2322   *
2323   * @typedef UsbIsoPacketDescriptor
2324   * @syscap SystemCapability.USB.USBManager
2325   * @since arkts {'1.1':'18', '1.2':'20'}
2326   * @arkts 1.1&1.2
2327   */
2328  interface UsbIsoPacketDescriptor {
2329    /**
2330     * Length of data to request in this packet
2331     *
2332     * @type { int }
2333     * @syscap SystemCapability.USB.USBManager
2334     * @since arkts {'1.1':'18', '1.2':'20'}
2335     * @arkts 1.1&1.2
2336     */
2337    length: int;
2338
2339    /**
2340     * Amount of data that was actually transferred
2341     *
2342     * @type { int }
2343     * @syscap SystemCapability.USB.USBManager
2344     * @since arkts {'1.1':'18', '1.2':'20'}
2345     * @arkts 1.1&1.2
2346     */
2347    actualLength: int;
2348
2349    /**
2350     * Status code for this packet
2351     *
2352     * @type { UsbTransferStatus }
2353     * @syscap SystemCapability.USB.USBManager
2354     * @since arkts {'1.1':'18', '1.2':'20'}
2355     * @arkts 1.1&1.2
2356     */
2357    status: UsbTransferStatus;
2358  }
2359
2360   /**
2361   * submit transfer callback.
2362   *
2363   * @typedef SubmitTransferCallback
2364   * @syscap SystemCapability.USB.USBManager
2365   * @since arkts {'1.1':'18', '1.2':'20'}
2366   * @arkts 1.1&1.2
2367   */
2368  interface SubmitTransferCallback {
2369    /**
2370     * Actual length of data that was transferred. Read-only, and only for
2371     * use within transfer callback function. Not valid for isochronous endpoint transfers.
2372     *
2373     * @type { int }
2374     * @syscap SystemCapability.USB.USBManager
2375     * @since arkts {'1.1':'18', '1.2':'20'}
2376     * @arkts 1.1&1.2
2377     */
2378    actualLength: int;
2379
2380    /**
2381     * The status of the transfer. Read-only, and only for use within transfer callback function.
2382     *
2383     * @type { UsbTransferStatus }
2384     * @syscap SystemCapability.USB.USBManager
2385     * @since arkts {'1.1':'18', '1.2':'20'}
2386     * @arkts 1.1&1.2
2387     */
2388    status: UsbTransferStatus;
2389
2390    /**
2391     * Isochronous packet descriptors, for isochronous transfers only.
2392     *
2393     * @type { Array<Readonly<UsbIsoPacketDescriptor>> }
2394     * @syscap SystemCapability.USB.USBManager
2395     * @since arkts {'1.1':'18', '1.2':'20'}
2396     * @arkts 1.1&1.2
2397     */
2398    isoPacketDescs: Array<Readonly<UsbIsoPacketDescriptor>>;
2399  }
2400
2401  /**
2402   * As a generic USB data transfer interface. The Client populates this interface and
2403   * submits it in order to request a transfer.
2404   *
2405   * @typedef UsbDataTransferParams
2406   * @syscap SystemCapability.USB.USBManager
2407   * @since arkts {'1.1':'18', '1.2':'20'}
2408   * @arkts 1.1&1.2
2409   */
2410  interface UsbDataTransferParams {
2411    /**
2412     * Pipe of the device that this data transfer will be submitted to.
2413     *
2414     * @type { USBDevicePipe }
2415     * @syscap SystemCapability.USB.USBManager
2416     * @since arkts {'1.1':'18', '1.2':'20'}
2417     * @arkts 1.1&1.2
2418     */
2419    devPipe: USBDevicePipe;
2420
2421    /**
2422     * A bitwise OR combination of UsbTransferFlags.
2423     *
2424     * @type { UsbTransferFlags }
2425     * @syscap SystemCapability.USB.USBManager
2426     * @since arkts {'1.1':'18', '1.2':'20'}
2427     * @arkts 1.1&1.2
2428     */
2429    flags: UsbTransferFlags;
2430
2431    /**
2432     * Address of the endpoint where this transfer will be sent.
2433     *
2434     * @type { int }
2435     * @syscap SystemCapability.USB.USBManager
2436     * @since arkts {'1.1':'18', '1.2':'20'}
2437     * @arkts 1.1&1.2
2438     */
2439    endpoint: int;
2440
2441    /**
2442     * Type of the transfer
2443     *
2444     * @type { UsbEndpointTransferType }
2445     * @syscap SystemCapability.USB.USBManager
2446     * @since arkts {'1.1':'18', '1.2':'20'}
2447     * @arkts 1.1&1.2
2448     */
2449    type: UsbEndpointTransferType;
2450
2451    /**
2452     * Timeout for this transfer in milliseconds. A value of 0 indicates no timeout.
2453     *
2454     * @type { int }
2455     * @syscap SystemCapability.USB.USBManager
2456     * @since arkts {'1.1':'18', '1.2':'20'}
2457     * @arkts 1.1&1.2
2458     */
2459    timeout: int;
2460
2461    /**
2462     * Length of the data buffer. Must be non-negative.
2463     *
2464     * @type { int }
2465     * @syscap SystemCapability.USB.USBManager
2466     * @since arkts {'1.1':'18', '1.2':'20'}
2467     * @arkts 1.1&1.2
2468     */
2469    length: int;
2470
2471    /**
2472     * Callback function. This will be invoked when the transfer completes, fails, or is canceled.
2473     *
2474     * @type { AsyncCallback<SubmitTransferCallback> }
2475     * @syscap SystemCapability.USB.USBManager
2476     * @since arkts {'1.1':'18', '1.2':'20'}
2477     * @arkts 1.1&1.2
2478     */
2479    callback: AsyncCallback<SubmitTransferCallback>;
2480
2481    /**
2482     * User context data. Useful for associating specific data to a transfer
2483     * that can be accessed from within the callback function.
2484     *
2485     * @type { Uint8Array }
2486     * @syscap SystemCapability.USB.USBManager
2487     * @since arkts {'1.1':'18', '1.2':'20'}
2488     * @arkts 1.1&1.2
2489     */
2490    userData: Uint8Array;
2491
2492    /**
2493     * Data buffer
2494     *
2495     * @type { Uint8Array }
2496     * @syscap SystemCapability.USB.USBManager
2497     * @since arkts {'1.1':'18', '1.2':'20'}
2498     * @arkts 1.1&1.2
2499     */
2500    buffer: Uint8Array;
2501
2502    /**
2503     * Count of isochronous packets. Only used for I/O with isochronous endpoints. Must be non-negative.
2504     *
2505     * @type { int }
2506     * @syscap SystemCapability.USB.USBManager
2507     * @since arkts {'1.1':'18', '1.2':'20'}
2508     * @arkts 1.1&1.2
2509     */
2510    isoPacketCount: int;
2511  }
2512
2513  /**
2514   * Submit USB data transfer.
2515   *
2516   * @param { transfer } As a generic USB data transfer interface. The Client populates this interface and
2517   * submits it in order to request a transfer
2518   * @throws { BusinessError } 801 - Capability not supported.
2519   * @throws { BusinessError } 14400001 - Access right denied. Call requestRight to get the USBDevicePipe access right first.
2520   * @throws { BusinessError } 14400007 - Resource busy. Possible causes:
2521   * <br>1. The transfer has already been submitted.
2522   * <br>2. The interface is claimed by another program or driver.
2523   * @throws { BusinessError } 14400008 - No such device (it may have been disconnected).
2524   * @throws { BusinessError } 14400009 - Insufficient memory. Possible causes:
2525   * <br>1. Memory allocation failed.
2526   * @throws { BusinessError } 14400012 - Transmission I/O error.
2527   * @syscap SystemCapability.USB.USBManager
2528   * @since arkts {'1.1':'18', '1.2':'20'}
2529   * @arkts 1.1&1.2
2530   */
2531  function usbSubmitTransfer(transfer: UsbDataTransferParams): void;
2532
2533  /**
2534   * Cancel USB data transfer.
2535   *
2536   * @param { transfer } Cancel the target transfer
2537   * @throws { BusinessError } 801 - Capability not supported.
2538   * @throws { BusinessError } 14400001 - Access right denied. Call requestRight to get the USBDevicePipe access right first.
2539   * @throws { BusinessError } 14400008 - No such device (it may have been disconnected).
2540   * @throws { BusinessError } 14400010 - Other USB error. Possible causes:
2541   * <br>1.Unrecognized discard error code.
2542   * @throws { BusinessError } 14400011 - The transfer is not in progress, or is already complete or cancelled.
2543   * @syscap SystemCapability.USB.USBManager
2544   * @since arkts {'1.1':'18', '1.2':'20'}
2545   * @arkts 1.1&1.2
2546   */
2547  function usbCancelTransfer(transfer: UsbDataTransferParams): void;
2548
2549  /**
2550   * Perform a USB port reset to reinitialize a usb device. The operation will attempt to restore the previous configuration
2551   * and alternate interface settings after the reset has completed.
2552   *
2553   * @param { USBDevicePipe } pipe - Represents a USB device,which is the target object to be restarted.It cannot be empty.
2554   * @returns { boolean } If the restart operation is successful, return {@code true}; if the restart operation fails, return {@code false}.
2555   * @throws { BusinessError } 801 - Capability not supported.
2556   * @throws { BusinessError } 14400001 - Access right denied. Call requestRight to get the USBDevicePipe access right first.
2557   * @throws { BusinessError } 14400004 -Service exception. Possible causes: 1. No accessory is plugged in.
2558   * @throws { BusinessError } 14400008 - No such device(it may have been disconnected)
2559   * @throws { BusinessError } 14400010 - Other USB error. Possible causes:
2560   * <br>1.Unrecognized discard error code.
2561   * @throws { BusinessError } 14400013 - The USBDevicePipe validity check failed. Possible causes:
2562   * <br>1.The input parameters fail the validation check.
2563   * <br>2.The call chain used to obtain the input parameters is not reasonable.
2564   * @syscap SystemCapability.USB.USBManager
2565   * @since 20
2566   * @arkts 1.1&1.2
2567   */
2568  function resetUsbDevice(pipe: USBDevicePipe): boolean;
2569
2570
2571
2572
2573
2574}
2575
2576export default usbManager;