Bluetooth: samples: ISO: Check validity of incoming data

Only print incoming data when the data is valid. Otherwise we also
print incoming data when no data was received.

Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
This commit is contained in:
Rubin Gerritsen 2023-06-07 13:05:07 +02:00 committed by Anas Nashif
commit 57ab4f4cf4
3 changed files with 10 additions and 4 deletions

View file

@ -91,9 +91,11 @@ static void iso_print_data(uint8_t *data, size_t data_len)
static void iso_recv(struct bt_iso_chan *chan, const struct bt_iso_recv_info *info,
struct net_buf *buf)
{
if (info->flags & BT_ISO_FLAGS_VALID) {
printk("Incoming data channel %p len %u\n", chan, buf->len);
iso_print_data(buf->data, buf->len);
}
}
static void iso_connected(struct bt_iso_chan *chan)
{

View file

@ -535,8 +535,10 @@ static void stream_recv(struct bt_bap_stream *stream,
const struct bt_iso_recv_info *info,
struct net_buf *buf)
{
if (info->flags & BT_ISO_FLAGS_VALID) {
printk("Incoming audio on stream %p len %u\n", stream, buf->len);
}
}
static struct bt_bap_stream_ops stream_ops = {
.configured = stream_configured,

View file

@ -545,8 +545,10 @@ static void stream_recv(struct bt_bap_stream *stream,
const struct bt_iso_recv_info *info,
struct net_buf *buf)
{
if (info->flags & BT_ISO_FLAGS_VALID) {
printk("Incoming audio on stream %p len %u\n", stream, buf->len);
}
}
#endif