Skip to content
Permalink
Browse files

Bluetooth: controller: Fix compilation without broadcaster or observer

Fix compilation issues in central_hr or peripheral_hr sample when using
split LL and privacy is enabled.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
  • Loading branch information...
joerchan authored and nashif committed May 20, 2019
1 parent cecd7f8 commit 9e96df39f2cb4c68268c14c4f9c1442255c391fb
@@ -622,8 +622,10 @@ void ll_rx_dequeue(void)
if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY)) {
u8_t bm;

bm = (ull_scan_is_enabled(0) << 1) |
ull_adv_is_enabled(0);
bm = (IS_ENABLED(CONFIG_BT_OBSERVER) &&
ull_scan_is_enabled(0) << 1) |
(IS_ENABLED(CONFIG_BT_BROADCASTER) &&
ull_adv_is_enabled(0));

if (!bm) {
ull_filter_adv_scan_state_cb(0);
@@ -864,7 +864,7 @@ u8_t ll_adv_enable(u8_t enable)
ull_filter_adv_scan_state_cb(BIT(0) | BIT(1));
}
#else /* !CONFIG_BT_HCI_MESH_EXT */
if (!ull_scan_is_enabled_get(0)) {
if (IS_ENABLED(CONFIG_BT_OBSERVER) && !ull_scan_is_enabled_get(0)) {
ull_filter_adv_scan_state_cb(BIT(0));
}
#endif /* !CONFIG_BT_HCI_MESH_EXT */
@@ -1202,7 +1202,7 @@ static inline u8_t disable(u16_t handle)
adv->is_enabled = 0U;

#if defined(CONFIG_BT_CTLR_PRIVACY)
if (!ull_scan_is_enabled_get(0)) {
if (IS_ENABLED(CONFIG_BT_OBSERVER) && !ull_scan_is_enabled_get(0)) {
ull_filter_adv_scan_state_cb(0);
}
#endif /* CONFIG_BT_CTLR_PRIVACY */
@@ -107,7 +107,9 @@ static void rl_clear(void);
static void rl_update(void);
static int rl_access_check(bool check_ar);

#if defined(CONFIG_BT_BROADCASTER)
static void rpa_adv_refresh(struct ll_adv_set *adv);
#endif
static void rpa_timeout(struct k_work *work);
static void rpa_refresh_start(void);
static void rpa_refresh_stop(void);
@@ -441,15 +443,17 @@ void ull_filter_adv_update(u8_t adv_fp)
filter_clear(&wl_filter);

/* enabling advertising */
if (adv_fp && !(ull_scan_filter_pol_get(0) & 0x1)) {
if (IS_ENABLED(CONFIG_BT_OBSERVER) &&
adv_fp && !(ull_scan_filter_pol_get(0) & 0x1)) {
/* whitelist not in use, update whitelist */
wl_update();
}

/* Clear before populating rl filter */
filter_clear(&rl_filter);

if (rl_enable && !ull_scan_is_enabled(0)) {
if (rl_enable &&
IS_ENABLED(CONFIG_BT_OBSERVER) && !ull_scan_is_enabled(0)) {
/* rl not in use, update resolving list LUT */
rl_update();
}
@@ -461,15 +465,17 @@ void ull_filter_scan_update(u8_t scan_fp)
filter_clear(&wl_filter);

/* enabling advertising */
if ((scan_fp & 0x1) && !ull_adv_filter_pol_get(0)) {
if ((scan_fp & 0x1) &&
(IS_ENABLED(CONFIG_BT_BROADCASTER) && !ull_adv_filter_pol_get(0))) {
/* whitelist not in use, update whitelist */
wl_update();
}

/* Clear before populating rl filter */
filter_clear(&rl_filter);

if (rl_enable && !ull_adv_is_enabled(0)) {
if (rl_enable &&
(IS_ENABLED(CONFIG_BT_BROADCASTER) && !ull_adv_is_enabled(0))) {
/* rl not in use, update resolving list LUT */
rl_update();
}
@@ -853,6 +859,7 @@ static void rl_update(void)
}
}

#if defined(CONFIG_BT_BROADCASTER)
static void rpa_adv_refresh(struct ll_adv_set *adv)
{
struct pdu_adv *prev;
@@ -885,6 +892,7 @@ static void rpa_adv_refresh(struct ll_adv_set *adv)

lll_adv_data_enqueue(&adv->lll, idx);
}
#endif /* CONFIG_BT_BROADCASTER */

static void rl_clear(void)
{
@@ -904,8 +912,9 @@ static int rl_access_check(bool check_ar)
}
}

return (ull_adv_is_enabled(0) ||
ull_scan_is_enabled(0)) ? 0 : 1;
return ((IS_ENABLED(CONFIG_BT_BROADCASTER) && ull_adv_is_enabled(0)) ||
(IS_ENABLED(CONFIG_BT_OBSERVER) && ull_scan_is_enabled(0)))
? 0 : 1;
}

static void rpa_timeout(struct k_work *work)

0 comments on commit 9e96df3

Please sign in to comment.
You can’t perform that action at this time.