From 3c82cea914af5c33d93c2c3c83d09069bfb29066 Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Mon, 4 Nov 2013 10:59:59 +0100 Subject: [PATCH] android: Fix not sending scan mode change notification Check for current settings instead of changed setting mask when sending notification. Otherwise scan mode change would be communicated only if power state changed at the same time. --- android/adapter.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/android/adapter.c b/android/adapter.c index 38dec9d88..81b61c138 100644 --- a/android/adapter.c +++ b/android/adapter.c @@ -174,19 +174,20 @@ static void settings_changed(uint32_t settings) DBG("0x%08x", changed_mask); - if (changed_mask & MGMT_SETTING_POWERED) { + if (changed_mask & MGMT_SETTING_POWERED) powered_changed(); - /* - * Only when powered, the connectable and discoverable - * state changes should be communicated. - */ - scan_mode_mask = MGMT_SETTING_CONNECTABLE | - MGMT_SETTING_DISCOVERABLE; + scan_mode_mask = MGMT_SETTING_CONNECTABLE | + MGMT_SETTING_DISCOVERABLE; + + /* + * Only when powered, the connectable and discoverable + * state changes should be communicated. + */ + if (adapter->current_settings & MGMT_SETTING_POWERED) if (changed_mask & scan_mode_mask) scan_mode_changed(); - } } static void new_settings_callback(uint16_t index, uint16_t length, -- 2.47.3