mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2025-02-25 19:52:16 +00:00
feat: js api support errors
Signed-off-by: aqxyjay <zhangchunxin@huawei.com>
This commit is contained in:
parent
6291e4567f
commit
dd360cffff
2
api/@ohos.batteryInfo.d.ts
vendored
2
api/@ohos.batteryInfo.d.ts
vendored
@ -241,7 +241,7 @@ declare namespace batteryInfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* Etra key code of common event COMMON_EVENT_BATTERY_CHANGED.
|
||||
* Extra key code of common event COMMON_EVENT_BATTERY_CHANGED.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
|
35
api/@ohos.batteryStatistics.d.ts
vendored
35
api/@ohos.batteryStatistics.d.ts
vendored
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AsyncCallback } from "./basic";
|
||||
import {AsyncCallback, BusinessError} from "./basic";
|
||||
|
||||
/**
|
||||
* Provides methods to get power consumption information.
|
||||
@ -61,18 +61,28 @@ declare namespace batteryStats {
|
||||
/**
|
||||
* Obtains the power consumption information list.
|
||||
*
|
||||
* @return Returns power consumption information list of a device.
|
||||
* @return {Promise<Array<BatteryStatsInfo>>} Power consumption information list.
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getBatteryStats(): Promise<Array<BatteryStatsInfo>>;
|
||||
|
||||
/**
|
||||
* Obtains the power consumption information list.
|
||||
*
|
||||
* @param {AsyncCallback} callback Indicates the callback of power consumption information list.
|
||||
* @throws {BusinessError} 401 If the callback is not valid.
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getBatteryStats(callback: AsyncCallback<Array<BatteryStatsInfo>>): void;
|
||||
|
||||
/**
|
||||
* Obtains power consumption information(Mah) for a given uid.
|
||||
*
|
||||
* @param uid Indicates the uid.
|
||||
* @return Returns power consumption information(Mah).
|
||||
* @param {number} uid Indicates the uid.
|
||||
* @return {number} Power consumption information(Mah).
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
@ -81,8 +91,9 @@ declare namespace batteryStats {
|
||||
/**
|
||||
* Obtains power consumption information(Percent) for a given uid.
|
||||
*
|
||||
* @param uid Indicates the uid.
|
||||
* @return Returns power consumption information(Percent).
|
||||
* @param {number} uid Indicates the uid.
|
||||
* @return {number} Power consumption information(Percent).
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
@ -91,8 +102,10 @@ declare namespace batteryStats {
|
||||
/**
|
||||
* Obtains power consumption information(Mah) for a given type.
|
||||
*
|
||||
* @param ConsumptionType Indicates the hardware type.
|
||||
* @return Returns power consumption information(Mah).
|
||||
* @param {ConsumptionType} type Indicates the hardware type.
|
||||
* @return {number} Power consumption information(Mah).
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @throws {BusinessError} 401 If the type is not valid.
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
@ -101,8 +114,10 @@ declare namespace batteryStats {
|
||||
/**
|
||||
* Obtains power consumption information(Percent) for a given type.
|
||||
*
|
||||
* @param ConsumptionType Indicates the hardware type.
|
||||
* @return Returns power consumption information(Percent).
|
||||
* @param {ConsumptionType} type Indicates the hardware type.
|
||||
* @return {number} Power consumption information(Percent).
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @throws {BusinessError} 401 If the type is not valid.
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
|
22
api/@ohos.brightness.d.ts
vendored
22
api/@ohos.brightness.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-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
|
||||
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AsyncCallback } from './basic';
|
||||
import {BusinessError} from './basic';
|
||||
|
||||
/**
|
||||
* Provides interfaces to control the power of display.
|
||||
@ -23,13 +23,15 @@ import { AsyncCallback } from './basic';
|
||||
* @since 7
|
||||
*/
|
||||
declare namespace brightness {
|
||||
/**
|
||||
* Sets the screen brightness.
|
||||
*
|
||||
* @param value Brightness value, ranging from 0 to 255.
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
function setValue(value: number): void;
|
||||
/**
|
||||
* Sets the screen brightness.
|
||||
*
|
||||
* @param {number} value Brightness value, ranging from 0 to 255.
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @throws {BusinessError} 401 If the value is not valid.
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
function setValue(value: number): void;
|
||||
}
|
||||
export default brightness;
|
||||
|
229
api/@ohos.power.d.ts
vendored
229
api/@ohos.power.d.ts
vendored
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {AsyncCallback} from './basic';
|
||||
import {AsyncCallback, BusinessError} from './basic';
|
||||
|
||||
/**
|
||||
* Provides interfaces to manage power.
|
||||
@ -22,103 +22,148 @@ import {AsyncCallback} from './basic';
|
||||
* @since 7
|
||||
*/
|
||||
declare namespace power {
|
||||
/**
|
||||
* Shuts down the system.
|
||||
*
|
||||
* <p>This method requires the ohos.permission.REBOOT permission.
|
||||
*
|
||||
* @param reason Indicates the shutdown reason.
|
||||
* @permission ohos.permission.REBOOT
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
function shutdownDevice(reason: string): void;
|
||||
/**
|
||||
* Shuts down the system.
|
||||
*
|
||||
* <p>This method requires the ohos.permission.REBOOT permission.
|
||||
*
|
||||
* @permission ohos.permission.REBOOT
|
||||
* @param {string} reason Indicates the shutdown reason.
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @throws {BusinessError} 201 If the permission is denied.
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
function shutdown(reason: string): void;
|
||||
|
||||
/**
|
||||
* Restarts the system.
|
||||
*
|
||||
* <p>This method requires the ohos.permission.REBOOT permission.
|
||||
*
|
||||
* @param reason Indicates the restart reason. For example, "updater" means to enter the updater mode
|
||||
* after the restart. If the parameter is not specified, the system enters the normal mode after the restart.
|
||||
* @permission ohos.permission.REBOOT
|
||||
* @since 7
|
||||
*/
|
||||
function rebootDevice(reason: string): void;
|
||||
/**
|
||||
* Restarts the system.
|
||||
*
|
||||
* <p>This method requires the ohos.permission.REBOOT permission.
|
||||
*
|
||||
* @param reason Indicates the restart reason. For example, "updater" indicates entering the updater mode
|
||||
* after the restart. If the parameter is not specified, the system enters the normal mode after the restart.
|
||||
* @permission ohos.permission.REBOOT
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
*/
|
||||
function rebootDevice(reason: string): void;
|
||||
|
||||
/**
|
||||
* Checks whether the screen of a device is on or off.
|
||||
*
|
||||
* @return Returns true if the screen is on; returns false otherwise.
|
||||
* @since 7
|
||||
*/
|
||||
function isScreenOn(callback: AsyncCallback<boolean>): void;
|
||||
function isScreenOn(): Promise<boolean>;
|
||||
/**
|
||||
* Restarts the system.
|
||||
*
|
||||
* <p>This method requires the ohos.permission.REBOOT permission.
|
||||
*
|
||||
* @permission ohos.permission.REBOOT
|
||||
* @param {string} reason Indicates the restart reason. For example, "updater" indicates entering the updater mode
|
||||
* after the restart. If the parameter is not specified, the system enters the normal mode after the restart.
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @throws {BusinessError} 201 If the permission is denied.
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function reboot(reason: string): void;
|
||||
|
||||
/**
|
||||
* Wakes up the device to turn on the screen.
|
||||
*
|
||||
* @param detail Indicates the detailed wakeup information.
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function wakeupDevice(detail: string): void;
|
||||
/**
|
||||
* Checks whether the screen of a device is on or off.
|
||||
*
|
||||
* @return Returns true if the screen is on; returns false otherwise.
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link isScreenOn}
|
||||
*/
|
||||
function isScreenOn(callback: AsyncCallback<boolean>): void;
|
||||
function isScreenOn(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Suspends the device to turn off the screen.
|
||||
*
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function suspendDevice(): void;
|
||||
/**
|
||||
* Checks whether the screen of a device is on or off.
|
||||
*
|
||||
* @return Returns true if the screen is on; returns false otherwise.
|
||||
* @throws {BusinessError} If connecting to the service failed.
|
||||
* @since 9
|
||||
*/
|
||||
function isScreenOn(): boolean;
|
||||
|
||||
/**
|
||||
* Obtains the power mode of the current device. For details, see {@link DevicePowerMode}.
|
||||
*
|
||||
* @return Returns the power mode of current device .
|
||||
* @permission ohos.permission.POWER_OPTIMIZATION
|
||||
* @since 9
|
||||
*/
|
||||
function getPowerMode(callback: AsyncCallback<DevicePowerMode>): void;
|
||||
function getPowerMode(): Promise<DevicePowerMode>;
|
||||
/**
|
||||
* Wakes up the device to turn on the screen.
|
||||
*
|
||||
* @param {string} detail Indicates the detail information who request wakeup.
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function wakeup(detail: string): void;
|
||||
|
||||
/**
|
||||
* Sets the power mode of current device. For details, see {@link DevicePowerMode}.
|
||||
*
|
||||
* @param mode Indicates the power mode to set.
|
||||
* @permission ohos.permission.POWER_OPTIMIZATION
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function setPowerMode(mode: DevicePowerMode, callback: AsyncCallback<void>): void;
|
||||
function setPowerMode(mode: DevicePowerMode): Promise<void>;
|
||||
/**
|
||||
* Suspends the device to turn off the screen.
|
||||
*
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function suspend(): void;
|
||||
|
||||
/**
|
||||
* Power mode of a device.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
export enum DevicePowerMode {
|
||||
/**
|
||||
* Normal power mode
|
||||
* @since 9
|
||||
*/
|
||||
MODE_NORMAL = 600,
|
||||
/**
|
||||
* Power save mode
|
||||
* @since 9
|
||||
*/
|
||||
MODE_POWER_SAVE,
|
||||
/**
|
||||
* Performance power mode
|
||||
* @since 9
|
||||
*/
|
||||
MODE_PERFORMANCE,
|
||||
/**
|
||||
* Extreme power save mode
|
||||
* @since 9
|
||||
*/
|
||||
MODE_EXTREME_POWER_SAVE
|
||||
}
|
||||
/**
|
||||
* Obtains the power mode of the current device. For details, see {@link DevicePowerMode}.
|
||||
*
|
||||
* @permission ohos.permission.POWER_OPTIMIZATION
|
||||
* @return The power mode {@link DevicePowerMode} of current device .
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @throws {BusinessError} 201 If the permission is denied.
|
||||
* @since 9
|
||||
*/
|
||||
function getPowerMode(): DevicePowerMode;
|
||||
|
||||
/**
|
||||
* Obtains the power mode of the current device. For details, see {@link DevicePowerMode}.
|
||||
*
|
||||
* @permission ohos.permission.POWER_OPTIMIZATION
|
||||
* @param {DevicePowerMode} mode Indicates power mode {@link DevicePowerMode} to set.
|
||||
* @param {AsyncCallback<void>} callback Indicates the callback of setting the power mode.
|
||||
* @throws {BusinessError} 401 If mode or callback is not valid.
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function setPowerMode(mode: DevicePowerMode, callback: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Sets the power mode of current device. For details, see {@link DevicePowerMode}.
|
||||
*
|
||||
* @permission ohos.permission.POWER_OPTIMIZATION
|
||||
* @param {DevicePowerMode} mode Indicates power mode {@link DevicePowerMode} to set.
|
||||
* @throws {BusinessError} 401 If mode is not valid.
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function setPowerMode(mode: DevicePowerMode): Promise<void>;
|
||||
|
||||
/**
|
||||
* Power mode of a device.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
export enum DevicePowerMode {
|
||||
/**
|
||||
* Normal power mode
|
||||
* @since 9
|
||||
*/
|
||||
MODE_NORMAL = 600,
|
||||
/**
|
||||
* Power save mode
|
||||
* @since 9
|
||||
*/
|
||||
MODE_POWER_SAVE,
|
||||
/**
|
||||
* Performance power mode
|
||||
* @since 9
|
||||
*/
|
||||
MODE_PERFORMANCE,
|
||||
/**
|
||||
* Extreme power save mode
|
||||
* @since 9
|
||||
*/
|
||||
MODE_EXTREME_POWER_SAVE
|
||||
}
|
||||
}
|
||||
export default power;
|
||||
|
111
api/@ohos.runningLock.d.ts
vendored
111
api/@ohos.runningLock.d.ts
vendored
@ -13,16 +13,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {AsyncCallback} from './basic';
|
||||
import {AsyncCallback, BusinessError} from './basic';
|
||||
|
||||
/**
|
||||
* Provides a mechanism to prevent the system from hibernating so that the applications can run in the background or
|
||||
* when the screen is off.
|
||||
*
|
||||
* <p>{@link createRunningLock} can be called to obtain a {@link RunningLock}.
|
||||
* <p>{@link lock} can be called to set the lock duration, during which the system will not hibernate. After the
|
||||
* lock duration times out, the lock is automatically released and the system hibernates if no other {@link
|
||||
* RunningLock} is set.
|
||||
* <p>{@link create} can be called to obtain a {@link RunningLock}.
|
||||
* <p>{@link hold} can be called to set the lock duration, during which the system will not hibernate. After the
|
||||
* lock duration times out, the lock is automatically released and the system hibernates if no other
|
||||
* {@link RunningLock} is set.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
@ -33,29 +33,66 @@ declare namespace runningLock {
|
||||
* Prevents the system from hibernating and sets the lock duration.
|
||||
* This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @param timeout Indicates the lock duration (ms). After the lock duration times out, the lock is automatically
|
||||
* released and the system hibernates if no other {@link RunningLock} is set.
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link hold}
|
||||
*/
|
||||
lock(timeout: number): void;
|
||||
|
||||
/**
|
||||
* Prevents the system from hibernating and sets the lock duration.
|
||||
* This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @param {number} timeout Indicates the lock duration (ms). After the lock duration times out,
|
||||
* the lock is automatically released and the system hibernates if no other {@link RunningLock} is set.
|
||||
* @throws {BusinessError} If connecting to the service failed.
|
||||
* @since 9
|
||||
*/
|
||||
hold(timeout: number): void;
|
||||
|
||||
/**
|
||||
* Checks whether a lock is held or in use.
|
||||
*
|
||||
* @return Returns true if the lock is held or in use; returns false if the lock has been released.
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link isHolding}
|
||||
*/
|
||||
isUsed(): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether a lock is held or in use.
|
||||
*
|
||||
* @return Returns true if the lock is held or in use; returns false if the lock has been released.
|
||||
* @throws {BusinessError} If connecting to the service failed.
|
||||
* @since 9
|
||||
*/
|
||||
isHolding(): boolean;
|
||||
|
||||
/**
|
||||
* Release the {@link RunningLock} that prevents the system from hibernating.
|
||||
* This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* @since 7
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link unhold}
|
||||
*/
|
||||
unlock(): void;
|
||||
|
||||
/**
|
||||
* Release the {@link RunningLock} that prevents the system from hibernating.
|
||||
* This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @throws {BusinessError} If connecting to the service failed.
|
||||
* @since 9
|
||||
*/
|
||||
unhold(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,9 +125,33 @@ declare namespace runningLock {
|
||||
* @return Returns true if the specified {@link RunningLockType} is supported;
|
||||
* returns false otherwise.
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link iSupported}
|
||||
*/
|
||||
function isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boolean>): void;
|
||||
function isRunningLockTypeSupported(type: RunningLockType): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Checks whether the specified {@link RunningLockType} is supported.
|
||||
*
|
||||
* @param {RunningLockType} type Indicates the specified {@link RunningLockType}.
|
||||
* @param {AsyncCallback} callback Indicates the callback of whether the specified {@link RunningLockType}
|
||||
* is supported.
|
||||
* @throws {BusinessError} If the type or callback is not valid.
|
||||
* @since 9
|
||||
*/
|
||||
function iSupported(type: RunningLockType, callback: AsyncCallback<boolean>): void;
|
||||
|
||||
/**
|
||||
* Checks whether the specified {@link RunningLockType} is supported.
|
||||
*
|
||||
* @param {RunningLockType} type Indicates the specified {@link RunningLockType}.
|
||||
* @return {Promise<boolean>} Whether the specified {@link RunningLockType} is supported.
|
||||
* @throws {BusinessError} If the type is not valid.
|
||||
* @since 9
|
||||
*/
|
||||
function isSupported(type: RunningLockType): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Creates a {@link RunningLock} object.
|
||||
*
|
||||
@ -104,8 +165,44 @@ declare namespace runningLock {
|
||||
* @return Returns the {@link RunningLock} object.
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link create}
|
||||
*/
|
||||
function createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>): void;
|
||||
function createRunningLock(name: string, type: RunningLockType): Promise<RunningLock>;
|
||||
|
||||
/**
|
||||
* Creates a {@link RunningLock} object.
|
||||
*
|
||||
* <p>This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* <p>The {@link RunningLock} object can be used to perform a lock operation to prevent the system from hibernating.
|
||||
*
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @param {string} name Indicates the {@link RunningLock} name. A recommended name consists of the package or
|
||||
* class name and a suffix.
|
||||
* @param {RunningLockType} type Indicates the {@link RunningLockType}.
|
||||
* @param {AsyncCallback<RunningLock>)} callback Indicates the callback of {@link RunningLock} object.
|
||||
* @throws {BusinessError} If the name, type or callback is not valid.
|
||||
* @since 9
|
||||
*/
|
||||
function create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>): void;
|
||||
|
||||
/**
|
||||
* Creates a {@link RunningLock} object.
|
||||
*
|
||||
* <p>This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* <p>The {@link RunningLock} object can be used to perform a lock operation to prevent the system from hibernating.
|
||||
*
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @param {string} name Indicates the {@link RunningLock} name. A recommended name consists of the package or
|
||||
* class name and a suffix.
|
||||
* @param {RunningLockType} type Indicates the {@link RunningLockType}.
|
||||
* @return {Promise<RunningLock>} The {@link RunningLock} object.
|
||||
* @throws {BusinessError} If the name or type is not valid.
|
||||
* @since 9
|
||||
*/
|
||||
function create(name: string, type: RunningLockType): Promise<RunningLock>;
|
||||
}
|
||||
export default runningLock;
|
||||
|
52
api/@ohos.thermal.d.ts
vendored
52
api/@ohos.thermal.d.ts
vendored
@ -13,13 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AsyncCallback, Callback } from './basic';
|
||||
import {AsyncCallback, BusinessError} from './basic';
|
||||
|
||||
/**
|
||||
* Provides thermal level-related callback and query APIs to obtain the information required for
|
||||
* 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.
|
||||
* {@link registerThermalLevelCallback}: subscribes to callbacks of thermal level changes.
|
||||
* {@link getLevel}: obtains the thermal level of the system in real time.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 8
|
||||
@ -44,50 +44,84 @@ declare namespace thermal {
|
||||
*/
|
||||
WARM = 2,
|
||||
/**
|
||||
* The device is heating up. You need to stop all imperceptible services and downgrade
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link registerThermalLevelCallback}
|
||||
*/
|
||||
function subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void;
|
||||
|
||||
/**
|
||||
* Registers to callbacks of thermal level changes.
|
||||
*
|
||||
* @param {AsyncCallback<void>} callback Callback of thermal level changes.
|
||||
* @throws {BusinessError} 401 If callback is not valid.
|
||||
* @since 9
|
||||
*/
|
||||
function registerThermalLevelCallback(callback: AsyncCallback<ThermalLevel>): void;
|
||||
|
||||
/**
|
||||
* Unsubscribes from the callbacks of thermal level changes.
|
||||
*
|
||||
* @param callback Callback of thermal level changes.
|
||||
|
||||
* @since 8
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link unregisterThermalLevelCallback}
|
||||
*/
|
||||
function unsubscribeThermalLevel(callback?: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Unregisters from the callbacks of thermal level changes.
|
||||
*
|
||||
* @param {AsyncCallback<void>} callback Callback of thermal level changes.
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @throws {BusinessError} 401 If callback is not valid.
|
||||
* @since 9
|
||||
*/
|
||||
function unregisterThermalLevelCallback(callback?: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Obtains the current thermal level.
|
||||
*
|
||||
* @return Returns the thermal level.
|
||||
* @since 8
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link getLevel}
|
||||
*/
|
||||
function getThermalLevel(): ThermalLevel;
|
||||
|
||||
/**
|
||||
* Obtains the current thermal level.
|
||||
*
|
||||
* @return {ThermalLevel} The thermal level.
|
||||
* @throws {BusinessError} 101 If connecting to the service failed.
|
||||
* @since 9
|
||||
*/
|
||||
function getLevel(): ThermalLevel;
|
||||
}
|
||||
export default thermal;
|
||||
|
Loading…
x
Reference in New Issue
Block a user