From b4dd20f6b3259c425884cbf43b9c2f95180cae19 Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Tue, 14 Feb 2023 12:18:16 +0530 Subject: [PATCH] Nimble: Updated bleprph example to enable ext adv after adv is completed --- examples/bluetooth/nimble/bleprph/main/main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/bluetooth/nimble/bleprph/main/main.c b/examples/bluetooth/nimble/bleprph/main/main.c index c43902b765..d091b13d32 100644 --- a/examples/bluetooth/nimble/bleprph/main/main.c +++ b/examples/bluetooth/nimble/bleprph/main/main.c @@ -89,9 +89,13 @@ ext_bleprph_advertise(void) { struct ble_gap_ext_adv_params params; struct os_mbuf *data; - uint8_t instance = 1; + uint8_t instance = 0; int rc; + /* First check if any instance is already active */ + if(ble_gap_adv_active()) + return; + /* use defaults for non-set params */ memset (¶ms, 0, sizeof(params)); @@ -324,7 +328,9 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg) case BLE_GAP_EVENT_ADV_COMPLETE: MODLOG_DFLT(INFO, "advertise complete; reason=%d", event->adv_complete.reason); -#if !CONFIG_EXAMPLE_EXTENDED_ADV +#if CONFIG_EXAMPLE_EXTENDED_ADV + ext_bleprph_advertise(); +#else bleprph_advertise(); #endif return 0; -- 2.25.1