File tree Expand file tree Collapse file tree 4 files changed +34
-13
lines changed
include/zephyr/bluetooth/audio
tests/bsim/bluetooth/audio/src Expand file tree Collapse file tree 4 files changed +34
-13
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,9 @@ enum bt_bap_bass_att_err {
91
91
* Value indicating that the Broadcast Assistant has no preference to which BIS
92
92
* the Scan Delegator syncs to
93
93
*/
94
- #define BT_BAP_BIS_SYNC_NO_PREF 0xFFFFFFFF
94
+ #define BT_BAP_BIS_SYNC_NO_PREF 0xFFFFFFFF
95
+ /** BIS sync value indicating that the BIG sync has failed for any reason */
96
+ #define BT_BAP_BIS_SYNC_FAILED 0xFFFFFFFF
95
97
96
98
/** Endpoint states */
97
99
enum bt_bap_ep_state {
@@ -305,7 +307,11 @@ struct bt_bap_scan_delegator_recv_state {
305
307
/** Number of subgroups */
306
308
uint8_t num_subgroups ;
307
309
308
- /** Subgroup specific information */
310
+ /** Subgroup specific information
311
+ *
312
+ * If the @ref bt_bap_bass_subgroup.bis_sync value is @ref BT_BAP_BIS_SYNC_FAILED then it
313
+ * indicates that the BIG sync failed.
314
+ */
309
315
struct bt_bap_bass_subgroup subgroups [CONFIG_BT_BAP_BASS_MAX_SUBGROUPS ];
310
316
};
311
317
@@ -2420,7 +2426,11 @@ struct bt_bap_broadcast_assistant_add_src_param {
2420
2426
/** Number of subgroups */
2421
2427
uint8_t num_subgroups ;
2422
2428
2423
- /** Pointer to array of subgroups */
2429
+ /** Pointer to array of subgroups
2430
+ *
2431
+ * The @ref bt_bap_bass_subgroup.bis_sync value can be set to BT_BAP_BIS_SYNC_NO_PREF to
2432
+ * let the broadcast sink decide which BIS to synchronize to.
2433
+ */
2424
2434
struct bt_bap_bass_subgroup * subgroups ;
2425
2435
};
2426
2436
Original file line number Diff line number Diff line change @@ -170,12 +170,13 @@ static void update_recv_state_big_cleared(const struct bt_bap_broadcast_sink *si
170
170
mod_src_param .encrypt_state = recv_state -> encrypt_state ;
171
171
}
172
172
173
- /* BIS syncs will be automatically cleared since the mod_src_param
174
- * struct is 0-initialized
175
- *
176
- * Since the metadata_len is also 0, then the metadata won't be
177
- * modified by the operation either.
178
- */
173
+ if (reason != BT_HCI_ERR_LOCALHOST_TERM_CONN ) {
174
+ for (uint8_t i = 0U ; i < recv_state -> num_subgroups ; i ++ ) {
175
+ mod_src_param .subgroups [i ].bis_sync = BT_BAP_BIS_SYNC_FAILED ;
176
+ }
177
+ }
178
+
179
+ /* Since the metadata_len is 0 then the metadata won't be modified by the operation either*/
179
180
180
181
/* Copy existing unchanged data */
181
182
mod_src_param .num_subgroups = recv_state -> num_subgroups ;
Original file line number Diff line number Diff line change @@ -1419,9 +1419,8 @@ static bool valid_bt_bap_scan_delegator_mod_src_param(
1419
1419
for (uint8_t i = 0U ; i < param -> num_subgroups ; i ++ ) {
1420
1420
const struct bt_bap_bass_subgroup * subgroup = & param -> subgroups [i ];
1421
1421
1422
- if (subgroup -> bis_sync == BT_BAP_BIS_SYNC_NO_PREF ||
1423
- !bis_syncs_unique_or_no_pref (subgroup -> bis_sync ,
1424
- aggregated_bis_syncs )) {
1422
+ if (subgroup -> bis_sync != BT_BAP_BIS_SYNC_FAILED &&
1423
+ !bis_syncs_unique_or_no_pref (subgroup -> bis_sync , aggregated_bis_syncs )) {
1425
1424
LOG_DBG ("Invalid BIS sync: %u" , subgroup -> bis_sync );
1426
1425
1427
1426
return false;
@@ -1483,7 +1482,8 @@ int bt_bap_scan_delegator_mod_src(const struct bt_bap_scan_delegator_mod_src_par
1483
1482
const uint32_t bis_sync = param -> subgroups [i ].bis_sync ;
1484
1483
const uint32_t bis_sync_requested = internal_state -> requested_bis_sync [i ];
1485
1484
1486
- if (!bits_subset_of (bis_sync , bis_sync_requested )) {
1485
+ if (bis_sync != BT_BAP_BIS_SYNC_FAILED &&
1486
+ !bits_subset_of (bis_sync , bis_sync_requested )) {
1487
1487
LOG_DBG ("Subgroup[%d] invalid bis_sync value %x for %x" ,
1488
1488
i , bis_sync , bis_sync_requested );
1489
1489
Original file line number Diff line number Diff line change @@ -147,6 +147,16 @@ static void bap_broadcast_assistant_recv_state_cb(
147
147
FAIL ("Bad code is not what we sent" );
148
148
return ;
149
149
}
150
+
151
+ for (uint8_t i = 0 ; i < state -> num_subgroups ; i ++ ) {
152
+ const struct bt_bap_bass_subgroup * subgroup = & state -> subgroups [i ];
153
+
154
+ if (subgroup -> bis_sync != BT_BAP_BIS_SYNC_FAILED ) {
155
+ FAIL ("Invalid BIS sync value 0x%08X for failed sync" ,
156
+ subgroup -> bis_sync );
157
+ return ;
158
+ }
159
+ }
150
160
}
151
161
152
162
for (uint8_t i = 0 ; i < state -> num_subgroups ; i ++ ) {
You can’t perform that action at this time.
0 commit comments