1/* 2 * Copyright (c) 2022 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 * @syscap SystemCapability.PowerManager.BatteryManager.Core 18 * @since 3 19 * @deprecated since 6 20 */ 21 export interface BatteryResponse { 22 /** 23 * Whether the battery is being charged. 24 * @since 3 25 * @deprecated since 6 26 */ 27 charging: boolean; 28 29 /** 30 * Current battery level, which ranges from 0.00 to 1.00. 31 * @since 3 32 * @deprecated since 6 33 */ 34 level: number; 35} 36 37/** 38 * @syscap SystemCapability.PowerManager.BatteryManager.Core 39 * @since 3 40 * @deprecated since 6 41 */ 42export interface GetStatusOptions { 43 /** 44 * Called when the current charging state and battery level are obtained. 45 * @since 3 46 * @deprecated since 6 47 */ 48 success?: (data: BatteryResponse) => void; 49 50 /** 51 * Called when the current charging state and battery level fail to be obtained. 52 * @since 3 53 * @deprecated since 6 54 */ 55 fail?: (data: string, code: number) => void; 56 57 /** 58 * Called when the execution is completed. 59 * @since 3 60 * @deprecated since 6 61 */ 62 complete?: () => void; 63} 64 65/** 66 * @syscap SystemCapability.PowerManager.BatteryManager.Core 67 * @since 3 68 * @deprecated since 6 69 */ 70export default class Battery { 71 /** 72 * Obtains the current charging state and battery level. 73 * @param options Options. 74 * @since 3 75 * @deprecated since 6 76 */ 77 static getStatus(options?: GetStatusOptions): void; 78}