Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Battery Service (BAS)

Battery Service (BAS) More...

Functions

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

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 <zephyr/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 <zephyr/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.