Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
Battery Service (BAS)

Battery Service (BAS) More...

Functions

uint8_t bt_bas_get_battery_level (void)
 Read battery level value. More...
 
int bt_bas_set_battery_level (uint8_t level)
 Update battery level value. More...
 

Detailed Description

Battery Service (BAS)

[Experimental] Users should note that the APIs can change as a part of ongoing development.

Function Documentation

◆ bt_bas_get_battery_level()

uint8_t bt_bas_get_battery_level ( void  )

#include <include/bluetooth/services/bas.h>

Read battery level value.

Read the characteristic value of the battery level

Returns
The battery level in percent.

◆ bt_bas_set_battery_level()

int bt_bas_set_battery_level ( uint8_t  level)

#include <include/bluetooth/services/bas.h>

Update battery level value.

Update the characteristic value of the battery level This will send a GATT notification to all current subscribers.

Parameters
levelThe battery level in percent.
Returns
Zero in case of success and error code in case of error.