Skip to content

Commit

Permalink
bluetooth: BAS: add gatt notify for battery level status char
Browse files Browse the repository at this point in the history
gatt notification for battery level status char is added
in battery service.

Signed-off-by: Nithin Ramesh Myliattil <[email protected]>
  • Loading branch information
niym-ot authored and carlescufi committed Aug 29, 2024
1 parent 6ae753f commit d8e4bc7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions subsys/bluetooth/services/bas/bas_bls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit d8e4bc7

Please sign in to comment.