Skip to content

Commit

Permalink
Bluetooth: Audio: Shell: Add broadcaster address in broadcast scan ca…
Browse files Browse the repository at this point in the history
…llback

Add printing of the broadcast source advertising address in the
scan callback. Also rename the scan callback to make
it more clear that it is for broadcast scanning.

Signed-off-by: Emil Gydesen <[email protected]>
  • Loading branch information
Thalley authored and carlescufi committed Oct 7, 2022
1 parent 208f447 commit 83d3a36
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions subsys/bluetooth/shell/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,12 +1009,16 @@ static uint32_t accepted_broadcast_id;
static struct bt_audio_base received_base;
static bool sink_syncable;

static bool scan_recv(const struct bt_le_scan_recv_info *info,
struct net_buf_simple *ad,
uint32_t broadcast_id)
static bool broadcast_scan_recv(const struct bt_le_scan_recv_info *info,
struct net_buf_simple *ad,
uint32_t broadcast_id)
{
shell_print(ctx_shell, "Found broadcaster with ID 0x%06X",
broadcast_id);
char le_addr[BT_ADDR_LE_STR_LEN];

bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr));

shell_print(ctx_shell, "Found broadcaster with ID 0x%06X and addr %s",
broadcast_id, le_addr);

if (broadcast_id == accepted_broadcast_id) {
shell_print(ctx_shell, "PA syncing to broadcaster");
Expand Down Expand Up @@ -1135,7 +1139,7 @@ static void pa_sync_lost(struct bt_audio_broadcast_sink *sink)

#if defined(CONFIG_BT_AUDIO_BROADCAST_SINK)
static struct bt_audio_broadcast_sink_cb sink_cbs = {
.scan_recv = scan_recv,
.scan_recv = broadcast_scan_recv,
.pa_synced = pa_synced,
.base_recv = base_recv,
.syncable = syncable,
Expand Down

0 comments on commit 83d3a36

Please sign in to comment.