From 67339340cb5e22a134011ccbf028f75a38f6efc5 Mon Sep 17 00:00:00 2001 From: q00569459 Date: Sun, 20 Feb 2022 23:20:51 +0800 Subject: [PATCH 1/3] Upload thermal js api Signed-off-by: q00569459 --- api/@ohos.thermal.d.ts | 88 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 api/@ohos.thermal.d.ts diff --git a/api/@ohos.thermal.d.ts b/api/@ohos.thermal.d.ts new file mode 100644 index 0000000000..2c933a6266 --- /dev/null +++ b/api/@ohos.thermal.d.ts @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback, Callback } from './basic'; + +/** + * Provides thermal level-related callback and query APIs to obtain the information required for temperature control. The APIs are as follows: + * {@link subscribeThermalLevel}: subscribes to callbacks of thermal level changes. + * {@link getThermalLevel}: obtains the thermal level of the system in real time. + * + * @SysCap SystemCapability.PowerMgr.ThermalManager + * @since 8 + */ +declare namespace thermal { + /** + * Enumerates the {@link ThermalLevel} types. + * + * @since 8 + */ + export enum ThermalLevel { + /** + * The device is cool, and services are not restricted. + */ + COOL = 0, + /** + * The device is operational but is not cool. You need to pay attention to its heating. + */ + NORMAL = 1, + /** + * The device is warm. You need to stop or delay some imperceptible services. + */ + WARM = 2, + /** + * The device is heating up. You need to stop all imperceptible services and downgrade or reduce the load of other services. + */ + HOT = 3, + /** + * The device is overheated. You need to stop all imperceptible services and downgrade or reduce the load of major services. + */ + OVERHEATED = 4, + /** + * 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. + */ + WARNING = 5, + /** + * The device has entered the emergency state. You need to stop all services except those for the emergency help purposes. + */ + EMERGENCY = 6, + } + /** + * Subscribes to callbacks of thermal level changes. + * + * @param callback Callback of thermal level changes. + * @return Returns the thermal level. + * @since 8 + */ + function subscribeThermalLevel(callback: AsyncCallback): void; + + /** + * Unsubscribes from the callbacks of thermal level changes. + * + * @param callback Callback of thermal level changes. + + * @since 8 + */ + function unsubscribeThermalLevel(callback?: AsyncCallback): void; + + /** + * Obtains the current thermal level. + * + * @return Returns the thermal level. + * @since 8 + */ + function getThermalLevel(): number; +} +export default thermal; -- Gitee From fe8ffaf176cc689b7314aaf6b49fb9ca87ae7b6a Mon Sep 17 00:00:00 2001 From: q00569459 Date: Mon, 21 Feb 2022 17:10:14 +0800 Subject: [PATCH 2/3] Fix translation Signed-off-by: q00569459 --- api/@ohos.thermal.d.ts | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/api/@ohos.thermal.d.ts b/api/@ohos.thermal.d.ts index 2c933a6266..350d3546ab 100644 --- a/api/@ohos.thermal.d.ts +++ b/api/@ohos.thermal.d.ts @@ -16,11 +16,12 @@ import { AsyncCallback, Callback } from './basic'; /** - * Provides thermal level-related callback and query APIs to obtain the information required for temperature control. The APIs are as follows: + * Provides thermal level-related callback and query APIs to obtain the information required for temperature control. + * The APIs are as follows: * {@link subscribeThermalLevel}: subscribes to callbacks of thermal level changes. * {@link getThermalLevel}: obtains the thermal level of the system in real time. * - * @SysCap SystemCapability.PowerMgr.ThermalManager + * @SysCap SystemCapability.PowerManager.ThermalManager * @since 8 */ declare namespace thermal { @@ -35,27 +36,33 @@ declare namespace thermal { */ COOL = 0, /** - * The device is operational but is not cool. You need to pay attention to its heating. + * The device is operational but is not cool. + * You need to pay attention to its heating. */ NORMAL = 1, /** - * The device is warm. You need to stop or delay some imperceptible services. + * The device is warm. + * You need to stop or delay some imperceptible services. */ WARM = 2, /** - * The device is heating up. You need to stop all imperceptible services and downgrade or reduce the load of other services. + * The device is heating up. + * You need to stop all imperceptible services and downgrade or reduce the load of other services. */ HOT = 3, /** - * The device is overheated. You need to stop all imperceptible services and downgrade or reduce the load of major services. + * The device is overheated. + * You need to stop all imperceptible services and downgrade or reduce the load of major services. */ OVERHEATED = 4, /** - * 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. + * 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. */ WARNING = 5, /** - * The device has entered the emergency state. You need to stop all services except those for the emergency help purposes. + * The device has entered the emergency state. + * You need to stop all services except those for the emergency help purposes. */ EMERGENCY = 6, } @@ -83,6 +90,6 @@ declare namespace thermal { * @return Returns the thermal level. * @since 8 */ - function getThermalLevel(): number; + function getThermalLevel(): ThermalLevel; } export default thermal; -- Gitee From 8c6b2154d49eee420d15108a2ae75da599146f4c Mon Sep 17 00:00:00 2001 From: q00569459 Date: Tue, 22 Feb 2022 09:27:41 +0800 Subject: [PATCH 3/3] format fix Signed-off-by: q00569459 --- api/@ohos.thermal.d.ts | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/api/@ohos.thermal.d.ts b/api/@ohos.thermal.d.ts index 350d3546ab..eb80bfa5f9 100644 --- a/api/@ohos.thermal.d.ts +++ b/api/@ohos.thermal.d.ts @@ -16,12 +16,12 @@ import { AsyncCallback, Callback } from './basic'; /** - * Provides thermal level-related callback and query APIs to obtain the information required for temperature control. - * The APIs are as follows: + * Provides thermal level-related callback and query APIs to obtain the information required for + * temperature control. The APIs are as follows: * {@link subscribeThermalLevel}: subscribes to callbacks of thermal level changes. * {@link getThermalLevel}: obtains the thermal level of the system in real time. * - * @SysCap SystemCapability.PowerManager.ThermalManager + * @syscap SystemCapability.PowerManager.ThermalManager * @since 8 */ declare namespace thermal { @@ -36,33 +36,31 @@ declare namespace thermal { */ COOL = 0, /** - * The device is operational but is not cool. - * You need to pay attention to its heating. + * The device is operational but is not cool. You need to pay attention to its heating. */ NORMAL = 1, /** - * The device is warm. - * You need to stop or delay some imperceptible services. + * The device is warm. You need to stop or delay some imperceptible services. */ WARM = 2, /** - * The device is heating up. - * You need to stop all imperceptible services and downgrade or reduce the load of other services. + * The device is heating up. You need to stop all imperceptible services and downgrade + * or reduce the load of other services. */ HOT = 3, /** - * The device is overheated. - * You need to stop all imperceptible services and downgrade or reduce the load of major services. + * The device is overheated. You need to stop all imperceptible services and downgrade + * or reduce the load of major services. */ OVERHEATED = 4, /** - * 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. + * 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. */ WARNING = 5, /** - * The device has entered the emergency state. - * You need to stop all services except those for the emergency help purposes. + * The device has entered the emergency state. You need to stop all services except those + * for the emergency help purposes. */ EMERGENCY = 6, } -- Gitee