未验证 提交 16b61dd9 编写于 作者: O openharmony_ci 提交者: Gitee

!3661 翻译已完成3540&3544

Merge pull request !3661 from shawn_he/b3540
# Battery Info<a name="EN-US_TOPIC_0000001121409574"></a> # Battery Info<a name="EN-US_TOPIC_0000001121409574"></a>
>![](../../public_sys-resources/icon-note.gif) **NOTE:** >![](../../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 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. The Battery Info module provides APIs for querying the charger type, battery health status, and battery charging status.
...@@ -8,7 +8,7 @@ The Battery Info module provides APIs for querying the charger type, battery hea ...@@ -8,7 +8,7 @@ The Battery Info module provides APIs for querying the charger type, battery hea
## Modules to Import<a name="section199443271307"></a> ## Modules to Import<a name="section199443271307"></a>
``` ```js
import batteryInfo from '@ohos.batteryInfo'; import batteryInfo from '@ohos.batteryInfo';
``` ```
...@@ -126,7 +126,7 @@ Describes battery information. ...@@ -126,7 +126,7 @@ Describes battery information.
- Example - Example
``` ```js
import batteryInfo from '@ohos.batteryInfo'; import batteryInfo from '@ohos.batteryInfo';
var batterySoc = batteryInfo.batterySOC; var batterySoc = batteryInfo.batterySOC;
``` ```
......
...@@ -8,7 +8,7 @@ The Brightness module provides an API for setting the screen brightness. ...@@ -8,7 +8,7 @@ The Brightness module provides an API for setting the screen brightness.
## Modules to Import ## Modules to Import
``` ```js
import brightness from '@ohos.brightness'; import brightness from '@ohos.brightness';
``` ```
...@@ -30,6 +30,6 @@ This is a system API and cannot be called by third-party applications. ...@@ -30,6 +30,6 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
brightness.setValue(128); brightness.setValue(128);
``` ```
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
## Modules to Import ## Modules to Import
``` ```js
import hichecker from '@ohos.hichecker'; import hichecker from '@ohos.hichecker';
``` ```
...@@ -42,7 +42,7 @@ Adds one or more rules. HiChecker detects unexpected operations or gives feedbac ...@@ -42,7 +42,7 @@ Adds one or more rules. HiChecker detects unexpected operations or gives feedbac
**Example** **Example**
``` ```js
// Add a rule. // Add a rule.
hichecker.addRule(hichecker.RULE_CAUTION_PRINT_LOG); hichecker.addRule(hichecker.RULE_CAUTION_PRINT_LOG);
...@@ -67,7 +67,7 @@ Removes one or more rules. The removed rules will become ineffective. ...@@ -67,7 +67,7 @@ Removes one or more rules. The removed rules will become ineffective.
**Example** **Example**
``` ```js
// Remove a rule. // Remove a rule.
hichecker.removeRule(hichecker.RULE_CAUTION_PRINT_LOG); hichecker.removeRule(hichecker.RULE_CAUTION_PRINT_LOG);
...@@ -92,7 +92,7 @@ Obtains a collection of thread, process, and alarm rules that have been added. ...@@ -92,7 +92,7 @@ Obtains a collection of thread, process, and alarm rules that have been added.
**Example** **Example**
``` ```js
// Add a rule. // Add a rule.
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
...@@ -122,7 +122,7 @@ Checks whether the specified rule exists in the collection of added rules. If th ...@@ -122,7 +122,7 @@ Checks whether the specified rule exists in the collection of added rules. If th
**Example** **Example**
``` ```js
// Add a rule. // Add a rule.
hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); hichecker.addRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS);
......
...@@ -8,7 +8,7 @@ The Power Manager module provides APIs for rebooting and shutting down the syste ...@@ -8,7 +8,7 @@ The Power Manager module provides APIs for rebooting and shutting down the syste
## Modules to Import ## Modules to Import
``` ```js
import power from '@ohos.power'; import power from '@ohos.power';
``` ```
...@@ -35,7 +35,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -35,7 +35,7 @@ This is a system API and cannot be called by third-party applications.
**Example** **Example**
``` ```js
power.shutdownDevice("shutdown_test"); power.shutdownDevice("shutdown_test");
console.info('power_shutdown_device_test success') console.info('power_shutdown_device_test success')
``` ```
...@@ -57,7 +57,7 @@ Reboots the system. ...@@ -57,7 +57,7 @@ Reboots the system.
**Example** **Example**
``` ```js
power.rebootDevice("reboot_test"); power.rebootDevice("reboot_test");
console.info('power_reboot_device_test success') console.info('power_reboot_device_test success')
``` ```
...@@ -77,7 +77,7 @@ Checks the screen status of the current device. ...@@ -77,7 +77,7 @@ Checks the screen status of the current device.
**Example** **Example**
``` ```js
power.isScreenOn((error, screenOn) => { power.isScreenOn((error, screenOn) => {
if (typeof error === "undefined") { if (typeof error === "undefined") {
console.info('screenOn status is ' + screenOn); console.info('screenOn status is ' + screenOn);
...@@ -101,7 +101,7 @@ Checks the screen status of the current device. ...@@ -101,7 +101,7 @@ Checks the screen status of the current device.
**Example** **Example**
``` ```js
power.isScreenOn() power.isScreenOn()
.then(screenOn => { .then(screenOn => {
console.info('screenOn status is ' + screenOn); console.info('screenOn status is ' + screenOn);
......
# Screen Lock Management # Screen Lock Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** > ![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 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 ## Modules to Import
``` ```js
import screenlock from '@ohos.screenLock'; import screenlock from '@ohos.screenLock';
``` ```
...@@ -28,7 +28,7 @@ Checks whether the screen is locked. This method uses an asynchronous callback t ...@@ -28,7 +28,7 @@ Checks whether the screen is locked. This method uses an asynchronous callback t
- Example - Example
``` ```js
screenlock.isScreenLocked((err, data)=>{ screenlock.isScreenLocked((err, data)=>{
if (err) { if (err) {
console.error('isScreenLocked callback error -> ${JSON.stringify(err)}'); console.error('isScreenLocked callback error -> ${JSON.stringify(err)}');
...@@ -54,7 +54,7 @@ Checks whether the screen is locked. This method uses a promise to return the re ...@@ -54,7 +54,7 @@ Checks whether the screen is locked. This method uses a promise to return the re
- Example - Example
``` ```js
screenlock.isScreenLocked().then((data) => { screenlock.isScreenLocked().then((data) => {
console.log('isScreenLocked success: data -> ${JSON.stringify(data)}'); console.log('isScreenLocked success: data -> ${JSON.stringify(data)}');
}).catch((err) => { }).catch((err) => {
...@@ -81,7 +81,7 @@ Checks whether a device is in secure mode. This method uses an asynchronous call ...@@ -81,7 +81,7 @@ Checks whether a device is in secure mode. This method uses an asynchronous call
- Example - Example
``` ```js
screenlock.isSecureMode((err, data)=>{ screenlock.isSecureMode((err, data)=>{
if (err) { if (err) {
console.error('isSecureMode callback error -> ${JSON.stringify(err)}'); console.error('isSecureMode callback error -> ${JSON.stringify(err)}');
...@@ -107,7 +107,7 @@ Checks whether a device is in secure mode. This method uses a promise to return ...@@ -107,7 +107,7 @@ Checks whether a device is in secure mode. This method uses a promise to return
- Example - Example
``` ```js
screenlock.isSecureMode().then((data) => { screenlock.isSecureMode().then((data) => {
console.log('isSecureMode success: data->${JSON.stringify(data)}'); console.log('isSecureMode success: data->${JSON.stringify(data)}');
}).catch((err) => { }).catch((err) => {
...@@ -134,7 +134,7 @@ Unlocks the screen. This method uses an asynchronous callback to return the resu ...@@ -134,7 +134,7 @@ Unlocks the screen. This method uses an asynchronous callback to return the resu
- Example - Example
``` ```js
screenlock.unlockScreen((err)=>{ screenlock.unlockScreen((err)=>{
if (err) { if (err) {
console.error('unlockScreen callback error -> ${JSON.stringify(err)}'); console.error('unlockScreen callback error -> ${JSON.stringify(err)}');
...@@ -160,7 +160,7 @@ Unlocks the screen. This method uses a promise to return the result. ...@@ -160,7 +160,7 @@ Unlocks the screen. This method uses a promise to return the result.
- Example - Example
``` ```js
screenlock.unlockScreen().then(() => { screenlock.unlockScreen().then(() => {
console.log('unlockScreen success'); console.log('unlockScreen success');
}).catch((err) => { }).catch((err) => {
......
# Battery Level # Battery Level
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.batteryInfo`](js-apis-battery-info.md) instead. > - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.batteryInfo`](js-apis-battery-info.md) instead.
> >
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## Modules to Import ## Modules to Import
``` ```js
import battery from '@system.battery'; import battery from '@system.battery';
``` ```
...@@ -39,7 +39,7 @@ The following value will be returned when the check result is obtained. ...@@ -39,7 +39,7 @@ The following value will be returned when the check result is obtained.
**Example** **Example**
``` ```js
export default { export default {
getStatus() { getStatus() {
battery.getStatus({ battery.getStatus({
......
# Screen Brightness # Screen Brightness
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.brightness`](js-apis-brightness.md) instead. > - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.brightness`](js-apis-brightness.md) instead.
> >
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
## Modules to Import ## Modules to Import
``` ```js
import brightness from '@system.brightness'; import brightness from '@system.brightness';
``` ```
...@@ -38,7 +38,7 @@ The following values will be returned when the operation is successful. ...@@ -38,7 +38,7 @@ The following values will be returned when the operation is successful.
**Example** **Example**
``` ```js
export default { export default {
getValue() { getValue() {
brightness.getValue({ brightness.getValue({
...@@ -73,7 +73,7 @@ Sets the screen brightness. ...@@ -73,7 +73,7 @@ Sets the screen brightness.
**Example** **Example**
``` ```js
export default { export default {
setValue() { setValue() {
brightness.setValue({ brightness.setValue({
...@@ -114,7 +114,7 @@ The following values will be returned when the operation is successful. ...@@ -114,7 +114,7 @@ The following values will be returned when the operation is successful.
**Example** **Example**
``` ```js
export default { export default {
getMode() { getMode() {
brightness.getMode({ brightness.getMode({
...@@ -149,7 +149,7 @@ Sets the screen brightness adjustment mode. ...@@ -149,7 +149,7 @@ Sets the screen brightness adjustment mode.
**Example** **Example**
``` ```js
export default { export default {
setMode() { setMode() {
brightness.setMode({ brightness.setMode({
...@@ -185,7 +185,7 @@ Sets whether to always keep the screen on. Call this API in **onShow()**. ...@@ -185,7 +185,7 @@ Sets whether to always keep the screen on. Call this API in **onShow()**.
**Example** **Example**
``` ```js
export default { export default {
setKeepScreenOn() { setKeepScreenOn() {
brightness.setKeepScreenOn({ brightness.setKeepScreenOn({
......
...@@ -8,7 +8,7 @@ This module provides thermal level-related callback and query APIs to obtain the ...@@ -8,7 +8,7 @@ This module provides thermal level-related callback and query APIs to obtain the
## Modules to Import ## Modules to Import
``` ```js
import thermal from '@ohos.thermal'; import thermal from '@ohos.thermal';
``` ```
...@@ -46,7 +46,7 @@ Subscribes to thermal level changes. ...@@ -46,7 +46,7 @@ Subscribes to thermal level changes.
**Example** **Example**
``` ```js
var lev = 0; var lev = 0;
thermal.subscribeThermalLevel((lev) => { thermal.subscribeThermalLevel((lev) => {
console.info("Thermal level is: " + lev); console.info("Thermal level is: " + lev);
...@@ -69,7 +69,7 @@ Unsubscribes from thermal level changes. ...@@ -69,7 +69,7 @@ Unsubscribes from thermal level changes.
**Example** **Example**
``` ```js
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("Unsubscribe completed."); console.info("Unsubscribe completed.");
}); });
...@@ -91,7 +91,7 @@ Obtains the current thermal level. ...@@ -91,7 +91,7 @@ Obtains the current thermal level.
**Example** **Example**
``` ```js
var lev = thermal.getThermalLevel(); var lev = thermal.getThermalLevel();
console.info("Thermal level is: " + lev); console.info("Thermal level is: " + lev);
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册