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:
parent
6ae753f5bd
commit
d8e4bc7ff0
1 changed files with 9 additions and 2 deletions
|
@ -121,14 +121,21 @@ static void bt_bas_bls_update_battery_level_status(void)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Notify/Indicate all connections */
|
/* Indicate all connections */
|
||||||
ind_params.attr = attr;
|
ind_params.attr = attr;
|
||||||
ind_params.data = &le_battery_level_status;
|
ind_params.data = &le_battery_level_status;
|
||||||
ind_params.len = sizeof(le_battery_level_status);
|
ind_params.len = sizeof(le_battery_level_status);
|
||||||
ind_params.func = indicate_cb;
|
ind_params.func = indicate_cb;
|
||||||
err = bt_gatt_indicate(NULL, &ind_params);
|
err = bt_gatt_indicate(NULL, &ind_params);
|
||||||
if (err) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue