> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
@@ -18,8 +18,8 @@ import StartOptions from '@ohos.application.StartOptions';
...
@@ -18,8 +18,8 @@ import StartOptions from '@ohos.application.StartOptions';
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
**Want** is the basic communication component of the system.
**Want** is the basic communication component of the system.
...
@@ -17,14 +17,14 @@ import Want from '@ohos.application.Want';
...
@@ -17,14 +17,14 @@ import Want from '@ohos.application.Want';
| deviceId | Read only | string | No | ID of the device running the ability. |
| deviceId | Read only | string | No | ID of the device running the ability. |
| bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.|
| bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability. |
| abilityName | Read only | string | No | Name of the ability. If both **package** and **AbilityName** are specified in this field in a **Want** object, the **Want** object can directly match the specified ability.|
| abilityName | Read only | string | No | Name of the ability. If both **package** and **AbilityName** are specified in this field in a **Want** object, the **Want** object can directly match the specified ability. |
| uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**. |
| type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. |
| type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. |
| flags | Read only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-featureAbility.md#flags).|
| flags | Read only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-featureAbility.md#flags). |
| action | Read only | string | No | Action option. |
| action | Read only | string | No | Action option. |
| parameters | Read only | {[key: string]: any} | No | List of parameters in the **Want** object. |
| parameters | Read only | {[key: string]: any} | No | List of parameters in the **Want** object. |
| entities | Read only | Array\<string> | No | List of entities. | |
| entities | Read only | Array\<string> | No | List of entities. |
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
@@ -18,11 +18,11 @@ import Ability from '@ohos.application.Ability';
...
@@ -18,11 +18,11 @@ import Ability from '@ohos.application.Ability';
@@ -220,9 +220,9 @@ Called when the ability startup mode is set to singleton.
...
@@ -220,9 +220,9 @@ Called when the ability startup mode is set to singleton.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.|
| want | [Want](js-apis-application-Want.md) | Yes | Want parameters, such as the ability name and bundle name. |
**Example**
**Example**
...
@@ -245,9 +245,9 @@ Called when the configuration of the environment where the ability is running is
...
@@ -245,9 +245,9 @@ Called when the configuration of the environment where the ability is running is
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes| New configuration.|
| config | [Configuration](js-apis-configuration.md) | Yes | New configuration. |
**Example**
**Example**
...
@@ -275,16 +275,16 @@ Sends sequenceable data to the target ability.
...
@@ -275,16 +275,16 @@ Sends sequenceable data to the target ability.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
| method | string | Yes | Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data. |
| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
| data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. |
**Return value**
**Return value**
| Type| Description|
| Type | Description |
| -------- | -------- |
| -------- | -------- |
| Promise<void> | Promise used to return a response.|
| Promise<void> | Promise used to return a response. |
**Example**
**Example**
...
@@ -345,16 +345,16 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
...
@@ -345,16 +345,16 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
| method | string | Yes | Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data. |
| data | rpc.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
| data | rpc.Sequenceable | Yes | Sequenceable data. You need to customize the data. |
**Return value**
**Return value**
| Type| Description|
| Type | Description |
| -------- | -------- |
| -------- | -------- |
| Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.|
| Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability. |
**Example**
**Example**
...
@@ -451,9 +451,9 @@ Registers a callback that is invoked when the Stub on the target ability is disc
...
@@ -451,9 +451,9 @@ Registers a callback that is invoked when the Stub on the target ability is disc
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.|
| callback | OnReleaseCallBack | Yes | Callback used for the **onRelease** API. |
**Example**
**Example**
...
@@ -499,10 +499,10 @@ Registers a caller notification callback, which is invoked when the target abili
...
@@ -499,10 +499,10 @@ Registers a caller notification callback, which is invoked when the target abili
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities.|
| method | string | Yes | Notification message string negotiated between the two abilities. |
| callback | CaleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.|
| callback | CaleeCallBack | Yes | JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails. |
**Example**
**Example**
...
@@ -552,9 +552,9 @@ Unregisters a caller notification callback, which is invoked when the target abi
...
@@ -552,9 +552,9 @@ Unregisters a caller notification callback, which is invoked when the target abi
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
@@ -19,10 +19,10 @@ import AbilityConstant from '@ohos.application.AbilityConstant';
...
@@ -19,10 +19,10 @@ import AbilityConstant from '@ohos.application.AbilityConstant';
> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
@@ -45,15 +45,15 @@ Called when a specified ability is started.
...
@@ -45,15 +45,15 @@ Called when a specified ability is started.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.|
| want | [Want](js-apis-application-Want.md) | Yes | Information about the ability to start, such as the ability name and bundle name. |
**Return value**
**Return value**
| Type| Description|
| Type | Description |
| -------- | -------- |
| -------- | -------- |
| string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started.|
| string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started. |
**Example**
**Example**
...
@@ -77,9 +77,9 @@ Called when the global configuration is updated.
...
@@ -77,9 +77,9 @@ Called when the global configuration is updated.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes| Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode.|
| config | [Configuration](js-apis-configuration.md) | Yes | Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode. |
**Example**
**Example**
...
@@ -96,6 +96,6 @@ Describes the configuration information about the context.
...
@@ -96,6 +96,6 @@ Describes the configuration information about the context.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
@@ -17,18 +17,18 @@ You must extend **AbilityContext** to implement this module.
...
@@ -17,18 +17,18 @@ You must extend **AbilityContext** to implement this module.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
## Modules to Import
...
@@ -20,9 +20,9 @@ Callback of the common event of a static subscriber.
...
@@ -20,9 +20,9 @@ Callback of the common event of a static subscriber.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| event | CommonEventData | Yes| Callback of the common event of a static subscriber.|
| event | CommonEventData | Yes | Callback of the common event of a static subscriber. |
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
| uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
| uri | string | Yes | URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**. |
| flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.|
| flag | wantConstant.Flags | Yes | Read or write permission on the file specified by the URI. |
| accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.|
| accessTokenId | number | Yes | Unique ID of an application, which is obtained through the **BundleManager** API. |
| callback | AsyncCallback<number> | Yes| Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.|
| callback | AsyncCallback<number> | Yes | Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite. |
| uri | string | Yes| URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**.|
| uri | string | Yes | URI of a file, for example, **fileshare:///com.samples.filesharetest.FileShare/person/10**. |
| flag | wantConstant.Flags | Yes| Read or write permission on the file specified by the URI.|
| flag | wantConstant.Flags | Yes | Read or write permission on the file specified by the URI. |
| accessTokenId | number | Yes| Unique ID of an application, which is obtained through the **BundleManager** API.|
| accessTokenId | number | Yes | Unique ID of an application, which is obtained through the **BundleManager** API. |
**Return value**
**Return value**
| Type| Description|
| Type | Description |
| -------- | -------- |
| -------- | -------- |
| Promise<number> | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.|
| Promise<number> | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite. |
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
@@ -48,10 +48,10 @@ Appends a key-value pair into the query string.
...
@@ -48,10 +48,10 @@ Appends a key-value pair into the query string.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| name | string | Yes| Key of the key-value pair to append.|
| name | string | Yes | Key of the key-value pair to append. |
| value | string | Yes| Value of the key-value pair to append.|
| value | string | Yes | Value of the key-value pair to append. |
**Example**
**Example**
...
@@ -72,9 +72,9 @@ Deletes key-value pairs of the specified key.
...
@@ -72,9 +72,9 @@ Deletes key-value pairs of the specified key.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| name | string | Yes| Key of the key-value pairs to delete.|
| name | string | Yes | Key of the key-value pairs to delete. |
**Example**
**Example**
...
@@ -95,15 +95,15 @@ Obtains all the key-value pairs based on the specified key.
...
@@ -95,15 +95,15 @@ Obtains all the key-value pairs based on the specified key.
**Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| name | string | Yes| Key specified to obtain all key-value pairs.|
| name | string | Yes | Key specified to obtain all key-value pairs. |
**Return value**
**Return value**
| Type| Description|
| Type | Description |
| -------- | -------- |
| -------- | -------- |
| string[] | All key-value pairs matching the specified key.|
| string[] | All key-value pairs matching the specified key. |
**Example**
**Example**
...
@@ -125,9 +125,9 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
...
@@ -125,9 +125,9 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
| Array<Readonly<[USBDevice](#usbdevice)>> | Device information list.|
| Array<Readonly<[USBDevice](#usbdevice)>> | Device information list.|
-**Example**
-**Example**
```js
```js
...
@@ -92,12 +92,12 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -92,12 +92,12 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| device | [USBDevice](#usbdevice) | Yes| USB device information.|
| device | [USBDevice](#usbdevice) | Yes| USB device information.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Readonly<[USBDevicePipe](#usbdevicepipe)> | USB device pipe for data transfer.|
| Readonly<[USBDevicePipe](#usbdevicepipe)> | USB device pipe for data transfer.|
-**Example**
-**Example**
```js
```js
...
@@ -117,12 +117,12 @@ Checks whether the application has the permission to access the device.
...
@@ -117,12 +117,12 @@ Checks whether the application has the permission to access the device.
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
| deviceName | string | Yes| Device name.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
-**Example**
-**Example**
```js
```js
...
@@ -143,12 +143,12 @@ Requests the temporary permission for the application to access the USB device.
...
@@ -143,12 +143,12 @@ Requests the temporary permission for the application to access the USB device.
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
| deviceName | string | Yes| Device name.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<boolean> | Returns **true** if the temporary device access permissions are granted; returns **false** otherwise.|
| Promise<boolean> | Returns **true** if the temporary device access permissions are granted; returns **false** otherwise.|
-**Example**
-**Example**
```js
```js
...
@@ -172,14 +172,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -172,14 +172,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
-**Example**
-**Example**
```js
```js
...
@@ -201,13 +201,13 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
...
@@ -201,13 +201,13 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
-**Example**
-**Example**
```js
```js
...
@@ -229,13 +229,13 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -229,13 +229,13 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
-**Example**
-**Example**
```js
```js
...
@@ -257,13 +257,13 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -257,13 +257,13 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface to set.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface to set.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
-**Example**
-**Example**
```js
```js
...
@@ -285,12 +285,12 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -285,12 +285,12 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Uint8Array | Raw descriptor data.|
| Uint8Array | Raw descriptor data.|
-**Example**
-**Example**
```js
```js
...
@@ -311,12 +311,12 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -311,12 +311,12 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| number | File descriptor of the USB device.|
| number | File descriptor of the USB device.|
-**Example**
-**Example**
```js
```js
...
@@ -337,14 +337,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -337,14 +337,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
| contrlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<number> | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
| Promise<number> | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
-**Example**
-**Example**
```js
```js
...
@@ -367,15 +367,15 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -367,15 +367,15 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
| timeout | number | No| Timeout duration. The default value is **0**, indicating no timeout.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| Promise<number> | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
| Promise<number> | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.|
-**Example**
-**Example**
```js
```js
...
@@ -401,12 +401,12 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
...
@@ -401,12 +401,12 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
-**Parameters**
-**Parameters**
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
-**Return value**
-**Return value**
| Type| Description|
| Type| Description|
| -------- | -------- |
| -------- | -------- |
| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
-**Example**
-**Example**
```js
```js
...
@@ -423,14 +423,14 @@ Represents the USB endpoint from which data is sent or received. You can obtain
...
@@ -423,14 +423,14 @@ Represents the USB endpoint from which data is sent or received. You can obtain
| Name| Type| Description|
| Name| Type| Description|
| -------- | -------- | -------- |
| -------- | -------- | -------- |
| address | number | Endpoint address.|
| address | number | Endpoint address.|
| attributes | number | Endpoint attributes.|
| attributes | number | Endpoint attributes.|
| interval | number | Endpoint interval.|
| interval | number | Endpoint interval.|
| maxPacketSize | number | Maximum size of data packets on the endpoint.|
| maxPacketSize | number | Maximum size of data packets on the endpoint.|
| direction | [USBRequestDirection](#usbrequestdirection) | Endpoint direction.|
| direction | [USBRequestDirection](#usbrequestdirection) | Endpoint direction.|
| number | number | Endpoint number.|
| number | number | Endpoint number.|
| type | number | Endpoint type.|
| type | number | Endpoint type.|
| interfaceId | number | Unique ID of the interface to which the endpoint belongs.|
| interfaceId | number | Unique ID of the interface to which the endpoint belongs.|
## USBInterface
## USBInterface
...
@@ -441,13 +441,13 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U
...
@@ -441,13 +441,13 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U
| Name| Type| Description|
| Name| Type| Description|
| -------- | -------- | -------- |
| -------- | -------- | -------- |
| id | number | Unique ID of the USB interface.|
| id | number | Unique ID of the USB interface.|
| protocol | number | Interface protocol.|
| protocol | number | Interface protocol.|
| clazz | number | Device type.|
| clazz | number | Device type.|
| subClass | number | Device subclass.|
| subClass | number | Device subclass.|
| alternateSetting | number | Settings for alternating between descriptors of the same USB interface.|
| alternateSetting | number | Settings for alternating between descriptors of the same USB interface.|
| name | string | Interface name.|
| name | string | Interface name.|
| endpoints | Array<[USBEndpoint](#usbendpoint)> | Endpoints that belong to the USB interface.|
| endpoints | Array<[USBEndpoint](#usbendpoint)> | Endpoints that belong to the USB interface.|
## USBConfig
## USBConfig
...
@@ -458,13 +458,13 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip
...
@@ -458,13 +458,13 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip
| Name| Type| Description|
| Name| Type| Description|
| -------- | -------- | -------- |
| -------- | -------- | -------- |
| id | number | Unique ID of the USB configuration.|
| id | number | Unique ID of the USB configuration.|
| attributes | number | Configuration attributes.|
| attributes | number | Configuration attributes.|
| maxPower | number | Maximum power consumption, in mA.|
| maxPower | number | Maximum power consumption, in mA.|
| name | string | Configuration name, which can be left empty.|
| name | string | Configuration name, which can be left empty.|
| isRemoteWakeup | boolean | Support for remote wakeup.|
| isRemoteWakeup | boolean | Support for remote wakeup.|
| isSelfPowered | boolean | Support for independent power supplies.|
| isSelfPowered | boolean | Support for independent power supplies.|