Bluetooth: BAP: Scan Delegator bis_sync_req cb called on rem

If a receive state is removed, then the bis_syn_req callback
will be called with 0x00000000, to indicate to the application
that the sink should be desynced.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2023-10-16 13:29:12 +02:00 committed by Carles Cufí
commit f58bea6b7b
2 changed files with 15 additions and 1 deletions

View file

@ -406,7 +406,9 @@ struct bt_bap_scan_delegator_cb {
* requested for the sync.
* @param[in] bis_sync_req Array of bitfields of which BIS indexes
* that is requested to sync for each subgroup
* by the Broadcast Assistant.
* by the Broadcast Assistant. A value of 0
* indicates a request to terminate the BIG
* sync.
*
* @return 0 in case of accept, or other value to reject.
*/

View file

@ -830,6 +830,7 @@ static int scan_delegator_rem_src(struct bt_conn *conn,
{
struct bass_recv_state_internal *internal_state;
struct bt_bap_scan_delegator_recv_state *state;
bool bis_sync_was_requested;
uint8_t src_id;
/* subtract 1 as the opcode has already been pulled */
@ -862,6 +863,14 @@ static int scan_delegator_rem_src(struct bt_conn *conn,
}
}
bis_sync_was_requested = false;
for (uint8_t i = 0U; i < state->num_subgroups; i++) {
if (internal_state->requested_bis_sync[i] != 0U) {
bis_sync_was_requested = true;
break;
}
}
LOG_DBG("Index %u: Removed source with ID 0x%02x",
internal_state->index, src_id);
@ -873,6 +882,9 @@ static int scan_delegator_rem_src(struct bt_conn *conn,
(void)memset(internal_state->requested_bis_sync, 0,
sizeof(internal_state->requested_bis_sync));
if (bis_sync_was_requested) {
bis_sync_request_updated(conn, internal_state);
}
receive_state_updated(conn, internal_state);
return 0;