From 6450b4bd355cda226205a6015c466cb88bd02619 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Fri, 10 Mar 2023 11:47:32 +0800 Subject: [PATCH] update doc Signed-off-by: shawn_he --- .../apis/js-apis-batteryStatistics.md | 4 +-- .../reference/apis/js-apis-system-battery.md | 14 +++++--- .../apis/js-apis-system-brightness.md | 35 ++++++++++++------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-batteryStatistics.md b/en/application-dev/reference/apis/js-apis-batteryStatistics.md index 89cd4ab39e..c2969b0248 100644 --- a/en/application-dev/reference/apis/js-apis-batteryStatistics.md +++ b/en/application-dev/reference/apis/js-apis-batteryStatistics.md @@ -203,7 +203,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod ```js try { var value = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_SCREEN); - console.info('battery statistics percent of hardware is: ' + percent); + console.info('battery statistics value of hardware is: ' + value); } catch(err) { console.error('get battery statistics percent of hardware failed, err: ' + err); } @@ -243,7 +243,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod ```js try { - var value = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN); + var percent = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN); console.info('battery statistics percent of hardware is: ' + percent); } catch(err) { console.error('get battery statistics percent of hardware failed, err: ' + err); diff --git a/en/application-dev/reference/apis/js-apis-system-battery.md b/en/application-dev/reference/apis/js-apis-system-battery.md index d673a50002..25af13c0c3 100644 --- a/en/application-dev/reference/apis/js-apis-system-battery.md +++ b/en/application-dev/reference/apis/js-apis-system-battery.md @@ -44,7 +44,9 @@ battery.getStatus({ ## GetStatusOptions -Object that contains the API calling result. +Obtains the object that contains the API calling result. + +**System capability**: SystemCapability.PowerManager.BatteryManager.Core | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ | @@ -56,7 +58,9 @@ Object that contains the API calling result. Defines a response that returns the charging status and remaining power of the device. -| Name| Type| Description| -| -------- | -------- | -------- | -| charging | boolean | Whether the battery is being charged.| -| level | number | Current battery level, which ranges from **0.00** to **1.00**.| +**System capability**: SystemCapability.PowerManager.BatteryManager.Core + +| Name| Type| Readable | Writable | Description| +| -------- | -------- | -------- | -------- | -------- | +| charging | boolean | Yes | No | Whether the battery is being charged.| +| level | number | Yes | No | Current battery level, which ranges from **0.00** to **1.00**.| diff --git a/en/application-dev/reference/apis/js-apis-system-brightness.md b/en/application-dev/reference/apis/js-apis-system-brightness.md index 939e7d7021..bfe2cb2960 100644 --- a/en/application-dev/reference/apis/js-apis-system-brightness.md +++ b/en/application-dev/reference/apis/js-apis-system-brightness.md @@ -45,7 +45,7 @@ Obtains the current screen brightness. ## brightness.setValue -etValue(options?: SetBrightnessOptions): void +setValue(options?: SetBrightnessOptions): void Sets the screen brightness. @@ -74,7 +74,7 @@ Sets the screen brightness. ## brightness.getMode -getMode(options?: GetBrightnessModeOptions: void +getMode(options?: GetBrightnessModeOptions): void Obtains the screen brightness adjustment mode. @@ -132,7 +132,8 @@ Sets the screen brightness adjustment mode. setKeepScreenOn(options?: SetKeepScreenOnOptions): void ->This API is no longer maintained since API version 7. It is recommended that you use [window.setKeepScreenOn](js-apis-window.md#setkeepscreenon) instead. +> NOTE +> This API is no longer maintained since API version 7. It is recommended that you use [window.setKeepScreenOn](js-apis-window.md#setkeepscreenon) instead. Sets whether to always keep the screen on. Call this API in **onShow()**. @@ -161,6 +162,8 @@ Sets whether to always keep the screen on. Call this API in **onShow()**. Defines the options for obtaining the screen brightness. +**System capability**: SystemCapability.PowerManager.DisplayPowerManager + | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | success | (data: [BrightnessResponse](#brightnessresponse)) => void | No | Called when API call is successful. **data** is a return value of the [BrightnessResponse](#brightnessresponse) type.| @@ -171,6 +174,8 @@ Defines the options for obtaining the screen brightness. Defines the options for setting the screen brightness. +**System capability**: SystemCapability.PowerManager.DisplayPowerManager + | Name | Type | Mandatory| Description | | -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | | value | number | Yes | Screen brightness. The value is an integer ranging from **1** to **255**.
- If the value is less than or equal to **0**, value **1** will be used.
- If the value is greater than **255**, value **255** will be used.
- If the value contains decimals, the integral part of the value will be used. For example, if value **8.1** is set, value **8** will be used.| @@ -182,13 +187,15 @@ Defines the options for setting the screen brightness. Defines a response that returns the screen brightness. -| Parameter| Type | Description| -| -------- | -------- | -------- | -| value | number | Screen brightness. The value ranges from 1 to 255.| +| Parameter| Type | Readable | Writable | Description| +| -------- | -------- | -------- | -------- | -------- | +| value | number | Yes | No | Screen brightness. The value ranges from 1 to 255.| ## GetBrightnessModeOptions -Defines the options for obtaining the screen brightness mode. +Gets the options of the screen brightness mode. + +**System capability**: SystemCapability.PowerManager.DisplayPowerManager | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | @@ -198,7 +205,9 @@ Defines the options for obtaining the screen brightness mode. ## SetBrightnessModeOptions -Defines the options for setting the screen brightness mode. +Sets the options of the screen brightness mode. + +**System capability**: SystemCapability.PowerManager.DisplayPowerManager | Name | Type | Mandatory| Description | | -------- | ------------------------------------ | ---- | ------------------------------------------------------ | @@ -211,13 +220,15 @@ Defines the options for setting the screen brightness mode. Defines a response that returns the screen brightness mode. -| Name| Type | Description| -| -------- | -------- | -------- | -| mode | number | The value **0** indicates the manual adjustment mode, and the value **1** indicates the automatic adjustment mode.| +| Parameter| Type | Readable | Writable | Description| +| -------- | -------- | -------- | -------- | -------- | +| mode | number | Yes | No | The value **0** indicates the manual adjustment mode, and the value **1** indicates the automatic adjustment mode.| ## SetKeepScreenOnOptions -Defines the options for setting the screen to be steady on. +Sets the options for keeping the screen steady on. + +**System capability**: SystemCapability.PowerManager.DisplayPowerManager | Name | Type | Mandatory| Description | | ------------ | ------------------------------------ | ---- | ------------------------------------------------------ | -- GitLab