提交 2c0e440b 编写于 作者: S shawn_he

update docs

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 15c66a99
......@@ -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<a name="section199443271307"></a>
```
......@@ -274,4 +277,3 @@ Enumerates battery health states.
</tr>
</tbody>
</table>
# Brightness<a name="EN-US_TOPIC_0000001152548786"></a>
# 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<a name="s56d19203690d4782bfc74069abb6bd71"></a>
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<a name="section1853612361618"></a>
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
<a name="table888613685714"></a>
<table><thead align="left"><tr id="row1988683685713"><th class="cellrowborder" valign="top" width="11.03%" id="mcps1.1.5.1.1"><p id="p1488693625712"><a name="p1488693625712"></a><a name="p1488693625712"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="11.64%" id="mcps1.1.5.1.2"><p id="p1886173613571"><a name="p1886173613571"></a><a name="p1886173613571"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="7.1499999999999995%" id="mcps1.1.5.1.3"><p id="p128861336155714"><a name="p128861336155714"></a><a name="p128861336155714"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="70.17999999999999%" id="mcps1.1.5.1.4"><p id="p3886143617571"><a name="p3886143617571"></a><a name="p3886143617571"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row9886133613577"><td class="cellrowborder" valign="top" width="11.03%" headers="mcps1.1.5.1.1 "><p id="p14886163695720"><a name="p14886163695720"></a><a name="p14886163695720"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="11.64%" headers="mcps1.1.5.1.2 "><p id="p9886123605716"><a name="p9886123605716"></a><a name="p9886123605716"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="7.1499999999999995%" headers="mcps1.1.5.1.3 "><p id="p988723618577"><a name="p988723618577"></a><a name="p988723618577"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="70.17999999999999%" headers="mcps1.1.5.1.4 "><p id="p2512184017289"><a name="p2512184017289"></a><a name="p2512184017289"></a>Brightness value, ranging from 0 to 255</p>
</td>
</tr>
</tbody>
</table>
- 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);
```
# 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&lt;boolean&gt; | Yes| Callback used to obtain the return value. <br/>The value **true** indicates that the screen is on, and value **false** indicates the opposite.|
| Type | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to obtain the return value.<br>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&lt;boolean&gt;
Checks the screen status of the current device.
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | Promise used to asynchronously obtain the return value. <br/>The value **true** indicates that the screen is on, and value **false** indicates the opposite.|
**Return Value**
| Type | Description |
| ---------------------- | --------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to asynchronously obtain the return value. <br/>Return value: The value **true** indicates that the screen is on, and the value **false** indicates the opposite.|
**Example**
......
......@@ -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&lt;boolean&gt;): 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&lt;boolean&gt; | Yes| Callback used to obtain the return value. <br/>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&lt;boolean&gt; | Yes | Callback used to obtain the return value.<br>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&lt;boolean&gt;
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&lt;boolean&gt; | 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&lt;boolean&gt; | Promise used to asynchronously obtain the return value.<br/>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&lt;[RunningLock](#runninglock)&gt; | 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&lt;[RunningLock](#runninglock)&gt; | Yes | Callback used to obtain the return value.|
**Example**
......@@ -122,19 +127,21 @@ createRunningLock(name: string, type: RunningLockType): Promise&lt;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&lt;[RunningLock](#runninglock)&gt; | 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**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册