Bluetooth: Host: reset adv_pool in bt_disable

Reset the adv_pool in disable so that advertising can be started after
re-enabling without issue.

Signed-off-by: Sean Madigan <sean.madigan@nordicsemi.no>
This commit is contained in:
Sean Madigan 2022-11-07 09:12:39 +00:00 committed by Fabio Baltieri
parent 0e010e8744
commit c80b6d8223
3 changed files with 14 additions and 0 deletions

View file

@ -270,6 +270,15 @@ void bt_le_ext_adv_foreach(void (*func)(struct bt_le_ext_adv *adv, void *data),
#endif /* defined(CONFIG_BT_EXT_ADV) */
}
void bt_adv_reset_adv_pool(void)
{
#if defined(CONFIG_BT_EXT_ADV)
(void)memset(&adv_pool, 0, sizeof(adv_pool));
#endif /* defined(CONFIG_BT_EXT_ADV) */
(void)memset(&bt_dev.adv, 0, sizeof(bt_dev.adv));
}
static struct bt_le_ext_adv *adv_get_legacy(void)
{
#if defined(CONFIG_BT_EXT_ADV)

View file

@ -20,3 +20,4 @@ int bt_le_adv_set_enable_ext(struct bt_le_ext_adv *adv,
const struct bt_le_ext_adv_start_param *param);
int bt_le_adv_set_enable_legacy(struct bt_le_ext_adv *adv, bool enable);
int bt_le_lim_adv_cancel_timeout(struct bt_le_ext_adv *adv);
void bt_adv_reset_adv_pool(void);

View file

@ -3800,6 +3800,10 @@ int bt_disable(void)
bt_monitor_send(BT_MONITOR_CLOSE_INDEX, NULL, 0);
#if defined(CONFIG_BT_EXT_ADV) || defined(CONFIG_BT_BROADCASTER)
bt_adv_reset_adv_pool();
#endif /* CONFIG_BT_EXT_ADV || CONFIG_BT_BROADCASTER */
#if defined(CONFIG_BT_PER_ADV_SYNC)
bt_periodic_sync_disable();
#endif /* CONFIG_BT_PER_ADV_SYNC */