Skip to content

Commit 48f4eb9

Browse files
cvinayakcarlescufi
authored andcommitted
tests: Bluetooth: bsim: Test updated to use Periodic Sync Recv Enable
Updated the ISO BabbleSim test to use Periodic Sync Receive enable command to disable Periodic Sync reports and yet receive the BIGInfo report. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent a181042 commit 48f4eb9

File tree

1 file changed

+20
-1
lines changed
  • tests/bluetooth/bsim_bt/bsim_test_iso/src

1 file changed

+20
-1
lines changed

tests/bluetooth/bsim_bt/bsim_test_iso/src/main.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,15 @@ static void pa_recv_cb(struct bt_le_per_adv_sync *sync,
316316
is_sync_recv = true;
317317
}
318318

319+
static void
320+
pa_state_changed_cb(struct bt_le_per_adv_sync *sync,
321+
const struct bt_le_per_adv_sync_state_info *info)
322+
{
323+
printk("PER_ADV_SYNC[%u]: state changed, receive %s.\n",
324+
bt_le_per_adv_sync_get_index(sync),
325+
info->recv_enabled ? "enabled" : "disabled");
326+
}
327+
319328
static bool volatile is_big_info;
320329

321330
static void pa_biginfo_cb(struct bt_le_per_adv_sync *sync,
@@ -348,6 +357,7 @@ static struct bt_le_per_adv_sync_cb sync_cb = {
348357
.synced = pa_sync_cb,
349358
.term = pa_terminated_cb,
350359
.recv = pa_recv_cb,
360+
.state_changed = pa_state_changed_cb,
351361
.biginfo = pa_biginfo_cb,
352362
};
353363

@@ -454,7 +464,8 @@ static void test_iso_recv_main(void)
454464
printk("Creating Periodic Advertising Sync...");
455465
is_sync = false;
456466
bt_addr_le_copy(&sync_create_param.addr, &per_addr);
457-
sync_create_param.options = 0;
467+
sync_create_param.options =
468+
BT_LE_PER_ADV_SYNC_OPT_REPORTING_INITIALLY_DISABLED;
458469
sync_create_param.sid = per_sid;
459470
sync_create_param.skip = 0;
460471
sync_create_param.timeout = 0xa;
@@ -624,6 +635,14 @@ static void test_iso_recv_main(void)
624635
FAIL("Remote Host Terminate Failed.\n");
625636
}
626637

638+
printk("Periodic sync receive enable...\n");
639+
err = bt_le_per_adv_sync_recv_enable(sync);
640+
if (err) {
641+
printk("failed (err %d)\n", err);
642+
return;
643+
}
644+
printk("receive enabled.\n");
645+
627646
uint8_t check_countdown = 3;
628647

629648
printk("Waiting for remote BIG terminate by checking for missing "

0 commit comments

Comments
 (0)