未验证 提交 4df77dcd 编写于 作者: O openharmony_ci 提交者: Gitee

!4180 【OpenHarmony开源贡献者计划2022】相关格式及表达问题0520-c

Merge pull request !4180 from king_he/0520-c
# StartOptions # StartOptions
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **NOTE**<br>
> 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';
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name| Readable| Writable| Type| Mandatory| Description| | Name | Readable | Writable | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- | -------- |
| [windowMode](js-apis-window.md#windowmode) | Yes| No| number | No| Window mode.| | [windowMode](js-apis-window.md#windowmode) | Yes| No | number | No | Window mode. |
| displayId | Yes| No| number | No| Display ID.| | displayId | Yes| No | number | No | Display ID. |
# Want # Want
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **NOTE**<br/>
> 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';
**System capability**: SystemCapability.Ability.AbilityBase **System capability**: SystemCapability.Ability.AbilityBase
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Readable/Writable | Type | Mandatory | Description |
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | | ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| 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. |
# Ability # Ability
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **NOTE**<br>
> 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';
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name| Type| Readable| Writable| Description| | Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.| | context | [AbilityContext](js-apis-ability-context.md) | Yes | No | Context of an ability. |
| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.| | launchWant | [Want](js-apis-application-Want.md) | Yes | No | Parameters for starting the ability. |
| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.| | lastRequestWant | [Want](js-apis-application-Want.md) | Yes | No | Parameters used when the ability was started last time. |
## Ability.onCreate ## Ability.onCreate
...@@ -35,10 +35,10 @@ Called to initialize the service logic when an ability is created. ...@@ -35,10 +35,10 @@ Called to initialize the service logic when an ability is created.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.| | want | [Want](js-apis-application-Want.md) | Yes | Information related to this ability, including the ability name and bundle name. |
| param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.| | param | AbilityConstant.LaunchParam | Yes | Parameters for starting the ability, and the reason for the last abnormal exit. |
**Example** **Example**
...@@ -61,9 +61,9 @@ Called when a **WindowStage** is created for this ability. ...@@ -61,9 +61,9 @@ Called when a **WindowStage** is created for this ability.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes| **WindowStage** information.| | windowStage | window.WindowStage | Yes | **WindowStage** information. |
**Example** **Example**
...@@ -105,9 +105,9 @@ Called when the **WindowStage** is restored during the migration of this ability ...@@ -105,9 +105,9 @@ Called when the **WindowStage** is restored during the migration of this ability
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| windowStage | window.WindowStage | Yes| **WindowStage** information.| | windowStage | window.WindowStage | Yes | **WindowStage** information. |
**Example** **Example**
...@@ -187,15 +187,15 @@ Called to save data during the ability migration preparation process. ...@@ -187,15 +187,15 @@ Called to save data during the ability migration preparation process.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| wantParam | {[key:&nbsp;string]:&nbsp;any} | Yes| **want** parameter.| | wantParam | {[key:&nbsp;string]:&nbsp;any} | Yes | **want** parameter. |
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| AbilityConstant.OnContinueResult | Continuation result.| | AbilityConstant.OnContinueResult | Continuation result. |
**Example** **Example**
...@@ -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&lt;void&gt; | Promise used to return a response.| | Promise&lt;void&gt; | 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&lt;rpc.MessageParcel&gt; | Promise used to return the sequenceable data from the target ability.| | Promise&lt;rpc.MessageParcel&gt; | 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
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| method | string | Yes| Registered notification message string.| | method | string | Yes | Registered notification message string. |
**Example** **Example**
...@@ -575,9 +575,9 @@ Unregisters a caller notification callback, which is invoked when the target abi ...@@ -575,9 +575,9 @@ Unregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name| Type| Readable| Writable| Description| | Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| (msg: string) | function | Yes| No| Prototype of the listener function interface registered by the caller.| | (msg: string) | function | Yes | No | Prototype of the listener function interface registered by the caller. |
## CaleeCallBack ## CaleeCallBack
...@@ -586,6 +586,6 @@ Unregisters a caller notification callback, which is invoked when the target abi ...@@ -586,6 +586,6 @@ Unregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name| Type| Readable| Writable| Description| | Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the message listener function interface registered by the callee.| | (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes | No | Prototype of the message listener function interface registered by the callee. |
# AbilityConstant # AbilityConstant
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> 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';
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description| | Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| launchReason | LaunchReason| Yes| Yes| Ability launch reason.| | launchReason | LaunchReason | Yes | Yes | Ability launch reason. |
| lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.| | lastExitReason | LastExitReason | Yes | Yes | Reason for the last exit. |
## AbilityConstant.LaunchReason ## AbilityConstant.LaunchReason
...@@ -30,12 +30,12 @@ Enumerates ability launch reasons. ...@@ -30,12 +30,12 @@ Enumerates ability launch reasons.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ | | ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason.| | UNKNOWN | 0 | Unknown reason. |
| START_ABILITY | 1 | Ability startup.| | START_ABILITY | 1 | Ability startup. |
| CALL | 2 | Call.| | CALL | 2 | Call. |
| CONTINUATION | 3 | Ability continuation.| | CONTINUATION | 3 | Ability continuation. |
## AbilityConstant.LastExitReason ## AbilityConstant.LastExitReason
...@@ -44,11 +44,11 @@ Enumerates reasons for the last exit. ...@@ -44,11 +44,11 @@ Enumerates reasons for the last exit.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ | | ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason.| | UNKNOWN | 0 | Unknown reason. |
| ABILITY_NOT_RESPONDING | 1 | The ability does not respond.| | ABILITY_NOT_RESPONDING | 1 | The ability does not respond. |
| NORMAL | 2 | Normal status.| | NORMAL | 2 | Normal status. |
## AbilityConstant.OnContinueResult ## AbilityConstant.OnContinueResult
...@@ -57,8 +57,8 @@ Enumerates ability continuation results. ...@@ -57,8 +57,8 @@ Enumerates ability continuation results.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Value | Description | | Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ | | ----------------------------- | ---- | ------------------------------------------------------------ |
| AGREE | 0 | Continuation agreed.| | AGREE | 0 | Continuation agreed. |
| REJECT | 1 | Continuation denied.| | REJECT | 1 | Continuation denied. |
| MISMATCH | 2 | Mismatch.| | MISMATCH | 2 | Mismatch. |
# AbilityStage # AbilityStage
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/> > **NOTE**<br>
> 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.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Description | | Name | Type | Description |
| ----------- | --------------------------- | ------------------------------------------------------------ | | ----------- | --------------------------- | ------------------------------------------------------------ |
| context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup.| | context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup. |
# Context # Context
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> 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.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Type| Readable| Writable| Description| | Name | Type | Readable | Writable | Description |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| resourceManager | ResourceManager | Yes| No| **ResourceManager** object.| | resourceManager | ResourceManager | Yes | No | **ResourceManager** object. |
| applicationInfo | ApplicationInfo | Yes| No| Information about the application.| | applicationInfo | ApplicationInfo | Yes | No | Information about the application. |
| cacheDir | string | Yes| No| Cache directory of the application on the internal storage.| | cacheDir | string | Yes | No | Cache directory of the application on the internal storage. |
| tempDir | string | Yes| No| Temporary file directory of the application.| | tempDir | string | Yes | No | Temporary file directory of the application. |
| filesDir | string | Yes| No| File directory of the application on the internal storage.| | filesDir | string | Yes | No | File directory of the application on the internal storage. |
| databaseDir | string | Yes| No| Storage directory of local data.| | databaseDir | string | Yes | No | Storage directory of local data. |
| storageDir | string | Yes| No| Storage directory of lightweight data.| | storageDir | string | Yes | No | Storage directory of lightweight data. |
| bundleCodeDir | string | Yes| No| Application installation path.| | bundleCodeDir | string | Yes | No | Application installation path. |
| distributedFilesDir | string | Yes| No| Storage directory of distributed application data files.| | distributedFilesDir | string | Yes | No | Storage directory of distributed application data files. |
| eventHub | [EventHub](js-apis-eventhub.md) | Yes| No| Event hub information.| | eventHub | [EventHub](js-apis-eventhub.md) | Yes | No | Event hub information. |
## Context.createBundleContext ## Context.createBundleContext
...@@ -41,15 +41,15 @@ Creates an application context. ...@@ -41,15 +41,15 @@ Creates an application context.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| bundleName | string | Yes| Application bundle name.| | bundleName | string | Yes | Application bundle name. |
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| Context | Context of the application created.| | Context | Context of the application created. |
**Example** **Example**
...@@ -69,9 +69,9 @@ Obtains the context of this application. ...@@ -69,9 +69,9 @@ Obtains the context of this application.
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| Context | Context obtained.| | Context | Context obtained. |
**Example** **Example**
......
# StaticSubscriberExtensionAbility # StaticSubscriberExtensionAbility
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> 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. |
**Example** **Example**
......
# uriPermissionManager # uriPermissionManager
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > **NOTE**<br>
> 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.
...@@ -27,12 +27,12 @@ SystemCapability.Ability.AbilityRuntime.Core ...@@ -27,12 +27,12 @@ SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| 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&lt;number&gt; | 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&lt;number&gt; | Yes | Callback used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite. |
**Example** **Example**
...@@ -56,17 +56,17 @@ SystemCapability.Ability.AbilityRuntime.Core ...@@ -56,17 +56,17 @@ SystemCapability.Ability.AbilityRuntime.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| 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&lt;number&gt; | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite.| | Promise&lt;number&gt; | Promise used to return the check result. The value **0** means that the application has the specified permission, and **-1** means the opposite. |
**Example** **Example**
......
# URL String Parsing # URL String Parsing
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br> > **NOTE**<br>
> 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
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;[string,&nbsp;string]&gt; | ES6 iterator.| | IterableIterator&lt;[string,&nbsp;string]&gt; | ES6 iterator. |
**Example** **Example**
...@@ -149,18 +149,18 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal ...@@ -149,18 +149,18 @@ Traverses the key-value pairs in the **URLSearchParams** instance by using a cal
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| callbackfn | function | Yes| Callback invoked to traverse the key-value pairs in the **URLSearchParams** instance.| | callbackfn | function | Yes | Callback invoked to traverse the key-value pairs in the **URLSearchParams** instance. |
| thisArg | Object | No| Value to use when the callback is invoked.| | thisArg | Object | No | Value to use when the callback is invoked. |
**Table 1** callbackfn parameter description **Table 1** callbackfn parameter description
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| value | string | Yes| Value that is currently traversed.| | value | string | Yes | Value that is currently traversed. |
| key | string | Yes| Key that is currently traversed.| | key | string | Yes | Key that is currently traversed. |
| searchParams | Object | Yes| Instance that invokes the **forEach** method.| | searchParams | Object | Yes | Instance that invokes the **forEach** method. |
**Example** **Example**
...@@ -182,16 +182,16 @@ Obtains the value of the first key-value pair based on the specified key. ...@@ -182,16 +182,16 @@ Obtains the value of the first key-value pair based on the specified key.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes| Key specified to obtain the value.| | name | string | Yes | Key specified to obtain the value. |
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| string | Returns the value of the first key-value pair if obtained.| | string | Returns the value of the first key-value pair if obtained. |
| null | Returns null if no value is obtained.| | null | Returns null if no value is obtained. |
**Example** **Example**
...@@ -213,15 +213,15 @@ Checks whether a key has a value. ...@@ -213,15 +213,15 @@ Checks whether a key has a value.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes| Key specified to search for its value.| | name | string | Yes | Key specified to search for its value. |
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the value exists; returns **false** otherwise.| | boolean | Returns **true** if the value exists; returns **false** otherwise. |
**Example** **Example**
...@@ -242,10 +242,10 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t ...@@ -242,10 +242,10 @@ Sets the value for a key. If key-value pairs matching the specified key exist, t
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| name | string | Yes| Key of the value to set.| | name | string | Yes | Key of the value to set. |
| value | string | Yes| Value to set.| | value | string | Yes | Value to set. |
**Example** **Example**
...@@ -283,9 +283,9 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs. ...@@ -283,9 +283,9 @@ Obtains an ES6 iterator that contains the keys of all the key-value pairs.
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;string&gt; | ES6 iterator that contains the keys of all the key-value pairs.| | IterableIterator&lt;string&gt; | ES6 iterator that contains the keys of all the key-value pairs. |
**Example** **Example**
...@@ -307,9 +307,9 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs. ...@@ -307,9 +307,9 @@ Obtains an ES6 iterator that contains the values of all the key-value pairs.
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;string&gt; | ES6 iterator that contains the values of all the key-value pairs.| | IterableIterator&lt;string&gt; | ES6 iterator that contains the values of all the key-value pairs. |
**Example** **Example**
...@@ -331,9 +331,9 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -331,9 +331,9 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;[string,&nbsp;string]&gt; | ES6 iterator.| | IterableIterator&lt;[string,&nbsp;string]&gt; | ES6 iterator. |
**Example** **Example**
...@@ -355,9 +355,9 @@ Obtains search parameters that are serialized as a string and, if necessary, per ...@@ -355,9 +355,9 @@ Obtains search parameters that are serialized as a string and, if necessary, per
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| string | String of serialized search parameters, which is percent-encoded if necessary.| | string | String of serialized search parameters, which is percent-encoded if necessary. |
**Example** **Example**
...@@ -401,10 +401,10 @@ Creates a URL. ...@@ -401,10 +401,10 @@ Creates a URL.
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| url | string | Yes| Input object.| | url | string | Yes | Input object. |
| base | string&nbsp;\|&nbsp;URL | No| Input parameter, which can be any of the following:<br>- **string**: string<br>- **URL**: string or object| | base | string&nbsp;\ |&nbsp;URL | No | Input parameter, which can be any of the following:<br>- **string**: string<br>- **URL**: string or object |
**Example** **Example**
...@@ -434,9 +434,9 @@ Converts the parsed URL into a string. ...@@ -434,9 +434,9 @@ Converts the parsed URL into a string.
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| string | Website address in a serialized string.| | string | Website address in a serialized string. |
**Example** **Example**
...@@ -456,9 +456,9 @@ Converts the parsed URL into a JSON string. ...@@ -456,9 +456,9 @@ Converts the parsed URL into a JSON string.
**Return value** **Return value**
| Type| Description| | Type | Description |
| -------- | -------- | | -------- | -------- |
| string | Website address in a serialized string.| | string | Website address in a serialized string. |
**Example** **Example**
```js ```js
......
...@@ -20,7 +20,7 @@ Obtains the USB device list. ...@@ -20,7 +20,7 @@ Obtains the USB device list.
- **Return value** - **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Array&lt;Readonly&lt;[USBDevice](#usbdevice)&gt;&gt; | Device information list.| | Array&lt;Readonly&lt;[USBDevice](#usbdevice)&gt;&gt; | 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&lt;[USBDevicePipe](#usbdevicepipe)&gt; | USB device pipe for data transfer.| | Readonly&lt;[USBDevicePipe](#usbdevicepipe)&gt; | 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&lt;boolean&gt; | Returns **true** if the temporary device access permissions are granted; returns **false** otherwise.| | Promise&lt;boolean&gt; | 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&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.| | Promise&lt;number&gt; | 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&lt;number&gt; | Returns the size of the transmitted or received data block if the control transfer is successful; returns **-1** if an exception occurs.| | Promise&lt;number&gt; | 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&lt;[USBEndpoint](#usbendpoint)&gt; | Endpoints that belong to the USB interface.| | endpoints | Array&lt;[USBEndpoint](#usbendpoint)&gt; | 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. |
| interfaces | Array&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Supported interface attributes.| | interfaces | Array&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Supported interface attributes. |
## USBDevice ## USBDevice
...@@ -475,19 +475,19 @@ Represents USB device information. ...@@ -475,19 +475,19 @@ Represents USB device information.
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| busNum | number | Bus address.| | busNum | number | Bus address. |
| devAddress | number | Device address.| | devAddress | number | Device address. |
| serial | string | Device SN.| | serial | string | Device SN. |
| name | string | Device name.| | name | string | Device name. |
| manufacturerName | string | Device manufacturer.| | manufacturerName | string | Device manufacturer. |
| productName | string | Product information.| | productName | string | Product information. |
| version | string | Version.| | version | string | Version. |
| vendorId | number | Vendor ID.| | vendorId | number | Vendor ID. |
| productId | number | Product ID.| | productId | number | Product ID. |
| clazz | number | Device class.| | clazz | number | Device class. |
| subClass | number | Device subclass.| | subClass | number | Device subclass. |
| protocol | number | Device protocol code.| | protocol | number | Device protocol code. |
| configs | Array&lt;[USBConfig](#usbconfig)&gt; | Device configuration descriptor information.| | configs | Array&lt;[USBConfig](#usbconfig)&gt; | Device configuration descriptor information. |
## USBDevicePipe ## USBDevicePipe
...@@ -498,8 +498,8 @@ Represents a USB device pipe, which is used to determine a USB device. ...@@ -498,8 +498,8 @@ Represents a USB device pipe, which is used to determine a USB device.
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| busNum | number | Bus address.| | busNum | number | Bus address. |
| devAddress | number | Device address.| | devAddress | number | Device address. |
## USBControlParams ## USBControlParams
...@@ -510,12 +510,12 @@ Represents control transfer parameters. ...@@ -510,12 +510,12 @@ Represents control transfer parameters.
| Name| Type| Description| | Name| Type| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| request | number | Request type.| | request | number | Request type. |
| target | [USBRequestTargetType](#usbrequesttargettype) | Represents the request target type.| | target | [USBRequestTargetType](#usbrequesttargettype) | Type of the request target. |
| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Request control type.| | reqType | [USBControlRequestType](#usbcontrolrequesttype) | Request control type. |
| value | number | Request parameters| | value | number | Request parameters|
| index | number | Index of the request parameter value.| | index | number | Index of the request parameter value. |
| data | Uint8Array | Buffer for writing or reading data.| | data | Uint8Array | Buffer for writing or reading data. |
## USBRequestTargetType ## USBRequestTargetType
...@@ -526,8 +526,8 @@ Represents the request target type. ...@@ -526,8 +526,8 @@ Represents the request target type.
| Name| Default Value | Description| | Name| Default Value | Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| USB_REQUEST_TARGET_DEVICE | 0 | Device.| | USB_REQUEST_TARGET_DEVICE | 0 | Device. |
| USB_REQUEST_TARGET_INTERFACE | 1 | Interface.| | USB_REQUEST_TARGET_INTERFACE | 1 | Interface. |
| USB_REQUEST_TARGET_ENDPOINT | 2 | Endpoint| | USB_REQUEST_TARGET_ENDPOINT | 2 | Endpoint|
| USB_REQUEST_TARGET_OTHER | 3 | Others| | USB_REQUEST_TARGET_OTHER | 3 | Others|
...@@ -541,7 +541,7 @@ Enumerates control request types. ...@@ -541,7 +541,7 @@ Enumerates control request types.
| Name| Default Value | Description| | Name| Default Value | Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| USB_REQUEST_TYPE_STANDARD | 0 | Standard| | USB_REQUEST_TYPE_STANDARD | 0 | Standard|
| USB_REQUEST_TYPE_CLASS | 1 | Class.| | USB_REQUEST_TYPE_CLASS | 1 | Class. |
| USB_REQUEST_TYPE_VENDOR | 2 | Vendor| | USB_REQUEST_TYPE_VENDOR | 2 | Vendor|
...@@ -553,5 +553,5 @@ Enumerates request directions. ...@@ -553,5 +553,5 @@ Enumerates request directions.
| Name| Default Value | Description| | Name| Default Value | Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| USB_REQUEST_DIR_TO_DEVICE | 0 | Request for writing data from the host to the device.| | USB_REQUEST_DIR_TO_DEVICE | 0 | Request for writing data from the host to the device. |
| USB_REQUEST_DIR_FROM_DEVICE | 0x80 | Request for reading data from the device to the host.| | USB_REQUEST_DIR_FROM_DEVICE | 0x80 | Request for reading data from the device to the host. |
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册