diff --git a/en/application-dev/reference/apis/js-apis-battery-info.md b/en/application-dev/reference/apis/js-apis-battery-info.md index 0ea9e33b560ba3a4c368e345924a21268e1c9449..a84c0cb9477cbdbbee02eba14c041fe18c7c8d29 100644 --- a/en/application-dev/reference/apis/js-apis-battery-info.md +++ b/en/application-dev/reference/apis/js-apis-battery-info.md @@ -3,6 +3,9 @@ >![](../../public_sys-resources/icon-note.gif) **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. + + ## Modules to Import ``` @@ -274,4 +277,3 @@ Enumerates battery health states. - diff --git a/en/application-dev/reference/apis/js-apis-brightness.md b/en/application-dev/reference/apis/js-apis-brightness.md index c573b79ab8f0af4128f4cbf950167607a7935baa..55ad71e3dd1a97d5ba65c07e51bf1639df999f46 100644 --- a/en/application-dev/reference/apis/js-apis-brightness.md +++ b/en/application-dev/reference/apis/js-apis-brightness.md @@ -1,54 +1,35 @@ -# Brightness +# Brightness ->![icon-note.gif](public_sys-resources/icon-note.gif) **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. +> ![icon-note.gif](public_sys-resources/icon-note.gif) **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. -## Modules to Import +The Brightness module provides an API for setting the screen brightness. + + +## Modules to Import ``` import brightness from '@ohos.brightness'; ``` -## System Capabilities +## brightness.setValue -SystemCapability.PowerManager.DisplayPowerManager +setValue(value: number) -## brightness.setValue +Sets the screen brightness. -setValue\(value: number\) +**System capability:** SystemCapability.PowerManager.DisplayPowerManager -Sets the screen brightness. +**Note:** This is a system API and it is used only for system applications. -- Parameters - - - - - - - - - - - - - - -

Name

-

Type

-

Mandatory

-

Description

-

value

-

number

-

Yes

-

Brightness value, ranging from 0 to 255

-
- -- Example - - ``` - import brightness from '@ohos.brightness.d.ts'; - brightness.setValue(128); - ``` +**Parameters** +| Name | Type | Mandatory | Description | +| ----- | ------ | ---- | ----------- | +| value | number | Yes | Brightness value, ranging from 0 to 255.| +**Example** + +``` +brightness.setValue(128); +``` diff --git a/en/application-dev/reference/apis/js-apis-power.md b/en/application-dev/reference/apis/js-apis-power.md index 6cd3cbf21a44e593a4b3abfd367987dabfbbf805..b45c98571491a349c3771f3527c8fe1b41a418c8 100644 --- a/en/application-dev/reference/apis/js-apis-power.md +++ b/en/application-dev/reference/apis/js-apis-power.md @@ -1,8 +1,10 @@ -# Power Management +# Power Manager > ![icon-note.gif](public_sys-resources/icon-note.gif) **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 Power Manager module provides APIs for rebooting and shutting down the system, as well as querying the screen status. + ## Modules to Import @@ -12,7 +14,7 @@ import power from '@ohos.power'; ## System Capabilities -SystemCapability.PowerManager.PowerManager +SystemCapability.PowerManager.PowerManager.Core ## power.shutdownDevice @@ -21,13 +23,15 @@ shutdownDevice(reason: string): void Shuts down the system. -Before using this API, you must declare the **ohos.permission.SHUTDOWN** permission. +**Required permission:** ohos.permission.SHUTDOWN + +**Note:** This is a system API and it is used only for system applications. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| reason | string | Yes| Reason for system shutdown.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ----- | +| reason | string | Yes | Reason for system shutdown.| **Example** @@ -43,13 +47,13 @@ rebootDevice(reason: string): void Restarts the device. -Before using this API, you must declare the **ohos.permission.REBOOT** permission (to reboot) or the **ohos.permission.REBOOT_RECOVERY** permission (to reboot and enter the recovery mode) +**Required permission:** ohos.permission.REBOOT (to reboot) or ohos.permission.REBOOT_UPDATER (to reboot and enter the updater mode) **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| reason | string | Yes| Reason for system reboot.| +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ----- | +| reason | string | Yes | Reason for system reboot.| **Example** @@ -67,9 +71,9 @@ Checks the screen status of the current device. **Parameters** -| Type| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to obtain the return value.
The value **true** indicates that the screen is on, and value **false** indicates the opposite.| +| Type | Type | Mandatory | Description | +| -------- | ---------------------------- | ---- | ---------------------------------------- | +| callback | AsyncCallback<boolean> | Yes | Callback used to obtain the return value.
Return value: The value **true** indicates that the screen is on, and the value **false** indicates the opposite.| **Example** @@ -90,10 +94,10 @@ isScreenOn(): Promise<boolean> Checks the screen status of the current device. -**Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to asynchronously obtain the return value.
The value **true** indicates that the screen is on, and value **false** indicates the opposite.| +**Return Value** +| Type | Description | +| ---------------------- | --------------------------------------- | +| Promise<boolean> | Promise used to asynchronously obtain the return value.
Return value: The value **true** indicates that the screen is on, and the value **false** indicates the opposite.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-runninglock.md b/en/application-dev/reference/apis/js-apis-runninglock.md index beefced18a8644010ac28c30c1e40a902e5e6cb2..57069c98f28570ac308bbc34e26f803e8e906283 100644 --- a/en/application-dev/reference/apis/js-apis-runninglock.md +++ b/en/application-dev/reference/apis/js-apis-runninglock.md @@ -3,41 +3,42 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **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 Running Lock module provides APIs for creating, querying, holding, and releasing running locks. + ## Modules to Import ``` -import runninglock from '@ohos.runningLock'; +import runningLock from '@ohos.runningLock'; ``` -## System Capabilities - -SystemCapability.PowerManager.PowerManager - - ## RunningLockType Enumerates the types of **RunningLock** objects. -| Name| Default Value| Description| -| -------- | -------- | -------- | -| BACKGROUND | 1 | Defines a **RunningLock** object.| -| PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen.| +**System capability:** SystemCapability.PowerManager.PowerManager.Core + +| Name | Default Value | Description | +| ------------------------ | ---- | ------------------- | +| BACKGROUND | 1 | Defines a **RunningLock** object. | +| PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen.| ## isRunningLockTypeSupported isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boolean>): void -Checks whether a specified type of RunningLock is supported. This function uses an asynchronous callback to return the result. +Checks whether a specified type of **RunningLock** is supported. This function uses an asynchronous callback to return the result. + +**System capability:** SystemCapability.PowerManager.PowerManager.Core **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | RunningLockType | Yes| Type of the **RunningLock** object.| -| callback | AsyncCallback<boolean> | Yes| Callback used to obtain the return value.
The value **true** indicates that the specified type of **RunningLock** is supported, and value **false** indicates the opposite.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------- | ---- | ---------------------------------------- | +| type | RunningLockType | Yes | Type of the **RunningLock** object. | +| callback | AsyncCallback<boolean> | Yes | Callback used to obtain the return value.
Return value: The value **true** indicates that the specified type of **RunningLock** is supported, and the value **false** indicates the opposite.| **Example** @@ -58,17 +59,19 @@ isRunningLockTypeSupported(type: RunningLockType): Promise<boolean> Checks whether a specified type of **RunningLock** is supported. This function uses an asynchronous callback to return the result. +**System capability:** SystemCapability.PowerManager.PowerManager.Core + **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | RunningLockType | Yes| Type of the **RunningLock** object.| +| Name | Type | Mandatory | Description | +| ---- | --------------- | ---- | ---------- | +| type | RunningLockType | Yes | Type of the **RunningLock** object.| -**Return value** +**Return Value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to asynchronously obtain the return value. The value **true** indicates that the specified type of **RunningLock** is supported, and value **false** indicates the opposite.| +| Type | Description | +| ---------------------- | ---------------------------------------- | +| Promise<boolean> | Promise used to asynchronously obtain the return value.
Return value: The value **true** indicates that the specified type of **RunningLock** is supported, and the value **false** indicates the opposite.| **Example** @@ -89,15 +92,17 @@ createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback&l Creates a **RunningLock** object. -Before using this API, you must declare the **ohos.permission.RUNNING_LOCK** permission. +**System capability:** SystemCapability.PowerManager.PowerManager.Core + +**Required permission:** ohos.permission.RUNNING_LOCK **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| name | string | Yes| Name of the **RunningLock** object.| -| type | RunningLockType | Yes| Type of the **RunningLock** object to be created.| -| callback | AsyncCallback<[RunningLock](#runninglock)> | Yes| Callback used to obtain the return value.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | -------------------------------------- | +| name | string | Yes | Name of the **RunningLock** object. | +| type | RunningLockType | Yes | Type of the **RunningLock** object to be created. | +| callback | AsyncCallback<[RunningLock](#runninglock)> | Yes | Callback used to obtain the return value.| **Example** @@ -122,19 +127,21 @@ createRunningLock(name: string, type: RunningLockType): Promise<RunningLock&g Creates a **RunningLock** object. -Before using this API, you must declare the **ohos.permission.RUNNING_LOCK** permission. +**System capability:** SystemCapability.PowerManager.PowerManager.Core + +**Required permission:** ohos.permission.RUNNING_LOCK **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| name | string | Yes| Name of the **RunningLock** object.| -| type | RunningLockType | Yes| Type of the **RunningLock** object to be created.| +| Name | Type | Mandatory | Description | +| ---- | --------------- | ---- | --------- | +| name | string | Yes | Name of the **RunningLock** object. | +| type | RunningLockType | Yes | Type of the **RunningLock** object to be created.| -**Return value** +**Return Value** -| Type| Description| -| -------- | -------- | +| Type | Description | +| ---------------------------------------- | ---------------------------------- | | Promise<[RunningLock](#runninglock)> | Promise used to asynchronously obtain the returned **RunningLock** object.| **Example** @@ -161,11 +168,13 @@ lock(timeout: number): void Locks and holds a **RunningLock** object. +**System capability:** SystemCapability.PowerManager.PowerManager.Core + **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| timeout | number | No| Duration for locking and holding the **RunningLock** object.| +| Name | Type | Mandatory | Description | +| ------- | ------ | ---- | -------------------- | +| timeout | number | No | Duration for locking and holding the **RunningLock** object.| **Example** @@ -187,6 +196,8 @@ unlock(): void Releases a **Runninglock** object. +**System capability:** SystemCapability.PowerManager.PowerManager.Core + **Example** ``` @@ -207,9 +218,11 @@ isUsed(): boolean Checks the status of the **Runninglock** object. -**Return value** -| Type| Description| -| -------- | -------- | +**System capability:** SystemCapability.PowerManager.PowerManager.Core + +**Return Value** +| Type | Description | +| ------- | ------------------------------------- | | boolean | Returns **true** if the **Runninglock** object is held; returns **false** if the **Runninglock** object is released.| **Example**