Skip to content

Commit d64252a

Browse files
committed
tests: Bluetooth: bsim: ISO test with ACAD in periodic advertising
Updated ISO test to demonstrate ACAD field in periodic advertising PDUs. Here, test changing the periodic advertising data. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 155405e commit d64252a

File tree

2 files changed

+48
-13
lines changed

2 files changed

+48
-13
lines changed

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

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ extern enum bst_result_t bst_result;
4444
#include "subsys/bluetooth/host/hci_core.h"
4545
#endif /* !USE_HOST_API */
4646

47+
static uint8_t mfg_data1[] = { 0xff, 0xff, 0x01, 0x02, 0x03, 0x04 };
48+
static uint8_t mfg_data2[] = { 0xff, 0xff, 0x05 };
49+
50+
static const struct bt_data per_ad_data1[] = {
51+
BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data1, 6),
52+
};
53+
54+
static const struct bt_data per_ad_data2[] = {
55+
BT_DATA(BT_DATA_MANUFACTURER_DATA, mfg_data2, 3),
56+
};
57+
4758
static void test_iso_main(void)
4859
{
4960
struct bt_le_ext_adv *adv;
@@ -53,15 +64,15 @@ static void test_iso_main(void)
5364

5465
printk("\n*ISO broadcast test*\n");
5566

56-
printk("Bluetooth initializing...\n");
67+
printk("Bluetooth initializing...");
5768
err = bt_enable(NULL);
5869
if (err) {
5970
FAIL("Could not init BT: %d\n", err);
6071
return;
6172
}
6273
printk("success.\n");
6374

64-
printk("Create advertising set...\n");
75+
printk("Create advertising set...");
6576
err = bt_le_ext_adv_create(BT_LE_EXT_ADV_NCONN_NAME, NULL, &adv);
6677
if (err) {
6778
FAIL("Failed to create advertising set (err %d)\n", err);
@@ -70,7 +81,7 @@ static void test_iso_main(void)
7081
printk("success.\n");
7182

7283

73-
printk("Setting Periodic Advertising parameters...\n");
84+
printk("Setting Periodic Advertising parameters...");
7485
err = bt_le_per_adv_set_param(adv, BT_LE_PER_ADV_DEFAULT);
7586
if (err) {
7687
FAIL("Failed to set periodic advertising parameters (err %d)\n",
@@ -79,19 +90,21 @@ static void test_iso_main(void)
7990
}
8091
printk("success.\n");
8192

82-
printk("Enable Periodic Advertising...\n");
93+
printk("Enable Periodic Advertising...");
8394
err = bt_le_per_adv_start(adv);
8495
if (err) {
8596
FAIL("Failed to enable periodic advertising (err %d)\n", err);
8697
return;
8798
}
99+
printk("success.\n");
88100

89-
/* Start extended advertising */
101+
printk("Start extended advertising...");
90102
err = bt_le_ext_adv_start(adv, BT_LE_EXT_ADV_START_DEFAULT);
91103
if (err) {
92104
printk("Failed to start extended advertising (err %d)\n", err);
93105
return;
94106
}
107+
printk("success.\n");
95108

96109
#if !IS_ENABLED(USE_HOST_API)
97110
uint8_t big_handle = 0;
@@ -108,7 +121,7 @@ static void test_iso_main(void)
108121
/* Assume that index == handle */
109122
index = bt_le_ext_adv_get_index(adv);
110123

111-
printk("Creating BIG...\n");
124+
printk("Creating BIG...");
112125
err = ll_big_create(big_handle, index, bis_count, sdu_interval, max_sdu,
113126
max_latency, rtn, phy, packing, framing, encryption,
114127
bcode);
@@ -120,7 +133,29 @@ static void test_iso_main(void)
120133

121134
k_sleep(K_MSEC(5000));
122135

123-
printk("Terminating BIG...\n");
136+
printk("Update periodic advertising data 1...");
137+
err = bt_le_per_adv_set_data(adv, per_ad_data1,
138+
ARRAY_SIZE(per_ad_data1));
139+
if (err) {
140+
FAIL("Failed to update periodic advertising data 1 (%d).\n",
141+
err);
142+
}
143+
printk("success.\n");
144+
145+
k_sleep(K_MSEC(5000));
146+
147+
printk("Update periodic advertising data 2...");
148+
err = bt_le_per_adv_set_data(adv, per_ad_data2,
149+
ARRAY_SIZE(per_ad_data2));
150+
if (err) {
151+
FAIL("Failed to update periodic advertising data 2 (%d).\n",
152+
err);
153+
}
154+
printk("success.\n");
155+
156+
k_sleep(K_MSEC(5000));
157+
158+
printk("Terminating BIG...");
124159
err = ll_big_terminate(big_handle, BT_HCI_ERR_LOCALHOST_TERM_CONN);
125160
if (err) {
126161
FAIL("Could not terminate BIG: %d\n", err);
@@ -245,7 +280,7 @@ static void test_iso_recv_main(void)
245280

246281
printk("\n*ISO broadcast test*\n");
247282

248-
printk("Bluetooth initializing...\n");
283+
printk("Bluetooth initializing...");
249284
err = bt_enable(NULL);
250285
if (err) {
251286
FAIL("Could not init BT: %d\n", err);
@@ -313,7 +348,7 @@ static void test_iso_recv_main(void)
313348
uint16_t sync_timeout = 0;
314349
struct node_rx_hdr *node_rx;
315350

316-
printk("Creating BIG...\n");
351+
printk("Creating BIG...");
317352
err = ll_big_sync_create(big_handle, sync->handle, encryption, bcode,
318353
mse, sync_timeout, bis_count, &bis_handle);
319354
if (err) {
@@ -322,9 +357,9 @@ static void test_iso_recv_main(void)
322357
}
323358
printk("success.\n");
324359

325-
k_sleep(K_MSEC(5000));
360+
k_sleep(K_MSEC(15000));
326361

327-
printk("Terminating BIG...\n");
362+
printk("Terminating BIG...");
328363
err = ll_big_sync_terminate(big_handle, (void **)&node_rx);
329364
if (err) {
330365
FAIL("Could not terminate BIG sync: %d\n", err);
@@ -342,7 +377,7 @@ static void test_iso_recv_main(void)
342377

343378
static void test_iso_init(void)
344379
{
345-
bst_ticker_set_next_tick_absolute(20e6);
380+
bst_ticker_set_next_tick_absolute(30e6);
346381
bst_result = In_progress;
347382
}
348383

tests/bluetooth/bsim_bt/bsim_test_iso/tests_scripts/broadcast_iso.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function Execute(){
1414
compile it?)\e[39m"
1515
exit 1
1616
fi
17-
timeout 20 $@ & process_ids="$process_ids $!"
17+
timeout 30 $@ & process_ids="$process_ids $!"
1818
}
1919

2020
: "${BSIM_OUT_PATH:?BSIM_OUT_PATH must be defined}"

0 commit comments

Comments
 (0)