From 9fd023d47f3b77961407939d8e63888bace167ac Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 28 Oct 2021 15:37:54 +0200 Subject: [PATCH] nimble/host/include/host/ble_gap: add ble_gap_ext_adv_active() --- nimble/host/include/host/ble_gap.h | 12 ++++++++++++ nimble/host/src/ble_gap.c | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/nimble/host/include/host/ble_gap.h b/nimble/host/include/host/ble_gap.h index 44e45cdf2..aac7f8fc0 100644 --- a/nimble/host/include/host/ble_gap.h +++ b/nimble/host/include/host/ble_gap.h @@ -1443,6 +1443,18 @@ int ble_gap_ext_adv_remove(uint8_t instance); * other error code on failure. */ int ble_gap_ext_adv_clear(void); + +/** + * Indicates whether an advertisement procedure is currently in progress on + * the specified Instance + * + * @param instance Instance Id + * + * @return 0 if there is no active advertising procedure for the instance, + * 1 otherwise + * + */ +int ble_gap_ext_adv_active(uint8_t instance); #endif /* Periodic Advertising */ diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c index 23abd08e7..632a110b8 100644 --- a/nimble/host/src/ble_gap.c +++ b/nimble/host/src/ble_gap.c @@ -1453,6 +1453,16 @@ ble_gap_adv_active_instance(uint8_t instance) } #endif +#if MYNEWT_VAL(BLE_EXT_ADV) +int ble_gap_ext_adv_active(uint8_t instance) +{ + if (instance >= BLE_ADV_INSTANCES) { + return 0; + } + return ble_gap_adv_active_instance(instance); +} +#endif + /** * Clears advertisement and discovery state. This function is necessary * when the controller loses its active state (e.g. on stack reset).