Bluetooth: Audio: Fix MCC discover callback on reconnected issue

With BT_GATT_SUBSCRIBE_FLAG_NO_RESUB the MCC subscriptions would
be resent to the server on reconnection. Since this may trigger an
error, the error will trigger a call to the MCC discover complete
callback.

For MCP We can assume that the server stores the subscriptions if
we are bonded, and thus we can use BT_GATT_SUBSCRIBE_FLAG_NO_RESUB.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2023-03-01 14:05:02 +01:00 committed by Carles Cufí
commit f2918b0109

View file

@ -1361,6 +1361,7 @@ static int do_subscribe(struct mcs_instance_t *mcs_inst, struct bt_conn *conn,
sub_params->subscribe = subscribe_mcs_char_func; sub_params->subscribe = subscribe_mcs_char_func;
/* disc_params pointer is also used as subscription flag */ /* disc_params pointer is also used as subscription flag */
sub_params->disc_params = &mcs_inst->discover_params; sub_params->disc_params = &mcs_inst->discover_params;
atomic_set_bit(sub_params->flags, BT_GATT_SUBSCRIBE_FLAG_NO_RESUB);
LOG_DBG("Subscring to handle %d", handle); LOG_DBG("Subscring to handle %d", handle);
return bt_gatt_subscribe(conn, sub_params); return bt_gatt_subscribe(conn, sub_params);