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 <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
442465f81c
commit
d0958995a3
@ -962,13 +962,18 @@ static void syncable_cb(struct bt_bap_broadcast_sink *sink, const struct bt_iso_
|
||||
LOG_DBG("Broadcaster PA found, encrypted %d, requested_bis_sync %d", biginfo->encryption,
|
||||
broadcaster->requested_bis_sync);
|
||||
|
||||
if (biginfo->encryption) {
|
||||
broadcaster->biginfo_received = true;
|
||||
|
||||
if (biginfo->encryption && !broadcaster->broadcast_code_received) {
|
||||
/* Wait for Set Broadcast Code and start sync at broadcast_code_cb */
|
||||
LOG_DBG("BIGInfo received, but have not yet received broadcast code for encrypted "
|
||||
"broadcast");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!broadcaster->assistant_request || !broadcaster->requested_bis_sync) {
|
||||
if (!broadcaster->assistant_request && broadcaster->requested_bis_sync == 0U) {
|
||||
/* No sync with any BIS was requested yet */
|
||||
LOG_DBG("BIGInfo received, but have not yet received request to sync to broadcast");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1205,8 +1210,15 @@ static void broadcast_code_cb(struct bt_conn *conn,
|
||||
|
||||
broadcaster->sink_recv_state = recv_state;
|
||||
(void)memcpy(broadcaster->sink_broadcast_code, broadcast_code, BT_ISO_BROADCAST_CODE_SIZE);
|
||||
broadcaster->broadcast_code_received = true;
|
||||
|
||||
if (!broadcaster->requested_bis_sync) {
|
||||
LOG_DBG("Broadcast code received, but not requested to sync");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!broadcaster->biginfo_received) {
|
||||
LOG_DBG("Broadcast code received, but have not yet received BIGInfo");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1474,6 +1486,11 @@ uint8_t btp_bap_broadcast_sink_bis_sync(const void *cmd, uint16_t cmd_len, void
|
||||
|
||||
broadcaster->requested_bis_sync = sys_le32_to_cpu(cp->requested_bis_sync);
|
||||
|
||||
if (!broadcaster->biginfo_received) {
|
||||
LOG_DBG("Broadcast sync requested, but have not yet received BIGInfo");
|
||||
return BTP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
err = bt_bap_broadcast_sink_sync(broadcaster->sink, broadcaster->requested_bis_sync,
|
||||
broadcaster->sink_streams,
|
||||
broadcaster->sink_broadcast_code);
|
||||
|
||||
@ -47,6 +47,8 @@ struct btp_bap_broadcast_remote_source {
|
||||
/* BIS Index bitfield read from sync request */
|
||||
uint32_t requested_bis_sync;
|
||||
bool assistant_request;
|
||||
bool biginfo_received;
|
||||
bool broadcast_code_received;
|
||||
uint8_t sink_broadcast_code[BT_ISO_BROADCAST_CODE_SIZE];
|
||||
const struct bt_bap_scan_delegator_recv_state *sink_recv_state;
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user