# Thermal Manager
- [Introduction](#section0056945901)
- [Directory Structure](#section0056945902)
- [Configuration Description](#section0056945903)
- [Repositories Involved](#section0056945904)
## Introduction
The thermal manager provides the device temperature management and control capabilities to ensure the thermal safety and experience of the entire system.
**Figure 1** Architecture of the thermal manager

**Key components of the thermal manager**:
1. Thermal Manager: provides temperature query and callback APIs for applications and other subsystems.
2. Thermal Service: implements core temperature control functions, such as temperature detection, temperature level arbitration, and action delivery, according to the configuration file.
3. Thermal HDI: implements temperature driver information reporting and driver instruction delivery according to the configuration file.
4. Thermal Protector: implements simplified temperature control in the non-running state according to the configuration file.
## Directory Structure
```
/base/powermgr/thermal_manager
├── application # Native application
│ └── protector # Thermal Protector code
├── etc # init configuration
├── figures # Figures
├── frameworks # NAPIs
├── hdi # Thermal HDI code
│ ├── api # APIs
│ ├── client # Client code
│ └── service # Service code
├── interface # APIs
│ ├── innerkits # Internal APIs
│ └── kits # External APIs
├── sa_profile # SA profile
├── services # Thermal Service code
│ ├── native # Native APIs
│ ├── test # Unit test code
│ └── zidl # zidl APIs
├── test # Test code
└── utils # Utilities
```
## Configuration Description
**1. thermal\_service\_config.xml**
Configuration example:
```
2800000
2400000
1500
3
2200000
1800000
1200
4
1600000
1200000
1000
5
1
```
```
thermal # Root directory. Wherein, version indicates the version number, and product indicates the product name.
├── base # base directory, used to configure basic parameters.
│ └── item # item directory. Wherein, tag indicates the configuration tag, and value indicates the configuration value.
├── level # Level directory, used to store the temperature level information.
│ └── sensor_cluster # sensor_cluster directory, used to configure a cluster of sensors. Wherein, name indicates the cluster name, and sensor indicates the sensor name.
│ └── item # item directory, used to configure the temperature level information. Wherein, level indicates the temperature level, threshold indicates the triggering temperature, and xxx_clr indicates the setback temperature.
├── state # state directory, used to configure the state machine. Wherein, name indicates the name of the state machine.
├── action # action directory, used to configure actions. Wherein, name indicates the name of the action, param indicates the action parameter, and strict indicates the arbitration scheme.
└── policy # policy directory, used to configure the policy for the corresponding temperature level.
└── config # config directory, used to configure the action for the corresponding temperature level. Wherein, name is that of sensor_cluster, and the level is that of the item in sensor_cluster.
└── # action name corresponding to the action value. The state condition and its value can be configured in this attribute.
```
**2. thermal\_hdi\_config.xml**
Configuration example:
```
```
Directory structure:
```
thermal # Root directory. Wherein, version indicates the version number, and product indicates the product name.
├── base # base directory, used to configure basic parameters.
│ └── item # item directory. Wherein, tag indicates the configuration tag, and value indicates the configuration value.
└── polling # polling directory, used to configure the temperature reporting information
└── group # group directory, used to configure the temperature reporting group. Wherein, name indicates the group name, and interval indicates the polling and reporting interval, in milliseconds.
├── thermal_zone # thermal_zone directory, used to configure the thermal zone reporting information. Wherein, type indicates the driver type, and replace (optional) indicates the name of the driver type to replace.
└── thermal_node # thermal_node directory, used to configure driver node reporting information. Wherein, path indicates the node path.
```
**3. thermal\_protector\_config.xml**
Configuration example:
```
-
1800
-
1500
5
```
Directory structure:
```
thermal # Root directory. Wherein, version indicates the version number, and product indicates the product name.
├── base # base directory, used to configure basic parameters.
│ └── item # item directory. Wherein, tag indicates the configuration tag, and value indicates the configuration value.
└── control # control directory, used to configure the temperature level and corresponding action.
└── thermal_zone # thermal_zone directory, used to configure the thermal zone reporting information. Wherein, type indicates the driver type, and interval indicates the polling and reporting interval, in milliseconds.
└── item # item directory, used to configure the temperature level information. Wherein, level indicates the temperature level, threshold indicates the triggering temperature, and xxx_clr indicates the setback temperature.
└── # action name corresponding to the action value.
```
## Repositories Involved
[Power Management Subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/power-management.md)
[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_thermal_manager**
[powermgr_battery_statistics](https://gitee.com/openharmony/powermgr_battery_statistics)
[powermgr_battery_lite](https://gitee.com/openharmony/powermgr_battery_lite)
[powermgr_powermgr_lite](https://gitee.com/openharmony/powermgr_powermgr_lite)