Skip to content

Commit f34c913

Browse files
Thalleycarlescufi
authored andcommitted
Bluetooth: Sample: Add iso get info use to iso connected benchmark
Add a call to bt_iso_chan_get_info for each CIS in the sample to ensure that we don't attempt to send any data on a CIS that is RX only. Signed-off-by: Emil Gydesen <[email protected]>
1 parent bcfb4df commit f34c913

File tree

1 file changed

+13
-3
lines changed
  • samples/bluetooth/iso_connected_benchmark/src

1 file changed

+13
-3
lines changed

samples/bluetooth/iso_connected_benchmark/src/main.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ struct iso_recv_stats {
5151
struct iso_chan_work {
5252
struct bt_iso_chan chan;
5353
struct k_work_delayable send_work;
54+
struct bt_iso_info info;
5455
} iso_chans[CONFIG_BT_ISO_MAX_CHAN];
5556

5657
static enum benchmark_role role;
@@ -154,12 +155,12 @@ static void iso_send(struct bt_iso_chan *chan)
154155
struct net_buf *buf;
155156
struct iso_chan_work *chan_work;
156157

157-
if (chan->qos->tx == NULL || chan->qos->tx->sdu == 0) {
158+
chan_work = CONTAINER_OF(chan, struct iso_chan_work, chan);
159+
160+
if (!chan_work->info.can_send) {
158161
return;
159162
}
160163

161-
chan_work = CONTAINER_OF(chan, struct iso_chan_work, chan);
162-
163164
buf = net_buf_alloc(&tx_pool, K_FOREVER);
164165
if (buf == NULL) {
165166
LOG_ERR("Could not allocate buffer");
@@ -259,8 +260,17 @@ static void iso_recv(struct bt_iso_chan *chan,
259260

260261
static void iso_connected(struct bt_iso_chan *chan)
261262
{
263+
struct iso_chan_work *chan_work;
264+
int err;
265+
262266
LOG_INF("ISO Channel %p connected", chan);
263267

268+
chan_work = CONTAINER_OF(chan, struct iso_chan_work, chan);
269+
err = bt_iso_chan_get_info(chan, &chan_work->info);
270+
if (err != 0) {
271+
LOG_ERR("Could get info about chan %p: %d", chan, err);
272+
}
273+
264274
/* If multiple CIS was created, this will be the value of the last
265275
* created in the CIG
266276
*/

0 commit comments

Comments
 (0)