openharmony_ci 6798d238e9 !68 fix: test repair
Merge pull request !68 from kongwei/master
2025-08-28 09:33:31 +00:00
2023-07-21 15:15:33 +08:00
2024-04-23 07:16:03 +00:00
2024-04-22 12:50:57 +00:00
2025-08-27 14:39:27 +08:00
2022-08-30 14:18:34 +08:00
2021-09-15 20:10:57 +08:00
2021-07-08 21:07:35 +08:00
2025-08-11 10:23:57 +08:00
2021-07-08 21:07:35 +08:00
2021-07-08 21:07:35 +08:00
2021-07-29 17:38:09 +08:00

Lite Battery Manager

Introduction

The lite battery manager provides the following functionalities:

  1. Obtaining battery information
  2. Obtaining the battery charging status and the battery state of charge (SoC)
  3. Monitoring the battery state of health (SoH)
  4. 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.

API

Description

int32_t GetBatSoc()

Obtains the battery SoC.

BatteryChargeState GetChargingStatus()

Obtains the current battery charging status.

BatteryHealthState GetHealthStatus()

Obtains the battery SoH.

BatteryPluggedType GetPluggedType()

Obtains the charger type.

int32_t GetBatVoltage()

Obtains the battery voltage.

bool IsBatPresent()

Checks whether the battery is present.

char* GetBatTechnology()

Obtains the battery model.

int32_t GetBatTemperature()

Obtains the battery temperature.

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

Power management subsystem

powermgr_power_manager

powermgr_display_manager

powermgr_battery_manager

powermgr_thermal_manager

powermgr_battery_statistics

powermgr_battery_lite

powermgr_powermgr_lite

S
Description
暂无描述
Readme 636 KiB
Languages
C 78.2%
C++ 18%
JavaScript 3.8%