1/*
2 * Copyright (c) 2020-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.Lite
18 */
19
20export interface BatterySocResponse {
21
22    batterySoc: number;
23}
24
25/**
26 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
27 */
28
29export interface GetBatterySOC {
30
31    success?: (data: BatterySocResponse) => void;
32
33    fail?: (data: string, code: number) => void;
34
35    complete?: () => void;
36}
37
38export interface BatteryChargingStatusResponse {
39
40  chargingStatus: number;
41}
42
43/**
44 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
45 */
46
47export interface GetChargingStatus {
48   success?: (data: BatteryChargingStatusResponse) => void;
49
50   fail?: (data: string, code: number) => void;
51
52   complete?: () => void;
53}
54
55/**
56 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
57 */
58
59export interface BatteryHealthStatusResponse {
60
61  healthStatus: number;
62}
63
64/**
65 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
66 */
67
68export interface GetHealthStatus {
69
70   success?: (data: BatteryHealthStatusResponse) => void;
71
72   fail?: (data: string, code: number) => void;
73
74   complete?: () => void;
75}
76
77/**
78 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
79 */
80
81export interface BatteryGetPluggedTypeResponse {
82
83  pluggedType: number;
84}
85
86/**
87 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
88 */
89
90export interface GetPluggedType {
91
92  success?: (data: BatteryGetPluggedTypeResponse) => void;
93
94  fail?: (data: string, code: number) => void;
95
96  complete?: () => void;
97}
98
99/**
100 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
101 */
102
103export interface BatteryGetVoltageResponse {
104
105  voltage: number;
106}
107
108/**
109 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
110 */
111
112export interface GetVoltage {
113
114  success?: (data: BatteryGetVoltageResponse) => void;
115
116  fail?: (data: string, code: number) => void;
117
118  complete?: () => void;
119}
120
121/**
122 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
123 */
124
125export interface BatteryTechnologyResponse {
126
127  technology: string;
128}
129
130/**
131 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
132 */
133
134export interface GetTechnology {
135
136  success?: (data: BatteryTechnologyResponse) => void;
137
138  fail?: (data: string, code: number) => void;
139
140  complete?: () => void;
141}
142
143/**
144 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
145 */
146
147export interface BatteryTemperatureResponse {
148
149  temperature: number;
150}
151
152/**
153 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
154 */
155
156export interface GetTemperature {
157
158  success?: (data: BatteryTemperatureResponse) => void;
159
160  fail?: (data: string, code: number) => void;
161
162  complete?: () => void;
163}
164
165/**
166 *  @sysCap SystemCapability.PowerManager.BatteryManager.Lite
167 */
168
169export default class battery {
170
171/**
172 * Battery state of charge (SoC) of the current device, in percent.
173 */
174
175  static BatterySOC(options?: GetBatterySOC): void;
176
177/**
178  * Battery charging status of the current device.
179  */
180
181  static ChargingStatus(options?: GetChargingStatus): void;
182
183/**
184  * Battery health state of the current device.
185  */
186
187  static HealthStatus(options?: GetHealthStatus): void;
188
189/**
190  * Charger type of the current device.
191  */
192
193  static PluggedType(options?: GetPluggedType): void;
194
195/**
196  * Battery voltage of the current device.
197  */
198
199  static Voltage(options?: GetVoltage): void;
200
201/**
202  * Battery technology of the current device.
203  */
204
205  static Technology(options?: GetTechnology): void;
206
207/**
208  * Battery temperature of the current device.
209  */
210
211  static Temperature(options?: GetTemperature): void;
212}
213