From 4ea0673a58223e0ee165d65fe349afeb0ff4d0bf Mon Sep 17 00:00:00 2001 From: NickWang007 Date: Wed, 13 Aug 2025 15:59:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4getdevices=E4=B9=8B=E5=A4=96?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: NickWang007 Change-Id: I864af6190d22ba27980942a517b5bba648da5493 Signed-off-by: NickWang007 --- api/@ohos.usbManager.d.ts | 523 +++++++++++++++----------------------- 1 file changed, 198 insertions(+), 325 deletions(-) diff --git a/api/@ohos.usbManager.d.ts b/api/@ohos.usbManager.d.ts index 8b6f402714..c12060c5ae 100644 --- a/api/@ohos.usbManager.d.ts +++ b/api/@ohos.usbManager.d.ts @@ -70,8 +70,7 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 14400001 - Access right denied. Call requestRight to get the USBDevicePipe access right first. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function connectDevice(device: USBDevice): Readonly; @@ -96,8 +95,7 @@ declare namespace usbManager { *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function hasRight(deviceName: string): boolean; @@ -124,8 +122,7 @@ declare namespace usbManager { *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function requestRight(deviceName: string): Promise; @@ -152,8 +149,7 @@ declare namespace usbManager { *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function removeRight(deviceName: string): boolean; @@ -315,8 +311,7 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function addDeviceAccessRight(tokenId: string, deviceName: string): boolean; @@ -348,8 +343,7 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function getFunctionsFromString(funcs: string): int; @@ -381,8 +375,7 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function getStringFromFunctions(funcs: FunctionType): string; @@ -418,8 +411,7 @@ declare namespace usbManager { * @throws { BusinessError } 14400006 - Unsupported operation. The function is not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function setDeviceFunctions(funcs: FunctionType): Promise; @@ -443,8 +435,7 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function getDeviceFunctions(): FunctionType; @@ -470,8 +461,7 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function getPortList(): Array; @@ -493,7 +483,7 @@ declare namespace usbManager { * Gets the mask combination for the supported mode list of the specified USBPort. * * @permission ohos.permission.MANAGE_USB_CONFIG - * @param { int } portId - unique ID of the port. It cannot be empty. + * @param { number } portId - unique ID of the port. It cannot be empty. * @returns { PortModeType } the mask combination for the supported mode list in PortModeType. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api. @@ -503,10 +493,9 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function getPortSupportModes(portId: int): PortModeType; + function getPortSupportModes(portId: number): PortModeType; /** * Sets the role types supported by the specified USBPort, which can be powerRole (for charging) and dataRole (for data transfer). @@ -529,7 +518,7 @@ declare namespace usbManager { * Sets the role types supported by the specified USBPort, which can be powerRole (for charging) and dataRole (for data transfer). * * @permission ohos.permission.MANAGE_USB_CONFIG - * @param { int } portId - unique ID of the port. It cannot be empty. + * @param { number } portId - unique ID of the port. It cannot be empty. * @param { PowerRoleType } powerRole - charging role. It cannot be empty. * @param { DataRoleType } dataRole - data role. It cannot be empty. * @returns { Promise } the promise returned by the function. @@ -542,10 +531,9 @@ declare namespace usbManager { * @throws { BusinessError } 14400003 - Unsupported operation. The current device does not support port role switching. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function setPortRoleTypes(portId: int, powerRole: PowerRoleType, dataRole: DataRoleType): Promise; + function setPortRoleTypes(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise; /** * Adds USB accessory access right. @@ -569,7 +557,7 @@ declare namespace usbManager { * Adds USB accessory access right. * * @permission ohos.permission.MANAGE_USB_CONFIG - * @param { int } tokenId - refers to application that require access permissions. It cannot be empty. + * @param { number } tokenId - refers to application that require access permissions. It cannot be empty. * @param { USBAccessory } accessory - USB accessory. It cannot be empty. * @throws { BusinessError } 201 - The permission check failed. * @throws { BusinessError } 202 - Permission denied. Normal application do not have permission to use system api. @@ -582,10 +570,9 @@ declare namespace usbManager { * @throws { BusinessError } 14400005 - Database operation exception. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function addAccessoryRight(tokenId: int, accessory: USBAccessory): void; + function addAccessoryRight(tokenId: number, accessory: USBAccessory): void; /* usb pipe functions begin */ /** @@ -607,16 +594,15 @@ declare namespace usbManager { * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty. * @param { USBInterface } iface - USB interface, which is used to determine the interface to claim. It cannot be empty. * @param { boolean } [force] - optional parameter that determines whether to forcibly claim the USB interface. - * @returns { int } returns **0** if the USB interface is successfully claimed; returns an error code otherwise. + * @returns { number } returns **0** if the USB interface is successfully claimed; returns an error code otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1.Mandatory parameters are left unspecified. *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): int; + function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number; /** * Releases a USB interface. @@ -635,16 +621,15 @@ declare namespace usbManager { * * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty. * @param { USBInterface } iface - USB interface, which is used to determine the interface to release. It cannot be empty. - * @returns { int } returns **0** if the USB interface is successfully released; returns an error code otherwise. + * @returns { number } returns **0** if the USB interface is successfully released; returns an error code otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1.Mandatory parameters are left unspecified. *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): int; + function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number; /** * Sets the device configuration. @@ -663,16 +648,15 @@ declare namespace usbManager { * * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty. * @param { USBConfiguration } config - device configuration. It cannot be empty. - * @returns { int } returns **0** if the device configuration is successfully set; returns an error code otherwise. + * @returns { number } returns **0** if the device configuration is successfully set; returns an error code otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1.Mandatory parameters are left unspecified. *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): int; + function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number; /** * Sets a USB interface. @@ -691,16 +675,15 @@ declare namespace usbManager { * * @param { USBDevicePipe } pipe - device pipe, which is used to determine the bus number and device address. It cannot be empty. * @param { USBInterface } iface - USB interface, which is used to determine the interface to set. It cannot be empty. - * @returns { int } returns **0** if the USB interface is successfully set; return an error code otherwise. + * @returns { number } returns **0** if the USB interface is successfully set; return an error code otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1.Mandatory parameters are left unspecified. *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function setInterface(pipe: USBDevicePipe, iface: USBInterface): int; + function setInterface(pipe: USBDevicePipe, iface: USBInterface): number; /** * Obtains the raw USB descriptor. @@ -723,8 +706,7 @@ declare namespace usbManager { *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function getRawDescriptor(pipe: USBDevicePipe): Uint8Array; @@ -743,16 +725,15 @@ declare namespace usbManager { * Obtains the file descriptor. * * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty. - * @returns { int } returns the file descriptor of the USB device. + * @returns { number } returns the file descriptor of the USB device. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1.Mandatory parameters are left unspecified. *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function getFileDescriptor(pipe: USBDevicePipe): int; + function getFileDescriptor(pipe: USBDevicePipe): number; /** * Performs control transfer. @@ -791,18 +772,17 @@ declare namespace usbManager { * * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty. * @param { USBDeviceRequestParams } requestparam - control transfer parameters. It cannot be empty. - * @param { int } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout. - * @returns { Promise } returns the size of the transmitted or received data block if the control transfer is successful; + * @param { number } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout. + * @returns { Promise } returns the size of the transmitted or received data block if the control transfer is successful; * return -1 if an exception occurs. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1.Mandatory parameters are left unspecified. *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function usbControlTransfer(pipe: USBDevicePipe, requestparam: USBDeviceRequestParams, timeout?: int): Promise; + function usbControlTransfer(pipe: USBDevicePipe, requestparam: USBDeviceRequestParams, timeout?: number): Promise; /** * Performs bulk transfer. @@ -825,23 +805,22 @@ declare namespace usbManager { * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty. * @param { USBEndpoint } endpoint - USB endpoint, which is used to determine the USB port for data transfer. It cannot be empty. * @param { Uint8Array } buffer - buffer for writing or reading data. It cannot be empty. - * @param { int } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout. - * @returns { Promise } the size of the transmitted or received data block if the control transfer is successful; + * @param { number } [timeout] - timeout duration. This parameter is optional. The default value is **0**, indicating no timeout. + * @returns { Promise } the size of the transmitted or received data block if the control transfer is successful; * return -1 if an exception occurs. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1.Mandatory parameters are left unspecified. *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function bulkTransfer( pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, - timeout?: int - ): Promise; + timeout?: number + ): Promise; /** * Closes a USB device pipe. @@ -858,16 +837,15 @@ declare namespace usbManager { * Closes a USB device pipe. * * @param { USBDevicePipe } pipe - device pipe, which is used to determine the USB device. It cannot be empty. - * @returns { int } returns **0** if the USB device pipe is closed successfully; return an error code otherwise. + * @returns { number } returns **0** if the USB device pipe is closed successfully; return an error code otherwise. * @throws { BusinessError } 401 - Parameter error. Possible causes: *
1.Mandatory parameters are left unspecified. *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - function closePipe(pipe: USBDevicePipe): int; + function closePipe(pipe: USBDevicePipe): number; /** * Checks whether the application has the right to access the USB accessory. @@ -898,8 +876,7 @@ declare namespace usbManager { * @throws { BusinessError } 14400005 - Database operation exception. * @throws { BusinessError } 14401001 - The target USBAccessory not matched. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function hasAccessoryRight(accessory: USBAccessory): boolean; @@ -932,8 +909,7 @@ declare namespace usbManager { * @throws { BusinessError } 14400005 - Database operation exception. * @throws { BusinessError } 14401001 - The target USBAccessory not matched. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function requestAccessoryRight(accessory: USBAccessory): Promise; @@ -964,8 +940,7 @@ declare namespace usbManager { * @throws { BusinessError } 14400005 - Database operation exception. * @throws { BusinessError } 14401001 - The target USBAccessory not matched. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function cancelAccessoryRight(accessory: USBAccessory): void; @@ -986,8 +961,7 @@ declare namespace usbManager { * @throws { BusinessError } 14400004 - Service exception. Possible causes: *
1. No accessory is plugged in. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function getAccessoryList(): Array>; @@ -1024,8 +998,7 @@ declare namespace usbManager { * @throws { BusinessError } 14401002 - Failed to open the native accessory node. * @throws { BusinessError } 14401003 - Cannot reopen the accessory. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function openAccessory(accessory: USBAccessory): USBAccessoryHandle; @@ -1052,8 +1025,7 @@ declare namespace usbManager { * @throws { BusinessError } 14400004 - Service exception. Possible causes: *
1. No accessory is plugged in. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function closeAccessory(accessoryHandle: USBAccessoryHandle): void; @@ -1461,39 +1433,35 @@ declare namespace usbManager { * * @typedef USBDevicePipe * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ interface USBDevicePipe { /** * Bus address. * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ - busNum: int; + busNum: number; /** * Device address * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ - devAddress: int; + devAddress: number; } /** * Enumerates power role types. * - * @enum { int } + * @enum { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ export enum PowerRoleType { /** @@ -1501,8 +1469,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ NONE = 0, @@ -1511,8 +1478,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ SOURCE = 1, @@ -1521,8 +1487,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ SINK = 2 } @@ -1530,11 +1495,10 @@ declare namespace usbManager { /** * Enumerates data role types. * - * @enum { int } + * @enum { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ export enum DataRoleType { /** @@ -1542,8 +1506,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ NONE = 0, @@ -1552,8 +1515,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ HOST = 1, @@ -1562,8 +1524,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ DEVICE = 2 } @@ -1571,11 +1532,10 @@ declare namespace usbManager { /** * Enumerates port mode types * - * @enum { int } + * @enum { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ export enum PortModeType { /** @@ -1583,8 +1543,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ NONE = 0, @@ -1593,8 +1552,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ UFP = 1, @@ -1603,8 +1561,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ DFP = 2, @@ -1613,8 +1570,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ DRP = 3, @@ -1623,8 +1579,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ NUM_MODES = 4 } @@ -1635,42 +1590,38 @@ declare namespace usbManager { * @typedef USBPortStatus * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ interface USBPortStatus { /** * USB mode * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ - currentMode: int; + currentMode: number; /** * Power role * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ - currentPowerRole: int; + currentPowerRole: number; /** * Data role * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ - currentDataRole: int; + currentDataRole: number; } /** @@ -1679,20 +1630,18 @@ declare namespace usbManager { * @typedef USBPort * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ interface USBPort { /** * Unique ID of the USB port * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ - id: int; + id: number; /** * Mask combination for the supported mode list of the USB port @@ -1700,8 +1649,7 @@ declare namespace usbManager { * @type { PortModeType } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ supportedModes: PortModeType; @@ -1711,8 +1659,7 @@ declare namespace usbManager { * @type { USBPortStatus } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ status: USBPortStatus; } @@ -1793,67 +1740,60 @@ declare namespace usbManager { * * @typedef USBDeviceRequestParams * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ interface USBDeviceRequestParams { /** * Bit map request type * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - bmRequestType: int; + bmRequestType: number; /** * Byte request * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - bRequest: int; + bRequest: number; /** * Request parameter word value * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - wValue: int; + wValue: number; /** * Word index of the parameter value * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - wIndex: int; + wIndex: number; /** * Word length of the parameter value * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ - wLength: int; + wLength: number; /** * Data written to or read from the buffer * * @type { Uint8Array } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ data: Uint8Array; } @@ -1861,18 +1801,16 @@ declare namespace usbManager { /** * Enumerates USB request target types. * - * @enum { int } + * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ export enum USBRequestTargetType { /** * USB device * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ USB_REQUEST_TARGET_DEVICE = 0, @@ -1880,8 +1818,7 @@ declare namespace usbManager { * USB interface * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ USB_REQUEST_TARGET_INTERFACE = 1, @@ -1889,8 +1826,7 @@ declare namespace usbManager { * Endpoint * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ USB_REQUEST_TARGET_ENDPOINT = 2, @@ -1898,8 +1834,7 @@ declare namespace usbManager { * Others * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ USB_REQUEST_TARGET_OTHER = 3 } @@ -1907,18 +1842,16 @@ declare namespace usbManager { /** * Enumerates control request types. * - * @enum { int } + * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ export enum USBControlRequestType { /** * Standard * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ USB_REQUEST_TYPE_STANDARD = 0, @@ -1926,8 +1859,7 @@ declare namespace usbManager { * Class * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ USB_REQUEST_TYPE_CLASS = 1, @@ -1935,8 +1867,7 @@ declare namespace usbManager { * Vendor * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ USB_REQUEST_TYPE_VENDOR = 2 } @@ -1972,11 +1903,10 @@ declare namespace usbManager { /** * Enumerates function modes. * - * @enum { int } + * @enum { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ export enum FunctionType { /** @@ -1984,8 +1914,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ NONE = 0, @@ -1994,8 +1923,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ ACM = 1, @@ -2004,8 +1932,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ ECM = 2, @@ -2014,8 +1941,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ HDC = 4, @@ -2024,8 +1950,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ MTP = 8, @@ -2034,8 +1959,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ PTP = 16, @@ -2044,8 +1968,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ RNDIS = 32, @@ -2054,8 +1977,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ MIDI = 64, @@ -2064,8 +1986,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ AUDIO_SOURCE = 128, @@ -2074,8 +1995,7 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 */ NCM = 256 } @@ -2085,8 +2005,7 @@ declare namespace usbManager { * * @typedef USBAccessory * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ interface USBAccessory { /** @@ -2094,8 +2013,7 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ manufacturer: string; @@ -2104,8 +2022,7 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ product: string; @@ -2114,8 +2031,7 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ description: string; @@ -2124,8 +2040,7 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ version: string; @@ -2134,8 +2049,7 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ serialNumber: string; } @@ -2145,36 +2059,32 @@ declare namespace usbManager { * * @typedef USBAccessoryHandle * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ interface USBAccessoryHandle { /** * The file descriptor of the accessory.The valid USBAccessoryHandle.accessoryFd is a positive value. * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'14', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ - accessoryFd: int; + accessoryFd: number; } /** * Usb transfer flag. * - * @enum { int } + * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ export enum UsbTransferFlags { /** * Report short frames as errors * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ USB_TRANSFER_SHORT_NOT_OK = 0, @@ -2182,8 +2092,7 @@ declare namespace usbManager { * Automatically free transfer buffer * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ USB_TRANSFER_FREE_BUFFER = 1, @@ -2191,8 +2100,7 @@ declare namespace usbManager { * Automatically free transfer after callback returns * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ USB_TRANSFER_FREE_TRANSFER = 2, @@ -2200,8 +2108,7 @@ declare namespace usbManager { * Transmissions that are multiples of wMaxPacketSize will add an additional zero packet. * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ USB_TRANSFER_ADD_ZERO_PACKET = 3 } @@ -2209,18 +2116,16 @@ declare namespace usbManager { /** * Usb transfer status. * - * @enum { int } + * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ export enum UsbTransferStatus { /** * Transfer completed * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_COMPLETED = 0, @@ -2228,8 +2133,7 @@ declare namespace usbManager { * Transfer failed * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_ERROR = 1, @@ -2237,8 +2141,7 @@ declare namespace usbManager { * Transfer timed out * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_TIMED_OUT = 2, @@ -2246,8 +2149,7 @@ declare namespace usbManager { * Transfer was canceled * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_CANCELED = 3, @@ -2256,8 +2158,7 @@ declare namespace usbManager { * stalled). For control endpoints: control request not supported. * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_STALL = 4, @@ -2265,8 +2166,7 @@ declare namespace usbManager { * Device was disconnected * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_NO_DEVICE = 5, @@ -2274,8 +2174,7 @@ declare namespace usbManager { * Device sent more data than requested * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_OVERFLOW = 6 } @@ -2283,18 +2182,16 @@ declare namespace usbManager { /** * USB DATA transfer type. * - * @enum { int } + * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ export enum UsbEndpointTransferType { /** * Isochronous endpoint * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_TYPE_ISOCHRONOUS = 0x1, @@ -2302,8 +2199,7 @@ declare namespace usbManager { * Bulk endpoint * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_TYPE_BULK = 0x2, @@ -2311,8 +2207,7 @@ declare namespace usbManager { * Interrupt endpoint * * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ TRANSFER_TYPE_INTERRUPT = 0x3 } @@ -2322,37 +2217,33 @@ declare namespace usbManager { * * @typedef UsbIsoPacketDescriptor * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ interface UsbIsoPacketDescriptor { /** * Length of data to request in this packet * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - length: int; + length: number; /** * Amount of data that was actually transferred * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - actualLength: int; + actualLength: number; /** * Status code for this packet * * @type { UsbTransferStatus } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ status: UsbTransferStatus; } @@ -2362,28 +2253,25 @@ declare namespace usbManager { * * @typedef SubmitTransferCallback * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ interface SubmitTransferCallback { /** * Actual length of data that was transferred. Read-only, and only for * use within transfer callback function. Not valid for isochronous endpoint transfers. * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - actualLength: int; + actualLength: number; /** * The status of the transfer. Read-only, and only for use within transfer callback function. * * @type { UsbTransferStatus } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ status: UsbTransferStatus; @@ -2392,8 +2280,7 @@ declare namespace usbManager { * * @type { Array> } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ isoPacketDescs: Array>; } @@ -2404,8 +2291,7 @@ declare namespace usbManager { * * @typedef UsbDataTransferParams * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ interface UsbDataTransferParams { /** @@ -2413,8 +2299,7 @@ declare namespace usbManager { * * @type { USBDevicePipe } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ devPipe: USBDevicePipe; @@ -2423,58 +2308,52 @@ declare namespace usbManager { * * @type { UsbTransferFlags } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ flags: UsbTransferFlags; /** * Address of the endpoint where this transfer will be sent. * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - endpoint: int; + endpoint: number; /** * Type of the transfer * * @type { UsbEndpointTransferType } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ type: UsbEndpointTransferType; /** * Timeout for this transfer in milliseconds. A value of 0 indicates no timeout. * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - timeout: int; + timeout: number; /** * Length of the data buffer. Must be non-negative. * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - length: int; + length: number; /** * Callback function. This will be invoked when the transfer completes, fails, or is canceled. * * @type { AsyncCallback } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ callback: AsyncCallback; @@ -2484,8 +2363,7 @@ declare namespace usbManager { * * @type { Uint8Array } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ userData: Uint8Array; @@ -2494,20 +2372,18 @@ declare namespace usbManager { * * @type { Uint8Array } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ buffer: Uint8Array; /** * Count of isochronous packets. Only used for I/O with isochronous endpoints. Must be non-negative. * - * @type { int } + * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ - isoPacketCount: int; + isoPacketCount: number; } /** @@ -2522,8 +2398,7 @@ declare namespace usbManager { * @throws { BusinessError } 14400009 - Insufficient memory. * @throws { BusinessError } 14400012 - Transmission I/O error. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function usbSubmitTransfer(transfer: UsbDataTransferParams): void; @@ -2538,8 +2413,7 @@ declare namespace usbManager { *
1.Unrecognized discard error code. * @throws { BusinessError } 14400011 - The transfer is not in progress, or is already complete or cancelled. * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'18', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ function usbCancelTransfer(transfer: UsbDataTransferParams): void; @@ -2560,7 +2434,6 @@ declare namespace usbManager { *
2.The call chain used to obtain the input parameters is not resonable. * @syscap SystemCapability.USB.USBManager * @since 20 - * @arkts 1.1&1.2 */ function resetUsbDevice(pipe: USBDevicePipe): boolean; } -- Gitee