Bluetooth: Audio: Use BT_GATT_SUBSCRIBE_FLAG_VOLATILE

The LE Audio implementations do not really support bonding yet,
and removing subs on disconnect is the most effective (and correct)
way of ensuring that we do not subscribe more than once when we
re-discover after reconnection.

The broadcast assistant and the media control client does not
support multiple connections as of this commit, so they needed
special treatment. In the case that we do discovery on multiple
ACL connections, it is important that the existing subscriptions
are removed correctly by calling bt_gatt_unsubscribe.

In order to implement this change properly on some of the clients,
thet had no proper connection references or support
for clearing the data on disconnects, they had to be updated
as well.

The csip_notify.sh test has been disabled, as that expected a
notification in the client, but since this commit removes that
(until bonding is properly supported in the clients), then the
test will fail.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2024-01-16 11:23:24 +01:00 committed by Maureen Helm
commit ec41dd9ba6
14 changed files with 325 additions and 122 deletions

View file

@ -1539,8 +1539,9 @@ static uint8_t discover_func(struct bt_conn *conn,
sub_params->end_handle = current_inst->end_handle;
sub_params->notify = notify_handler;
atomic_set_bit(sub_params->flags, BT_GATT_SUBSCRIBE_FLAG_VOLATILE);
err = bt_gatt_subscribe(conn, sub_params);
if (err != 0) {
if (err != 0 && err != -EALREADY) {
LOG_DBG("Could not subscribe to "
"characterstic at handle 0x%04X"
"(%d)",