17#include <zephyr/kernel.h>
19#include <zephyr/bluetooth/gatt.h>
20#include <zephyr/bluetooth/conn.h>
21#include <zephyr/bluetooth/uuid.h>
37#define BT_BAS_VAL_INVALID (255)
44#define BT_BAS_VAL_MAX (100)
void bt_bas_stop_per_read_battery_level(struct bt_bas_client *bas)
Stop periodic reading of the battery value from the device.
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.
int bt_bas_get_last_battery_level(struct bt_bas_client *bas)
Get the last known battery level.
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.
struct bt_conn * bt_bas_conn(const struct bt_bas_client *bas)
Get the connection object that is used with a given BAS Client.
void bt_bas_client_init(struct bt_bas_client *bas)
Initialize the BAS Client instance.
int bt_bas_read_battery_level(struct bt_bas_client *bas, bt_bas_read_cb func)
Read the battery level value from the device.
void(* bt_bas_read_cb)(struct bt_bas_client *bas, uint8_t battery_level, int err)
Read complete callback.
Definition: bas_client.h:72
static bool bt_bas_notify_supported(struct bt_bas_client *bas)
Check whether notification is supported by the service.
Definition: bas_client.h:212
void(* bt_bas_notify_cb)(struct bt_bas_client *bas, uint8_t battery_level)
Value notification callback.
Definition: bas_client.h:60
int bt_bas_unsubscribe_battery_level(struct bt_bas_client *bas)
Remove the subscription.
struct bt_conn * conn
Definition: bas_client.h:89
uint16_t val_handle
Definition: bas_client.h:103
struct bt_gatt_read_params read_params
Definition: bas_client.h:93
uint8_t battery_level
Definition: bas_client.h:107
bt_bas_notify_cb notify_cb
Definition: bas_client.h:99
struct bt_bas_periodic_read periodic_read
Definition: bas_client.h:97
struct bt_gatt_subscribe_params notify_params
Definition: bas_client.h:91
bool notify
Definition: bas_client.h:111
bt_bas_read_cb read_cb
Definition: bas_client.h:101
uint16_t ccc_handle
Definition: bas_client.h:105
uint8_t properties
Definition: bas_client.h:109
Battery Service Client instance.
Definition: bas_client.h:87
struct bt_gatt_read_params params
Definition: bas_client.h:81
atomic_t interval
Definition: bas_client.h:83
struct k_work_delayable read_work
Definition: bas_client.h:79
Definition: bas_client.h:77