mirror of
https://github.com/openharmony/powermgr_battery_manager.git
synced 2026-07-01 06:42:05 -04:00
56ee1320da2dae9cb51bb725fcdce0edf728668d
Add a new CLI tool under tools/ohos-battery-manager/ that wraps BatterySrvClient inner API to provide battery information queries via command line interface. Commands: - capacity: query battery level percentage (0-100%) - total-energy: query battery total energy (mAh) - remain-energy: query battery remaining energy (mAh) The tool uses static command table dispatch (std::unordered_map), outputs JSON to stdout, logs to stderr, and is configured with CFI sanitize per battery_manager component requirements. Feature gate: battery_manager_feature_support_battery_cli (default: false) Co-Authored-By: Agent Change-Id: I11bbcad5db8189338df3b1d7982f9860868aaa7a Signed-off-by: wangyantian <wangyantian@huawei.com>
Battery Manager
Introduction
The Battery Manager module provides the following functions:
- Obtaining battery information
- Obtaining the battery charging status and the battery state of charge (SoC)
- Power off charging
Figure 1 Architecture of the Battery Manager module
Directory Structure
base/powermgr/battery_manager
├── figures # Architecture
├── frameworks # Framework layer
│ ├── napi # NAPI layer
│ └── native # Native layer
├── interfaces # API layer
│ └── inner_api # Internal APIs
├── sa_profile # SA profile
└── services # Service layer
│ └── native # Native layer
│ └── zidl # Zidl API layer
├── test # Test cases
│ ├── fuzztest # Fuzz test
│ ├── unittest # Unit test
│ ├── systemtest # System test
│ └── utils # Test tools
└── utils # Utilities
Repositories Involved
powermgr_battery_manager
Description
Languages
C++
99.5%
C
0.5%
