mirror of
https://github.com/openharmony/powermgr_battery_manager.git
synced 2026-07-01 06:42:05 -04:00
e9bc5e652dbbebef9f5e5ca422852e7add1c880b
- Replace nlohmann::json with cJSON for JSON output (remove heavy dependency) - Split CmdHelp into PrintFullHelp + PrintSubcommandHelp (reduce cyclomatic complexity 12→3/4) - Extract HasHelpFlag helper from HandleCommand (reduce cyclomatic complexity 6→5) - Fix bug: PrintSubcommandHelp return value now propagated (unknown-cmd --help returns 1) - Rename global variables to g_camelCase convention (g_commands, g_programName, etc.) - Replace magic number with CJSON_DEEP_COPY constant - Add test cases 031-032 for PrintSubcommandHelp failure path and top-level --help priority - Remove nlohmann_json_static from both BUILD.gn files Co-Authored-By: Agent Change-Id: Ie3a7c1b2d4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9 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%
