Adjust the architecture

Signed-off-by: liuhan <liuhan53@huawei.com>
This commit is contained in:
liuhan
2025-09-25 21:45:38 +08:00
parent 37bb156d80
commit 93bb7a6960
5 changed files with 18 additions and 14 deletions
+14 -8
View File
@@ -2,7 +2,7 @@
## Introduction
The powermgr_cangjie_wrapper is a Cangjie API encapsulated on OpenHarmony based on the capabilities of the power management subsystem. Provides the ability to query battery status and charge-discharge status.The currently open power service Cangjie interface supports only standard devices.
The powermgr_cangjie_wrapper is a Cangjie API encapsulated on OpenHarmony for application developers to provide battery status and charge-discharge status query capabilities. The currently open power service Cangjie interface only supports standard devices.
**Figure 1** powermgr_cangjie_wrapper architecture
@@ -10,12 +10,17 @@ The powermgr_cangjie_wrapper is a Cangjie API encapsulated on OpenHarmony based
As shown in the architecture diagram:
- Battery Service Wrapper: Provides methods for battery level information query, charger type enumeration, battery health status enumeration, and additional information query enumeration.
- Cangjie Power Service FFI Encapsulation Definition: Responsible for defining the C-language interoperation interface with Cangjie, which is used to implement the capabilities of Cangjie's power management service.
Interface layer description:
Dependencies:
- Battery Service API: Cangjie public interfaces based on battery service encapsulation exposed to developers.
- Power Management Service: Calls the underlying power driver to provide C language interfaces for basic power management service functions that can be called by the power service Cangjie interface.
Framework layer description:
- Battery Service Wrapper: Provides battery level information query, charger type enumeration, battery health status enumeration, and additional information query enumeration methods. This encapsulation layer is a Cangjie encapsulation implementation of battery service functionality based on the power management service.
Cangjie Power Service Dependencies:
- Power Management Service: Calls the underlying power driver to provide native basic power management service functionality implementation.
- Cangjie Interop: Encapsulates public interfaces for C language interoperation, and provides Cangjie tag class implementation for annotating Cangjie APIs, as well as providing BusinessException exception class definitions thrown to users.
## Directory Structure
@@ -27,7 +32,6 @@ base/powermgr/powermgr_cangjie_wrapper
│ └── battery_info # Cangjie battery_info code
├── test # Test cases
│ └── battery_info # Battery service tests
│ └── test # Test project directory
└── bundle.json # Component description file
```
@@ -36,6 +40,10 @@ base/powermgr/powermgr_cangjie_wrapper
The following power service functions are provided:
- Battery Service: Supports charging and discharging, and displays information on battery and charging status
Power service usage examples please refer to [Battery Information Development Guide](https://gitcode.com/openharmony-sig/arkcompiler_cangjie_ark_interop/blob/master/doc/Dev_Guide/source_en/basic-services/cj-battery-info-development-guide.md).
## Constraints
Compared with the API capabilities provided by ArkTS, the following functions are currently not supported:
- Restart Service: System restart and power off
- System Power Management Service: System power status management and sleep running lock management
@@ -47,8 +55,6 @@ Compared with the API capabilities provided by ArkTS, the following functions ar
- Battery service for lightweight devices
- Power management service for lightweight devices
For APIs related to battery info, please refer to [Battery Management API](https://gitcode.com/openharmony-sig/arkcompiler_cangjie_ark_interop/blob/master/doc/API_Reference/source_en/apis/BasicServicesKit/cj-apis-battery_info.md).
## Code Contribution
Developers are welcome to contribute code, documentation, etc. For specific contribution processes and methods, please refer to [Code Contribution](https://gitcode.com/openharmony/docs/blob/master/en/contribute/code-contribution.md).
+3 -5
View File
@@ -2,7 +2,7 @@
## 简介
电源服务仓颉接口是在 OpenHarmony 上面向开发者进行应用开发使用的电源管理能力的仓颉API。提供了电池状态和充放电状态查询的能力。当前开放的电源服务仓颉接口仅支持standard设备。
电源服务仓颉封装为OpenHarmony应用开发者提供了电池状态和充放电状态查询的能力的仓颉 API。当前开放的电源服务仓颉接口仅支持standard设备。
**图 1** 电源管理仓颉架构图
@@ -17,12 +17,11 @@
框架层说明:
- 电池服务封装:提供电量信息查询、充电器类型枚举、电池健康状态枚举、附加信息查询枚举的方法。该封装层是基于电源管理服务对电池服务功能进行的仓颉封装实现。
- 仓颉电源服务 FFI 封装定义:负责定义被Cangjie语言调用的C语言互操作接口,用于实现仓颉电源管理服务能力。
仓颉电源服务依赖部件引入说明:
- 电源管理服务:调用底层电源驱动,提供可被电源服务仓颉接口调用的电源管理服务基本功能C语言接口
- 仓颉互操作:封装C语言互操作公共接口,并提供仓颉标签类实现用于对仓颉API进行标注,以及提供抛向用户的BusinessException异常类定义。
- 电源管理服务:调用底层电源驱动,提供电源管理服务native基本功能实现
- cangjie_ark_interop:封装C语言互操作公共接口,并提供仓颉标签类实现用于对仓颉API进行标注,以及提供抛向用户的BusinessException异常类定义。
## 目录
@@ -33,7 +32,6 @@ base/powermgr/powermgr_cangjie_wrapper
│ └── battery_info # 电池服务仓颉接口代码目录
├── test # 测试用例代码
│ └── battery_info # 电池服务测试
│ └── test # 测试工程目录
└── bundle.json # 组件描述文件
```
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@ohos/powermgr_cangjie_wrapper",
"description": "Battery status reporting",
"description": "Display of charge-discharge, battery, and state of charge information",
"version": "6.0",
"license": "Apache-2.0",
"publishAs": "code-segment",
Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 74 KiB