nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
Battery Service Client API

API for the Bluetooth LE GATT Battery Service (BAS) Client. More...

Data Structures

struct  bt_bas_periodic_read
 
struct  bt_bas_client
 Battery Service Client instance. More...
 

Macros

#define BT_BAS_VAL_INVALID   (255)
 Value that shows that the battery level is invalid.
 
#define BT_BAS_VAL_MAX   (100)
 Maximum allowed value for battery level.
 

Typedefs

typedef void(* bt_bas_notify_cb) (struct bt_bas_client *bas, uint8_t battery_level)
 Value notification callback.
 
typedef void(* bt_bas_read_cb) (struct bt_bas_client *bas, uint8_t battery_level, int err)
 Read complete callback.
 

Functions

void bt_bas_client_init (struct bt_bas_client *bas)
 Initialize the BAS Client instance.
 
int bt_bas_handles_assign (struct bt_gatt_dm *dm, struct bt_bas_client *bas)
 Assign handles to the BAS Client instance.
 
int bt_bas_subscribe_battery_level (struct bt_bas_client *bas, bt_bas_notify_cb func)
 Subscribe to the battery level value change notification.
 
int bt_bas_unsubscribe_battery_level (struct bt_bas_client *bas)
 Remove the subscription.
 
struct bt_conn * bt_bas_conn (const struct bt_bas_client *bas)
 Get the connection object that is used with a given BAS Client.
 
int bt_bas_read_battery_level (struct bt_bas_client *bas, bt_bas_read_cb func)
 Read the battery level value from the device.
 
int bt_bas_get_last_battery_level (struct bt_bas_client *bas)
 Get the last known battery level.
 
static bool bt_bas_notify_supported (struct bt_bas_client *bas)
 Check whether notification is supported by the service.
 
int bt_bas_start_per_read_battery_level (struct bt_bas_client *bas, int32_t interval, bt_bas_notify_cb func)
 Periodically read the battery level value from the device with specific time interval.
 
void bt_bas_stop_per_read_battery_level (struct bt_bas_client *bas)
 Stop periodic reading of the battery value from the device.
 

Detailed Description

API for the Bluetooth LE GATT Battery Service (BAS) Client.