39 #ifndef _IOT_BATTERY_H_ 40 #define _IOT_BATTERY_H_ 50 #define IOT_BATTERY_SUCCESS ( 0 ) 51 #define IOT_BATTERY_INVALID_VALUE ( 1 ) 52 #define IOT_BATTERY_NOT_EXIST ( 2 ) 53 #define IOT_BATTERY_READ_FAILED ( 3 ) 54 #define IOT_BATTERY_FUNCTION_NOT_SUPPORTED ( 4 ) 104 typedef struct IotBatteryInfo
120 typedef enum IotBatteryIoctlRequest
179 struct IotBatteryDescriptor_t;
246 void * pvUserContext );
275 uint16_t * pusCurrent);
292 uint16_t * pusVoltage);
309 uint8_t * pucChargeLevel);
327 uint16_t * pusCapacity);
363 uint8_t * pucEnable);
379 uint8_t * pucCharging);
401 void *
const pvBuffer );
Definition: iot_battery.h:96
Definition: iot_battery.h:154
Definition: iot_battery.h:71
struct IotBatteryDescriptor_t * IotBatteryHandle_t
IotBatteryHandle_t type is the Battery handle returned by calling iot_battery_open() this is initiali...
Definition: iot_battery.h:186
void iot_battery_set_callback(IotBatteryHandle_t const pxBatteryHandle, IotBatteryCallback_t xCallback, void *pvUserContext)
iot_battery_set_callback is used to set the callback to be called when a notification needs to be sen...
IotBatteryStatus_t
Battery status.
Definition: iot_battery.h:79
int16_t sMinTemperature
Definition: iot_battery.h:109
Definition: iot_battery.h:126
IotBatteryInfo_t * iot_battery_getInfo(IotBatteryHandle_t const pxBatteryHandle)
iot_battery_getInfo is used to get the battery info
int32_t iot_battery_is_charging(IotBatteryHandle_t const pxBatteryHandle, uint8_t *pucCharging)
iot_battery_is_charging is used to query if the battery is currently charging.
int32_t iot_battery_chargeLevel(IotBatteryHandle_t const pxBatteryHandle, uint8_t *pucChargeLevel)
iot_battery_chargeLevel is used to get the battery charging level in percentage (from 1 to 100)...
Definition: iot_battery.h:162
Definition: iot_battery.h:93
Definition: iot_battery.h:164
Definition: iot_battery.h:170
int32_t iot_battery_close(IotBatteryHandle_t const pxBatteryHandle)
iot_battery_close is used to de-Initialize Battery driver.
Definition: iot_battery.h:156
IotBatteryIoctlRequest_t
Ioctl request types.
Definition: iot_battery.h:120
Definition: iot_battery.h:95
Definition: iot_battery.h:122
int16_t sMaxTemperature
Definition: iot_battery.h:110
Definition: iot_battery.h:72
Definition: iot_battery.h:172
Definition: iot_battery.h:136
Definition: iot_battery.h:160
int32_t iot_battery_voltage(IotBatteryHandle_t const pxBatteryHandle, uint16_t *pusVoltage)
iot_battery_voltage is used to get the battery voltage in milli-volts.
Definition: iot_battery.h:84
Definition: iot_battery.h:144
Definition: iot_battery.h:133
IotBatteryType_t
Battery Type.
Definition: iot_battery.h:59
int32_t iot_battery_temp(IotBatteryHandle_t const pxBatteryHandle, int16_t *psTemp)
iot_battery_temp is used to get the battery temperature in milliCelcius
IotBatteryChargeSource_t
Charger type.
Definition: iot_battery.h:68
IotBatteryType_t xBatteryType
Definition: iot_battery.h:106
Definition: iot_battery.h:150
int32_t iot_battery_capacity(IotBatteryHandle_t const pxBatteryHandle, uint16_t *pusCapacity)
iot_battery_capacity is used to get the current battery capacity value in mAh
Battery information.
Definition: iot_battery.h:104
Definition: iot_battery.h:142
Definition: iot_battery.h:130
Definition: iot_battery.h:98
Definition: iot_battery.h:86
Definition: iot_battery.h:82
Definition: iot_battery.h:81
uint8_t ucAsyncSupported
Definition: iot_battery.h:112
Definition: iot_battery.h:148
void(* IotBatteryCallback_t)(IotBatteryStatus_t xStatus, void *pvUserContext)
Battery notification callback type. This callback is passed to the driver by using iot_battery_set_ca...
Definition: iot_battery.h:204
int32_t iot_battery_current(IotBatteryHandle_t const pxBatteryHandle, uint16_t *pusCurrent)
iot_battery_current is used to get the battery current in mA.
Definition: iot_battery.h:70
uint16_t usMaxVoltage
Definition: iot_battery.h:108
Definition: iot_battery.h:88
Definition: iot_battery.h:62
Definition: iot_battery.h:61
Definition: iot_battery.h:139
uint16_t usMinVoltage
Definition: iot_battery.h:107
IotBatteryHandle_t iot_battery_open(int32_t lBatteryInstance)
iot_battery_open is used to initialize the Battery and Charging driver.
int32_t iot_battery_enable_charging(IotBatteryHandle_t const pxBatteryHandle, uint8_t *pucEnable)
iot_battery_enable_charging is used to enable battery charging if charging is supported. if battery is already at full charge, enable will not charge battery until the charging level drops below 100, and even if battery is at critical level, and charging is not enabled, battery will not be charging. Charging is always enabled by default unless disabled by using this API.
Definition: iot_battery.h:152
Definition: iot_battery.h:90
Definition: iot_battery.h:166
int32_t iot_battery_ioctl(IotBatteryHandle_t const pxBatteryHandle, IotBatteryIoctlRequest_t xRequest, void *const pvBuffer)
iot_battery_ioctl is used to set Battery configuration and Battery properties like battery threshold...
Definition: iot_battery.h:168
Definition: iot_battery.h:158
Definition: iot_battery.h:94
uint8_t usMaxCapacity
Definition: iot_battery.h:111
Definition: iot_battery.h:73
Definition: iot_battery.h:91
Definition: iot_battery.h:92
Definition: iot_battery.h:146