Bluetooth: Shell: PA sync terminate callback clears entry

The sync terminate callback did not set any entries in the
PA sync array to NULL, thus not allowing the shell to
reuse them in case that the sync was lost unexpectectly.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2020-09-21 20:52:07 +02:00 committed by Johan Hedberg
commit 68a357e66d

View file

@ -1399,6 +1399,13 @@ static void per_adv_sync_terminated_cb(
{
char le_addr[BT_ADDR_LE_STR_LEN];
for (int i = 0; i < ARRAY_SIZE(per_adv_syncs); i++) {
if (per_adv_syncs[i] == sync) {
per_adv_syncs[i] = NULL;
break;
}
}
bt_addr_le_to_str(info->addr, le_addr, sizeof(le_addr));
shell_print(ctx_shell, "PER_ADV_SYNC[%u]: [DEVICE]: %s sync terminated",
bt_le_per_adv_sync_get_index(sync), le_addr);