From d4fe898fe226999fa6ca68e851686f576a01bd96 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 13 Jun 2017 12:05:54 +0200 Subject: [PATCH] Bluetooth: controller: Add functions to get active filter policy Add internal functions to read advertiser and scanner filter policy if the roles are enabled. This is required to restrict updates to whitelist and resolving lists when filter policy are being used by the roles. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ctrl.c | 28 ++++++++++++++++++++++++ subsys/bluetooth/controller/ll_sw/ctrl.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.c b/subsys/bluetooth/controller/ll_sw/ctrl.c index 5ee6f34c754..3baa73ba3c5 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.c +++ b/subsys/bluetooth/controller/ll_sw/ctrl.c @@ -8301,6 +8301,20 @@ u32_t radio_adv_is_enabled(void) return _radio.advertiser.is_enabled; } +u32_t radio_adv_filter_pol_get(void) +{ + /* NOTE: filter_policy is only written in thread mode; if is_enabled is + * unset by ISR, returning the stale filter_policy is acceptable because + * the unset code path in ISR will generate a connection complete + * event. + */ + if (_radio.advertiser.is_enabled) { + return _radio.advertiser.filter_policy; + } + + return 0; +} + u32_t radio_scan_enable(u8_t type, u8_t init_addr_type, u8_t *init_addr, u16_t interval, u16_t window, u8_t filter_policy) { @@ -8425,6 +8439,20 @@ u32_t radio_scan_is_enabled(void) return _radio.scanner.is_enabled; } +u32_t radio_scan_filter_pol_get(void) +{ + /* NOTE: filter_policy is only written in thread mode; if is_enabled is + * unset by ISR, returning the stale filter_policy is acceptable because + * the unset code path in ISR will generate a connection complete + * event. + */ + if (_radio.scanner.is_enabled) { + return _radio.scanner.filter_policy; + } + + return 0; +} + u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr, u16_t interval, u16_t latency, u16_t timeout) { diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.h b/subsys/bluetooth/controller/ll_sw/ctrl.h index 85ff8a2bf56..ded4855ece1 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.h +++ b/subsys/bluetooth/controller/ll_sw/ctrl.h @@ -319,12 +319,14 @@ u32_t radio_adv_enable(u16_t interval, u8_t chl_map, u8_t filter_policy); u32_t radio_adv_disable(void); u32_t radio_adv_is_enabled(void); +u32_t radio_adv_filter_pol_get(void); /* Downstream - Scanner */ u32_t radio_scan_enable(u8_t type, u8_t init_addr_type, u8_t *init_addr, u16_t interval, u16_t window, u8_t filter_policy); u32_t radio_scan_disable(void); u32_t radio_scan_is_enabled(void); +u32_t radio_scan_filter_pol_get(void); u32_t radio_connect_enable(u8_t adv_addr_type, u8_t *adv_addr, u16_t interval, u16_t latency,