1# Thermal Manager 2 3> **NOTE**<br> 4> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. 5 6This module provides thermal level-related callback and query APIs to obtain the information required for thermal control. 7 8 9## Modules to Import 10 11```js 12import thermal from '@ohos.thermal'; 13``` 14 15 16## ThermalLevel 17 18Represents the thermal level. 19 20**System capability:** SystemCapability.PowerManager.ThermalManager 21 22| Name | Default Value | Description | 23| ---------- | ---- | ---------------------------------------- | 24| COOL | 0 | The device is cool, and services are not restricted.| 25| NORMAL | 1 | The device is operational but is not cool. You need to pay attention to its heating.| 26| WARM | 2 | The device is warm. You need to stop or delay some imperceptible services.| 27| HOT | 3 | The device is heating up. You need to stop all imperceptible services and downgrade or reduce the load of other services.| 28| OVERHEATED | 4 | The device is overheated. You need to stop all imperceptible services and downgrade or reduce the load of major services.| 29| WARNING | 5 | The device is overheated and is about to enter the emergency state. You need to stop all imperceptible services and downgrade major services to the maximum extent.| 30| EMERGENCY | 6 | The device has entered the emergency state. You need to stop all services except those for the emergency help purposes.| 31 32 33## thermal.subscribeThermalLevel 34 35subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void 36 37Subscribes to thermal level changes. 38 39**System capability:** SystemCapability.PowerManager.ThermalManager 40 41**Parameters** 42 43| Name | Type | Mandatory | Description | 44| -------- | --------------------------------- | ---- | ---------------------------------------- | 45| callback | AsyncCallback<ThermalLevel> | Yes | Callback used to obtain the return value.<br>Return value: thermal level| 46 47**Example** 48 49```js 50var lev = 0; 51thermal.subscribeThermalLevel((lev) => { 52 console.info("Thermal level is: " + lev); 53}) 54``` 55 56## thermal.unsubscribeThermalLevel 57 58unsubscribeThermalLevel(callback?: AsyncCallback\<void>): void 59 60Unsubscribes from thermal level changes. 61 62**System capability:** SystemCapability.PowerManager.ThermalManager 63 64**Parameters** 65 66| Name | Type | Mandatory | Description | 67| -------- | ------------------------- | ---- | --------------------- | 68| callback | AsyncCallback<void> | No | Callback without a return value.| 69 70**Example** 71 72```js 73thermal.unsubscribeThermalLevel(() => { 74 console.info("Unsubscribe completed."); 75}); 76``` 77 78## thermal.getThermalLevel 79 80getThermalLevel(): ThermalLevel 81 82Obtains the current thermal level. 83 84**System capability:** SystemCapability.PowerManager.ThermalManager 85 86**Return value**: 87 88| Type | Description | 89| ------------ | ------ | 90| ThermalLevel | Thermal level obtained.| 91 92**Example** 93 94```js 95var lev = thermal.getThermalLevel(); 96console.info("Thermal level is: " + lev); 97``` 98