Skip to content

Commit fc33f6a

Browse files
Thalleycfriedt
authored andcommitted
Bluetooth: sample: Update iso_broadcast_benchmark to use new ISO API
Update the sample to use the new ISO API. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 1d1cd57 commit fc33f6a

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

samples/bluetooth/iso_broadcast_benchmark/src/broadcaster.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ static struct bt_iso_chan *bis[CONFIG_BT_ISO_MAX_CHAN];
3838
static struct bt_iso_big_create_param big_create_param = {
3939
.num_bis = DEFAULT_BIS_COUNT,
4040
.bis_channels = bis,
41+
.packing = DEFAULT_BIS_PACKING, /* 0 - sequential, 1 - interleaved */
42+
.framing = DEFAULT_BIS_FRAMING, /* 0 - unframed, 1 - framed */
43+
.interval = DEFAULT_BIS_INTERVAL_US, /* in microseconds */
44+
.latency = DEFAULT_BIS_LATENCY_MS, /* milliseconds */
4145
};
4246

4347
static void iso_connected(struct bt_iso_chan *chan)
@@ -67,17 +71,13 @@ static struct bt_iso_chan_ops iso_ops = {
6771
};
6872

6973
static struct bt_iso_chan_io_qos iso_tx_qos = {
70-
.interval = DEFAULT_BIS_INTERVAL_US, /* in microseconds */
71-
.latency = DEFAULT_BIS_LATENCY_MS, /* milliseconds */
7274
.sdu = DEFAULT_BIS_SDU, /* bytes */
7375
.rtn = DEFAULT_BIS_RTN,
7476
.phy = DEFAULT_BIS_PHY,
7577
};
7678

7779
static struct bt_iso_chan_qos bis_iso_qos = {
7880
.tx = &iso_tx_qos,
79-
.packing = DEFAULT_BIS_PACKING, /* 0 - sequential, 1 - interleaved */
80-
.framing = DEFAULT_BIS_FRAMING, /* 0 - unframed, 1 - framed */
8181
};
8282

8383
static size_t get_chars(char *buffer, size_t max_size)
@@ -130,7 +130,7 @@ static int parse_interval_arg(void)
130130
uint64_t interval;
131131

132132
printk("Set interval (us) (current %u, default %u)\n",
133-
iso_tx_qos.interval, DEFAULT_BIS_INTERVAL_US);
133+
big_create_param.interval, DEFAULT_BIS_INTERVAL_US);
134134

135135
char_count = get_chars(buffer, sizeof(buffer) - 1);
136136
if (char_count == 0) {
@@ -154,7 +154,7 @@ static int parse_latency_arg(void)
154154
uint64_t latency;
155155

156156
printk("Set latency (ms) (current %u, default %u)\n",
157-
iso_tx_qos.latency, DEFAULT_BIS_LATENCY_MS);
157+
big_create_param.latency, DEFAULT_BIS_LATENCY_MS);
158158

159159
char_count = get_chars(buffer, sizeof(buffer) - 1);
160160
if (char_count == 0) {
@@ -228,7 +228,7 @@ static int parse_packing_arg(void)
228228
uint64_t packing;
229229

230230
printk("Set packing (current %u, default %u)\n",
231-
bis_iso_qos.packing, DEFAULT_BIS_PACKING);
231+
big_create_param.packing, DEFAULT_BIS_PACKING);
232232

233233
char_count = get_chars(buffer, sizeof(buffer) - 1);
234234
if (char_count == 0) {
@@ -252,7 +252,7 @@ static int parse_framing_arg(void)
252252
uint64_t framing;
253253

254254
printk("Set framing (current %u, default %u)\n",
255-
bis_iso_qos.framing, DEFAULT_BIS_FRAMING);
255+
big_create_param.framing, DEFAULT_BIS_FRAMING);
256256

257257
char_count = get_chars(buffer, sizeof(buffer) - 1);
258258
if (char_count == 0) {
@@ -346,12 +346,12 @@ static int parse_args(void)
346346
}
347347

348348
iso_tx_qos.rtn = rtn;
349-
iso_tx_qos.interval = interval;
350-
iso_tx_qos.latency = latency;
351349
iso_tx_qos.phy = phy;
352350
iso_tx_qos.sdu = sdu;
353-
bis_iso_qos.packing = packing;
354-
bis_iso_qos.framing = framing;
351+
big_create_param.interval = interval;
352+
big_create_param.latency = latency;
353+
big_create_param.packing = packing;
354+
big_create_param.framing = framing;
355355
big_create_param.num_bis = bis_count;
356356

357357
return 0;
@@ -368,7 +368,7 @@ static void iso_timer_timeout(struct k_work *work)
368368
* calls `bt_iso_chan_send` but the controller only sending a single
369369
* ISO packet.
370370
*/
371-
k_work_reschedule(&iso_send_work, K_USEC(iso_tx_qos.interval - 100));
371+
k_work_reschedule(&iso_send_work, K_USEC(big_create_param.interval - 100));
372372

373373
for (int i = 0; i < big_create_param.num_bis; i++) {
374374
buf = net_buf_alloc(&bis_tx_pool, K_FOREVER);
@@ -508,9 +508,9 @@ int test_run_broadcaster(void)
508508

509509
printk("Change settings (y/N)? (Current settings: rtn=%u, interval=%u, "
510510
"latency=%u, phy=%u, sdu=%u, packing=%u, framing=%u, "
511-
"bis_count=%u)\n", iso_tx_qos.rtn, iso_tx_qos.interval,
512-
iso_tx_qos.latency, iso_tx_qos.phy, iso_tx_qos.sdu,
513-
bis_iso_qos.packing, bis_iso_qos.framing,
511+
"bis_count=%u)\n", iso_tx_qos.rtn, big_create_param.interval,
512+
big_create_param.latency, iso_tx_qos.phy, iso_tx_qos.sdu,
513+
big_create_param.packing, big_create_param.framing,
514514
big_create_param.num_bis);
515515

516516
c = tolower(console_getchar());
@@ -523,9 +523,10 @@ int test_run_broadcaster(void)
523523

524524
printk("New settings: rtn=%u, interval=%u, latency=%u, "
525525
"phy=%u, sdu=%u, packing=%u, framing=%u, bis_count=%u\n",
526-
iso_tx_qos.rtn, iso_tx_qos.interval, iso_tx_qos.latency,
527-
iso_tx_qos.phy, iso_tx_qos.sdu, bis_iso_qos.packing,
528-
bis_iso_qos.framing, big_create_param.num_bis);
526+
iso_tx_qos.rtn, big_create_param.interval,
527+
big_create_param.latency, iso_tx_qos.phy, iso_tx_qos.sdu,
528+
big_create_param.packing, big_create_param.framing,
529+
big_create_param.num_bis);
529530
}
530531

531532
err = create_big(&adv, &big);

0 commit comments

Comments
 (0)