From 27c0407fda87234cc22349ab36325da1fe5b816b Mon Sep 17 00:00:00 2001 From: q00569459 Date: Mon, 7 Feb 2022 12:01:06 +0800 Subject: [PATCH] upload thermal interface Signed-off-by: q00569459 --- api/@ohos.thermal.d.ts | 87 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 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..1cbd90ae0b --- /dev/null +++ b/api/@ohos.thermal.d.ts @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2021 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 interfaces to obtain thermal information. + * + * @SysCap SystemCapability.PowerMgr.ThermalManager + * @since 7 + */ +declare namespace thermal { + /** + * Enumerates the {@link ThermalLevel} types. + * + * @since 7 + */ + export enum ThermalLevel { + /** + * Indicates the device is cool. + */ + COOL = 0, + /** + * Indicates the device is in normal working condition, but not cool. + */ + NORMAL = 1, + /** + * Indicates the device is in a warm state. + */ + WARM = 2, + /** + * Indicates the device is in a hot state. + */ + HOT = 3, + /** + * Indicates the device is in a state of severe heating. + */ + OVERHEATED = 4, + /** + * Indicates the device is about to enter a state of emergency. + */ + WARNING = 5, + /** + * Indicates the device is in a state of emergency + * and must stop working immediately. + */ + EMERGENCY = 6, + } + /** + * Subscribe to thermal level change notification. + * + * @param callback Specified callback method. + * @return Return thermal level. + * @since 7 + */ + function subscribeThermalLevel(callback: AsyncCallback): void; + + /** + * Cancel thermal level change subscription. + * + * @param callback Specified callback method. + * @return Null. + * @since 7 + */ + function unsubscribeThermalLevel(callback?: AsyncCallback): void; + + /** + * Get the current thermal level information. + * + * @return Return the thermal level value. + * @since 7 + */ + function getThermalLevel(): number; +} +export default thermal; -- Gitee