未验证 提交 5aa0f83a 编写于 作者: O openharmony_ci 提交者: Gitee

!15831 翻译已完成15656

Merge pull request !15831 from shawn_he/15656-b
...@@ -203,7 +203,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod ...@@ -203,7 +203,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
```js ```js
try { try {
var value = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_SCREEN); 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) { } catch(err) {
console.error('get battery statistics percent of hardware failed, err: ' + 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 ...@@ -243,7 +243,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
```js ```js
try { 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); console.info('battery statistics percent of hardware is: ' + percent);
} catch(err) { } catch(err) {
console.error('get battery statistics percent of hardware failed, err: ' + err); console.error('get battery statistics percent of hardware failed, err: ' + err);
......
...@@ -44,7 +44,9 @@ battery.getStatus({ ...@@ -44,7 +44,9 @@ battery.getStatus({
## GetStatusOptions ## 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 | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ |
...@@ -56,7 +58,9 @@ Object that contains the API calling result. ...@@ -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. Defines a response that returns the charging status and remaining power of the device.
| Name| Type| Description| **System capability**: SystemCapability.PowerManager.BatteryManager.Core
| -------- | -------- | -------- |
| charging | boolean | Whether the battery is being charged.| | Name| Type| Readable | Writable | Description|
| level | number | Current battery level, which ranges from **0.00** to **1.00**.| | -------- | -------- | -------- | -------- | -------- |
| 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**.|
...@@ -45,7 +45,7 @@ Obtains the current screen brightness. ...@@ -45,7 +45,7 @@ Obtains the current screen brightness.
## brightness.setValue ## brightness.setValue
etValue(options?: SetBrightnessOptions): void setValue(options?: SetBrightnessOptions): void
Sets the screen brightness. Sets the screen brightness.
...@@ -74,7 +74,7 @@ Sets the screen brightness. ...@@ -74,7 +74,7 @@ Sets the screen brightness.
## brightness.getMode ## brightness.getMode
getMode(options?: GetBrightnessModeOptions: void getMode(options?: GetBrightnessModeOptions): void
Obtains the screen brightness adjustment mode. Obtains the screen brightness adjustment mode.
...@@ -132,7 +132,8 @@ Sets the screen brightness adjustment mode. ...@@ -132,7 +132,8 @@ Sets the screen brightness adjustment mode.
setKeepScreenOn(options?: SetKeepScreenOnOptions): void 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<br>
> 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()**. 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()**. ...@@ -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. Defines the options for obtaining the screen brightness.
**System capability**: SystemCapability.PowerManager.DisplayPowerManager
| Name | Type | Mandatory| Description | | 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.| | 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. ...@@ -171,6 +174,8 @@ Defines the options for obtaining the screen brightness.
Defines the options for setting the screen brightness. Defines the options for setting the screen brightness.
**System capability**: SystemCapability.PowerManager.DisplayPowerManager
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------ | ---- | ------------------------------------------------------------ |
| value | number | Yes | Screen brightness. The value is an integer ranging from **1** to **255**.<br>-&nbsp;If the value is less than or equal to **0**, value **1** will be used.<br>-&nbsp;If the value is greater than **255**, value **255** will be used.<br>-&nbsp;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.| | value | number | Yes | Screen brightness. The value is an integer ranging from **1** to **255**.<br>-&nbsp;If the value is less than or equal to **0**, value **1** will be used.<br>-&nbsp;If the value is greater than **255**, value **255** will be used.<br>-&nbsp;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. ...@@ -182,13 +187,15 @@ Defines the options for setting the screen brightness.
Defines a response that returns the screen brightness. Defines a response that returns the screen brightness.
| Parameter| Type | Description| | Parameter| Type | Readable | Writable | Description|
| -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| value | number | Screen brightness. The value ranges from 1 to 255.| | value | number | Yes | No | Screen brightness. The value ranges from 1 to 255.|
## GetBrightnessModeOptions ## 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 | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
...@@ -198,7 +205,9 @@ Defines the options for obtaining the screen brightness mode. ...@@ -198,7 +205,9 @@ Defines the options for obtaining the screen brightness mode.
## SetBrightnessModeOptions ## 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 | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------ | ---- | ------------------------------------------------------ | | -------- | ------------------------------------ | ---- | ------------------------------------------------------ |
...@@ -211,13 +220,15 @@ Defines the options for setting the screen brightness mode. ...@@ -211,13 +220,15 @@ Defines the options for setting the screen brightness mode.
Defines a response that returns the screen brightness mode. Defines a response that returns the screen brightness mode.
| Name| Type | Description| | Parameter| Type | Readable | Writable | Description|
| -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| mode | number | The value **0** indicates the manual adjustment mode, and the value **1** indicates the automatic adjustment mode.| | mode | number | Yes | No | The value **0** indicates the manual adjustment mode, and the value **1** indicates the automatic adjustment mode.|
## SetKeepScreenOnOptions ## 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 | | Name | Type | Mandatory| Description |
| ------------ | ------------------------------------ | ---- | ------------------------------------------------------ | | ------------ | ------------------------------------ | ---- | ------------------------------------------------------ |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册