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 IBATTERY_SRV_H
17#define IBATTERY_SRV_H
18#include <stdint.h>
19#include "battery_info.h"
20
21#ifdef __cplusplus
22extern "C" {
23#endif // __cplusplus
24#define BATTECHNOLOGY_LEN 64
25
26typedef struct {
27    /** 电池电量 */
28    int32_t batSoc;
29    /** 电池电压 */
30    int32_t batVoltage;
31    /** 电池温度 */
32    int32_t BatTemp;
33    /** 电池容量 */
34    int32_t batCapacity;
35    /** 充电状态 */
36    BatteryChargeState chargingStatus;
37    /** 连接类型 */
38    BatteryPluggedType pluggedType;
39    /** 电池类型 */
40    char BatTechnology[BATTECHNOLOGY_LEN];
41    /** 电池健康状态 */
42    BatteryHealthState healthStatus;
43} BatInfo;
44
45typedef struct IBattery {
46    int32_t (*GetSoc)();
47    BatteryChargeState (*GetChargingStatus)();
48    BatteryHealthState (*GetHealthStatus)();
49    BatteryPluggedType (*GetPluggedType)();
50    int32_t (*GetVoltage)();
51    char* (*GetTechnology)();
52    int32_t (*GetTemperature)();
53    int (*TurnOnLed)(int red, int green, int blue);
54    int (*TurnOffLed)();
55    int (*SetLedColor)(int red, int green, int blue);
56    int (*GetLedColor)(int* red, int* green, int* blue);
57    void (*ShutDown)();
58    void (*UpdateBatInfo)(BatInfo*);
59} IBattery;
60
61IBattery *NewBatterInterfaceInstance(void);
62int32_t FreeBatterInterfaceInstance(void);
63
64#ifdef __cplusplus
65}
66#endif // __cplusplus
67#endif // IBATTERY_SRV_H