mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 14:13:45 +00:00
docs: JSDoc normative modification
Signed-off-by: waaaaanyang <wanyang10@huawei.com>
This commit is contained in:
parent
e7b30d285f
commit
71c9178cea
611
api/@ohos.batteryInfo.d.ts
vendored
611
api/@ohos.batteryInfo.d.ts
vendored
@ -15,7 +15,6 @@
|
||||
|
||||
/**
|
||||
* Obtains battery information of a device.
|
||||
*
|
||||
* <p>Battery information includes the remaining battery power,
|
||||
* voltage, temperature, model, and charger type.
|
||||
*
|
||||
@ -24,307 +23,387 @@
|
||||
* @since 6
|
||||
*/
|
||||
declare namespace batteryInfo {
|
||||
/**
|
||||
* Battery state of charge (SoC) of the current device, in percent.
|
||||
*
|
||||
* @constant
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const batterySOC: number;
|
||||
|
||||
/**
|
||||
* Battery charging status of the current device.
|
||||
*
|
||||
* @constant
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const chargingStatus: BatteryChargeState;
|
||||
|
||||
/**
|
||||
* Battery health state of the current device.
|
||||
*
|
||||
* @constant
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const healthStatus: BatteryHealthState;
|
||||
|
||||
/**
|
||||
* Charger type of the current device.
|
||||
*
|
||||
* @constant
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const pluggedType: BatteryPluggedType;
|
||||
|
||||
/**
|
||||
* Battery voltage of the current device, in µV.
|
||||
*
|
||||
* @constant
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const voltage: number;
|
||||
|
||||
/**
|
||||
* Battery technology of the current device.
|
||||
*
|
||||
* @constant
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const technology: string;
|
||||
|
||||
/**
|
||||
* Battery temperature of the current device, in 0.1℃.
|
||||
*
|
||||
* @constant
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const batteryTemperature: number;
|
||||
|
||||
/**
|
||||
* Battery present state of the current device.
|
||||
*
|
||||
* @constant
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 7
|
||||
*/
|
||||
const isBatteryPresent: boolean;
|
||||
|
||||
/**
|
||||
* Battery capacity level of the current device.
|
||||
*
|
||||
* @constant
|
||||
* @type { BatteryCapacityLevel }
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
const batteryCapacityLevel: BatteryCapacityLevel;
|
||||
|
||||
/**
|
||||
* Estimated remaining time for the current device to be fully charged, in ms.
|
||||
*
|
||||
* @constant
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
const estimatedRemainingChargeTime: number;
|
||||
|
||||
/**
|
||||
* Battery total energy of the current device, in mAh.
|
||||
*
|
||||
* @constant
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
const totalEnergy: number;
|
||||
|
||||
/**
|
||||
* Battery immediate current of the current device, in mA.
|
||||
*
|
||||
* @constant
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
const nowCurrent: number;
|
||||
|
||||
/**
|
||||
* Battery remaining energy of the current device, in mAh.
|
||||
*
|
||||
* @constant
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
const remainingEnergy: number;
|
||||
|
||||
/**
|
||||
* Charger type of a device.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
export enum BatteryPluggedType {
|
||||
/**
|
||||
* Battery state of charge (SoC) of the current device, in percent.
|
||||
* Unknown type
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const batterySOC: number;
|
||||
|
||||
NONE,
|
||||
/**
|
||||
* Battery charging status of the current device.
|
||||
* AC charger
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const chargingStatus: BatteryChargeState;
|
||||
|
||||
AC,
|
||||
/**
|
||||
* Battery health state of the current device.
|
||||
* USB charger
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const healthStatus: BatteryHealthState;
|
||||
|
||||
USB,
|
||||
/**
|
||||
* Charger type of the current device.
|
||||
* Wireless charger
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const pluggedType: BatteryPluggedType;
|
||||
WIRELESS
|
||||
}
|
||||
|
||||
/**
|
||||
* Battery charging status of a device.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
export enum BatteryChargeState {
|
||||
/**
|
||||
* Battery voltage of the current device, in µV.
|
||||
* Unknown state.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const voltage: number;
|
||||
|
||||
NONE,
|
||||
/**
|
||||
* Battery technology of the current device.
|
||||
* The battery is being charged.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const technology: string;
|
||||
|
||||
ENABLE,
|
||||
/**
|
||||
* Battery temperature of the current device, in 0.1℃.
|
||||
* The battery is not being charged.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const batteryTemperature: number;
|
||||
|
||||
DISABLE,
|
||||
/**
|
||||
* Battery present state of the current device.
|
||||
* @since 7
|
||||
* The battery is fully charged.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
const isBatteryPresent: boolean;
|
||||
FULL
|
||||
}
|
||||
|
||||
/**
|
||||
* Battery health status of a device.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
export enum BatteryHealthState {
|
||||
/**
|
||||
* Battery capacity level of the current device.
|
||||
* @type {BatteryCapacityLevel}
|
||||
* Unknown state.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
UNKNOWN,
|
||||
/**
|
||||
* The battery is in healthy state.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
GOOD,
|
||||
/**
|
||||
* The battery is overheated.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
OVERHEAT,
|
||||
/**
|
||||
* The battery voltage is over high.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
OVERVOLTAGE,
|
||||
/**
|
||||
* The battery temperature is low.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
COLD,
|
||||
/**
|
||||
* The battery is dead.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
DEAD
|
||||
}
|
||||
|
||||
/**
|
||||
* Battery capacity level of a device.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
export enum BatteryCapacityLevel {
|
||||
/**
|
||||
* The battery is in full capacity level.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
const batteryCapacityLevel: BatteryCapacityLevel;
|
||||
|
||||
LEVEL_FULL,
|
||||
/**
|
||||
* Estimated remaining time for the current device to be fully charged, in ms.
|
||||
* @type {number}
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
const estimatedRemainingChargeTime: number;
|
||||
|
||||
/**
|
||||
* Battery total energy of the current device, in mAh.
|
||||
* @type {number}
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
const totalEnergy: number;
|
||||
|
||||
/**
|
||||
* Battery immediate current of the current device, in mA.
|
||||
* @type {number}
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
const nowCurrent: number;
|
||||
|
||||
/**
|
||||
* Battery remaining energy of the current device, in mAh.
|
||||
* @type {number}
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
const remainingEnergy: number;
|
||||
|
||||
/**
|
||||
* Charger type of a device.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
export enum BatteryPluggedType {
|
||||
/**
|
||||
* Unknown type
|
||||
* @since 6
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* AC charger
|
||||
* @since 6
|
||||
*/
|
||||
AC,
|
||||
/**
|
||||
* USB charger
|
||||
* @since 6
|
||||
*/
|
||||
USB,
|
||||
/**
|
||||
* Wireless charger
|
||||
* @since 6
|
||||
*/
|
||||
WIRELESS
|
||||
}
|
||||
|
||||
/**
|
||||
* Battery charging status of a device.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
export enum BatteryChargeState {
|
||||
/**
|
||||
* Unknown state.
|
||||
* @since 6
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* The battery is being charged.
|
||||
* @since 6
|
||||
*/
|
||||
ENABLE,
|
||||
/**
|
||||
* The battery is not being charged.
|
||||
* @since 6
|
||||
*/
|
||||
DISABLE,
|
||||
/**
|
||||
* The battery is fully charged.
|
||||
* @since 6
|
||||
*/
|
||||
FULL
|
||||
}
|
||||
|
||||
/**
|
||||
* Battery health status of a device.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 6
|
||||
*/
|
||||
export enum BatteryHealthState {
|
||||
/**
|
||||
* Unknown state.
|
||||
* @since 6
|
||||
*/
|
||||
UNKNOWN,
|
||||
/**
|
||||
* The battery is in healthy state.
|
||||
* @since 6
|
||||
*/
|
||||
GOOD,
|
||||
/**
|
||||
* The battery is overheated.
|
||||
* @since 6
|
||||
*/
|
||||
OVERHEAT,
|
||||
/**
|
||||
* The battery voltage is over high.
|
||||
* @since 6
|
||||
*/
|
||||
OVERVOLTAGE,
|
||||
/**
|
||||
* The battery temperature is low.
|
||||
* @since 6
|
||||
*/
|
||||
COLD,
|
||||
/**
|
||||
* The battery is dead.
|
||||
* @since 6
|
||||
*/
|
||||
DEAD
|
||||
}
|
||||
|
||||
/**
|
||||
* Battery capacity level of a device.
|
||||
* @enum {number}
|
||||
* The battery is in high capacity level.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
export enum BatteryCapacityLevel {
|
||||
/**
|
||||
* The battery is in full capacity level.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_FULL,
|
||||
/**
|
||||
* The battery is in high capacity level.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_HIGH,
|
||||
/**
|
||||
* The battery is in normal capacity level.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_NORMAL,
|
||||
/**
|
||||
* The battery is in low capacity level.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_LOW,
|
||||
/**
|
||||
* The battery is in warning low capacity level.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_WARNING,
|
||||
/**
|
||||
* The battery is in critical low capacity level.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_CRITICAL,
|
||||
/**
|
||||
* The battery is in the lowest capacity level, system will shut down automatically in a few seconds.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_SHUTDOWN
|
||||
}
|
||||
|
||||
LEVEL_HIGH,
|
||||
/**
|
||||
* Extra key of common event COMMON_EVENT_BATTERY_CHANGED.
|
||||
* @enum {string}
|
||||
* The battery is in normal capacity level.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
export enum CommonEventBatteryChangedKey {
|
||||
/**
|
||||
* Extra code of batterySOC.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_SOC = "soc",
|
||||
/**
|
||||
* Extra code of chargingStatus.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_CHARGE_STATE = "chargeState",
|
||||
/**
|
||||
* Extra code of healthStatus.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_HEALTH_STATE = "healthState",
|
||||
/**
|
||||
* Extra code of pluggedType.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_PLUGGED_TYPE = "pluggedType",
|
||||
/**
|
||||
* Extra code of voltage.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_VOLTAGE = "voltage",
|
||||
/**
|
||||
* Extra code of technology.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_TECHNOLOGY = "technology",
|
||||
/**
|
||||
* Extra code of batteryTemperature.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_TEMPERATURE = "temperature",
|
||||
/**
|
||||
* Extra code of isBatteryPresent.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_PRESENT = "present",
|
||||
/**
|
||||
* Extra code of batteryCapacityLevel.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_CAPACITY_LEVEL = "capacityLevel",
|
||||
}
|
||||
LEVEL_NORMAL,
|
||||
/**
|
||||
* The battery is in low capacity level.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_LOW,
|
||||
/**
|
||||
* The battery is in warning low capacity level.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_WARNING,
|
||||
/**
|
||||
* The battery is in critical low capacity level.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_CRITICAL,
|
||||
/**
|
||||
* The battery is in the lowest capacity level, system will shut down automatically in a few seconds.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
LEVEL_SHUTDOWN
|
||||
}
|
||||
|
||||
/**
|
||||
* Extra key of common event COMMON_EVENT_BATTERY_CHANGED.
|
||||
*
|
||||
* @enum { string }
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
export enum CommonEventBatteryChangedKey {
|
||||
/**
|
||||
* Extra code of batterySOC.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_SOC = 'soc',
|
||||
/**
|
||||
* Extra code of chargingStatus.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_CHARGE_STATE = 'chargeState',
|
||||
/**
|
||||
* Extra code of healthStatus.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_HEALTH_STATE = 'healthState',
|
||||
/**
|
||||
* Extra code of pluggedType.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_PLUGGED_TYPE = 'pluggedType',
|
||||
/**
|
||||
* Extra code of voltage.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_VOLTAGE = 'voltage',
|
||||
/**
|
||||
* Extra code of technology.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_TECHNOLOGY = 'technology',
|
||||
/**
|
||||
* Extra code of batteryTemperature.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_TEMPERATURE = 'temperature',
|
||||
/**
|
||||
* Extra code of isBatteryPresent.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_PRESENT = 'present',
|
||||
/**
|
||||
* Extra code of batteryCapacityLevel.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
EXTRA_CAPACITY_LEVEL = 'capacityLevel'
|
||||
}
|
||||
}
|
||||
export default batteryInfo;
|
||||
|
237
api/@ohos.batteryStatistics.d.ts
vendored
237
api/@ohos.batteryStatistics.d.ts
vendored
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {AsyncCallback, BusinessError} from "./basic";
|
||||
import { AsyncCallback, BusinessError } from './basic';
|
||||
|
||||
/**
|
||||
* Provides methods to get power consumption information.
|
||||
@ -24,138 +24,139 @@ import {AsyncCallback, BusinessError} from "./basic";
|
||||
* @since 8
|
||||
*/
|
||||
declare namespace batteryStats {
|
||||
/**
|
||||
* Describes the consumption type.
|
||||
*
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
export enum ConsumptionType {
|
||||
/** Indicates an invalid consumption type */
|
||||
CONSUMPTION_TYPE_INVALID = -17,
|
||||
/**
|
||||
* Describes the consumption type.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
export enum ConsumptionType {
|
||||
/** Indicates an invalid consumption type */
|
||||
CONSUMPTION_TYPE_INVALID = -17,
|
||||
|
||||
/** Indicates the battery power consumption generated by APP */
|
||||
CONSUMPTION_TYPE_APP,
|
||||
/** Indicates the battery power consumption generated by APP */
|
||||
CONSUMPTION_TYPE_APP,
|
||||
|
||||
/** Indicates the battery power consumption generated by bluetooth */
|
||||
CONSUMPTION_TYPE_BLUETOOTH,
|
||||
/** Indicates the battery power consumption generated by bluetooth */
|
||||
CONSUMPTION_TYPE_BLUETOOTH,
|
||||
|
||||
/** Indicates the battery power consumption generated when the CPU is idle */
|
||||
CONSUMPTION_TYPE_IDLE,
|
||||
/** Indicates the battery power consumption generated when the CPU is idle */
|
||||
CONSUMPTION_TYPE_IDLE,
|
||||
|
||||
/** Indicates the battery power consumption generated when phone call is active */
|
||||
CONSUMPTION_TYPE_PHONE,
|
||||
/** Indicates the battery power consumption generated when phone call is active */
|
||||
CONSUMPTION_TYPE_PHONE,
|
||||
|
||||
/** Indicates the battery power consumption generated by radio */
|
||||
CONSUMPTION_TYPE_RADIO,
|
||||
/** Indicates the battery power consumption generated by radio */
|
||||
CONSUMPTION_TYPE_RADIO,
|
||||
|
||||
/** Indicates the battery power consumption generated by screen */
|
||||
CONSUMPTION_TYPE_SCREEN,
|
||||
/** Indicates the battery power consumption generated by screen */
|
||||
CONSUMPTION_TYPE_SCREEN,
|
||||
|
||||
/** Indicates the battery power consumption generated by user */
|
||||
CONSUMPTION_TYPE_USER,
|
||||
/** Indicates the battery power consumption generated by user */
|
||||
CONSUMPTION_TYPE_USER,
|
||||
|
||||
/** Indicates the battery power consumption generated by WIFI */
|
||||
CONSUMPTION_TYPE_WIFI
|
||||
}
|
||||
/** Indicates the battery power consumption generated by WIFI */
|
||||
CONSUMPTION_TYPE_WIFI
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the power consumption information list.
|
||||
*
|
||||
* @returns {Promise<Array<BatteryStatsInfo>>} Power consumption information list.
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getBatteryStats(): Promise<Array<BatteryStatsInfo>>;
|
||||
/**
|
||||
* Obtains the power consumption information list.
|
||||
*
|
||||
* @returns { Promise<Array<BatteryStatsInfo>> } Power consumption information list.
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @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} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 401 - If the callback is not valid.
|
||||
* @throws {BusinessError} 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getBatteryStats(callback: AsyncCallback<Array<BatteryStatsInfo>>): void;
|
||||
/**
|
||||
* Obtains the power consumption information list.
|
||||
*
|
||||
* @param { AsyncCallback } callback Indicates the callback of power consumption information list.
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If the callback is not valid.
|
||||
* @throws { BusinessError } 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getBatteryStats(callback: AsyncCallback<Array<BatteryStatsInfo>>): void;
|
||||
|
||||
/**
|
||||
* Obtains power consumption information(Mah) for a given uid.
|
||||
*
|
||||
* @param {number} uid Indicates the uid.
|
||||
* @returns {number} Power consumption information(Mah).
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getAppPowerValue(uid: number): number;
|
||||
/**
|
||||
* Obtains power consumption information(Mah) for a given uid.
|
||||
*
|
||||
* @param { number } uid Indicates the uid.
|
||||
* @returns { number } Power consumption information(Mah).
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getAppPowerValue(uid: number): number;
|
||||
|
||||
/**
|
||||
* Obtains power consumption information(Percent) for a given uid.
|
||||
*
|
||||
* @param {number} uid Indicates the uid.
|
||||
* @returns {number} Power consumption information(Percent).
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getAppPowerPercent(uid: number): number;
|
||||
/**
|
||||
* Obtains power consumption information(Percent) for a given uid.
|
||||
*
|
||||
* @param { number } uid Indicates the uid.
|
||||
* @returns { number } Power consumption information(Percent).
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getAppPowerPercent(uid: number): number;
|
||||
|
||||
/**
|
||||
* Obtains power consumption information(Mah) for a given type.
|
||||
*
|
||||
* @param {ConsumptionType} type Indicates the hardware type.
|
||||
* @returns {number} Power consumption information(Mah).
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 401 - If the type is not valid.
|
||||
* @throws {BusinessError} 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getHardwareUnitPowerValue(type: ConsumptionType): number;
|
||||
/**
|
||||
* Obtains power consumption information(Mah) for a given type.
|
||||
*
|
||||
* @param { ConsumptionType } type Indicates the hardware type.
|
||||
* @returns { number } Power consumption information(Mah).
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If the type is not valid.
|
||||
* @throws { BusinessError } 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getHardwareUnitPowerValue(type: ConsumptionType): number;
|
||||
|
||||
/**
|
||||
* Obtains power consumption information(Percent) for a given type.
|
||||
*
|
||||
* @param {ConsumptionType} type Indicates the hardware type.
|
||||
* @returns {number} Power consumption information(Percent).
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 401 - If the type is not valid.
|
||||
* @throws {BusinessError} 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getHardwareUnitPowerPercent(type: ConsumptionType): number;
|
||||
/**
|
||||
* Obtains power consumption information(Percent) for a given type.
|
||||
*
|
||||
* @param { ConsumptionType } type Indicates the hardware type.
|
||||
* @returns { number } Power consumption information(Percent).
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If the type is not valid.
|
||||
* @throws { BusinessError } 4600101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
function getHardwareUnitPowerPercent(type: ConsumptionType): number;
|
||||
|
||||
/**
|
||||
* Contains power consumption information of a device.
|
||||
*
|
||||
* <p>Power consumption information includes the uid, type and power consumption value.
|
||||
*
|
||||
* @typedef BatteryStatsInfo
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
interface BatteryStatsInfo {
|
||||
/** The uid related with the power consumption info. */
|
||||
uid: number;
|
||||
/**
|
||||
* Contains power consumption information of a device.
|
||||
* <p>Power consumption information includes the uid, type and power consumption value.
|
||||
*
|
||||
* @typedef BatteryStatsInfo
|
||||
* @syscap SystemCapability.PowerManager.BatteryStatistics
|
||||
* @systemapi
|
||||
* @since 8
|
||||
*/
|
||||
interface BatteryStatsInfo {
|
||||
/** The uid related with the power consumption info. */
|
||||
uid: number;
|
||||
|
||||
/** The type related with the power consumption info. */
|
||||
type: ConsumptionType;
|
||||
/** The type related with the power consumption info. */
|
||||
type: ConsumptionType;
|
||||
|
||||
/** The power consumption value(Mah). */
|
||||
power: number;
|
||||
}
|
||||
/** The power consumption value(Mah). */
|
||||
power: number;
|
||||
}
|
||||
}
|
||||
export default batteryStats;
|
||||
export default batteryStats;
|
||||
|
26
api/@ohos.brightness.d.ts
vendored
26
api/@ohos.brightness.d.ts
vendored
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {BusinessError} from './basic';
|
||||
import { BusinessError } from './basic';
|
||||
|
||||
/**
|
||||
* Provides interfaces to control the power of display.
|
||||
@ -24,17 +24,17 @@ import {BusinessError} from './basic';
|
||||
* @since 7
|
||||
*/
|
||||
declare namespace brightness {
|
||||
/**
|
||||
* Sets the screen brightness.
|
||||
*
|
||||
* @param {number} value Brightness value, ranging from 0 to 255.
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 401 - If the value is not valid.
|
||||
* @throws {BusinessError} 4700101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
function setValue(value: number): void;
|
||||
/**
|
||||
* Sets the screen brightness.
|
||||
*
|
||||
* @param { number } value Brightness value, ranging from 0 to 255.
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If the value is not valid.
|
||||
* @throws { BusinessError } 4700101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
function setValue(value: number): void;
|
||||
}
|
||||
export default brightness;
|
||||
|
108
api/@ohos.charger.d.ts
vendored
108
api/@ohos.charger.d.ts
vendored
@ -18,61 +18,75 @@
|
||||
*
|
||||
* @namespace charger
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 10
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
declare namespace charger {
|
||||
/**
|
||||
* Indicates the type of the charger plugged-in.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
export enum ChargeType {
|
||||
/**
|
||||
* Indicates the type of the charger plugged-in.
|
||||
* Unknown type
|
||||
*
|
||||
* @enum {number}
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
export enum ChargeType {
|
||||
/**
|
||||
* Unknown type
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 10
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* Wired normal type
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 10
|
||||
*/
|
||||
WIRED_NORMAL,
|
||||
/**
|
||||
* Wired quick type
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 10
|
||||
*/
|
||||
WIRED_QUICK,
|
||||
/**
|
||||
* Wired super quick type
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 10
|
||||
*/
|
||||
WIRED_SUPER_QUICK,
|
||||
/**
|
||||
* Wireless normal type
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 10
|
||||
*/
|
||||
WIRELESS_NORMAL,
|
||||
/**
|
||||
* Wireless quick type
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 10
|
||||
*/
|
||||
WIRELESS_QUICK,
|
||||
/**
|
||||
* Wireless super quick type
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 10
|
||||
*/
|
||||
WIRELESS_SUPER_QUICK,
|
||||
}
|
||||
NONE,
|
||||
/**
|
||||
* Wired normal type
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
WIRED_NORMAL,
|
||||
/**
|
||||
* Wired quick type
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
WIRED_QUICK,
|
||||
/**
|
||||
* Wired super quick type
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
WIRED_SUPER_QUICK,
|
||||
/**
|
||||
* Wireless normal type
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
WIRELESS_NORMAL,
|
||||
/**
|
||||
* Wireless quick type
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
WIRELESS_QUICK,
|
||||
/**
|
||||
* Wireless super quick type
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @systemapi
|
||||
* @since 10
|
||||
*/
|
||||
WIRELESS_SUPER_QUICK
|
||||
}
|
||||
}
|
||||
export default charger;
|
||||
|
319
api/@ohos.power.d.ts
vendored
319
api/@ohos.power.d.ts
vendored
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {AsyncCallback, BusinessError} from './basic';
|
||||
import { AsyncCallback, BusinessError } from './basic';
|
||||
|
||||
/**
|
||||
* Provides interfaces to manage power.
|
||||
@ -23,174 +23,191 @@ import {AsyncCallback, BusinessError} from './basic';
|
||||
* @since 7
|
||||
*/
|
||||
declare namespace power {
|
||||
/**
|
||||
* 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} 201 - If the permission is denied.
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 401 - If the reason is not valid.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @systemapi
|
||||
* @since 7
|
||||
*/
|
||||
function shutdown(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 } 201 - If the permission is denied.
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If the reason is not valid.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @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" 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
|
||||
* @useinstead {@link power#reboot}
|
||||
*/
|
||||
function rebootDevice(reason: string): void;
|
||||
/**
|
||||
* Restarts the system.
|
||||
* <p>This method requires the ohos.permission.REBOOT permission.
|
||||
*
|
||||
* @permission ohos.permission.REBOOT
|
||||
* @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.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link power#reboot }
|
||||
*/
|
||||
function rebootDevice(reason: string): void;
|
||||
|
||||
/**
|
||||
* 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} 201 - If the permission is denied.
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 401 - If the reason is not valid.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function reboot(reason: string): void;
|
||||
/**
|
||||
* 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 } 201 - If the permission is denied.
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If the reason is not valid.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function reboot(reason: string): void;
|
||||
|
||||
/**
|
||||
* Checks whether the screen of a device is on or off.
|
||||
*
|
||||
* @returns Returns true if the screen is on; returns false otherwise.
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link power#isActive}
|
||||
*/
|
||||
function isScreenOn(callback: AsyncCallback<boolean>): void;
|
||||
function isScreenOn(): Promise<boolean>;
|
||||
/**
|
||||
* Checks whether the screen of a device is on or off.
|
||||
*
|
||||
* @param { AsyncCallback<boolean> } callback
|
||||
* @returns Returns true if the screen is on; returns false otherwise.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link power#isActive }
|
||||
*/
|
||||
function isScreenOn(callback: AsyncCallback<boolean>): void;
|
||||
function isScreenOn(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Checks whether the screen of a device is on or off.
|
||||
*
|
||||
* @returns Returns true if the screen is on; returns false otherwise.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link power#isActive }
|
||||
*/
|
||||
function isScreenOn(): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Checks whether the device is active.
|
||||
* <p>
|
||||
* The screen will be on if device is active, screen will be off otherwise.
|
||||
*
|
||||
* @returns Returns true if the device is active; returns false otherwise.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
function isActive(): boolean;
|
||||
|
||||
/**
|
||||
* Wakes up the device to turn on the screen.
|
||||
*
|
||||
* @param { string } detail Indicates the detail information who request wakeup.
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If the detail is not valid.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function wakeup(detail: string): void;
|
||||
|
||||
/**
|
||||
* Suspends the device to turn off the screen.
|
||||
*
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function suspend(): void;
|
||||
|
||||
/**
|
||||
* Obtains the power mode of the current device. For details, see {@link DevicePowerMode}.
|
||||
*
|
||||
* @returns The power mode {@link DevicePowerMode} of current device .
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @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 } 201 – If the permission is denied.
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If mode or callback is not valid.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @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.
|
||||
* @returns { Promise<void> }
|
||||
* @throws { BusinessError } 201 – If the permission is denied.
|
||||
* @throws { BusinessError } 202 - If the system permission is denied.
|
||||
* @throws { BusinessError } 401 - If mode or callback is not valid.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function setPowerMode(mode: DevicePowerMode): Promise<void>;
|
||||
|
||||
/**
|
||||
* Power mode of a device.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
export enum DevicePowerMode {
|
||||
/**
|
||||
* Checks whether the device is active.
|
||||
* <p>
|
||||
* The screen will be on if device is active, screen will be off otherwise.
|
||||
* Normal power mode
|
||||
*
|
||||
* @returns Returns true if the device is active; returns false otherwise.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
function isActive(): boolean;
|
||||
|
||||
MODE_NORMAL = 600,
|
||||
/**
|
||||
* Wakes up the device to turn on the screen.
|
||||
* Power save mode
|
||||
*
|
||||
* @param {string} detail Indicates the detail information who request wakeup.
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 401 - If the detail is not valid.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function wakeup(detail: string): void;
|
||||
|
||||
/**
|
||||
* Suspends the device to turn off the screen.
|
||||
*
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function suspend(): void;
|
||||
|
||||
/**
|
||||
* Obtains the power mode of the current device. For details, see {@link DevicePowerMode}.
|
||||
*
|
||||
* @returns The power mode {@link DevicePowerMode} of current device .
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
function getPowerMode(): DevicePowerMode;
|
||||
|
||||
MODE_POWER_SAVE,
|
||||
/**
|
||||
* Obtains the power mode of the current device. For details, see {@link DevicePowerMode}.
|
||||
* Performance power mode
|
||||
*
|
||||
* @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} 201 – If the permission is denied.
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 401 - If mode or callback is not valid.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @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} 201 – If the permission is denied.
|
||||
* @throws {BusinessError} 202 - If the system permission is denied.
|
||||
* @throws {BusinessError} 401 - If mode or callback is not valid.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @systemapi
|
||||
* @since 9
|
||||
*/
|
||||
function setPowerMode(mode: DevicePowerMode): Promise<void>;
|
||||
|
||||
/**
|
||||
* Power mode of a device.
|
||||
*
|
||||
* @enum {number}
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
export enum DevicePowerMode {
|
||||
/**
|
||||
* Normal power mode
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
MODE_NORMAL = 600,
|
||||
/**
|
||||
* Power save mode
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
MODE_POWER_SAVE,
|
||||
/**
|
||||
* Performance power mode
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
MODE_PERFORMANCE,
|
||||
/**
|
||||
* Extreme power save mode
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
MODE_EXTREME_POWER_SAVE
|
||||
}
|
||||
MODE_PERFORMANCE,
|
||||
/**
|
||||
* Extreme power save mode
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
MODE_EXTREME_POWER_SAVE
|
||||
}
|
||||
}
|
||||
export default power;
|
||||
|
342
api/@ohos.runningLock.d.ts
vendored
342
api/@ohos.runningLock.d.ts
vendored
@ -13,204 +13,236 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {AsyncCallback, BusinessError} 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 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.
|
||||
*
|
||||
* @namespace runningLock
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
*/
|
||||
declare namespace runningLock {
|
||||
class 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.
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link RunningLock#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} 401 - If the timeout is not valid.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
hold(timeout: number): void;
|
||||
|
||||
/**
|
||||
* Checks whether a lock is held or in use.
|
||||
*
|
||||
* @returns 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 RunningLock#isHolding}
|
||||
*/
|
||||
isUsed(): boolean;
|
||||
|
||||
/**
|
||||
* Checks whether a lock is held or in use.
|
||||
*
|
||||
* @returns Returns true if the lock is held or in use; returns false if the lock has been released.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
isHolding(): boolean;
|
||||
|
||||
/**
|
||||
* Release the {@link RunningLock} that prevents the system from hibernating.
|
||||
* This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link RunningLock#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} 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
unhold(): void;
|
||||
}
|
||||
|
||||
class RunningLock {
|
||||
/**
|
||||
* Enumerates the {@link RunningLock} types.
|
||||
* Prevents the system from hibernating and sets the lock duration.
|
||||
* This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* <p>Two {@link RunningLock} types are available: {@link BACKGROUND}, and {@link PROXIMITY_SCREEN_CONTROL}.
|
||||
* {@link BACKGROUND} ensures that applications can run in the background.
|
||||
* {@link PROXIMITY_SCREEN_CONTROL} determines whether to turn on or off the screen based on the proximity sensor.
|
||||
*
|
||||
* @enum {number}
|
||||
* @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.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
*/
|
||||
export enum RunningLockType {
|
||||
/**
|
||||
* Indicates the lock that prevents the system from hibernating.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 10
|
||||
*/
|
||||
BACKGROUND = 1,
|
||||
/**
|
||||
* Indicates the lock that determines whether to turn on or off the screen based on the proximity sensor.
|
||||
* For example, during a call, if the proximity sensor detects that the device is moving close to
|
||||
* the user's ear, the screen turns off; if the proximity sensor detects that the device is moving away
|
||||
* from the user's ear, the screen turns on.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
*/
|
||||
PROXIMITY_SCREEN_CONTROL
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the specified {@link RunningLockType} is supported.
|
||||
*
|
||||
* @param type Indicates the specified {@link RunningLockType}.
|
||||
* @param callback Indicates the callback function contains the result whether the specified
|
||||
* {@link RunningLockType} is supported.
|
||||
* @returns Returns true if the specified {@link RunningLockType} is supported;
|
||||
* returns false otherwise.
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link RunningLock#isSupported}
|
||||
* @useinstead { @link RunningLock#hold }
|
||||
*/
|
||||
function isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boolean>): void;
|
||||
function isRunningLockTypeSupported(type: RunningLockType): Promise<boolean>;
|
||||
lock(timeout: number): void;
|
||||
|
||||
/**
|
||||
* Checks whether the specified {@link RunningLockType} is supported.
|
||||
* Prevents the system from hibernating and sets the lock duration.
|
||||
* This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* @param {RunningLockType} type Indicates the specified {@link RunningLockType}.
|
||||
* @returns {boolean} Whether the specified {@link RunningLockType} is supported.
|
||||
* @throws {BusinessError} 401 - If the type is not valid.
|
||||
* @throws {BusinessError} 4900101 - If connecting to the service failed.
|
||||
* @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 } 401 - If the timeout is not valid.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
function isSupported(type: RunningLockType): boolean;
|
||||
hold(timeout: number): void;
|
||||
|
||||
/**
|
||||
* Creates a {@link RunningLock} object.
|
||||
* Checks whether a lock is held or in use.
|
||||
*
|
||||
* <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.
|
||||
*
|
||||
* @param name Indicates the {@link RunningLock} name. A recommended name consists of the package or class name and
|
||||
* a suffix.
|
||||
* @param type Indicates the {@link RunningLockType}.
|
||||
* @param callback Indicates the callback contains the {@link RunningLock} object.
|
||||
* @returns Returns the {@link RunningLock} object.
|
||||
* @permission ohos.permission.RUNNING_LOCK
|
||||
* @returns Returns true if the lock is held or in use; returns false if the lock has been released.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link RunningLock#create}
|
||||
* @useinstead { @link RunningLock#isHolding }
|
||||
*/
|
||||
function createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>): void;
|
||||
function createRunningLock(name: string, type: RunningLockType): Promise<RunningLock>;
|
||||
isUsed(): boolean;
|
||||
|
||||
/**
|
||||
* Creates a {@link RunningLock} object.
|
||||
* Checks whether a lock is held or in use.
|
||||
*
|
||||
* <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} 401 - If the name, type or callback is not valid.
|
||||
* @returns Returns true if the lock is held or in use; returns false if the lock has been released.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
function create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>): void;
|
||||
isHolding(): boolean;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* Release the {@link RunningLock} that prevents the system from hibernating.
|
||||
* This method requires the ohos.permission.RUNNING_LOCK permission.
|
||||
*
|
||||
* @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}.
|
||||
* @returns {Promise<RunningLock>} The {@link RunningLock} object.
|
||||
* @throws {BusinessError} 401 - If the name or type is not valid.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link RunningLock#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 } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
function create(name: string, type: RunningLockType): Promise<RunningLock>;
|
||||
unhold(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerates the {@link RunningLock} types.
|
||||
* <p>Two {@link RunningLock} types are available: {@link BACKGROUND}, and {@link PROXIMITY_SCREEN_CONTROL}.
|
||||
* {@link BACKGROUND} ensures that applications can run in the background.
|
||||
* {@link PROXIMITY_SCREEN_CONTROL} determines whether to turn on or off the screen based on the proximity sensor.
|
||||
*
|
||||
* @enum { number }
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
*/
|
||||
export enum RunningLockType {
|
||||
/**
|
||||
* Indicates the lock that prevents the system from hibernating.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 10
|
||||
*/
|
||||
BACKGROUND = 1,
|
||||
/**
|
||||
* Indicates the lock that determines whether to turn on or off the screen based on the proximity sensor.
|
||||
* For example, during a call, if the proximity sensor detects that the device is moving close to
|
||||
* the user's ear, the screen turns off; if the proximity sensor detects that the device is moving away
|
||||
* from the user's ear, the screen turns on.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
*/
|
||||
PROXIMITY_SCREEN_CONTROL
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the specified {@link RunningLockType} is supported.
|
||||
*
|
||||
* @param type Indicates the specified {@link RunningLockType}.
|
||||
* @param callback Indicates the callback function contains the result whether the specified
|
||||
* {@link RunningLockType} is supported.
|
||||
* @returns Returns true if the specified {@link RunningLockType} is supported;
|
||||
* returns false otherwise.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link RunningLock#isSupported }
|
||||
*/
|
||||
function isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boolean>): void;
|
||||
function isRunningLockTypeSupported(type: RunningLockType): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Checks whether the specified {@link RunningLockType} is supported.
|
||||
*
|
||||
* @param type Indicates the specified {@link RunningLockType}.
|
||||
* @param callback Indicates the callback function contains the result whether the specified
|
||||
* {@link RunningLockType} is supported.
|
||||
* @returns Returns true if the specified {@link RunningLockType} is supported;
|
||||
* returns false otherwise.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link RunningLock#isSupported }
|
||||
*/
|
||||
function isRunningLockTypeSupported(type: RunningLockType): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Checks whether the specified {@link RunningLockType} is supported.
|
||||
*
|
||||
* @param { RunningLockType } type Indicates the specified {@link RunningLockType}.
|
||||
* @returns { boolean } Whether the specified {@link RunningLockType} is supported.
|
||||
* @throws { BusinessError } 401 - If the type is not valid.
|
||||
* @throws { BusinessError } 4900101 - If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
function isSupported(type: RunningLockType): boolean;
|
||||
|
||||
/**
|
||||
* 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 name Indicates the {@link RunningLock} name. A recommended name consists of the package or class name and
|
||||
* a suffix.
|
||||
* @param type Indicates the {@link RunningLockType}.
|
||||
* @param callback Indicates the callback contains the {@link RunningLock} object.
|
||||
* @returns Returns the {@link RunningLock} object.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link RunningLock#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 name Indicates the {@link RunningLock} name. A recommended name consists of the package or class name and
|
||||
* a suffix.
|
||||
* @param type Indicates the {@link RunningLockType}.
|
||||
* @param callback Indicates the callback contains the {@link RunningLock} object.
|
||||
* @returns Returns the {@link RunningLock} object.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 7
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link RunningLock#create }
|
||||
*/
|
||||
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 } 401 - If the name, type or callback is not valid.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @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}.
|
||||
* @returns { Promise<RunningLock> } The {@link RunningLock} object.
|
||||
* @throws { BusinessError } 401 - If the name or type is not valid.
|
||||
* @syscap SystemCapability.PowerManager.PowerManager.Core
|
||||
* @since 9
|
||||
*/
|
||||
function create(name: string, type: RunningLockType): Promise<RunningLock>;
|
||||
}
|
||||
export default runningLock;
|
||||
|
200
api/@ohos.thermal.d.ts
vendored
200
api/@ohos.thermal.d.ts
vendored
@ -13,7 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {AsyncCallback, BusinessError, Callback} from './basic';
|
||||
import { AsyncCallback, BusinessError, Callback } from './basic';
|
||||
|
||||
/**
|
||||
* Provides thermal level-related callback and query APIs to obtain the information required for
|
||||
@ -26,107 +26,125 @@ import {AsyncCallback, BusinessError, Callback} from './basic';
|
||||
* @since 8
|
||||
*/
|
||||
declare namespace thermal {
|
||||
/**
|
||||
* Enumerates the {@link ThermalLevel} types.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 8
|
||||
*/
|
||||
export enum ThermalLevel {
|
||||
/**
|
||||
* Enumerates the {@link ThermalLevel} types.
|
||||
* The device is cool, and services are not restricted.
|
||||
*
|
||||
* @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.
|
||||
* @returns Returns the thermal level.
|
||||
* @since 8
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link thermal#registerThermalLevelCallback}
|
||||
*/
|
||||
function subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void;
|
||||
|
||||
/**
|
||||
* Registers to callbacks of thermal level changes.
|
||||
*
|
||||
* @param {Callback<ThermalLevel>} callback Callback of thermal level changes.
|
||||
* @throws {BusinessError} 401 - If callback is not valid.
|
||||
* @throws {BusinessError} 4800101 If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 9
|
||||
*/
|
||||
function registerThermalLevelCallback(callback: Callback<ThermalLevel>): void;
|
||||
|
||||
COOL = 0,
|
||||
/**
|
||||
* Unsubscribes from the callbacks of thermal level changes.
|
||||
* The device is operational but is not cool. You need to pay attention to its heating.
|
||||
*
|
||||
* @param callback Callback of thermal level changes.
|
||||
* @since 8
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link thermal#unregisterThermalLevelCallback}
|
||||
*/
|
||||
function unsubscribeThermalLevel(callback?: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Unregisters from the callbacks of thermal level changes.
|
||||
*
|
||||
* @param {Callback<void>} callback Callback of thermal level changes.
|
||||
* @throws {BusinessError} 401 - If callback is not valid.
|
||||
* @throws {BusinessError} 4800101 If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 9
|
||||
*/
|
||||
function unregisterThermalLevelCallback(callback?: Callback<void>): void;
|
||||
|
||||
NORMAL = 1,
|
||||
/**
|
||||
* Obtains the current thermal level.
|
||||
* The device is warm. You need to stop or delay some imperceptible services.
|
||||
*
|
||||
* @returns Returns the thermal level.
|
||||
* @since 8
|
||||
* @deprecated since 9
|
||||
* @useinstead {@link thermal#getLevel}
|
||||
*/
|
||||
function getThermalLevel(): ThermalLevel;
|
||||
|
||||
/**
|
||||
* Obtains the current thermal level.
|
||||
*
|
||||
* @returns {ThermalLevel} The thermal level.
|
||||
* @throws {BusinessError} 4800101 If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 9
|
||||
*/
|
||||
function getLevel(): ThermalLevel;
|
||||
WARM = 2,
|
||||
/**
|
||||
* The device is heating up. You need to stop all imperceptible services and downgrade
|
||||
* or reduce the load of other services.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
*/
|
||||
HOT = 3,
|
||||
/**
|
||||
* The device is overheated. You need to stop all imperceptible services and downgrade
|
||||
* or reduce the load of major services.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
*/
|
||||
WARNING = 5,
|
||||
/**
|
||||
* The device has entered the emergency state. You need to stop all services except those
|
||||
* for the emergency help purposes.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
*/
|
||||
EMERGENCY = 6
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribes to callbacks of thermal level changes.
|
||||
*
|
||||
* @param callback Callback of thermal level changes.
|
||||
* @returns Returns the thermal level.
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 8
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link thermal#registerThermalLevelCallback }
|
||||
*/
|
||||
function subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void;
|
||||
|
||||
/**
|
||||
* Registers to callbacks of thermal level changes.
|
||||
*
|
||||
* @param { Callback<ThermalLevel> } callback Callback of thermal level changes.
|
||||
* @throws { BusinessError } 401 - If callback is not valid.
|
||||
* @throws { BusinessError } 4800101 If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 9
|
||||
*/
|
||||
function registerThermalLevelCallback(callback: Callback<ThermalLevel>): void;
|
||||
|
||||
/**
|
||||
* Unsubscribes from the callbacks of thermal level changes.
|
||||
*
|
||||
* @param callback Callback of thermal level changes.
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 8
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link thermal#unregisterThermalLevelCallback }
|
||||
*/
|
||||
function unsubscribeThermalLevel(callback?: AsyncCallback<void>): void;
|
||||
|
||||
/**
|
||||
* Unregisters from the callbacks of thermal level changes.
|
||||
*
|
||||
* @param { Callback<void> } callback Callback of thermal level changes.
|
||||
* @throws { BusinessError } 401 - If callback is not valid.
|
||||
* @throws { BusinessError } 4800101 If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 9
|
||||
*/
|
||||
function unregisterThermalLevelCallback(callback?: Callback<void>): void;
|
||||
|
||||
/**
|
||||
* Obtains the current thermal level.
|
||||
*
|
||||
* @returns Returns the thermal level.
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 8
|
||||
* @deprecated since 9
|
||||
* @useinstead { @link thermal#getLevel }
|
||||
*/
|
||||
function getThermalLevel(): ThermalLevel;
|
||||
|
||||
/**
|
||||
* Obtains the current thermal level.
|
||||
*
|
||||
* @returns { ThermalLevel } The thermal level.
|
||||
* @throws { BusinessError } 4800101 If connecting to the service failed.
|
||||
* @syscap SystemCapability.PowerManager.ThermalManager
|
||||
* @since 9
|
||||
*/
|
||||
function getLevel(): ThermalLevel;
|
||||
}
|
||||
export default thermal;
|
||||
|
88
api/@system.battery.d.ts
vendored
88
api/@system.battery.d.ts
vendored
@ -19,19 +19,23 @@
|
||||
* @deprecated since 6
|
||||
*/
|
||||
export interface BatteryResponse {
|
||||
/**
|
||||
* Whether the battery is being charged.
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
charging: boolean;
|
||||
/**
|
||||
* Whether the battery is being charged.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
charging: boolean;
|
||||
|
||||
/**
|
||||
* Current battery level, which ranges from 0.00 to 1.00.
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
level: number;
|
||||
/**
|
||||
* Current battery level, which ranges from 0.00 to 1.00.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
level: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,26 +44,32 @@ export interface BatteryResponse {
|
||||
* @deprecated since 6
|
||||
*/
|
||||
export interface GetStatusOptions {
|
||||
/**
|
||||
* Called when the current charging state and battery level are obtained.
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
success?: (data: BatteryResponse) => void;
|
||||
/**
|
||||
* Called when the current charging state and battery level are obtained.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
success?: (data: BatteryResponse) => void;
|
||||
|
||||
/**
|
||||
* Called when the current charging state and battery level fail to be obtained.
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
/**
|
||||
* Called when the current charging state and battery level fail to be obtained.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
complete?: () => void;
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
complete?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,11 +78,13 @@ export interface GetStatusOptions {
|
||||
* @deprecated since 6
|
||||
*/
|
||||
export default class Battery {
|
||||
/**
|
||||
* Obtains the current charging state and battery level.
|
||||
* @param options Options.
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
static getStatus(options?: GetStatusOptions): void;
|
||||
}
|
||||
/**
|
||||
* Obtains the current charging state and battery level.
|
||||
*
|
||||
* @param options Options.
|
||||
* @syscap SystemCapability.PowerManager.BatteryManager.Core
|
||||
* @since 3
|
||||
* @deprecated since 6
|
||||
*/
|
||||
static getStatus(options?: GetStatusOptions): void;
|
||||
}
|
||||
|
378
api/@system.brightness.d.ts
vendored
378
api/@system.brightness.d.ts
vendored
@ -19,12 +19,14 @@
|
||||
* @deprecated since 7
|
||||
*/
|
||||
export interface BrightnessResponse {
|
||||
/**
|
||||
* Screen brightness, which ranges from 1 to 255.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
value: number;
|
||||
/**
|
||||
* Screen brightness, which ranges from 1 to 255.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
value: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -33,26 +35,32 @@ export interface BrightnessResponse {
|
||||
* @deprecated since 7
|
||||
*/
|
||||
export interface GetBrightnessOptions {
|
||||
/**
|
||||
* Called when the current screen brightness is obtained.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: (data: BrightnessResponse) => void;
|
||||
/**
|
||||
* Called when the current screen brightness is obtained.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: (data: BrightnessResponse) => void;
|
||||
|
||||
/**
|
||||
* Called when the current screen brightness fails to be obtained.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
/**
|
||||
* Called when the current screen brightness fails to be obtained.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void;
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,37 +69,45 @@ export interface GetBrightnessOptions {
|
||||
* @deprecated since 7
|
||||
*/
|
||||
export interface SetBrightnessOptions {
|
||||
/**
|
||||
* Screen brightness. The value is an integer ranging from 1 to 255.
|
||||
* If the value is less than or equal to 0, value 1 will be used.
|
||||
* If the value is greater than 255, value 255 will be used.
|
||||
* If the value contains decimals, the integral part of the value will be used.
|
||||
* For example, if value is 8.1 is set, value 8 will be used.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
value: number;
|
||||
/**
|
||||
* Screen brightness. The value is an integer ranging from 1 to 255.
|
||||
* If the value is less than or equal to 0, value 1 will be used.
|
||||
* If the value is greater than 255, value 255 will be used.
|
||||
* If the value contains decimals, the integral part of the value will be used.
|
||||
* For example, if value is 8.1 is set, value 8 will be used.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
value: number;
|
||||
|
||||
/**
|
||||
* Called when the setting is successful.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: () => void;
|
||||
/**
|
||||
* Called when the setting is successful.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: () => void;
|
||||
|
||||
/**
|
||||
* Called when the setting fails.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
/**
|
||||
* Called when the setting fails.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,14 +116,16 @@ export interface SetBrightnessOptions {
|
||||
* @deprecated since 7
|
||||
*/
|
||||
export interface BrightnessModeResponse {
|
||||
/**
|
||||
* The value can be 0 or 1.
|
||||
* 0: The screen brightness is manually adjusted.
|
||||
* 1: The screen brightness is automatically adjusted.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
mode: number;
|
||||
/**
|
||||
* The value can be 0 or 1.
|
||||
* 0: The screen brightness is manually adjusted.
|
||||
* 1: The screen brightness is automatically adjusted.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
mode: number;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,26 +134,32 @@ export interface BrightnessModeResponse {
|
||||
* @deprecated since 7
|
||||
*/
|
||||
export interface GetBrightnessModeOptions {
|
||||
/**
|
||||
* Called when the screen brightness adjustment mode is obtained.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: (data: BrightnessModeResponse) => void;
|
||||
/**
|
||||
* Called when the screen brightness adjustment mode is obtained.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: (data: BrightnessModeResponse) => void;
|
||||
|
||||
/**
|
||||
* Called when the screen brightness adjustment mode fails to be obtained.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
/**
|
||||
* Called when the screen brightness adjustment mode fails to be obtained.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void;
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,35 +168,43 @@ export interface GetBrightnessModeOptions {
|
||||
* @deprecated since 7
|
||||
*/
|
||||
export interface SetBrightnessModeOptions {
|
||||
/**
|
||||
* The screen brightness mode.
|
||||
* 0: The screen brightness is manually adjusted.
|
||||
* 1: The screen brightness is automatically adjusted.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
mode: number;
|
||||
/**
|
||||
* The screen brightness mode.
|
||||
* 0: The screen brightness is manually adjusted.
|
||||
* 1: The screen brightness is automatically adjusted.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
mode: number;
|
||||
|
||||
/**
|
||||
* Called when the setting is successful.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: () => void;
|
||||
/**
|
||||
* Called when the setting is successful.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: () => void;
|
||||
|
||||
/**
|
||||
* Called when the setting fails.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
/**
|
||||
* Called when the setting fails.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -181,33 +213,41 @@ export interface SetBrightnessModeOptions {
|
||||
* @deprecated since 7
|
||||
*/
|
||||
export interface SetKeepScreenOnOptions {
|
||||
/**
|
||||
* Whether to always keep the screen on.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
keepScreenOn: boolean;
|
||||
/**
|
||||
* Whether to always keep the screen on.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
keepScreenOn: boolean;
|
||||
|
||||
/**
|
||||
* Called when the setting is successful.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: () => void;
|
||||
/**
|
||||
* Called when the setting is successful.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
success?: () => void;
|
||||
|
||||
/**
|
||||
* Called when the setting fails.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
/**
|
||||
* Called when the setting fails.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
fail?: (data: string, code: number) => void;
|
||||
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
*
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
complete?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -216,43 +256,53 @@ export interface SetKeepScreenOnOptions {
|
||||
* @deprecated since 7
|
||||
*/
|
||||
export default class Brightness {
|
||||
/**
|
||||
* Obtains the current screen brightness.
|
||||
* @param options Options.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static getValue(options?: GetBrightnessOptions): void;
|
||||
/**
|
||||
* Obtains the current screen brightness.
|
||||
*
|
||||
* @param options Options.
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static getValue(options?: GetBrightnessOptions): void;
|
||||
|
||||
/**
|
||||
* Sets the screen brightness.
|
||||
* @param options Options.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static setValue(options?: SetBrightnessOptions): void;
|
||||
/**
|
||||
* Sets the screen brightness.
|
||||
*
|
||||
* @param options Options.
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static setValue(options?: SetBrightnessOptions): void;
|
||||
|
||||
/**
|
||||
* Obtains the screen brightness adjustment mode.
|
||||
* @param options Options.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static getMode(options?: GetBrightnessModeOptions): void;
|
||||
/**
|
||||
* Obtains the screen brightness adjustment mode.
|
||||
*
|
||||
* @param options Options.
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static getMode(options?: GetBrightnessModeOptions): void;
|
||||
|
||||
/**
|
||||
* Sets the screen brightness adjustment mode.
|
||||
* @param options Options.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static setMode(options?: SetBrightnessModeOptions): void;
|
||||
/**
|
||||
* Sets the screen brightness adjustment mode.
|
||||
*
|
||||
* @param options Options.
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static setMode(options?: SetBrightnessModeOptions): void;
|
||||
|
||||
/**
|
||||
* Sets whether to always keep the screen on.
|
||||
* @param options Options.
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static setKeepScreenOn(options?: SetKeepScreenOnOptions): void;
|
||||
}
|
||||
/**
|
||||
* Sets whether to always keep the screen on.
|
||||
*
|
||||
* @param options Options.
|
||||
* @syscap SystemCapability.PowerManager.DisplayPowerManager
|
||||
* @since 3
|
||||
* @deprecated since 7
|
||||
*/
|
||||
static setKeepScreenOn(options?: SetKeepScreenOnOptions): void;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user