Tizen HAL API  1.0
Battery

The Battery provides functions for receiving Battery events or information.

Required Header

#include <hal-device-battery.h>

Overview

The Battery provides the way to get the current battery capacity value, battery state and charging state. And it provides the power source information like name, type. 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.

The Battery functions provide battery information including:

For more information on the Battery features and the macros, see HAL Battery programming guides and tutorials.

Typedefs

typedef struct
_hal_backend_device_battery_funcs 
hal_backend_device_battery_funcs
 Structure for Battery functions.
typedef void(* hal_device_battery_updated_cb )(hal_device_battery_info_s *info, void *data)
 Called when a Battery information is handled.

Data Structure Documentation

struct _hal_backend_device_battery_funcs

Structure for Battery functions.

Since:
HAL_MODULE_DEVICE_BATTERY 1.0

Data Fields

int(* register_changed_event )(hal_device_battery_updated_cb updated_cb, void *data)
void(* unregister_changed_event )(hal_device_battery_updated_cb updated_cb)
int(* get_current_state )(hal_device_battery_updated_cb updated_cb, void *data)

Field Documentation

Get current states, it operates synchronously

struct hal_device_battery_info_s

Structure for Battery information data.

Since:
HAL_MODULE_DEVICE_BATTERY 1.0

Data Fields

char * name
char * status
char * health
hal_device_battery_power_source_type_e power_source
int online
int present
int capacity
int current_now
int current_average
int voltage_now
int voltage_average
int temperature

Field Documentation

The remaining capacity of the battery

The average amount of current consumed by the device over time

The amount of current being consumed by the device at the moment

The overall condition of the battery

The name of the battery

This indicates whether the device is currently receiving power from an external source.

This indicates whether there is a battery inside the system physically, with 1 indicating it is connected and 0 otherwise.

The current state of the battery

The current temperature of the battery

The average voltage level of the battery over time

The current voltage level of the battery


Typedef Documentation

Structure for Battery functions.

Since:
HAL_MODULE_DEVICE_BATTERY 1.0
typedef void(* hal_device_battery_updated_cb)(hal_device_battery_info_s *info, void *data)

Called when a Battery information is handled.

Since:
HAL_MODULE_DEVICE_BATTERY 1.0
Parameters:
[out]infoBattery information
[out]user_dataUser data passed

Enumeration Type Documentation

Enumeration for Battery power source type.

Since:
HAL_MODULE_DEVICE_BATTERY 1.0
Enumerator:
HAL_DEVICE_BATTERY_POWER_SOURCE_NONE 

power source type None

HAL_DEVICE_BATTERY_POWER_SOURCE_AC 

power source type Ac

HAL_DEVICE_BATTERY_POWER_SOURCE_USB 

power source type Usb

HAL_DEVICE_BATTERY_POWER_SOURCE_WIRELESS 

power source type Wireless