From d8e4bc7ff0f82cacae29ae4a36a7a2b29baae54c Mon Sep 17 00:00:00 2001 From: Nithin Ramesh Myliattil Date: Tue, 27 Aug 2024 16:28:35 +0200 Subject: [PATCH] bluetooth: BAS: add gatt notify for battery level status char gatt notification for battery level status char is added in battery service. Signed-off-by: Nithin Ramesh Myliattil --- subsys/bluetooth/services/bas/bas_bls.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/services/bas/bas_bls.c b/subsys/bluetooth/services/bas/bas_bls.c index bcb2fea3619484..37b346db63205d 100644 --- a/subsys/bluetooth/services/bas/bas_bls.c +++ b/subsys/bluetooth/services/bas/bas_bls.c @@ -121,14 +121,21 @@ static void bt_bas_bls_update_battery_level_status(void) #endif }; - /* Notify/Indicate all connections */ + /* Indicate all connections */ ind_params.attr = attr; ind_params.data = &le_battery_level_status; ind_params.len = sizeof(le_battery_level_status); ind_params.func = indicate_cb; err = bt_gatt_indicate(NULL, &ind_params); if (err) { - LOG_DBG("Failed to send ntf/ind to all connections (err %d)\n", err); + LOG_DBG("Failed to send ind to all connections (err %d)\n", err); + } + + /* Notify all connections */ + err = bt_gatt_notify(NULL, attr, &le_battery_level_status, + sizeof(le_battery_level_status)); + if (err) { + LOG_DBG("Failed to send ntf to all connections (err %d)\n", err); } } }