• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { AsyncCallback, Callback } from './basic';
17
18/**
19 * Provides thermal level-related callback and query APIs to obtain the information required for
20 * temperature control. The APIs are as follows:
21 * {@link subscribeThermalLevel}: subscribes to callbacks of thermal level changes.
22 * {@link getThermalLevel}: obtains the thermal level of the system in real time.
23 *
24 * @syscap SystemCapability.PowerManager.ThermalManager
25 * @since 8
26 */
27declare namespace thermal {
28    /**
29     * Enumerates the {@link ThermalLevel} types.
30     *
31     * @since 8
32     */
33    export enum ThermalLevel {
34        /**
35         * The device is cool, and services are not restricted.
36         */
37        COOL = 0,
38        /**
39         * The device is operational but is not cool. You need to pay attention to its heating.
40         */
41        NORMAL = 1,
42        /**
43         * The device is warm. You need to stop or delay some imperceptible services.
44         */
45        WARM = 2,
46        /**
47         * The device is heating up. You need to stop all imperceptible services and downgrade
48         * or reduce the load of other services.
49         */
50        HOT = 3,
51        /**
52         * The device is overheated. You need to stop all imperceptible services and downgrade
53         * or reduce the load of major services.
54         */
55        OVERHEATED = 4,
56        /**
57         * The device is overheated and is about to enter the emergency state. You need to stop
58         * all imperceptible services and downgrade major services to the maximum extent.
59         */
60        WARNING = 5,
61        /**
62         * The device has entered the emergency state. You need to stop all services except those
63         * for the emergency help purposes.
64         */
65        EMERGENCY = 6,
66    }
67    /**
68     * Subscribes to callbacks of thermal level changes.
69     *
70     * @param callback Callback of thermal level changes.
71     * @return Returns the thermal level.
72     * @since 8
73     */
74    function subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void;
75
76    /**
77     * Unsubscribes from the callbacks of thermal level changes.
78     *
79     * @param callback Callback of thermal level changes.
80
81     * @since 8
82     */
83    function unsubscribeThermalLevel(callback?: AsyncCallback<void>): void;
84
85    /**
86     * Obtains the current thermal level.
87     *
88     * @return Returns the thermal level.
89     * @since 8
90     */
91    function getThermalLevel(): ThermalLevel;
92}
93export default thermal;
94