mirror of
https://github.com/openharmony/powermgr_battery_lite.git
synced 2026-07-01 22:04:52 -04:00
c0e92dbba01b2174ff571f0133418e8a029a61e6
Signed-off-by: youshugen <youshugen@huawei.com>
Lite Battery Manager
Introduction
The lite battery manager provides the following functionalities:
- Obtaining battery information
- Obtaining the battery charging status and the battery state of charge (SoC)
- Monitoring the battery state of health (SoH)
- Controlling the battery charging indicator
Figure 1 Lite battery manager architecture
Directory Structure
base/powermgr/battery_lite
├── figures # Architecture figures
├── frameworks # Frameworks
│ ├── js # Built_in interface
│ └── native # Native code
├── interfaces # APIs
│ └── kits # External APIs
├── services # Services
│ ├── include # Header files
│ └── src # Source files
└── test # Interface test
Usage
Available APIs
The following table lists the JavaScript APIs provided by the lite battery manager.
Usage Guidelines
The lite battery manager provides APIs for obtaining the battery SoC, battery charging status, and battery SoH.
The sample code is as follows:
int32_t capacity = GetBatSoc();
BatteryChargeState chargState = GetChargingStatus();
Repositories Involved
powermgr_battery_lite
Description
Languages
C
78.2%
C++
18%
JavaScript
3.8%
