提交 34224d0e 编写于 作者: zyjhandsome's avatar zyjhandsome

Merge branch 'master' of https://gitee.com/openharmony/docs

# Ability Development
> **NOTE**<br/>
> This folder is deprecated. Read [Application Models](../application-models/Readme-EN.md) instead.
- [Ability Framework Overview](ability-brief.md)
- [Context Usage](context-userguide.md)
- FA Model
......
......@@ -73,10 +73,10 @@ The ability assistant enables you to start applications, atomic services, and te
| -a/--all | - | Prints ability information in all missions. |
| -l/--mission-list | type (All logs are printed if this parameter is left unspecified.)| Prints mission stack information.<br>The following values are available for **type**:<br>- NORMAL <br>- DEFAULT_STANDARD<br>- DEFAULT_SINGLE<br>- LAUNCHER |
| -e/--extension | elementName | Prints extended component information. |
| -u/--userId | UserId | Prints stack information of a specified user ID. This parameter must be used together with other parameters. <br/>Example commands: aa **dump -a -u 100** and **aa dump -d -u 100**. |
| -d/--data | - | Prints Data ability information. |
| -i/--ability | AbilityRecord ID | Prints detailed information about a specified ability. |
| -c/--client | - | Prints detailed ability information. This parameter must be used together with other parameters. <br/>Example commands: **aa dump -a -c** and **aa dump -i 21 -c**. |
| -u/--userId | UserId | Prints stack information of a specified user ID. This parameter must be used together with other parameters. <br/>Example commands: aa **dump -a -u 100** and **aa dump -d -u 100**.|
| -d/--data | - | Prints Data ability information. |
| -i/--ability | AbilityRecord ID | Prints detailed information about a specified ability. |
| -c/--client | - | Prints detailed ability information. This parameter must be used together with other parameters. <br/>Example commands: **aa dump -a -c** and **aa dump -i 21 -c**.|
**Method**
......
......@@ -46,19 +46,19 @@ For details about how to use DevEco Studio to start the test framework, see [Ope
## Introduction to TestRunner
**TestRunner** is the entry class of the test framework test process. When the test process is started, the system calls related APIs in **TestRunner**. You need to inherit this class and override the **onPrepare** and **onRun** APIs. When creating an application template, DevEco Studio initializes the default **TestRunner** and starts the default **TestAbility** in the **onRun** API. You can modify the test code of **TestAbility** or override **onPrepare** and **onRun** in **TestRunner** to implement your own test code. For details, see [TestRunner](../reference/apis/js-apis-testRunner.md).
**TestRunner** is the entry class of the test framework test process. When the test process is started, the system calls related APIs in **TestRunner**. You need to inherit this class and override the **onPrepare** and **onRun** APIs. When creating an application template, DevEco Studio initializes the default **TestRunner** and starts the default **TestAbility** in the **onRun** API. You can modify the test code of **TestAbility** or override **onPrepare** and **onRun** in **TestRunner** to implement your own test code. For details, see [TestRunner](../reference/apis/js-apis-application-testRunner.md).
## Introduction to AbilityDelegatorRegistry
**AbilityDelegatorRegistry** is the **AbilityDelegator** repository class provided by the test framework. You can use **AbilityDelegatorRegistry** to obtain an **AbilityDelegator** instance and the input and generated parameters **AbilityDelegatorArgs** during the test. You can use **AbilityDelegator** to invoke the function set provided by the test framework for testing and verification. For details, see [AbilityDelegatorRegistry](../reference/apis/js-apis-abilityDelegatorRegistry.md).
**AbilityDelegatorRegistry** is the **AbilityDelegator** repository class provided by the test framework. You can use **AbilityDelegatorRegistry** to obtain an **AbilityDelegator** instance and the input and generated parameters **AbilityDelegatorArgs** during the test. You can use **AbilityDelegator** to invoke the function set provided by the test framework for testing and verification. For details, see [AbilityDelegatorRegistry](../reference/apis/js-apis-application-abilityDelegatorRegistry.md).
## Introduction to AbilityDelegatorArgs
**AbilityDelegatorArgs** is a test parameter class provided by the test framework. You can use **AbilityDelegatorArgs** to obtain the parameters passed and generated during the test. For details, see [AbilityDelegatorArgs](../reference/apis/js-apis-application-abilityDelegatorArgs.md).
**AbilityDelegatorArgs** is a test parameter class provided by the test framework. You can use **AbilityDelegatorArgs** to obtain the parameters passed and generated during the test. For details, see [AbilityDelegatorArgs](../reference/apis/js-apis-inner-application-abilityDelegatorArgs.md).
## Introduction to AbilityMonitor
**AbilityMonitor** is provided by the test framework for binding to and listening for abilities. You can use **AbilityMonitor** to bind to an **Ability** instance and add **AbilityMonitor** to the listening list. When **AbilityMonitor** is bound to an ability, the creation and lifecycle changes of the ability will trigger the related callback in **AbilityMonitor**. You can test and verify the ability in these callbacks. For details, see [AbilityMonitor](../reference/apis/js-apis-application-abilityMonitor.md).
**AbilityMonitor** is provided by the test framework for binding to and listening for abilities. You can use **AbilityMonitor** to bind to an **Ability** instance and add **AbilityMonitor** to the listening list. When **AbilityMonitor** is bound to an ability, the creation and lifecycle changes of the ability will trigger the related callback in **AbilityMonitor**. You can test and verify the ability in these callbacks. For details, see [AbilityMonitor](../reference/apis/js-apis-inner-application-abilityMonitor.md).
**Example**
......@@ -131,7 +131,7 @@ abilityDelegator.startAbility(want, (err, data) => {
### Scheduling the Ability Lifecycle
**AbilityDelegator** provides APIs to display and schedule the ability lifecycle and supports the foreground and background. It works with **AbilityMonitor** to listen for the ability lifecycle. For details, see [AbilityDelegator](../reference/apis/js-apis-application-abilityDelegator.md).
**AbilityDelegator** provides APIs to display and schedule the ability lifecycle and supports the foreground and background. It works with **AbilityMonitor** to listen for the ability lifecycle. For details, see [AbilityDelegator](../reference/apis/js-apis-inner-application-abilityDelegator.md).
### Running a Shell Command
......
......@@ -4,12 +4,12 @@
**Context** provides the capability of obtaining contextual information of an application.
The OpenHarmony application framework has two models: Feature Ability (FA) model and stage model. Correspondingly, there are two sets of context mechanisms. **application/BaseContext** is a common context base class. It uses the **stageMode** attribute to specify whether the context is used for the stage model.
- FA model
Only the methods in **app/Context** can be used for the context in the FA model. Both the application-level context and ability-level context are instances of this type. If an ability-level method is invoked in the application-level context, an error occurs. Therefore, you must pay attention to the actual meaning of the **Context** instance.
The OpenHarmony application framework has two models: Feature Ability (FA) model and stage model. Correspondingly, there are two sets of context mechanisms. **application/BaseContext** is a common context base class. It uses the **stageMode** attribute to specify whether the context is used for the stage model.
- FA model
Only the methods in **app/Context** can be used for the context in the FA model. Both the application-level context and ability-level context are instances of this type. If an ability-level method is invoked in the application-level context, an error occurs. Therefore, you must pay attention to the actual meaning of the **Context** instance.
- Stage model
The stage model has the following types of contexts: **application/Context**, **application/ApplicationContext**, **application/AbilityStageContext**, **application/ExtensionContext**, **application/AbilityContext**, and **application/FormExtensionContext**. For details about these contexts and how to use them, see [Context in the Stage Model](#context-in-the-stage-model).
......@@ -239,7 +239,7 @@ export default class MainAbility extends Ability {
### application/FormExtensionContext
For details, see [FormExtensionContext](../reference/apis/js-apis-formextensioncontext.md).
For details, see [FormExtensionContext](../reference/apis/js-apis-inner-application-formExtensionContext.md).
### Obtaining the Context on an ArkTS Page
......
......@@ -188,7 +188,7 @@ As the entry of the ability continuation capability, **continuationManager** is
}
```
The preceding multi-device collaboration operation is performed across devices in the stage model. For details about this operation in the FA model, see [Page Ability Development](https://gitee.com/openharmony/docs/blob/master/en/application-dev/ability/fa-pageability.md).
The preceding multi-device collaboration operation is performed across devices in the stage model. For details about this operation in the FA model, see [Page Ability Development](fa-pageability.md).
You can also instruct the device selection module to update the device connection state. The sample code is as follows:
......
......@@ -38,4 +38,6 @@ When an ability is started, an application process as well as a thread for this
For details about the project directory structure of the FA model, see [OpenHarmony Project Overview](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-project-overview-0000001218440650#section4154183910141).
For details about how to configure the application package structure of the FA model, see [Application Package Structure Configuration File](../quick-start/package-structure.md).
For details about how to configure the application package structure of the FA model, see [Application Package Structure Configuration File](../quick-start/application-configuration-file-overview-fa.md).
<!--no_check-->
\ No newline at end of file
......@@ -148,7 +148,7 @@ The basic dependency packages include:
1. Create a Data ability helper.
For details about the APIs provided by **DataAbilityHelper**, see [DataAbilityHelper Module](../reference/apis/js-apis-dataAbilityHelper.md).
For details about the APIs provided by **DataAbilityHelper**, see [DataAbilityHelper Module](../reference/apis/js-apis-inner-ability-dataAbilityHelper.md).
```js
// Different from the URI defined in the config.json file, the URI passed in the parameter has an extra slash (/), because there is a DeviceID parameter between the second and the third slash (/).
import featureAbility from '@ohos.ability.featureAbility'
......
......@@ -43,7 +43,7 @@ The table below describes the **LifecycleForm** APIs, which represent the lifecy
| onDestroy(formId: string): void | Called to notify the widget provider that a widget has been destroyed. |
| onAcquireFormState?(want: Want): formInfo.FormState | Called to instruct the widget provider to receive the status query result of a widget. |
The table below describes the **FormProvider** APIs. For details, see [FormProvider](../reference/apis/js-apis-formprovider.md).
The table below describes the **FormProvider** APIs. For details, see [FormProvider](../reference/apis/js-apis-application-formProvider.md).
**Table 2** FormProvider APIs
......
......@@ -61,7 +61,7 @@ By default, **singleton** is used.
| API | Description |
| --------------------------------------------------- | --------------- |
| void startAbility(parameter: StartAbilityParameter) | Starts an ability. |
| void startAbility(parameter: StartAbilityParameter) | Starts an ability. |
| Context getContext(): | Obtains the application context.|
| void terminateSelf() | Terminates the ability. |
| bool hasWindowFocus() | Checks whether the ability has focus. |
......
......@@ -22,7 +22,9 @@ The differences between **onCommand()** and **onConnect()** are as follows:
### Creating and Registering a Service Ability
1. Override the Service ability-related lifecycle callbacks to implement your own logic for processing interaction requests.
1. Override the Service ability-related lifecycle callbacks to implement your own logic for processing interaction requests.
```ts
export default {
......@@ -45,7 +47,7 @@ The differences between **onCommand()** and **onConnect()** are as follows:
}
}
```
2. Register a Service ability.
Declare the Service ability in the **config.json** file by setting its **type** attribute to **service**.
......
......@@ -301,11 +301,13 @@ In the ability continuation scenario, the distributed data object is used to syn
### Restrictions
1. The continuation must be performed between the same ability, which means the same bundle name, module name, and ability name. For details, see [Application Package Structure Configuration File](../quick-start/stage-structure.md).
1. The continuation must be performed between the same ability, which means the same bundle name, module name, and ability name. For details, see [Application Package Structure Configuration File](../quick-start/module-configuration-file.md).
2. Currently, the application can only implement the continuation capability. The continuation action must be initiated by the system.
### Best Practice
For better user experience, you are advised to use the **wantParam** parameter to transmit data smaller than 100 KB and use distributed objects to transmit data larger than 100 KB.
For better user experience, you are advised to use the **wantParam** parameter to transmit data smaller than 100 KB and use distributed objects to transmit data larger than 100 KB.
<!--no_check-->
\ No newline at end of file
# Ability Development
## When to Use
Ability development in the [stage model](stage-brief.md) is significantly different from that in the FA model. The stage model requires you to declare the application package structure in the **module.json5** and **app.json5** files during application development. For details about the configuration file, see [Application Package Structure Configuration File](../quick-start/stage-structure.md). To develop an ability based on the stage model, implement the following logic:
Ability development in the [stage model](stage-brief.md) is significantly different from that in the FA model. The stage model requires you to declare the application package structure in the **module.json5** and **app.json5** files during application development. For details about the configuration file, see [Application Package Structure Configuration File](../quick-start/application-package-structure-stage.md). To develop an ability based on the stage model, implement the following logic:
- Create an ability that supports screen viewing and human-machine interaction. You must implement the following scenarios: ability lifecycle callbacks, obtaining ability configuration, requesting permissions, and notifying environment changes.
- Start an ability. You need to implement ability startup on the same device, on a remote device, or with a specified UI page.
- Call abilities. For details, see [Call Development](stage-call.md).
......@@ -30,7 +30,7 @@ By default, the singleton mode is used. The following is an example of the **mod
```
## Creating an Ability
### Available APIs
The table below describes the APIs provided by the **AbilityStage** class, which has the **context** attribute. For details about the APIs, see [AbilityStage](../reference/apis/js-apis-application-abilitystage.md).
The table below describes the APIs provided by the **AbilityStage** class, which has the **context** attribute. For details about the APIs, see [AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md).
**Table 1** AbilityStage APIs
|API|Description|
......@@ -321,3 +321,5 @@ struct Index {
}
}
```
<!--no_check-->
\ No newline at end of file
......@@ -12,15 +12,15 @@ The stage model is designed based on the following considerations:
- Efficient management of application processes
As the device memory becomes larger, the number of processes concurrently running in the system increases. If the number of concurrent processes reaches several hundreds, the overall power consumption and performance of the system will be adversely affected without effective management measures. To restrict the behavior of background processes, the stage model uses four measures: transient task, continuous task, agent task, and Work Scheduler task. With these measures, foreground processes will obtain guaranteed resources, thereby delivering a better user experience.
As the device memory becomes larger, the number of processes concurrently running in the system increases. If the number of concurrent processes reaches several hundreds, the overall power consumption and performance of the system will be adversely affected without effective management measures. To restrict the behavior of background processes, the stage model uses four measures: transient task, continuous task, agent task, and Work Scheduler task. With these measures, foreground processes will obtain guaranteed resources, thereby delivering a better user experience.
- Native support for cross-device migration and multi-device collaboration
OpenHarmony is a native distributed OS. Its application framework must be designed for easier component migration and collaboration across devices. The stage model achieves this design objective by providing features such as separation between ability and UI as well as integration of UI display and service capabilities.
OpenHarmony is a native distributed OS. Its application framework must be designed for easier component migration and collaboration across devices. The stage model achieves this design objective by providing features such as separation between ability and UI as well as integration of UI display and service capabilities.
- Different window forms for various device types
The stage model redefines the ability lifecycle. In terms of architecture, the component manager and window manager are decoupled. This facilitates adaptation between window forms and device types.
The stage model redefines the ability lifecycle. In terms of architecture, the component manager and window manager are decoupled. This facilitates adaptation between window forms and device types.
## Basic Concepts
......@@ -103,8 +103,12 @@ The processes of an application can be classified into three types:
![stageprocessmodel](figures/stageprocessmodel.png)
## Application Package Structure
For details about the project directory structure of the stage model, see [OpenHarmony Project Overview](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-project-overview-0000001218440650#section56487581904).
For details about how to configure the application package structure of the stage model, see [Application Package Structure Configuration File (Stage Model)](../quick-start/stage-structure.md).
For details about how to configure the application package structure of the stage model, see [Application Package Structure Configuration File](../quick-start/application-configuration-file-overview-stage.md).
<!--no_check-->
\ No newline at end of file
......@@ -34,7 +34,7 @@ The table below describes the ability call APIs. For details, see [Ability](../r
**Table 2** Ability call APIs
|API|Description|
|:------|:------|
|startAbilityByCall(want: Want): Promise\<Caller>|Starts an ability in the foreground (through the **want** configuration) or background (default) and obtains the **Caller** object for communication with the ability. For details, see [AbilityContext](../reference/apis/js-apis-ability-context.md#abilitycontextstartabilitybycall) or [ServiceExtensionContext](../reference/apis/js-apis-service-extension-context.md#serviceextensioncontextstartabilitybycall).|
|startAbilityByCall(want: Want): Promise\<Caller>|Starts an ability in the foreground (through the **want** configuration) or background (default) and obtains the **Caller** object for communication with the ability. For details, see [AbilityContext](../reference/apis/js-apis-ability-context.md#abilitycontextstartabilitybycall) or [ServiceExtensionContext](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextstartabilitybycall).|
|on(method: string, callback: CalleeCallBack): void|Callback invoked when the callee ability registers a method.|
|off(method: string): void|Callback invoked when the callee ability deregisters a method.|
|call(method: string, data: rpc.Sequenceable): Promise\<void>|Sends agreed sequenceable data to the callee ability.|
......
......@@ -31,7 +31,7 @@ Stage widget development refers to the development conducted by the widget provi
## Available APIs
The **FormExtension** class has the following APIs. For details, see [FormExtension](../reference/apis/js-apis-formextension.md).
The **FormExtension** class has the following APIs. For details, see [FormExtension](../reference/apis/js-apis-app-form-formExtensionAbility.md).
**Table 1** FormExtension APIs
......@@ -45,7 +45,7 @@ The **FormExtension** class has the following APIs. For details, see [FormExtens
| onDestroy(formId: string): void | Called to notify the widget provider that a **Form** instance (widget) has been destroyed. |
| onConfigurationUpdated(config: Configuration): void; | Called when the configuration of the environment where the widget is running is updated. |
The **FormExtension** class also has a member context, that is, the **FormExtensionContext** class. For details, see [FormExtensionContext](../reference/apis/js-apis-formextensioncontext.md).
The **FormExtension** class also has a member context, that is, the **FormExtensionContext** class. For details, see [FormExtensionContext](../reference/apis/js-apis-inner-application-formExtensionContext.md).
**Table 2** FormExtensionContext APIs
......@@ -54,7 +54,7 @@ The **FormExtension** class also has a member context, that is, the **FormExtens
| startAbility(want: Want, callback: AsyncCallback&lt;void&gt;): void | Starts an ability. This API uses an asynchronous callback to return the result. (This is a system API and cannot be called by third-party applications.)|
| startAbility(want: Want): Promise&lt;void&gt; | Starts an ability. This API uses a promise to return the result. (This is a system API and cannot be called by third-party applications.)|
For details about the **FormProvider** APIs, see [FormProvider](../reference/apis/js-apis-formprovider.md).
For details, see [FormProvider](../reference/apis/js-apis-application-formProvider.md).
**Table 3** FormProvider APIs
......@@ -412,4 +412,4 @@ The following is an example:
}
}
}
```
\ No newline at end of file
```
......@@ -71,4 +71,5 @@ OpenHarmony does not support creation of a Service Extension ability for third-p
console.log('onDestroy');
}
}
```
\ No newline at end of file
```
......@@ -2,8 +2,6 @@
## When to Use
The **WantAgent** class encapsulates want information that specifies a particular action, which can be starting an ability or publishing a common event. You can either call **wantAgent.trigger** to trigger a **WantAgent** directly or add a **WantAgent** to a notification so that it will be triggered when users tap the notification.
## Available APIs
| API | Description|
| ---------------------------------------------------------------------------------------------- | ----------- |
......
......@@ -21,7 +21,7 @@ Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
Error code 28 refers to **CURLE_OPERATION_TIMEDOUT**, which means a cURL operation timeout. For details, see any HTTP status code description available.
Reference: [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-http.md#httpresponse) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
Reference: [Response Codes](../reference/apis/js-apis-http.md#responsecode) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
## What does error code 6 mean for the response of \@ohos.net.http.d.ts?
......@@ -30,4 +30,4 @@ Applicable to: OpenHarmony SDK 3.2.3.5
Error code 6 indicates a failure to resolve the host in the address. You can ping the URL carried in the request to check whether the host is accessible.
Reference: [Development Guide](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-http.md#httpresponse) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
Reference: [Response Codes](../reference/apis/js-apis-http.md#responsecode) and [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html)
......@@ -19,7 +19,7 @@ Run **hdc\_std shell param get persist.ace.testmode.enabled**.
If the value is **0**, run the **hdc\_std shell param set persist.ace.testmode.enabled 1** to enable the test mode.
## Why Is Private Displayed in Logs When the Format Parameter Type of hilog in C++ Code Is %d or %s?
## Why is private displayed in logs when the format parameter type of HiLog in C++ code is %d or %s?
When format parameters such as **%d** and **%s** are directly used, the standard system uses **private** to replace the actual data for printing by default to prevent data leakage. To print the actual data, replace **%d** with **%{public}d** or replace **%s** with **%{public}s**.
......@@ -35,7 +35,7 @@ Applicable to: OpenHarmony SDK 3.2.2.5
You are advised to use the [HiLog](../reference/apis/js-apis-hilog.md) for log printing. For details about how to set the **domain** parameter, see the [Development Guide](../reference/apis/js-apis-hilog.md#hilogisloggable).
## What is the maximum length of a log record when HiLog Is used? Is it configurable?
## What is the maximum length of a log record when HiLog is used? Is it configurable?
Applicable to: OpenHarmony SDK 3.2.2.5
......
......@@ -24,7 +24,7 @@ APIs involved in MindSpore Lite model inference are categorized into context API
| ------------------ | ----------------- |
|OH_AI_ContextHandle OH_AI_ContextCreate()|Creates a context object.|
|void OH_AI_ContextSetThreadNum(OH_AI_ContextHandle context, int32_t thread_num)|Sets the number of runtime threads.|
| void OH_AI_ContextSetThreadAffinityMode(OH_AI_ContextHandle context, int mode)|Sets the affinity mode for binding runtime threads to CPU cores, which are categorized into little cores and big cores depending on the CPU frequency.|
| void OH_AI_ContextSetThreadAffinityMode(OH_AI_ContextHandle context, int mode)|Sets the affinity mode for binding runtime threads to CPU cores, which are classified into large, medium, and small cores based on the CPU frequency. You only need to bind the large or medium cores, but not small cores.|
|OH_AI_DeviceInfoHandle OH_AI_DeviceInfoCreate(OH_AI_DeviceType device_type)|Creates a runtime device information object.|
|void OH_AI_ContextDestroy(OH_AI_ContextHandle *context)|Destroys a context object.|
|void OH_AI_DeviceInfoSetEnableFP16(OH_AI_DeviceInfoHandle device_info, bool is_fp16)|Sets whether to enable float16 inference. This function is available only for CPU and GPU devices.|
......
......@@ -203,15 +203,16 @@
- [@ohos.data.distributedKVStore](js-apis-distributedKVStore.md)
- [@ohos.data.preferences](js-apis-data-preferences.md)
- [@ohos.data.rdb](js-apis-data-rdb.md)
- [@ohos.data.ValuesBucket](js-apis-data-ValuesBucket.md)
- data/rdb/[resultSet](js-apis-data-resultset.md)
- [@ohos.data.ValuesBucket](js-apis-data-valuesBucket.md)
- data/rdb
- [resultSet](js-apis-data-resultset.md)
- File Management
- [@ohos.document](js-apis-document.md)
- [@ohos.environment](js-apis-environment.md)
- [@ohos.data.fileAccess](js-apis-fileAccess.md)
- [@ohos.fileExtensionInfo](js-apis-fileExtensionInfo.md)
- [@ohos.fileio](js-apis-fileio.md)
- [@ohos.filemanagement.userfile_manager](js-apis-userfilemanager.md)
- [@ohos.filemanagement.userFileManager](js-apis-userfilemanager.md)
- [@ohos.multimedia.medialibrary](js-apis-medialibrary.md)
- [@ohos.securityLabel](js-apis-securityLabel.md)
- [@ohos.statfs](js-apis-statfs.md)
......@@ -240,10 +241,13 @@
- [@ohos.nfc.controller](js-apis-nfcController.md)
- [@ohos.nfc.tag](js-apis-nfcTag.md)
- [@ohos.rpc](js-apis-rpc.md)
- [@ohos.wifiManager (WLAN)](js-apis-wifiManager.md)
- [@ohos.wifiManagerExt](js-apis-wifiManagerExt.md)
- [@ohos.wifi](js-apis-wifi.md)
- [@ohos.wifiext](js-apis-wifiext.md)
- tag/[nfctech](js-apis-nfctech.md)
- tag/[tagSession](js-apis-tagSession.md)
- tag
- [nfctech](js-apis-nfctech.md)
- [tagSession](js-apis-tagSession.md)
- Basic Features
- [@ohos.accessibility](js-apis-accessibility.md)
- [@ohos.accessibility.config](js-apis-accessibility-config.md)
......
# @ohos.accessibility.GesturePath
The **GesturePath** module provides APIs for creating gesture path information required for an accessibility application to inject gestures.
> **NOTE**
>
> 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
```ts
import GesturePath from '@ohos.accessibility.GesturePath';
```
## GesturePath
Defines a gesture path.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| ------------ | ---------------------------------------- | ---- | ---- | ------ |
| points | Array&lt;[GesturePoint](js-apis-accessibility-GesturePoint.md#gesturepoint)&gt; | Yes | Yes | Gesture touch point. |
| durationTime | number | Yes | Yes | Total gesture duration, in milliseconds.|
### constructor
constructor(durationTime: number);
Constructor used to create a **GesturePath** object.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| durationTime | number | Yes| Total gesture duration, in milliseconds.|
**Example**
```ts
let gesturePath = new GesturePath.GesturePath(20);
```
# @ohos.accessibility.GesturePoint
The **GesturePoint** module provides APIs for creating gesture touch point information required for an accessibility application to inject gestures.
> **NOTE**
>
> 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
```ts
import GesturePoint from '@ohos.accessibility.GesturePoint';
```
## GesturePoint
Defines a gesture touch point.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ------- |
| positionX | number | Yes | Yes | X coordinate of the touch point.|
| positionY | number | Yes | Yes | Y coordinate of the touch point.|
### constructor
constructor(positionX: number, positionY: number);
Constructor used to create a **GesturePoint** object.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| positionX | number | Yes| X coordinate of the touch point.|
| positionY | number | Yes | Y coordinate of the touch point.|
**Example**
```ts
let gesturePoint = new GesturePoint.GesturePoint(1, 2);
```
# App Account Management
# @ohos.account.appAccount
The **appAccount** module provides APIs for adding, deleting, modifying, and querying app account information, and supports inter-app authentication and distributed data synchronization.
......@@ -3173,7 +3173,7 @@ Set credentials for an app account. This API uses an asynchronous callback to re
| Name | Type | Mandatory | Description |
| -------------- | ------------------------- | ---- | ------------- |
| name | string | Yes | Name of the target app account. |
| credentialType | string | Yes | Type of the credential to delete. |
| credentialType | string | Yes | Type of the credential to set. |
| credential | string | Yes | Credential value. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
......@@ -3203,7 +3203,7 @@ Set credentials for an app account. This API uses a promise to return the result
| Name | Type | Mandatory | Description |
| -------------- | ------ | ---- | ---------- |
| name | string | Yes | Name of the target app account. |
| credentialType | string | Yes | Type of the credential to delete.|
| credentialType | string | Yes | Type of the credential to set.|
| credential | string | Yes | Credential value.|
**Return value**
......@@ -3576,7 +3576,7 @@ Obtains the credential of an app account. This API uses an asynchronous callback
| Name | Type | Mandatory | Description |
| -------------- | --------------------------- | ---- | -------------- |
| name | string | Yes | Name of the target app account. |
| credentialType | string | Yes | Type of the credential to delete.|
| credentialType | string | Yes | Type of the credential to obtain.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the credential obtained. Otherwise, **err** is an error object.|
**Example**
......@@ -3606,7 +3606,7 @@ Obtains the credential of an app account. This API uses a promise to return the
| Name | Type | Mandatory | Description |
| -------------- | ------ | ---- | ---------- |
| name | string | Yes | Name of the target app account. |
| credentialType | string | Yes | Type of the credential to delete.|
| credentialType | string | Yes | Type of the credential to obtain.|
**Return value**
......
# Accessibility Extension Ability
# @ohos.application.AccessibilityExtensionAbility
The **AccessibilityExtensionAbility** module is based on the ExtensionAbility framework and provides the **AccessibilityExtensionAbility**.
The **AccessibilityExtensionAbility** module provides accessibility extension capabilities based on the ExtensionAbility framework.
>**NOTE**
> **NOTE**
>
>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 APIs of this module can be used only in the stage model.
> 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
......@@ -18,9 +16,9 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name | Type | Readable | Writable | Description |
| Name | Type| Readable| Writable| Description |
| --------- | -------- | ---- | ---- | ------------------------- |
| context | [AccessibilityExtensionContext](js-apis-accessibility-extension-context.md) | Yes | No | Context of the accessibility extension ability. |
| context | [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md) | Yes| No| Context of the accessibility extension ability.|
## AccessibilityEvent
......@@ -32,36 +30,10 @@ Defines an accessibility event.
| Name | Type | Readable | Writable | Description |
| --------- | ---------------------------------------- | ---- | ---- | ---------- |
| eventType | [EventType](js-apis-accessibility.md#eventtype) \| [WindowUpdateType](js-apis-accessibility.md#windowupdatetype) \| [TouchGuideType](#touchguidetype) \| [GestureType](#gesturetype) \| [PageUpdateType](#pageupdatetype) | Yes | No | Event type. |
| eventType | [accessibility.EventType](js-apis-accessibility.md#EventType) \| [accessibility.WindowUpdateType](js-apis-accessibility.md#WindowUpdateType) \| [TouchGuideType](#touchguidetype) \| [GestureType](#gesturetype) \| [PageUpdateType](#pageupdatetype) | Yes | No | Event type. |
| target | AccessibilityElement | Yes | No | Target component where the event occurs.|
| timeStamp | number | Yes | No | Timestamp of the event. |
## GesturePath
Defines a gesture path.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| ------------ | ---------------------------------------- | ---- | ---- | ------ |
| points | Array&lt;[GesturePoint](gesturepoint)&gt; | Yes | Yes | An array of gesture touch points. |
| durationTime | number | Yes | Yes | Total time consumed by the gesture.|
## GesturePoint
Defines a gesture touch point.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
| Name | Type | Readable | Writable | Description |
| --------- | ------ | ---- | ---- | ------- |
| positionX | number | Yes | Yes | X-coordinate of the touch point.|
| positionY | number | Yes | Yes | Y-coordinate of the touch point.|
## GestureType
Enumerates gesture types.
......@@ -89,7 +61,7 @@ Enumerates gesture types.
## PageUpdateType
Enumerates the page refresh types.
Enumerates the page update types.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
......@@ -106,27 +78,25 @@ Enumerates the touch guide event types.
| Name | Description |
| ---------- | ------------ |
| touchBegin | A touch starts in touch guide mode.|
| touchEnd | A touch ends in touch guide mode.|
| touchBegin | Start of touch in touch guide mode. |
| touchEnd | End of touch in touch guide mode. |
## AccessibilityExtensionAbility.onConnect
onConnect(): void;
Called when the **AccessibilityExtensionAbility** is enabled and connected to the system service. In this API, you can initialize service logic. This API can be overridden as required.
Called when the **AccessibilityExtensionAbility** is enabled and connected to the system service. In this API, you can have the service logic initialized. This API can be overridden as required.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
None
**Example**
```ts
onConnect(): void {
console.log("AxExtensionAbility onConnect");
}
class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility {
onConnect() {
console.log('AxExtensionAbility onConnect');
}
};
```
## AccessibilityExtensionAbility.onDisconnect
......@@ -137,16 +107,14 @@ Called when the **AccessibilityExtensionAbility** is disabled and disconnected f
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
None
**Example**
```ts
onDisconnect(): void {
console.log("AxExtensionAbility onDisconnect");
}
class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility {
onDisconnect() {
console.log('AxExtensionAbility onDisconnect');
}
};
```
## AccessibilityExtensionAbility.onAccessibilityEvent
......@@ -166,19 +134,21 @@ Called when an event that matches the specified bundle and event type occurs. In
**Example**
```ts
onAccessibilityEvent(event: AccessibilityEvent): void {
console.log("AxExtensionAbility onAccessibilityEvent");
if (event.eventType == 'click') {
console.log("AxExtensionAbility onAccessibilityEvent: click");
class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility {
onAccessibilityEvent(event) {
console.log('AxExtensionAbility onAccessibilityEvent');
if (event.eventType == 'click') {
console.log('AxExtensionAbility onAccessibilityEvent: click');
}
}
}
};
```
## AccessibilityExtensionAbility.onKeyEvent
onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean;
onKeyEvent(keyEvent: KeyEvent): boolean;
Called when a physical key is pressed. In this API, you can determine whether to intercept the key event based on the service.
Called when a physical key is pressed. In this API, you can determine whether to intercept an event based on the service.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
......@@ -191,12 +161,14 @@ Called when a physical key is pressed. In this API, you can determine whether to
**Example**
```ts
onKeyEvent(keyEvent: inputEventClient.KeyEvent): boolean {
console.log("AxExtensionAbility onKeyEvent");
if (keyEvent.keyCode == 22) {
console.log("AxExtensionAbility onKeyEvent: intercept 22");
return true;
class MyAccessibilityExtensionAbility extends AccessibilityExtensionAbility {
onKeyEvent(keyEvent) {
console.log('AxExtensionAbility onKeyEvent');
if (keyEvent.keyCode == 22) {
console.log('AxExtensionAbility onKeyEvent: intercept 22');
return true;
}
return false;
}
return false;
}
};
```
# Battery Info
>**NOTE**
>
>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The Battery Info module provides APIs for querying the charger type, battery health status, and battery charging status.
> **NOTE**
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
......@@ -13,67 +12,100 @@ The Battery Info module provides APIs for querying the charger type, battery hea
import batteryInfo from '@ohos.batteryInfo';
```
## System Capabilities
SystemCapability.PowerManager.BatteryManager
## Attributes
Describes battery information.
| Name | Type | Readable | Writable | Description |
| ----------------------------- | ----------------------------------------- | -------- | -------- | ------------------------------------------------------------ |
| batterySOC | number | Yes | No | Battery state of charge (SoC) of the current device, in unit of percentage. |
| chargingStatus | [BatteryChargeState](#batterychargestate) | Yes | No | Battery charging state of the current device. |
| healthStatus | [BatteryHealthState](#batteryhealthstate) | Yes | No | Battery health state of the current device. |
| pluggedType | [BatteryPluggedType](#batterypluggedtype) | Yes | No | Charger type of the current device. |
| voltage | number | Yes | No | Battery voltage of the current device, in unit of microvolt. |
| technology | string | Yes | No | Battery technology of the current device. |
| batteryTemperature | number | Yes | No | Battery temperature of the current device, in unit of 0.1°C. |
| isBatteryPresent<sup>7+</sup> | boolean | Yes | No | Whether the battery is supported or present. |
**Example**
```js
import batteryInfo from '@ohos.batteryInfo';
var batterySoc = batteryInfo.batterySOC;
```
**System capability**: SystemCapability.PowerManager.BatteryManager.Core
| Name | Type | Readable| Writable| Description |
| --------------- | ------------------- | ---- | ---- | ---------------------|
| batterySOC | number | Yes | No | Battery state of charge (SoC) of the device, in unit of percentage. |
| chargingStatus | [BatteryChargeState](#batterychargestate) | Yes | No | Battery charging state of the device. |
| healthStatus | [BatteryHealthState](#batteryhealthstate) | Yes | No | Battery health state of the device. |
| pluggedType | [BatteryPluggedType](#batterypluggedtype) | Yes | No | Charger type of the device. |
| voltage | number | Yes | No | Battery voltage of the device, in unit of microvolt. |
| technology | string | Yes | No | Battery technology of the device. |
| batteryTemperature | number | Yes | No | Battery temperature of the device, in unit of 0.1°C. |
| isBatteryPresent<sup>7+</sup> | boolean | Yes | No | Whether the battery is supported or present. |
| batteryCapacityLevel<sup>9+</sup> | [BatteryCapacityLevel](#batterycapacitylevel9) | Yes | No | Battery level of the device. |
| estimatedRemainingChargeTime<sup>9+</sup> | number | Yes | No | Estimated time for fully charging the current device, in unit of milliseconds. |
| totalEnergy<sup>9+</sup> | number | Yes | No | Total battery capacity of the device, in unit of mAh. This is a system API. |
| nowCurrent<sup>9+</sup> | number | Yes | No | Battery current of the device, in unit of mA. This is a system API. |
| remainingEnergy<sup>9+</sup> | number | Yes | No | Remaining battery capacity of the device, in unit of mAh. This is a system API.|
## BatteryPluggedType
Enumerates charger types.
| Name | Default Value | Description |
| -------- | ------------- | ----------------- |
| NONE | 0 | Unknown type. |
| AC | 1 | AC charger. |
| USB | 2 | USB charger. |
| WIRELESS | 3 | Wireless charger. |
**System capability**: SystemCapability.PowerManager.BatteryManager.Core
| Name | Value | Description |
| -------- | ---- | ----------------- |
| NONE | 0 | Unknown type |
| AC | 1 | AC charger|
| USB | 2 | USB charger |
| WIRELESS | 3 | Wireless charger|
## BatteryChargeState
Enumerates charging states.
| Name | Default Value | Description |
| ------- | ------------- | --------------------------------- |
| NONE | 0 | Unknown state. |
| ENABLE | 1 | The battery is being charged. |
| DISABLE | 2 | The battery is not being charged. |
| FULL | 3 | The battery is fully charged. |
**System capability**: SystemCapability.PowerManager.BatteryManager.Core
| Name | Value | Description |
| ------- | ---- | --------------- |
| NONE | 0 | Unknown state. |
| ENABLE | 1 | The battery is being charged. |
| DISABLE | 2 | The battery is not being charged. |
| FULL | 3 | The battery is fully charged.|
## BatteryHealthState
Enumerates battery health states.
| Name | Default Value | Description |
| ----------- | ------------- | ------------------------------------ |
| UNKNOWN | 0 | Unknown state. |
| GOOD | 1 | The battery is in the healthy state. |
| OVERHEAT | 2 | The battery is overheated. |
| OVERVOLTAGE | 3 | The battery voltage is over high. |
| COLD | 4 | The battery temperature is low. |
| DEAD | 5 | The battery is dead. |
**System capability**: SystemCapability.PowerManager.BatteryManager.Core
| Name | Value | Description |
| ----------- | ---- | -------------- |
| UNKNOWN | 0 | Unknown state. |
| GOOD | 1 | The battery is in the healthy state. |
| OVERHEAT | 2 | The battery is overheated. |
| OVERVOLTAGE | 3 | The battery voltage is over high. |
| COLD | 4 | The battery temperature is low. |
| DEAD | 5 | The battery is dead.|
## BatteryCapacityLevel<sup>9+</sup>
Enumerates battery levels.
**System capability**: SystemCapability.PowerManager.BatteryManager.Core
| Name | Value| Description |
| -------------- | ------ | ---------------------------- |
| LEVEL_NONE | 0 | Unknown battery level. |
| LEVEL_FULL | 1 | Full battery level. |
| LEVEL_HIGH | 2 | High battery level. |
| LEVEL_NORMAL | 3 | Normal battery level.|
| LEVEL_LOW | 4 | Low battery level. |
| LEVEL_CRITICAL | 5 | Ultra-low battery level.|
## CommonEventBatteryChangedCode<sup>9+</sup>
Enumerates keys for querying the additional information about the **COMMON_EVENT_BATTERY_CHANGED** event.
**System capability**: SystemCapability.PowerManager.BatteryManager.Core
| Name | Value| Description |
| -------------------- | ------ | -------------------------------------------------- |
| EXTRA_SOC | 0 | Remaining battery level in percentage. |
| EXTRA_VOLTAGE | 1 | Battery voltage of the device. |
| EXTRA_TEMPERATURE | 2 | Battery temperature of the device. |
| EXTRA_HEALTH_STATE | 3 | Battery health status of the device. |
| EXTRA_PLUGGED_TYPE | 4 | Type of the charger connected to the device. |
| EXTRA_MAX_CURRENT | 5 | Maximum battery current of the device. |
| EXTRA_MAX_VOLTAGE | 6 | Maximum battery voltage of the device. |
| EXTRA_CHARGE_STATE | 7 | Battery charging status of the device. |
| EXTRA_CHARGE_COUNTER | 8 | Number of battery charging times of the device. |
| EXTRA_PRESENT | 9 | Whether the battery is supported by the device or installed.|
| EXTRA_TECHNOLOGY | 10 | Battery technology of the device. |
# Battery Statistics
This module provides APIs for querying software and hardware power consumption statistics.
> **NOTE**
>
> - 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 APIs provided by this module are system APIs.
## Modules to Import
```js
import batteryStats from '@ohos.batteryStatistics';
```
## batteryStats.getBatteryStats
getBatteryStats(): Promise<Array&lt;BatteryStatsInfo&gt;>
Obtains the power consumption information list, using a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryStatistics
**Return value**
| Type | Description |
| ----------------------------------------------------- | ------------------------------- |
| Promise<Array<[BatteryStatsInfo](#batterystatsinfo)>> | Promise used to return the power consumption information list.|
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
| Code| Error Message |
| -------- | -------------- |
| 4600101 | Operation failed. Cannot connect to service.|
**Example**
```js
batteryStats.getBatteryStats()
.then(data => {
console.info('battery statistics info: ' + data);
})
.catch(err => {
console.error('get battery statisitics failed, err: ' + err);
});
```
## batteryStats.getBatteryStats
getBatteryStats(callback: AsyncCallback<Array&lt;BatteryStatsInfo&gt;>): void
Obtains the power consumption information list. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryStatistics
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback<Array<[BatteryStatsInfo](#batterystatsinfo)>> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the array of power consumption information obtained. If the operation failed, **err** is an error object.|
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
| Code| Error Message |
| -------- | -------------- |
| 4600101 | Operation failed. Cannot connect to service.|
**Example**
```js
batteryStats.getBatteryStats((err, data) => {
if (typeof err === 'undefined') {
console.info('battery statistics info: ' + data);
} else {
console.error('get battery statisitics failed, err: ' + err);
}
});
```
## batteryStats.getAppPowerValue
getAppPowerValue(uid: number): number
Obtains the power consumption of an application.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryStatistics
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ----------- |
| uid | number | Yes | Application UID.|
**Return value**
| Type | Description |
| ------ | --------------------------------- |
| number | Power consumption of the application with this UID, in unit of mAh.|
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
| Code| Error Message |
| -------- | -------------- |
| 4600101 | Operation failed. Cannot connect to service.|
**Example**
```js
try {
var value = batteryStats.getAppPowerValue(10021);
console.info('battery statistics value of app is: ' + value);
} catch(err) {
console.error('get battery statisitics value of app failed, err: ' + err);
}
```
## batteryStats.getAppPowerPercent
getAppPowerPercent(uid: number): number
Obtains the proportion of the power consumption of an application.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryStatistics
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ----------- |
| uid | number | Yes | Application UID.|
**Return value**
| Type | Description |
| ------ | ------------------------- |
| number | Proportion of the power consumption of an application with this UID.|
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
| Code| Error Message |
| -------- | -------------- |
| 4600101 | Operation failed. Cannot connect to service.|
**Example**
```js
try {
var percent = batteryStats.getAppPowerPercent(10021);
console.info('battery statistics percent of app is: ' + percent);
} catch(err) {
console.error('get battery statisitics percent of app failed, err: ' + err);
}
```
## batteryStats.getHardwareUnitPowerValue
getHardwareUnitPowerValue(type: ConsumptionType): number
Obtains the power consumption of a hardware unit according to the consumption type.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryStatistics
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ----------------------------------- | ---- | -------------- |
| type | [ConsumptionType](#consumptiontype) | Yes | Power consumption type.|
**Return value**
| Type | Description |
| ------ | ------------------------------------------ |
| number | Power consumption of the hardware unit corresponding to the power consumption type, in unit of mAh.|
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
| Code| Error Message |
| -------- | -------------- |
| 4600101 | Operation failed. Cannot connect to service.|
**Example**
```js
try {
var value = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_SCREEN);
console.info('battery statistics percent of hardware is: ' + percent);
} catch(err) {
console.error('get battery statisitics percent of hardware failed, err: ' + err);
}
```
## batteryStats.getHardwareUnitPowerPercent
getHardwareUnitPowerPercent(type: ConsumptionType): number
Obtains the proportion of the power consumption of a hardware unit according to the power consumption type.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryStatistics
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ----------------------------------- | ---- | -------------- |
| type | [ConsumptionType](#consumptiontype) | Yes | Power consumption type.|
**Return value**
| Type | Description |
| ------ | ---------------------------------- |
| number | Proportion of the power consumption of the hardware unit corresponding to the power consumption type.|
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
| Code| Error Message |
| -------- | -------------- |
| 4600101 | Operation failed. Cannot connect to service.|
**Example**
```js
try {
var value = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN);
console.info('battery statistics percent of hardware is: ' + percent);
} catch(err) {
console.error('get battery statisitics percent of hardware failed, err: ' + err);
}
```
## BatteryStatsInfo
Describes the device power consumption information.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryStatistics
### Attributes
| Name | Type | Readable| Writable| Description |
| ----- | ----------------------------------- | ---- | ---- | ---------------------- |
| uid | number | Yes | No | UID related to power consumption information. |
| type | [ConsumptionType](#consumptiontype) | Yes | No | Power consumption type. |
| power | number | Yes | No | Power consumption, in unit of mAh.|
## ConsumptionType
Enumerates power consumption types.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryStatistics
| Name | Value | Description |
| -------------------------- | ---- | ----------------------------- |
| CONSUMPTION_TYPE_INVALID | -17 | Unknown type. |
| CONSUMPTION_TYPE_APP | -16 | Power consumption of an application. |
| CONSUMPTION_TYPE_BLUETOOTH | -15 | Power consumption of Bluetooth. |
| CONSUMPTION_TYPE_IDLE | -14 | Power consumption when the CPU is idle.|
| CONSUMPTION_TYPE_PHONE | -13 | Power consumption of a phone call. |
| CONSUMPTION_TYPE_RADIO | -12 | Power consumption of wireless communication. |
| CONSUMPTION_TYPE_SCREEN | -11 | Power consumption of the screen. |
| CONSUMPTION_TYPE_USER | -10 | Power consumption of the user. |
| CONSUMPTION_TYPE_WIFI | -9 | Power consumption of Wi-Fi. |
# Bluetooth
# @ohos.bluetooth
The **Bluetooth** module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising.
> **NOTE**<br>
> **NOTE**
>
> 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.
......@@ -202,7 +203,7 @@ Obtains the connection state of a profile.
| Name | Type | Mandatory | Description |
| --------- | --------- | ---- | ------------------------------------- |
| ProfileId | profileId | Yes | ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.|
| ProfileId | profileId | Yes | ID of the profile to obtain, for example, **PROFILE_A2DP_SOURCE**.|
**Return value**
......@@ -1280,10 +1281,6 @@ Obtains the connected devices.
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
No value is returned.
**Return value**
| Type | Description |
......@@ -2695,8 +2692,6 @@ Obtains all services of the remote BLE device. This API uses a promise to return
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
**Return value**
| Type | Description |
......@@ -2830,7 +2825,7 @@ Reads the descriptor contained in the specific characteristic of the remote BLE
| Name | Type | Mandatory | Description |
| ---------- | ---------------------------------------- | ---- | ----------------------- |
| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Descriptor to read. |
| callback | AsyncCallback&lt;[BLECharacteristic](#blecharacteristic)&gt; | Yes | Callback invoked to return the descriptor read.|
| callback | AsyncCallback&lt;[BLEDescriptor](#bledescriptor)&gt; | Yes | Callback invoked to return the descriptor read.|
**Return value**
......@@ -3309,7 +3304,7 @@ Enumerates the scan modes.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| ---------------------------------------- | ---- | --------------- |
| SCAN_MODE_NONE | 0 | No scan mode. |
| SCAN_MODE_CONNECTABLE | 1 | Connectable mode. |
......@@ -3324,7 +3319,7 @@ Enumerates the pairing states.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| ------------------ | ---- | ------ |
| BOND_STATE_INVALID | 0 | Invalid pairing.|
| BOND_STATE_BONDING | 1 | Pairing. |
......@@ -3350,7 +3345,7 @@ Enumerates the SPP link types.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| ---------- | ---- | ------------- |
| SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.|
......@@ -3510,7 +3505,7 @@ Enumerates the profile connection states.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| ------------------- | ---- | -------------- |
| STATE_DISCONNECTED | 0 | Disconnected. |
| STATE_CONNECTING | 1 | Connecting.|
......@@ -3558,7 +3553,7 @@ Enumerates the scan duty options.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| --------------------- | ---- | ------------ |
| SCAN_MODE_LOW_POWER | 0 | Low-power mode, which is the default value.|
| SCAN_MODE_BALANCED | 1 | Balanced mode. |
......@@ -3571,7 +3566,7 @@ Enumerates the hardware match modes of BLE scan filters.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| --------------------- | ---- | ---------------------------------------- |
| MATCH_MODE_AGGRESSIVE | 1 | Hardware reports the scan result with a lower threshold of signal strength and few number of matches in a duration. This is the default value.|
| MATCH_MODE_STICKY | 2 | Hardware reports the scan result with a higher threshold of signal strength and sightings. |
......@@ -3596,7 +3591,7 @@ Enumerates the Bluetooth states.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| --------------------- | ---- | ------------------ |
| STATE_OFF | 0 | Bluetooth is turned off. |
| STATE_TURNING_ON | 1 | Bluetooth is being turned on. |
......@@ -3641,7 +3636,7 @@ Defines the content of a BLE advertisement packet.
| Name | Type | Readable | Writable | Description |
| ---------------- | ------------------- | ---- | ---- | ------------------ |
| manufactureId | Array&lt;string&gt; | Yes | Yes | Manufacturer ID allocated by the Bluetooth SIG.|
| manufactureId | number | Yes | Yes | Manufacturer ID allocated by the Bluetooth SIG.|
| manufactureValue | ArrayBuffer | Yes | Yes | Manufacturer data. |
......@@ -3713,7 +3708,7 @@ Enumerates the major classes of Bluetooth devices.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| ------------------- | ------ | ---------- |
| MAJOR_MISC | 0x0000 | Miscellaneous device. |
| MAJOR_COMPUTER | 0x0100 | Computer. |
......@@ -3734,7 +3729,7 @@ Enumerates the major and minor classes of Bluetooth devices.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| ---------------------------------------- | ------ | --------------- |
| COMPUTER_UNCATEGORIZED | 0x0100 | Unclassified computer. |
| COMPUTER_DESKTOP | 0x0104 | Desktop computer. |
......@@ -3830,7 +3825,7 @@ Enumerates the A2DP playing states.
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| ----------------- | ------ | ------- |
| STATE_NOT_PLAYING | 0x0000 | Not playing. |
| STATE_PLAYING | 0x0001 | Playing.|
......@@ -3842,9 +3837,9 @@ Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOS
**System capability**: SystemCapability.Communication.Bluetooth.Core
| Name | Default Value | Description |
| Name | Value | Description |
| -------------------------------- | ------ | --------------- |
| PROFILE_A2DP_SOURCE | 0x0001 | A2DP profile.|
| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 0x0004 | HFP profile. |
| PROFILE_HID_HOST<sup>9+</sup> | 0x0006 | Human Interface Device (HID) profile. |
| PROFILE_PAN_NETWORK<sup>9+</sup> | 0x0007 | PAN profile. |
| PROFILE_A2DP_SOURCE | 1 | A2DP profile.|
| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | HFP profile. |
| PROFILE_HID_HOST<sup>9+</sup> | 6 | Human Interface Device (HID) profile. |
| PROFILE_PAN_NETWORK<sup>9+</sup> | 7 | PAN profile. |
# Brightness
> ![icon-note.gif](public_sys-resources/icon-note.gif) **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.
# Screen Brightness
The Brightness module provides an API for setting the screen brightness.
> **NOTE**
>
> - 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 APIs provided by this module are system APIs.
## Modules to Import
......@@ -18,18 +20,30 @@ setValue(value: number): void
Sets the screen brightness.
This is a system API and cannot be called by third-party applications.
**System API**: This is a system API.
**System capability:** SystemCapability.PowerManager.DisplayPowerManager
**System capability**: SystemCapability.PowerManager.DisplayPowerManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----------- |
| value | number | Yes | Brightness value, ranging from **0** to **255**.|
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ----------------------- |
| value | number | Yes | Brightness value. The value ranges from 0 to 255.|
**Error codes**
For details about the error codes, see [Screen Brightness Error Codes](../errorcodes/errorcode-brightness.md).
| Code | Error Message |
|---------|---------|
| 4700101 | Operation failed. Cannot connect to service.|
**Example**
```js
brightness.setValue(128);
try {
brightness.setValue(128);
} catch(err) {
console.error('set brightness failed, err: ' + err);
}
```
# Standard NFC Card Emulation
# @ohos.nfc.cardEmulation
The **cardEmulation** module implements Near-Field Communication (NFC) card emulation. You can use the APIs provided by this module to determine the card emulation type supported and implement Host-based Card Emulation (HCE).
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```
......@@ -18,7 +18,7 @@ Enumerates the NFC card emulation types.
**System capability**: SystemCapability.Communication.NFC.Core
| Name| Default Value| Description|
| Name| Value| Description|
| -------- | -------- | -------- |
| HCE | 0 | HCE.|
| UICC | 1 | Subscriber identity module (SIM) card emulation.|
......@@ -30,8 +30,6 @@ isSupported(feature: number): boolean
Checks whether a certain type of card emulation is supported.
**Required permissions**: ohos.permission.NFC_CARD_EMULATION
**System capability**: SystemCapability.Communication.NFC.Core
**Parameters**
......@@ -42,9 +40,9 @@ Checks whether a certain type of card emulation is supported.
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the card emulation type is supported; returns **false** otherwise.|
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the card emulation type is supported; returns **false** otherwise.|
## HceService<sup>8+</sup>
......
# Active Tag
# @ohos.connectedTag
The **connectedTag** module provides methods for using active tags. You can use the APIs provided by this module to initialize the active tag chip and read and write active tags.
The **connectedTag** module provides APIs for using active tags. You can use the APIs to initialize the active tag chip and read and write active tags.
> **NOTE**<br>
> **NOTE**
>
> 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.
## Modules to Import
```
```js
import connectedTag from '@ohos.connectedTag';
```
## connectedTag.init
init(): boolean
......@@ -23,11 +22,11 @@ Initializes the active tag chip.
**System capability**: SystemCapability.Communication.ConnectedTag
- Return value
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the initialization is successful; returns **false** otherwise.|
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## connectedTag.uninit
......@@ -39,125 +38,136 @@ Uninitializes the active tag resources.
**System capability**: SystemCapability.Communication.ConnectedTag
- Return value
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
## connectedTag.readNdefTag
readNdefTag(): Promise&lt;string&gt;
Reads the content of this active tag. This method uses a promise to return the result.
Reads the content of this active tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
- Return value
| **Type**| **Description**|
| -------- | -------- |
| Promise&lt;string&gt; | Promise used to return the content of the active tag.|
**Return value**
- Example
```
import connectedTag from '@ohos.connectedTag';
| **Type**| **Description**|
| -------- | -------- |
| Promise&lt;string&gt; | Promise used to return the content of the active tag.|
connectedTag.readNdefTag().then(result => {
console.log("promise recv ndef response: " + result);
});
```
**Example**
```js
import connectedTag from '@ohos.connectedTag';
connectedTag.readNdefTag().then((data) => {
console.log("connectedTag readNdefTag Promise data = " + data);
}).catch((err)=> {
console.log("connectedTag readNdefTag Promise err: " + err);
});
```
## connectedTag.readNdefTag
readNdefTag(callback: AsyncCallback&lt;string&gt;): void
Reads the content of this active tag. This method uses an asynchronous callback to return the result.
Reads the content of this active tag. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the active tag content obtained.|
**Parameters**
- Example
```
import connectedTag from '@ohos.connectedTag';
connectedTag.readNdefTag(result => {
console.log("callback recv ndef response: " + result);
});
```
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the active tag content obtained.|
**Example**
```js
import connectedTag from '@ohos.connectedTag';
connectedTag.readNdefTag((err, data)=> {
if (err) {
console.log("connectedTag readNdefTag AsyncCallback err: " + err);
} else {
console.log("connectedTag readNdefTag AsyncCallback data: " + data);
}
});
```
## connectedTag.writeNdefTag
writeNdefTag(data: string): Promise&lt;void&gt;
Writes data to this active tag. This method uses a promise to return the result.
Writes data to this active tag. This API uses a promise to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| data | string | Yes| Data to write. The maximum length is 1024 bytes.|
- Return value
| **Type**| **Description**|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result. This method returns no value.|
- Example
```
import connectedTag from '@ohos.connectedTag';
writeNdefTag.write("010203")
.then((value) => {
// Data is written to the tag.
console.log(`success to write event: ${value}`);
}).catch((err) => {
// Failed to write data to the tag.
console.error(`failed to write event because ${err.code}`);
});
```
**Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| data | string | Yes| Data to write. The maximum length is 1024 bytes.|
**Return value**
| **Type**| **Description**|
| -------- | -------- |
| Promise&lt;void&gt; | Promise that returns no value.|
**Example**
```js
import connectedTag from '@ohos.connectedTag';
var rawData = "010203"; // change it tobe correct.
connectedTag.writeNdefTag(rawData).then(() => {
console.log("connectedTag writeNdefTag Promise success.");
}).catch((err)=> {
console.log("connectedTag writeNdefTag Promise err: " + err);
});
```
## connectedTag.writeNdefTag
writeNdefTag(data: string, callback: AsyncCallback&lt;void&gt;): void
Writes data to this active tag. This method uses an asynchronous callback to return the result.
Writes data to this active tag. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.NFC_TAG
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| data | string | Yes| Data to write. The maximum length is 1024 bytes.|
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the active tag content obtained.|
- Example
```
import connectedTag from '@ohos.connectedTag';
connectedTag.writeNdefTag("010203", (err, value) => {
if (err) {
// Failed to write data to the tag.
console.error(`failed to write event because ${err.code}`);
return;
}
// Data is written to the tag.
console.log(`success to write event: ${value}`);
});
```
**Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| data | string | Yes| Data to write. The maximum length is 1024 bytes.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the active tag content obtained.|
**Example**
```js
import connectedTag from '@ohos.connectedTag';
var rawData = "010203"; // change it tobe correct.
connectedTag.writeNdefTag(rawData, (err)=> {
if (err) {
console.log("connectedTag writeNdefTag AsyncCallback err: " + err);
} else {
console.log("connectedTag writeNdefTag AsyncCallback success.");
}
});
```
## connectedTag.on('notify')
......@@ -169,18 +179,12 @@ Registers the NFC field strength state events.
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **notify**.|
| callback | Callback&lt;number&gt; | Yes| Callback invoked to return the field strength state.|
- Enumerates the field strength states.
| **Value**| **Description**|
| -------- | -------- |
| 0 | Field off.|
| 1 | Field on.|
**Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **notify**.|
| callback | Callback&lt;number&gt; | Yes| Callback used to return the [NfcRfType](#nfcrftype).|
## connectedTag.off('notify')
......@@ -192,36 +196,54 @@ Unregisters the NFC field strength state events.
**System capability**: SystemCapability.Communication.ConnectedTag
- Parameters
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **notify**.|
| callback | Callback&lt;number&gt; | No| Callback used to return the field strength state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
- Example
```
import connectedTag from '@ohos.connectedTag';
var NFC_RF_NOTIFY = "notify";
var recvNfcRfNotifyFunc = result => {
console.info("nfc rf receive state: " + result);
}
// Register event notification.
connectedTag.on(NFC_RF_NOTIFY, recvNfcRfNotifyFunc);
// Unregister event notification.
connectedTag.off(NFC_RF_NOTIFY, recvNfcRfNotifyFunc);
```
**Parameters**
| **Name**| **Type**| **Mandatory**| **Description**|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value is **notify**.|
| callback | Callback&lt;number&gt; | No| Callback used to return the field strength state. If this parameter is not specified, all callbacks associated with the specified event will be unregistered.|
**Example**
```js
import connectedTag from '@ohos.connectedTag';
// Register the event.
connectedTag.on("notify", (err, rfState)=> {
if (err) {
console.log("connectedTag on Callback err: " + err);
} else {
console.log("connectedTag on Callback rfState: " + rfState);
}
});
var initStatus = connectedTag.init();
console.log("connectedTag init status: " + initStatus);
// Add nfc connecected tag business oprations here...
// connectedTag.writeNdefTag(rawData)
// connectedTag.readNdefTag()
var uninitStatus = connectedTag.uninit();
console.log("connectedTag uninit status: " + uninitStatus);
// Unregister the event.
connectedTag.off("notify", (err, rfState)=> {
if (err) {
console.log("connectedTag off Callback err: " + err);
} else {
console.log("connectedTag off Callback rfState: " + rfState);
}
});
```
## NfcRfType
Enumerates the NFC states.
Enumerates the NFC field strength states.
**System capability**: SystemCapability.Communication.ConnectedTag
| Name| Default Value| Description|
| Name| Value| Description|
| -------- | -------- | -------- |
| NFC_RF_LEAVE | 0 | Field on.|
| NFC_RF_LEAVE | 0 | Field off.|
| NFC_RF_ENTER | 1 | Field on.|
# Value Bucket
# @ohos.data.ValuesBucket
The **ValueBucket** module holds data in key-value (KV) pairs. You can use it to insert data into a database.
......
# Device Usage Statistics
# @ohos.deviceUsageStatistics (Device Usage Statistics)
This module provides APIs for collecting statistics on device usage.
......@@ -487,7 +487,7 @@ Enumerates the interval types for querying the application usage duration.
**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App
| Name | Default Value | Description |
| Name | Value | Description |
| ------------ | ---- | ---------------------------------------- |
| BY_OPTIMIZED | 0 | The system obtains the application usage duration statistics in the specified time frame at the interval the system deems appropriate.|
| BY_DAILY | 1 | The system obtains the application usage duration statistics in the specified time frame on a daily basis. |
......
# Distributed Account Management
# @ohos.account.distributedAccount
The **distributedAccount** module provides APIs for managing distributed accounts, including querying and updating account login status.
The **distributedAccount** module provides APIs for managing distributed accounts, including querying and updating account login states.
> **NOTE**<br>
> **NOTE**
>
> 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.
......@@ -49,7 +49,7 @@ Obtains distributed account information. This API uses an asynchronous callback
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **undefined** and data is the distributed account information obtained. Otherwise, **err** is an error object.|
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the distributed account information obtained. Otherwise, **err** is an error object.|
**Error codes**
......@@ -124,7 +124,7 @@ Obtains distributed account information. This API uses an asynchronous callback
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **undefined** and data is the distributed account information obtained. Otherwise, **err** is an error object.|
| callback | AsyncCallback&lt;[DistributedInfo](#distributedinfo)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the distributed account information obtained. Otherwise, **err** is an error object.|
**Example**
```js
......@@ -181,7 +181,7 @@ Sets the distributed account information. This API uses an asynchronous callback
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| accountInfo | [DistributedInfo](#distributedinfo) | Yes| New distributed account information.|
| accountInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the distributed account information is set successfully, **err** is **undefined**. Otherwise, **err** is an error object.|
**Error codes**
......@@ -219,7 +219,7 @@ Sets the distributed account information. This API uses a promise to return the
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| accountInfo | [DistributedInfo](#distributedinfo) | Yes| New distributed account information.|
| accountInfo | [DistributedInfo](#distributedinfo) | Yes| Distributed account information to set.|
**Return value**
......@@ -322,7 +322,7 @@ Defines distributed OS account information.
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the distributed account. It must be a non-null string.|
| id | string | Yes| UID of the distributed account. It must be a non-null string.|
| event | string | Yes| Login state of a distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:<br>-&nbsp;Ohos.account.event.LOGIN<br>-&nbsp;Ohos.account.event.LOGOUT<br>-&nbsp;Ohos.account.event.TOKEN_INVALID<br>-&nbsp;Ohos.account.event.LOGOFF |
| event | string | Yes| Login state of the distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:<br>-&nbsp;Ohos.account.event.LOGIN<br>-&nbsp;Ohos.account.event.LOGOUT<br>-&nbsp;Ohos.account.event.TOKEN_INVALID<br>-&nbsp;Ohos.account.event.LOGOFF |
| nickname<sup>9+</sup> | string | No| Nickname of the distributed account. It must be a non-null string.|
| avatar<sup>9+</sup> | string | No| Avatar of the distributed account. It must be a non-null string.|
| scalableData | object | No| Extended information about the distributed account, passed in key-value (KV) pairs.<br>**NOTE**<br>This parameter is reserved and not used in query and update methods.|
| scalableData | object | No| Extended information about the distributed account, passed in key-value (KV) pairs.<br>**NOTE**<br>This parameter is reserved and not used in the setters and getters.|
# Device Usage Statistics
# @ohos.resourceschedule.usageStatistics (Device Usage Statistics)
This module provides APIs for collecting statistics on device usage.
......@@ -703,7 +703,7 @@ Queries FA usage records. This API uses an asynchronous callback to return a max
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ----------------------------------- |
| callback | AsyncCallback&lt;Array&lt;[HapModuleInfo](#hapmoduleinfo)&gt;&gt; | Yes | Callback used to return a maximum of 1000 FA usage records.|
| callback | AsyncCallback&lt;Array&lt;[HapModuleInfo](#hapmoduleinfo)&gt;&gt; | Yes | Callback used to return a maximum of **maxNum** FA usage records.|
**Error codes**
......
# WLAN
# @ohos.wifiext
This **wifiext** module provides WLAN extension interfaces for non-universal products.
> **NOTE**<br>
> **NOTE**
>
> 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 APIs described in this document are used only for non-universal products, such as routers.
......@@ -69,7 +71,7 @@ Enumerates the power models.
**System capability**: SystemCapability.Communication.WiFi.AP.Extension
| Name| Default Value| Description|
| Name| Value| Description|
| -------- | -------- | -------- |
| SLEEPING | 0 | Sleeping|
| GENERAL | 1 | General|
......@@ -90,7 +92,7 @@ Obtains the supported power models. This API uses an asynchronous callback to re
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is 0 and **data** is the power models obtained. If **err** is not **0**, an error has occurred.|
| callback | AsyncCallback&lt;Array&lt;[PowerModel](#powermodel)&gt;&gt; | Yes| Callback invoked to return the result. If the operation is successful, **err** is 0 and **data** is the power models obtained. If **err** is not **0**, an error has occurred.|
## wifiext.getPowerModel
......@@ -141,7 +143,7 @@ setPowerModel(model: PowerModel) : boolean;
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| model | AsyncCallback&lt;[PowerModel](#powermodel)&gt; | Yes| Power model to set.|
| model | [PowerModel](#powermodel) | Yes| Power model to set.|
**Return value**
......
......@@ -593,7 +593,7 @@ KVStore数据库类型枚举。
| --- | ---- | ----------------------- |
| DEVICE_COLLABORATION | 0 | 表示多设备协同数据库。<br> **数据库特点:** 数据以设备的维度管理,不存在冲突;支持按照设备的维度查询数据。<br>**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore |
| SINGLE_VERSION | 1 | 表示单版本数据库。<br> **数据库特点:** 数据不分设备,设备之间修改相同的key会覆盖。 <br>**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core |
| MULTI_VERSION | 2 | 表示多版本数据库。此类型当前不允许使用<br>**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore |
| MULTI_VERSION | 2 | 表示多版本数据库。当前暂不支持使用此接口<br>**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore |
## SecurityLevel
......
......@@ -10,6 +10,6 @@
| 名称 | 可读 | 可写 | 类型 | 必填 | 说明 |
| ----------- | -------- |-------- | -------------------- | ---- | ------------------------------------------------------------ |
| resultCode | 是 | 否 | number | | 表示ability拉起、销毁之后返回的结果码。 |
| resultCode | 是 | 否 | number | | 表示ability拉起、销毁之后返回的结果码。 |
| want | 是 | 否 | [Want](./js-apis-app-ability-want.md) | 否 | 表示ability销毁之后返回的数据。 |
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册