Skip to content

Commit d095899

Browse files
Thalleyaescolar
authored andcommitted
tests: Bluetooth: Tester: Handle BIGInfo after sync request
In the BAP Broadcast Sink implementation the sync request, the BIGInfo and the broadcast code can come in any other. Currently the btp_bap_broadcast_sink_bis_sync would reject the request if it came before the BIGInfo, but will now instead store the request and then apply it once the BIGInfo has been received, as there is not BIGInfo BTP event that the caller can use. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 442465f commit d095899

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

tests/bluetooth/tester/src/audio/btp_bap_broadcast.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,13 +962,18 @@ static void syncable_cb(struct bt_bap_broadcast_sink *sink, const struct bt_iso_
962962
LOG_DBG("Broadcaster PA found, encrypted %d, requested_bis_sync %d", biginfo->encryption,
963963
broadcaster->requested_bis_sync);
964964

965-
if (biginfo->encryption) {
965+
broadcaster->biginfo_received = true;
966+
967+
if (biginfo->encryption && !broadcaster->broadcast_code_received) {
966968
/* Wait for Set Broadcast Code and start sync at broadcast_code_cb */
969+
LOG_DBG("BIGInfo received, but have not yet received broadcast code for encrypted "
970+
"broadcast");
967971
return;
968972
}
969973

970-
if (!broadcaster->assistant_request || !broadcaster->requested_bis_sync) {
974+
if (!broadcaster->assistant_request && broadcaster->requested_bis_sync == 0U) {
971975
/* No sync with any BIS was requested yet */
976+
LOG_DBG("BIGInfo received, but have not yet received request to sync to broadcast");
972977
return;
973978
}
974979

@@ -1205,8 +1210,15 @@ static void broadcast_code_cb(struct bt_conn *conn,
12051210

12061211
broadcaster->sink_recv_state = recv_state;
12071212
(void)memcpy(broadcaster->sink_broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE);
1213+
broadcaster->broadcast_code_received = true;
12081214

12091215
if (!broadcaster->requested_bis_sync) {
1216+
LOG_DBG("Broadcast code received, but not requested to sync");
1217+
return;
1218+
}
1219+
1220+
if (!broadcaster->biginfo_received) {
1221+
LOG_DBG("Broadcast code received, but have not yet received BIGInfo");
12101222
return;
12111223
}
12121224

@@ -1474,6 +1486,11 @@ uint8_t btp_bap_broadcast_sink_bis_sync(const void *cmd, uint16_t cmd_len, void
14741486

14751487
broadcaster->requested_bis_sync = sys_le32_to_cpu(cp->requested_bis_sync);
14761488

1489+
if (!broadcaster->biginfo_received) {
1490+
LOG_DBG("Broadcast sync requested, but have not yet received BIGInfo");
1491+
return BTP_STATUS_SUCCESS;
1492+
}
1493+
14771494
err = bt_bap_broadcast_sink_sync(broadcaster->sink, broadcaster->requested_bis_sync,
14781495
broadcaster->sink_streams,
14791496
broadcaster->sink_broadcast_code);

tests/bluetooth/tester/src/audio/btp_bap_broadcast.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ struct btp_bap_broadcast_remote_source {
4747
/* BIS Index bitfield read from sync request */
4848
uint32_t requested_bis_sync;
4949
bool assistant_request;
50+
bool biginfo_received;
51+
bool broadcast_code_received;
5052
uint8_t sink_broadcast_code[BT_ISO_BROADCAST_CODE_SIZE];
5153
const struct bt_bap_scan_delegator_recv_state *sink_recv_state;
5254
};

0 commit comments

Comments
 (0)