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 <niym@demant.com>
This commit is contained in:
Nithin Ramesh Myliattil 2024-08-27 16:28:35 +02:00 committed by Carles Cufí
commit d8e4bc7ff0

View file

@ -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);
}
}
}