1/* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @interface BatteryResponse 18 * @syscap SystemCapability.PowerManager.BatteryManager.Lite 19 * @since 3 20 * @deprecated since 6 21 */ 22export interface BatteryResponse { 23 /** 24 * Whether the battery is being charged. 25 * 26 * @syscap SystemCapability.PowerManager.BatteryManager.Lite 27 * @since 3 28 * @deprecated since 6 29 */ 30 charging: boolean; 31 32 /** 33 * Current battery level, which ranges from 0.00 to 1.00. 34 * 35 * @syscap SystemCapability.PowerManager.BatteryManager.Lite 36 * @since 3 37 * @deprecated since 6 38 */ 39 level: number; 40} 41 42/** 43 * @interface GetStatusOptions 44 * @syscap SystemCapability.PowerManager.BatteryManager.Lite 45 * @since 3 46 * @deprecated since 6 47 */ 48export interface GetStatusOptions { 49 /** 50 * Called when the current charging state and battery level are obtained. 51 * 52 * @syscap SystemCapability.PowerManager.BatteryManager.Lite 53 * @since 3 54 * @deprecated since 6 55 */ 56 success?: (data: BatteryResponse) => void; 57 58 /** 59 * Called when the current charging state and battery level fail to be obtained. 60 * 61 * @syscap SystemCapability.PowerManager.BatteryManager.Lite 62 * @since 3 63 * @deprecated since 6 64 */ 65 fail?: (data: string, code: number) => void; 66 67 /** 68 * Called when the execution is completed. 69 * 70 * @syscap SystemCapability.PowerManager.BatteryManager.Lite 71 * @since 3 72 * @deprecated since 6 73 */ 74 complete?: () => void; 75} 76 77/** 78 * @syscap SystemCapability.PowerManager.BatteryManager.Lite 79 * @since 3 80 * @deprecated since 6 81 */ 82export default class Battery { 83 /** 84 * Obtains the current charging state and battery level. 85 * 86 * @param { GetStatusOptions } options Options. 87 * @syscap SystemCapability.PowerManager.BatteryManager.Lite 88 * @since 3 89 * @deprecated since 6 90 */ 91 static getStatus(options?: GetStatusOptions): void; 92} 93