The Battery API provides functions to get information about the battery.
Required Header
#include <device/battery.h>
#include <device/callback.h>
Overview
The Battery API provides the way to get the current battery capacity value, battery state and charging state. It also supports the API for an application to receive the battery events from the system. To receive the battery event it should be described by the callback function.
Enumeration Type Documentation
Enumeration for the battery level status.
- Since :
- 2.3.1
- Enumerator:
DEVICE_BATTERY_LEVEL_EMPTY |
The battery goes empty. Prepare for the safe termination of the application, because the device starts a shutdown process soon after entering this level.
|
DEVICE_BATTERY_LEVEL_CRITICAL |
The battery charge is at a critical state. You may have to stop using multimedia features, because they are not guaranteed to work correctly at this battery status.
|
DEVICE_BATTERY_LEVEL_LOW |
The battery has little charge left.
|
DEVICE_BATTERY_LEVEL_HIGH |
The battery status is not to be careful.
|
DEVICE_BATTERY_LEVEL_FULL |
The battery status is full.
|
Function Documentation
Gets the battery charge percentage.
It returns an integer value from 0
to 100
that indicates remaining battery charge as a percentage of the maximum level.
- Since :
- 2.3.1
- Parameters:
-
[out] | percent | The remaining battery charge percentage (0 ~ 100 ) |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-