1/*
2 * Copyright (c) 2021 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#ifndef BATTERY_INFO_H
17#define BATTERY_INFO_H
18
19#ifdef __cplusplus
20extern "C" {
21#endif // __cplusplus
22
23typedef enum {
24    /**
25     * Battery is discharge.
26     */
27    CHARGE_STATE_NONE,
28    /**
29     * Battery is charging.
30     */
31    CHARGE_STATE_ENABLE,
32    /**
33     * Battery is not charging.
34     */
35    CHARGE_STATE_DISABLE,
36    /**
37     * Battery charge full.
38     */
39    CHARGE_STATE_FULL,
40    /**
41    * The bottom of the enum.
42    */
43    CHARGE_STATE_BUTT
44} BatteryChargeState;
45
46typedef enum {
47    /**
48     * Health Status: unknown.
49     */
50    HEALTH_STATE_UNKNOWN,
51    /**
52     * Health Status: good.
53     */
54    HEALTH_STATE_GOOD,
55    /**
56     * Health Status: over heat.
57     */
58    HEALTH_STATE_OVERHEAT,
59    /**
60     * Health Status: over voltage.
61     */
62    HEALTH_STATE_OVERVOLTAGE,
63    /**
64     * Health Status: COLD.
65     */
66    HEALTH_STATE_COLD,
67    /**
68     * Health Status: Dead.
69     */
70    HEALTH_STATE_DEAD,
71    /**
72    * The bottom of the enum.
73    */
74    HEALTH_STATE_BUTT
75} BatteryHealthState;
76
77typedef enum {
78    /**
79     * Power source is unplugged.
80     */
81    PLUGGED_TYPE_NONE,
82    /**
83     * Power source is an AC charger.
84     */
85    PLUGGED_TYPE_AC,
86    /**
87     * Power source is a USB DC charger.
88     */
89    PLUGGED_TYPE_USB,
90    /**
91     * Power source is wireless charger.
92     */
93    PLUGGED_TYPE_WIRELESS,
94    /**
95    * The bottom of the enum.
96    */
97    PLUGGED_TYPE_BUTT
98} BatteryPluggedType;
99
100int32_t GetBatSoc(void);
101BatteryChargeState GetChargingStatus(void);
102BatteryHealthState GetHealthStatus(void);
103BatteryPluggedType GetPluggedType(void);
104int32_t GetBatVoltage(void);
105char* GetBatTechnology(void);
106int32_t GetBatTemperature(void);
107
108#ifdef __cplusplus
109}
110#endif // __cplusplus
111#endif // BATTERY_INFO_H