diff --git a/api/@ohos.usbManager.d.ts b/api/@ohos.usbManager.d.ts index f5d0c02749e8f41d39585b72590344f6fc481567..0014f3be613d9752a822cd63f10004890be4a2b6 100644 --- a/api/@ohos.usbManager.d.ts +++ b/api/@ohos.usbManager.d.ts @@ -73,7 +73,8 @@ 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 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function connectDevice(device: USBDevice): Readonly; @@ -98,7 +99,8 @@ declare namespace usbManager { *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function hasRight(deviceName: string): boolean; @@ -125,7 +127,8 @@ declare namespace usbManager { *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function requestRight(deviceName: string): Promise; @@ -152,7 +155,8 @@ declare namespace usbManager { *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function removeRight(deviceName: string): boolean; @@ -314,7 +318,8 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function addDeviceAccessRight(tokenId: string, deviceName: string): boolean; @@ -347,9 +352,29 @@ declare namespace usbManager { * @syscap SystemCapability.USB.USBManager * @systemapi * @since 18 + * @arkts 1.1 */ function getFunctionsFromString(funcs: string): number; + /** + * Converts the string descriptor of a given USB function list to a numeric mask combination. + * + * @permission ohos.permission.MANAGE_USB_CONFIG + * @param { string } funcs - descriptor of the supported function list. It cannot be empty. + * @returns { int } the numeric mask combination of the function list. + * @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. + * @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 + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getFunctionsFromString(funcs: string): int; + /** * Converts the numeric mask combination of a given USB function list to a string descriptor. * @@ -378,7 +403,8 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function getStringFromFunctions(funcs: FunctionType): string; @@ -414,7 +440,8 @@ declare namespace usbManager { * @throws { BusinessError } 14400006 - Unsupported operation. The function is not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function setDeviceFunctions(funcs: FunctionType): Promise; @@ -438,7 +465,8 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function getDeviceFunctions(): FunctionType; @@ -464,7 +492,8 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function getPortList(): Array; @@ -497,9 +526,29 @@ declare namespace usbManager { * @syscap SystemCapability.USB.USBManager * @systemapi * @since 18 + * @arkts 1.1 */ function getPortSupportModes(portId: number): PortModeType; + /** + * 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. + * @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. + * @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 + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function getPortSupportModes(portId: int): PortModeType; + /** * Sets the role types supported by the specified USBPort, which can be powerRole (for charging) and dataRole (for data transfer). * @@ -535,9 +584,32 @@ declare namespace usbManager { * @syscap SystemCapability.USB.USBManager * @systemapi * @since 18 + * @arkts 1.1 */ function setPortRoleTypes(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise; + /** + * 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 { 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. + * @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. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14400003 - Unsupported operation. The current device does not support port role switching. + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function setPortRoleTypes(portId: int, powerRole: PowerRoleType, dataRole: DataRoleType): Promise; + /** * Adds USB accessory access right. * @@ -574,9 +646,32 @@ declare namespace usbManager { * @syscap SystemCapability.USB.USBManager * @systemapi * @since 18 + * @arkts 1.1 */ function addAccessoryRight(tokenId: number, accessory: USBAccessory): void; + /** + * 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 { 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. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + *
1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14400004 - Service exception. Possible causes: + *
1. No accessory is plugged in. + * @throws { BusinessError } 14400005 - Database operation exception. + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + function addAccessoryRight(tokenId: int, accessory: USBAccessory): void; + /* usb pipe functions begin */ /** * Claims a USB interface. @@ -604,9 +699,27 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number; + /** + * Claims a USB interface. + * + * @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. + * @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 20 + * @arkts 1.2 + */ + function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): int; + /** * Releases a USB interface. * @@ -631,9 +744,26 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number; + /** + * Releases a USB interface. + * + * @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. + * @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 20 + * @arkts 1.2 + */ + function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): int; + /** * Sets the device configuration. * @@ -658,9 +788,26 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number; + /** + * Sets the device configuration. + * + * @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. + * @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 20 + * @arkts 1.2 + */ + function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): int; + /** * Sets a USB interface. * @@ -685,9 +832,26 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ function setInterface(pipe: USBDevicePipe, iface: USBInterface): number; + /** + * Sets a USB interface. + * + * @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. + * @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 20 + * @arkts 1.2 + */ + function setInterface(pipe: USBDevicePipe, iface: USBInterface): int; + /** * Obtains the raw USB descriptor. * @@ -709,7 +873,8 @@ declare namespace usbManager { *
2.Incorrect parameter types. * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function getRawDescriptor(pipe: USBDevicePipe): Uint8Array; @@ -735,9 +900,25 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ function getFileDescriptor(pipe: USBDevicePipe): number; + /** + * 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. + * @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 20 + * @arkts 1.2 + */ + function getFileDescriptor(pipe: USBDevicePipe): int; + /** * Performs control transfer. * @@ -784,9 +965,28 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ function usbControlTransfer(pipe: USBDevicePipe, requestparam: USBDeviceRequestParams, timeout?: number): Promise; + /** + * Performs usb control transfer. + * + * @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; + * 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 20 + * @arkts 1.2 + */ + function usbControlTransfer(pipe: USBDevicePipe, requestparam: USBDeviceRequestParams, timeout?: int): Promise; + /** * Performs bulk transfer. * @@ -817,6 +1017,7 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ function bulkTransfer( pipe: USBDevicePipe, @@ -825,6 +1026,30 @@ declare namespace usbManager { timeout?: number ): Promise; + /** + * Performs bulk transfer. + * + * @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; + * 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 20 + * @arkts 1.2 + */ + function bulkTransfer( + pipe: USBDevicePipe, + endpoint: USBEndpoint, + buffer: Uint8Array, + timeout?: int + ): Promise; + /** * Closes a USB device pipe. * @@ -847,9 +1072,25 @@ declare namespace usbManager { * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ function closePipe(pipe: USBDevicePipe): number; + /** + * 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. + * @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 20 + * @arkts 1.2 + */ + function closePipe(pipe: USBDevicePipe): int; + /** * Checks whether the application has the right to access the USB accessory. * @@ -879,7 +1120,8 @@ declare namespace usbManager { * @throws { BusinessError } 14400005 - Database operation exception. * @throws { BusinessError } 14401001 - The target USBAccessory not matched. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function hasAccessoryRight(accessory: USBAccessory): boolean; @@ -912,7 +1154,8 @@ declare namespace usbManager { * @throws { BusinessError } 14400005 - Database operation exception. * @throws { BusinessError } 14401001 - The target USBAccessory not matched. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function requestAccessoryRight(accessory: USBAccessory): Promise; @@ -943,7 +1186,8 @@ declare namespace usbManager { * @throws { BusinessError } 14400005 - Database operation exception. * @throws { BusinessError } 14401001 - The target USBAccessory not matched. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function cancelAccessoryRight(accessory: USBAccessory): void; @@ -964,7 +1208,8 @@ declare namespace usbManager { * @throws { BusinessError } 14400004 - Service exception. Possible causes: *
1. No accessory is plugged in. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function getAccessoryList(): Array>; @@ -1001,7 +1246,8 @@ 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 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function openAccessory(accessory: USBAccessory): USBAccessoryHandle; @@ -1028,7 +1274,8 @@ declare namespace usbManager { * @throws { BusinessError } 14400004 - Service exception. Possible causes: *
1. No accessory is plugged in. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function closeAccessory(accessoryHandle: USBAccessoryHandle): void; @@ -1046,40 +1293,80 @@ declare namespace usbManager { * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ address: number; /** - * Endpoint attributes + * Endpoint address * - * @type { number } + * @type { int } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ - attributes: number; + address: int; /** - * Endpoint interval + * Endpoint attributes * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ - interval: number; + attributes: number; /** - * Maximum size of data packets on the endpoint + * Endpoint attributes * - * @type { number } + * @type { int } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 20 + * @arkts 1.2 */ - maxPacketSize: number; + attributes: int; + + /** + * Endpoint interval + * + * @type { number } + * @syscap SystemCapability.USB.USBManager + * @since 9 + * @arkts 1.1 + */ + interval: number; + + /** + * Endpoint interval + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + interval: int; + + /** + * Maximum size of data packets on the endpoint + * + * @type { number } + * @syscap SystemCapability.USB.USBManager + * @since 9 + * @arkts 1.1 + */ + maxPacketSize: number; + + /** + * Maximum size of data packets on the endpoint + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + maxPacketSize: int; /** * Endpoint direction @@ -1097,9 +1384,20 @@ declare namespace usbManager { * @type { number } * @syscap SystemCapability.USB.USBManager * @since 9 + * @arkts 1.1 */ number: number; + /** + * Endpoint number + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + number: int; + /** * Endpoint address * @@ -1115,20 +1413,40 @@ declare namespace usbManager { * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ type: number; + /** + * Endpoint type + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + type: int; + /** * Unique ID defined by USBInterface.id, which indicates the interface to which the endpoint belongs * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ interfaceId: number; + + /** + * Unique ID defined by USBInterface.id, which indicates the interface to which the endpoint belongs + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + interfaceId: int; } /** @@ -1145,51 +1463,101 @@ declare namespace usbManager { * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ id: number; + /** + * Unique ID of the USB interface + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + id: int; + /** * Interface protocol * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ protocol: number; + /** + * Interface protocol + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + protocol: int; + /** * Device type * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ clazz: number; + /** + * Device type + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + clazz: int; + /** * Device subclass * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ subClass: number; + /** + * Device subclass + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + subClass: int; + /** * Alternation between descriptors of the same USB interface * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ alternateSetting: number; + /** + * Alternation between descriptors of the same USB interface + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + alternateSetting: int; + /** * Interface name * @@ -1225,31 +1593,61 @@ declare namespace usbManager { * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ id: number; + /** + * Unique ID of the USB configuration + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + id: int; + /** * Configuration attributes * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ attributes: number; + /** + * Configuration attributes + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + attributes: int; + /** * Maximum power consumption, in mA * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ maxPower: number; + /** + * Maximum power consumption, in mA + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + maxPower: int; + /** * Configuration name, which can be left empty * @@ -1305,21 +1703,41 @@ declare namespace usbManager { * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ busNum: number; + /** + * Bus address + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + busNum: int; + /** * Device address * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ devAddress: number; + /** + * Device address + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + devAddress: int; + /** * Device SN * @@ -1375,51 +1793,101 @@ declare namespace usbManager { * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ vendorId: number; + /** + * Vendor ID + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + vendorId: int; + /** * Product ID * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ productId: number; + /** + * Product ID + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + productId: int; + /** * Device class * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ clazz: number; + /** + * Device class + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + clazz: int; + /** * Device subclass * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ subClass: number; + /** + * Device subclass + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + subClass: int; + /** * Device protocol code * * @type { number } * @syscap SystemCapability.USB.USBManager - * @since arkts {'1.1':'9', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @arkts 1.1 */ protocol: number; + /** + * Device protocol code + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + protocol: int; + /** * Device configuration descriptor information * @@ -1436,7 +1904,8 @@ declare namespace usbManager { * * @typedef USBDevicePipe * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ interface USBDevicePipe { /** @@ -1445,17 +1914,39 @@ declare namespace usbManager { * @type { number } * @syscap SystemCapability.USB.USBManager * @since 9 + * @arkts 1.1 */ busNum: number; + /** + * Bus address. + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + busNum: int; + /** * Device address * * @type { number } * @syscap SystemCapability.USB.USBManager * @since 9 + * @arkts 1.1 */ devAddress: number; + + /** + * Device address + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + devAddress: int; } /** @@ -1464,7 +1955,8 @@ declare namespace usbManager { * @enum { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum PowerRoleType { /** @@ -1472,7 +1964,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ NONE = 0, @@ -1481,7 +1974,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ SOURCE = 1, @@ -1490,7 +1984,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ SINK = 2 } @@ -1501,7 +1996,8 @@ declare namespace usbManager { * @enum { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum DataRoleType { /** @@ -1509,7 +2005,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ NONE = 0, @@ -1518,7 +2015,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ HOST = 1, @@ -1527,7 +2025,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ DEVICE = 2 } @@ -1538,7 +2037,8 @@ declare namespace usbManager { * @enum { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum PortModeType { /** @@ -1546,7 +2046,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ NONE = 0, @@ -1555,7 +2056,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ UFP = 1, @@ -1564,7 +2066,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ DFP = 2, @@ -1573,7 +2076,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ DRP = 3, @@ -1582,7 +2086,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ NUM_MODES = 4 } @@ -1593,7 +2098,8 @@ declare namespace usbManager { * @typedef USBPortStatus * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ interface USBPortStatus { /** @@ -1603,9 +2109,21 @@ declare namespace usbManager { * @syscap SystemCapability.USB.USBManager * @systemapi * @since 9 + * @arkts 1.1 */ currentMode: number; + /** + * USB mode + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + currentMode: int; + /** * Power role * @@ -1613,9 +2131,21 @@ declare namespace usbManager { * @syscap SystemCapability.USB.USBManager * @systemapi * @since 9 + * @arkts 1.1 */ currentPowerRole: number; + /** + * Power role + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + currentPowerRole: int; + /** * Data role * @@ -1623,8 +2153,20 @@ declare namespace usbManager { * @syscap SystemCapability.USB.USBManager * @systemapi * @since 9 + * @arkts 1.1 */ currentDataRole: number; + + /** + * Data role + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + currentDataRole: int; } /** @@ -1633,7 +2175,8 @@ declare namespace usbManager { * @typedef USBPort * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ interface USBPort { /** @@ -1643,16 +2186,29 @@ declare namespace usbManager { * @syscap SystemCapability.USB.USBManager * @systemapi * @since 9 + * @arkts 1.1 */ id: number; + /** + * Unique ID of the USB port + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 20 + * @arkts 1.2 + */ + id: int; + /** * Mask combination for the supported mode list of the USB port * * @type { PortModeType } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ supportedModes: PortModeType; @@ -1662,7 +2218,8 @@ declare namespace usbManager { * @type { USBPortStatus } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ status: USBPortStatus; } @@ -1743,26 +2300,49 @@ declare namespace usbManager { * * @typedef USBDeviceRequestParams * @syscap SystemCapability.USB.USBManager - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ interface USBDeviceRequestParams { /** - * Bit map request type + * Bit map request type + * + * @type { number } + * @syscap SystemCapability.USB.USBManager + * @since 12 + * @arkts 1.1 + */ + bmRequestType: number; + + /** + * Bit map request type + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + bmRequestType: int; + + /** + * Byte request * * @type { number } * @syscap SystemCapability.USB.USBManager * @since 12 + * @arkts 1.1 */ - bmRequestType: number; + bRequest: number; /** * Byte request * - * @type { number } + * @type { int } * @syscap SystemCapability.USB.USBManager - * @since 12 + * @since 20 + * @arkts 1.2 */ - bRequest: number; + bRequest: int; /** * Request parameter word value @@ -1770,33 +2350,67 @@ declare namespace usbManager { * @type { number } * @syscap SystemCapability.USB.USBManager * @since 12 + * @arkts 1.1 */ wValue: number; + /** + * Request parameter word value + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + wValue: int; + /** * Word index of the parameter value * * @type { number } * @syscap SystemCapability.USB.USBManager * @since 12 + * @arkts 1.1 */ wIndex: number; + /** + * Word index of the parameter value + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + wIndex: int; + /** * Word length of the parameter value * * @type { number } * @syscap SystemCapability.USB.USBManager * @since 12 + * @arkts 1.1 */ wLength: number; + /** + * Word length of the parameter value + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + wLength: int; + /** * Data written to or read from the buffer * * @type { Uint8Array } * @syscap SystemCapability.USB.USBManager - * @since 12 + * @since arkts {'1.1':'12', '1.2':'20'} + * @arkts 1.1&1.2 */ data: Uint8Array; } @@ -1806,14 +2420,16 @@ declare namespace usbManager { * * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum USBRequestTargetType { /** * USB device * * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_REQUEST_TARGET_DEVICE = 0, @@ -1821,7 +2437,8 @@ declare namespace usbManager { * USB interface * * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_REQUEST_TARGET_INTERFACE = 1, @@ -1829,7 +2446,8 @@ declare namespace usbManager { * Endpoint * * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_REQUEST_TARGET_ENDPOINT = 2, @@ -1837,7 +2455,8 @@ declare namespace usbManager { * Others * * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_REQUEST_TARGET_OTHER = 3 } @@ -1847,14 +2466,16 @@ declare namespace usbManager { * * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum USBControlRequestType { /** * Standard * * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_REQUEST_TYPE_STANDARD = 0, @@ -1862,7 +2483,8 @@ declare namespace usbManager { * Class * * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_REQUEST_TYPE_CLASS = 1, @@ -1870,7 +2492,8 @@ declare namespace usbManager { * Vendor * * @syscap SystemCapability.USB.USBManager - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_REQUEST_TYPE_VENDOR = 2 } @@ -1909,7 +2532,8 @@ declare namespace usbManager { * @enum { number } * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum FunctionType { /** @@ -1917,7 +2541,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ NONE = 0, @@ -1926,7 +2551,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ ACM = 1, @@ -1935,7 +2561,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ ECM = 2, @@ -1944,7 +2571,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ HDC = 4, @@ -1953,7 +2581,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ MTP = 8, @@ -1962,7 +2591,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ PTP = 16, @@ -1971,7 +2601,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ RNDIS = 32, @@ -1980,7 +2611,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ MIDI = 64, @@ -1989,7 +2621,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ AUDIO_SOURCE = 128, @@ -1998,7 +2631,8 @@ declare namespace usbManager { * * @syscap SystemCapability.USB.USBManager * @systemapi - * @since 9 + * @since arkts {'1.1':'9', '1.2':'20'} + * @arkts 1.1&1.2 */ NCM = 256 } @@ -2008,7 +2642,8 @@ declare namespace usbManager { * * @typedef USBAccessory * @syscap SystemCapability.USB.USBManager - * @since 14 + * @since arkts {'1.1':'14', '1.2':'20'} + * @arkts 1.1&1.2 */ interface USBAccessory { /** @@ -2016,7 +2651,8 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since 14 + * @since arkts {'1.1':'14', '1.2':'20'} + * @arkts 1.1&1.2 */ manufacturer: string; @@ -2025,7 +2661,8 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since 14 + * @since arkts {'1.1':'14', '1.2':'20'} + * @arkts 1.1&1.2 */ product: string; @@ -2034,7 +2671,8 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since 14 + * @since arkts {'1.1':'14', '1.2':'20'} + * @arkts 1.1&1.2 */ description: string; @@ -2043,7 +2681,8 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since 14 + * @since arkts {'1.1':'14', '1.2':'20'} + * @arkts 1.1&1.2 */ version: string; @@ -2052,7 +2691,8 @@ declare namespace usbManager { * * @type { string } * @syscap SystemCapability.USB.USBManager - * @since 14 + * @since arkts {'1.1':'14', '1.2':'20'} + * @arkts 1.1&1.2 */ serialNumber: string; } @@ -2062,7 +2702,8 @@ declare namespace usbManager { * * @typedef USBAccessoryHandle * @syscap SystemCapability.USB.USBManager - * @since 14 + * @since arkts {'1.1':'14', '1.2':'20'} + * @arkts 1.1&1.2 */ interface USBAccessoryHandle { /** @@ -2071,8 +2712,19 @@ declare namespace usbManager { * @type { number } * @syscap SystemCapability.USB.USBManager * @since 14 + * @arkts 1.1 */ accessoryFd: number; + + /** + * The file descriptor of the accessory.The valid USBAccessoryHandle.accessoryFd is a positive value. + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + accessoryFd: int; } /** @@ -2080,14 +2732,16 @@ declare namespace usbManager { * * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum UsbTransferFlags { /** * Report short frames as errors * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_TRANSFER_SHORT_NOT_OK = 0, @@ -2095,7 +2749,8 @@ declare namespace usbManager { * Automatically free transfer buffer * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_TRANSFER_FREE_BUFFER = 1, @@ -2103,7 +2758,8 @@ declare namespace usbManager { * Automatically free transfer after callback returns * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_TRANSFER_FREE_TRANSFER = 2, @@ -2111,7 +2767,8 @@ declare namespace usbManager { * Transmissions that are multiples of wMaxPacketSize will add an additional zero packet. * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ USB_TRANSFER_ADD_ZERO_PACKET = 3 } @@ -2121,14 +2778,16 @@ declare namespace usbManager { * * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum UsbTransferStatus { /** * Transfer completed * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_COMPLETED = 0, @@ -2136,7 +2795,8 @@ declare namespace usbManager { * Transfer failed * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_ERROR = 1, @@ -2144,7 +2804,8 @@ declare namespace usbManager { * Transfer timed out * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_TIMED_OUT = 2, @@ -2152,7 +2813,8 @@ declare namespace usbManager { * Transfer was canceled * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_CANCELED = 3, @@ -2161,7 +2823,8 @@ declare namespace usbManager { * stalled). For control endpoints: control request not supported. * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_STALL = 4, @@ -2169,7 +2832,8 @@ declare namespace usbManager { * Device was disconnected * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_NO_DEVICE = 5, @@ -2177,7 +2841,8 @@ declare namespace usbManager { * Device sent more data than requested * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_OVERFLOW = 6 } @@ -2187,14 +2852,16 @@ declare namespace usbManager { * * @enum { number } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ export enum UsbEndpointTransferType { /** * Isochronous endpoint * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_TYPE_ISOCHRONOUS = 0x1, @@ -2202,7 +2869,8 @@ declare namespace usbManager { * Bulk endpoint * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_TYPE_BULK = 0x2, @@ -2210,7 +2878,8 @@ declare namespace usbManager { * Interrupt endpoint * * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ TRANSFER_TYPE_INTERRUPT = 0x3 } @@ -2220,7 +2889,8 @@ declare namespace usbManager { * * @typedef UsbIsoPacketDescriptor * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ interface UsbIsoPacketDescriptor { /** @@ -2229,24 +2899,47 @@ declare namespace usbManager { * @type { number } * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ length: number; + /** + * Length of data to request in this packet + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + length: int; + /** * Amount of data that was actually transferred * * @type { number } * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ actualLength: number; + /** + * Amount of data that was actually transferred + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + actualLength: int; + /** * Status code for this packet * * @type { UsbTransferStatus } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ status: UsbTransferStatus; } @@ -2256,7 +2949,8 @@ declare namespace usbManager { * * @typedef SubmitTransferCallback * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ interface SubmitTransferCallback { /** @@ -2266,15 +2960,28 @@ declare namespace usbManager { * @type { number } * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ actualLength: number; + /** + * 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 } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + actualLength: int; + /** * The status of the transfer. Read-only, and only for use within transfer callback function. * * @type { UsbTransferStatus } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ status: UsbTransferStatus; @@ -2283,7 +2990,8 @@ declare namespace usbManager { * * @type { Array> } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ isoPacketDescs: Array>; } @@ -2294,7 +3002,8 @@ declare namespace usbManager { * * @typedef UsbDataTransferParams * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ interface UsbDataTransferParams { /** @@ -2302,7 +3011,8 @@ declare namespace usbManager { * * @type { USBDevicePipe } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ devPipe: USBDevicePipe; @@ -2311,7 +3021,8 @@ declare namespace usbManager { * * @type { UsbTransferFlags } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ flags: UsbTransferFlags; @@ -2321,15 +3032,27 @@ declare namespace usbManager { * @type { number } * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ endpoint: number; + /** + * Address of the endpoint where this transfer will be sent. + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + endpoint: int; + /** * Type of the transfer * * @type { UsbEndpointTransferType } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ type: UsbEndpointTransferType; @@ -2339,24 +3062,47 @@ declare namespace usbManager { * @type { number } * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ timeout: number; + /** + * Timeout for this transfer in milliseconds. A value of 0 indicates no timeout. + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + timeout: int; + /** * Length of the data buffer. Must be non-negative. * * @type { number } * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ length: number; + /** + * Length of the data buffer. Must be non-negative. + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + length: int; + /** * Callback function. This will be invoked when the transfer completes, fails, or is canceled. * * @type { AsyncCallback } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ callback: AsyncCallback; @@ -2366,7 +3112,8 @@ declare namespace usbManager { * * @type { Uint8Array } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ userData: Uint8Array; @@ -2375,7 +3122,8 @@ declare namespace usbManager { * * @type { Uint8Array } * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ buffer: Uint8Array; @@ -2385,8 +3133,19 @@ declare namespace usbManager { * @type { number } * @syscap SystemCapability.USB.USBManager * @since 18 + * @arkts 1.1 */ isoPacketCount: number; + + /** + * Count of isochronous packets. Only used for I/O with isochronous endpoints. Must be non-negative. + * + * @type { int } + * @syscap SystemCapability.USB.USBManager + * @since 20 + * @arkts 1.2 + */ + isoPacketCount: int; } /** @@ -2401,7 +3160,8 @@ declare namespace usbManager { * @throws { BusinessError } 14400009 - Insufficient memory. * @throws { BusinessError } 14400012 - Transmission I/O error. * @syscap SystemCapability.USB.USBManager - * @since 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function usbSubmitTransfer(transfer: UsbDataTransferParams): void; @@ -2416,7 +3176,8 @@ 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 18 + * @since arkts {'1.1':'18', '1.2':'20'} + * @arkts 1.1&1.2 */ function usbCancelTransfer(transfer: UsbDataTransferParams): void;