1413470f0Sopenharmony_ci# Lite Battery Manager<a name="EN-US_TOPIC_0000001174637973"></a>
2413470f0Sopenharmony_ci
3413470f0Sopenharmony_ci-   [Introduction](#section11660541593)
4413470f0Sopenharmony_ci-   [Directory Structure](#section19472752217)
5413470f0Sopenharmony_ci-   [Usage](#section146636391856)
6413470f0Sopenharmony_ci    -   [Available APIs](#section481251394)
7413470f0Sopenharmony_ci    -   [Usage Guidelines](#section12620311012)
8413470f0Sopenharmony_ci
9413470f0Sopenharmony_ci-   [Repositories Involved](#section63151229062)
10413470f0Sopenharmony_ci
11413470f0Sopenharmony_ci## Introduction<a name="section11660541593"></a>
12413470f0Sopenharmony_ci
13413470f0Sopenharmony_ciThe lite battery manager provides the following functionalities:
14413470f0Sopenharmony_ci
15413470f0Sopenharmony_ci1.  Obtaining battery information
16413470f0Sopenharmony_ci2.  Obtaining the battery charging status and the battery state of charge \(SoC\)
17413470f0Sopenharmony_ci3.  Monitoring the battery state of health \(SoH\)
18413470f0Sopenharmony_ci4.  Controlling the battery charging indicator
19413470f0Sopenharmony_ci
20413470f0Sopenharmony_ci**Figure  1**  Lite battery manager architecture<a name="fig106301571239"></a>
21413470f0Sopenharmony_ci
22413470f0Sopenharmony_ci
23413470f0Sopenharmony_ci![](figures/en-us_image_0000001176131699.png)
24413470f0Sopenharmony_ci
25413470f0Sopenharmony_ci## Directory Structure<a name="section19472752217"></a>
26413470f0Sopenharmony_ci
27413470f0Sopenharmony_ci```
28413470f0Sopenharmony_cibase/powermgr/battery_lite
29413470f0Sopenharmony_ci├── figures           # Architecture figures
30413470f0Sopenharmony_ci├── frameworks        # Frameworks
31413470f0Sopenharmony_ci│   ├── js            # Built_in interface
32413470f0Sopenharmony_ci│   └── native        # Native code
33413470f0Sopenharmony_ci├── interfaces        # APIs
34413470f0Sopenharmony_ci│   └── kits          # External APIs
35413470f0Sopenharmony_ci├── services          # Services
36413470f0Sopenharmony_ci│   ├── include       # Header files
37413470f0Sopenharmony_ci│   └── src           # Source files
38413470f0Sopenharmony_ci└── test              # Interface test
39413470f0Sopenharmony_ci```
40413470f0Sopenharmony_ci
41413470f0Sopenharmony_ci## Usage<a name="section146636391856"></a>
42413470f0Sopenharmony_ci
43413470f0Sopenharmony_ci### Available APIs<a name="section481251394"></a>
44413470f0Sopenharmony_ci
45413470f0Sopenharmony_ciThe following table lists the JavaScript APIs provided by the lite battery manager.
46413470f0Sopenharmony_ci
47413470f0Sopenharmony_ci<a name="table45171237103112"></a>
48413470f0Sopenharmony_ci
49413470f0Sopenharmony_ci<table><thead align="left"><tr id="row12572123793117"><th class="cellrowborder" valign="top" width="38.71%" id="mcps1.1.3.1.1"><p id="p19572937163116"><a name="p19572937163116"></a><a name="p19572937163116"></a><strong id="b1783175664017"><a name="b1783175664017"></a><a name="b1783175664017"></a>API</strong></p>
50413470f0Sopenharmony_ci</th>
51413470f0Sopenharmony_ci<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.3.1.2"><p id="p157213711313"><a name="p157213711313"></a><a name="p157213711313"></a><strong id="b62896374115"><a name="b62896374115"></a><a name="b62896374115"></a>Description</strong></p>
52413470f0Sopenharmony_ci</th>
53413470f0Sopenharmony_ci</tr>
54413470f0Sopenharmony_ci</thead>
55413470f0Sopenharmony_ci<tbody><tr id="row14574143723119"><td class="cellrowborder" valign="top" width="38.71%" headers="mcps1.1.3.1.1 "><p id="p169098161437"><a name="p169098161437"></a><a name="p169098161437"></a>int32_t GetBatSoc()</p>
56413470f0Sopenharmony_ci</td>
57413470f0Sopenharmony_ci<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.3.1.2 "><p id="p105741337153115"><a name="p105741337153115"></a><a name="p105741337153115"></a>Obtains the battery SoC.</p>
58413470f0Sopenharmony_ci</td>
59413470f0Sopenharmony_ci</tr>
60413470f0Sopenharmony_ci<tr id="row19195203919318"><td class="cellrowborder" valign="top" width="38.71%" headers="mcps1.1.3.1.1 "><p id="p46911925104319"><a name="p46911925104319"></a><a name="p46911925104319"></a>BatteryChargeState GetChargingStatus()</p>
61413470f0Sopenharmony_ci</td>
62413470f0Sopenharmony_ci<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.3.1.2 "><p id="p1619618397312"><a name="p1619618397312"></a><a name="p1619618397312"></a>Obtains the current battery charging status.</p>
63413470f0Sopenharmony_ci</td>
64413470f0Sopenharmony_ci</tr>
65413470f0Sopenharmony_ci<tr id="row9397121153216"><td class="cellrowborder" valign="top" width="38.71%" headers="mcps1.1.3.1.1 "><p id="p1339731103216"><a name="p1339731103216"></a><a name="p1339731103216"></a>BatteryHealthState GetHealthStatus()</p>
66413470f0Sopenharmony_ci</td>
67413470f0Sopenharmony_ci<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.3.1.2 "><p id="p113972183214"><a name="p113972183214"></a><a name="p113972183214"></a>Obtains the battery SoH.</p>
68413470f0Sopenharmony_ci</td>
69413470f0Sopenharmony_ci</tr>
70413470f0Sopenharmony_ci<tr id="row1721311920324"><td class="cellrowborder" valign="top" width="38.71%" headers="mcps1.1.3.1.1 "><p id="p321412915320"><a name="p321412915320"></a><a name="p321412915320"></a>BatteryPluggedType GetPluggedType()</p>
71413470f0Sopenharmony_ci</td>
72413470f0Sopenharmony_ci<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.3.1.2 "><p id="p32141298323"><a name="p32141298323"></a><a name="p32141298323"></a>Obtains the charger type.</p>
73413470f0Sopenharmony_ci</td>
74413470f0Sopenharmony_ci</tr>
75413470f0Sopenharmony_ci<tr id="row269082112447"><td class="cellrowborder" valign="top" width="38.71%" headers="mcps1.1.3.1.1 "><p id="p16690202119449"><a name="p16690202119449"></a><a name="p16690202119449"></a>int32_t GetBatVoltage()</p>
76413470f0Sopenharmony_ci</td>
77413470f0Sopenharmony_ci<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.3.1.2 "><p id="p1869014214445"><a name="p1869014214445"></a><a name="p1869014214445"></a>Obtains the battery voltage.</p>
78413470f0Sopenharmony_ci</td>
79413470f0Sopenharmony_ci</tr>
80413470f0Sopenharmony_ci<tr id="row3654173318447"><td class="cellrowborder" valign="top" width="38.71%" headers="mcps1.1.3.1.1 "><p id="p11654173374412"><a name="p11654173374412"></a><a name="p11654173374412"></a>bool IsBatPresent()</p>
81413470f0Sopenharmony_ci</td>
82413470f0Sopenharmony_ci<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.3.1.2 "><p id="p13654123354416"><a name="p13654123354416"></a><a name="p13654123354416"></a>Checks whether the battery is present.</p>
83413470f0Sopenharmony_ci</td>
84413470f0Sopenharmony_ci</tr>
85413470f0Sopenharmony_ci<tr id="row12187141584413"><td class="cellrowborder" valign="top" width="38.71%" headers="mcps1.1.3.1.1 "><p id="p718841504418"><a name="p718841504418"></a><a name="p718841504418"></a>char* GetBatTechnology()</p>
86413470f0Sopenharmony_ci</td>
87413470f0Sopenharmony_ci<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.3.1.2 "><p id="p181881615194414"><a name="p181881615194414"></a><a name="p181881615194414"></a>Obtains the battery model.</p>
88413470f0Sopenharmony_ci</td>
89413470f0Sopenharmony_ci</tr>
90413470f0Sopenharmony_ci<tr id="row18381310134520"><td class="cellrowborder" valign="top" width="38.71%" headers="mcps1.1.3.1.1 "><p id="p18838610114516"><a name="p18838610114516"></a><a name="p18838610114516"></a>int32_t GetBatTemperature()</p>
91413470f0Sopenharmony_ci</td>
92413470f0Sopenharmony_ci<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.3.1.2 "><p id="p13838121064515"><a name="p13838121064515"></a><a name="p13838121064515"></a>Obtains the battery temperature.</p>
93413470f0Sopenharmony_ci</td>
94413470f0Sopenharmony_ci</tr>
95413470f0Sopenharmony_ci</tbody>
96413470f0Sopenharmony_ci</table>
97413470f0Sopenharmony_ci
98413470f0Sopenharmony_ci
99413470f0Sopenharmony_ci### Usage Guidelines<a name="section12620311012"></a>
100413470f0Sopenharmony_ci
101413470f0Sopenharmony_ciThe lite battery manager provides APIs for obtaining the battery SoC, battery charging status, and battery SoH.
102413470f0Sopenharmony_ci
103413470f0Sopenharmony_ciThe sample code is as follows:
104413470f0Sopenharmony_ci
105413470f0Sopenharmony_ci```
106413470f0Sopenharmony_ciint32_t capacity = GetBatSoc();
107413470f0Sopenharmony_ciBatteryChargeState chargState = GetChargingStatus();
108413470f0Sopenharmony_ci```
109413470f0Sopenharmony_ci
110413470f0Sopenharmony_ci## Repositories Involved<a name="section63151229062"></a>
111413470f0Sopenharmony_ci
112413470f0Sopenharmony_ci[Power management subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/power-management.md)
113413470f0Sopenharmony_ci
114413470f0Sopenharmony_ci[powermgr_power_manager](https://gitee.com/openharmony/powermgr_power_manager)
115413470f0Sopenharmony_ci
116413470f0Sopenharmony_ci[powermgr_display_manager](https://gitee.com/openharmony/powermgr_display_manager)
117413470f0Sopenharmony_ci
118413470f0Sopenharmony_ci[powermgr_battery_manager](https://gitee.com/openharmony/powermgr_battery_manager)
119413470f0Sopenharmony_ci
120413470f0Sopenharmony_ci[powermgr_thermal_manager](https://gitee.com/openharmony/powermgr_thermal_manager)
121413470f0Sopenharmony_ci
122413470f0Sopenharmony_ci[powermgr_battery_statistics](https://gitee.com/openharmony/powermgr_battery_statistics)
123413470f0Sopenharmony_ci
124413470f0Sopenharmony_ci**powermgr_battery_lite**
125413470f0Sopenharmony_ci
126413470f0Sopenharmony_ci[powermgr_powermgr_lite](https://gitee.com/openharmony/powermgr_powermgr_lite)
127