diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent.md b/en/device-dev/subsystems/subsys-dfx-hisysevent.md index a50973f8b093660bcd4dd2983dc3320a27479648..0b138b45a81eefe5ed0c615129e2eb8aa9527315 100644 --- a/en/device-dev/subsystems/subsys-dfx-hisysevent.md +++ b/en/device-dev/subsystems/subsys-dfx-hisysevent.md @@ -1,285 +1,9 @@ -# Development Guidelines on HiSysEvent +# HiSysEvent -- [Overview](#section77571101789) -- [Available APIs](#section13480315886) -- [How to Develop](#section112771171317) +- **[HiSysEvent Logging] (subsys-dfx-hisysevent-write.md)** -## Overview - -HiSysEvent provides event logging APIs for OpenHarmony to record important information of key processes during system running, helping you locate faults. In addition, you can upload the log data to the cloud for big data analytics. - -## Available APIs - -The following table lists the C++ APIs provided by the **HiSysEvent** class. - -For details about the **HiSysEvent** class, see the API reference. - -**Table 1** C++ APIs provided by HiSysEvent - - - - - - - - - - -

API

-

Description

-

template<typename... Types> static int Write(const std::string &domain, const std::string &eventName, EventType type, Types... keyValues)

-

Logs system events.

-

Input arguments:

-
  • domain: Indicates the domain related to the event. You can use a preconfigured domain or customize a domain as needed. The name of a custom domain can contain a maximum of 16 characters, including digits (0-9) and uppercase letters (A-Z). It must start with a letter.
  • eventName: Indicates the event name. The value contains a maximum of 32 characters, including digits (0 to 9), lowercase letters (a-z), uppercase letters (A-Z), and underscores (_). It must start with a letter and cannot end with an underscore (_).
  • type: Indicates the event type. For details, see EventType.
  • keyValues: Indicates the key-value pairs of event parameters. It can be in the format of the basic data type, std::string, std::vector<basic data type>, or std:vector<std::string>. The value contains a maximum of 48 characters, including digits (0 to 9), lowercase letters (a-z), uppercase letters (A-Z), and underscores (_). It must start with a letter and cannot end with an underscore (_). The number of parameter names cannot exceed 32.
-

Return value: Returns 0 if the operation is successful; returns a value less than 0 otherwise.

-
- -**Table 2** Description of HiSysEvent::Domain APIs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

API

-

Description

-

static const std::string AAFWK

-

Ability management framework

-

static const std::string APPEXECFWK

-

Application framework

-

static const std::string ACCOUNT

-

Account subsystem

-

static const std::string ACE

-

ACE subsystem

-

static const std::string AI

-

AI subsystem

-

static const std::string BARRIER_FREE

-

Accessibility subsystem

-

static const std::string BIOMETRICS

-

Biometric recognition subsystem

-

static const std::string CCRUNTIME

-

C/C++ operating environment subsystem

-

static const std::string COMMUNICATION

-

Communication subsystem

-

static const std::string DEVELOPTOOLS

-

Development toolchain subsystem

-

static const std::string DISTRIBUTED_DATAMGR

-

Distributed data management subsystem

-

static const std::string DISTRIBUTED_SCHEDULE

-

Distributed scheduler subsystem

-

static const std::string GLOBAL

-

Globalization subsystem

-

static const std::string GRAPHIC

-

Graphics subsystem

-

static const std::string HIVIEWDFX

-

DFX subsystem

-

static const std::string IAWARE

-

Scheduling and resource management subsystem

-

static const std::string INTELLI_ACCESSORIES

-

Smart accessory subsystem

-

static const std::string INTELLI_TV

-

Smart TV subsystem

-

static const std::string IVI_HARDWARE

-

IVI-dedicated hardware subsystem

-

static const std::string LOCATION

-

Location subsystem

-

static const std::string MSDP

-

MSDP subsystem

-

static const std::string MULTI_MEDIA

-

Multimedia subsystem

-

static const std::string MULTI_MODAL_INPUT

-

Multimodal input subsystem

-

static const std::string NOTIFICATION

-

Common event and notification subsystem

-

static const std::string POWERMGR

-

Power management subsystem

-

static const std::string ROUTER

-

Router subsystem

-

static const std::string SECURITY

-

Security subsystem

-

static const std::string SENSORS

-

Pan-sensor subsystem

-

static const std::string SOURCE_CODE_TRANSFORMER

-

Application porting subsystem

-

static const std::string STARTUP

-

Startup subsystem

-

static const std::string TELEPHONY

-

Telephony subsystem

-

static const std::string UPDATE

-

Update subsystem

-

static const std::string USB

-

USB subsystem

-

static const std::string WEARABLE_HARDWARE

-

Wearable-dedicated hardware subsystem

-

static const std::string WEARABLE

-

Wearable-dedicated service subsystem

-

static const std::string OTHERS

-

Others

-
- -**Table 3** Description of HiSysEvent::EventType APIs - - - - - - - - - - - - - - - - - - - -

API

-

Description

-

FAULT

-

Fault event

-

STATISTIC

-

Statistical event

-

SECURITY

-

Security event

-

BEHAVIOR

-

System behavior event

-
- -## How to Develop - -**C++** - -1. Develop the source code. - - Include the **HiSysEvent** header file in the class definition header file or class implementation source file. For example: - - ``` - #include "hisysevent.h" - ``` - - Add the event logging code. For example, if you want to log events specific to the app start time \(start\_app\), then add the following code to the service implementation source file: - - ``` - HiSysEvent::Write(HiSysEvent::Domain::AAFWK, "start_app", HiSysEvent::EventType::FAULT, "app_name", "com.demo"); - ``` - -2. Configure compilation information. Specifically, add the subsystem SDK dependency to **BUILD.gn**. - - ``` - external_deps = [ "hisysevent_native:libhisysevent" ] - ``` +- **[HiSysEvent Listening] (subsys-dfx-hisysevent-read.md)** +- **[HiSysEvent Query] (subsys-dfx-hisysevent-select.md)** +- **[HiSysEvent Tool Usage] (subsys-dfx-hisysevent-tool.md)** diff --git a/en/readme/figures/power-management-subsystem-architecture.png b/en/readme/figures/power-management-subsystem-architecture.png index 698bf197806b9e260b6919e4eaeff2a9900b2d50..da1c6d779d3e7de861385f1f82daa84b79e34f0e 100644 Binary files a/en/readme/figures/power-management-subsystem-architecture.png and b/en/readme/figures/power-management-subsystem-architecture.png differ diff --git a/en/readme/power-management.md b/en/readme/power-management.md index efbb74157d502f451fb1ccf8d4c413d10d68534b..c1d2f1cca2584954102db32652c9116c9bf410d5 100644 --- a/en/readme/power-management.md +++ b/en/readme/power-management.md @@ -7,15 +7,19 @@ ## Introduction -The power management subsystem provides the following functionalities: +The power management subsystem provides the following functions: -1. Rebooting the device -2. Managing running locks -3. Querying the power status -4. Obtaining and reporting the charging and battery status -5. Turning on/off the device screen and adjusting the screen brightness +1. System restarting: restarts or shuts down the system. +2. System power management: manages the system power status and running lock. +3. Display-related power consumption adjustment: adjusts the backlight brightness based on the ambient light and turns off the screen based on the proximity light. +4. Power saving: works in low power consumption mode without compromising main functions and performance. +5. Battery management: supports charging and discharging, battery and charging status monitoring (including status updating and reporting), and charging upon power-off. +6. Temperature control: restricts temperature rise through application, SoC, and peripheral control when the device temperature reaches the specified limit. +7. Power consumption statistics: collects statistics on the power consumption of software, hardware, and a single application. +8. Battery service for mini-, small-, and standard-system devices +9. Power management service for mini-, small-, and standard-system devices -**Figure 1** Power management subsystem architecture +**Figure 1** Power management subsystem architecture ![](figures/power-management-subsystem-architecture.png) @@ -24,38 +28,38 @@ The power management subsystem provides the following functionalities: ``` /base/powermgr -├── battery_manager # Battery manager -│ ├── hdi # Hardware Driver Interfaces (HDIs) -│ ├── interfaces # APIs -│ ├── sa_profile # SA profile -│ ├── services # Services -│ └── utils # Utilities -├── display_manager # Display manager -│ ├── interfaces # APIs -│ └── sa_profile # SA profile -│ └── services # Services -│ └── utils # Utilities -├── powermgr_lite # Lite power manager -│ ├── interfaces # APIs -│ └── services # Services -└── power_manager # Power manager - ├── interfaces # APIs - ├── sa_profile # SA profile - └── services # Services - └── utils # Utilities +├── battery_lite # Battery service for mini-, small-, and standard-system devices +├── battery_manager # Battery service +├── battery_statistics # Power consumption statistics service +├── display_manager # Display energy efficiency management service +├── power_manager # System power management service +├── powermgr_lite # Power management service for mini-, small-, and standard-system devices +└── thermal_manager # Temperature control and thermal management service ``` ## Usage -You can use the APIs provided by the power management subsystem to create and release a running lock, obtain battery information, adjust the screen brightness, reboot a device, and power off a device. +As shown in the system architecture, the power management subsystem consists of seven modules. Some modules provide external APIs or public event notifications. You can use them based on your use cases. The functions of key modules are described as follows: + +- Power Manager: provides APIs to request and release the running lock, enable the power saving mode, adjust the brightness, and restart or power off the device. It also provides public events for you to observe changes of the power saving mode and power-off status. +- Battery Manager: provides APIs to query battery information. It also provides public events for you to observer changes of the battery status and charging/discharging status. +- Thermal Manager: provides APIs to query the temperature rise status of a device. It also allows you to register callbacks and public events to listen for the temperature rise status of a device. +- Battery Statistics: provides power consumption statistics on hardware and software. It allows you to query the power consumption of hardware or applications. ## Repositories Involved -**Power Management subsystem** +**Power Management Subsystem** + +[powermgr_power_manager](https://gitee.com/openharmony/powermgr_power_manager) + +[powermgr_display_manager](https://gitee.com/openharmony/powermgr_display_manager) + +[powermgr_battery_manager](https://gitee.com/openharmony/powermgr_battery_manager) -powermgr\_battery\_manager +[powermgr_thermal_manager](https://gitee.com/openharmony/powermgr_thermal_manager) -powermgr\_power\_manager +[powermgr_battery_statistics](https://gitee.com/openharmony/powermgr_battery_statistics) -powermgr\_display\_manager +[powermgr_battery_lite](https://gitee.com/openharmony/powermgr_battery_lite) +[powermgr_powermgr_lite](https://gitee.com/openharmony/powermgr_powermgr_lite)