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 <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-01-21 11:38:38 +01:00 committed by Carles Cufí
parent bcfb4df390
commit f34c9132d6

View file

@ -51,6 +51,7 @@ struct iso_recv_stats {
struct iso_chan_work {
struct bt_iso_chan chan;
struct k_work_delayable send_work;
struct bt_iso_info info;
} iso_chans[CONFIG_BT_ISO_MAX_CHAN];
static enum benchmark_role role;
@ -154,12 +155,12 @@ static void iso_send(struct bt_iso_chan *chan)
struct net_buf *buf;
struct iso_chan_work *chan_work;
if (chan->qos->tx == NULL || chan->qos->tx->sdu == 0) {
chan_work = CONTAINER_OF(chan, struct iso_chan_work, chan);
if (!chan_work->info.can_send) {
return;
}
chan_work = CONTAINER_OF(chan, struct iso_chan_work, chan);
buf = net_buf_alloc(&tx_pool, K_FOREVER);
if (buf == NULL) {
LOG_ERR("Could not allocate buffer");
@ -259,8 +260,17 @@ static void iso_recv(struct bt_iso_chan *chan,
static void iso_connected(struct bt_iso_chan *chan)
{
struct iso_chan_work *chan_work;
int err;
LOG_INF("ISO Channel %p connected", chan);
chan_work = CONTAINER_OF(chan, struct iso_chan_work, chan);
err = bt_iso_chan_get_info(chan, &chan_work->info);
if (err != 0) {
LOG_ERR("Could get info about chan %p: %d", chan, err);
}
/* If multiple CIS was created, this will be the value of the last
* created in the CIG
*/