summaryrefslogtreecommitdiff
path: root/src/advertising.c
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@codecoup.pl>2018-02-07 11:02:24 +0100
committerSzymon Janc <szymon.janc@codecoup.pl>2018-02-09 15:12:30 +0100
commit91d4b17160b80d34f30f60d7dcc99053fc69540a (patch)
tree6f94190efd5e6d5c40f90bf44a1ce10be4737ad8 /src/advertising.c
parent1873096352f518d3247f8efb3c2e0aa8804e50ac (diff)
downloadbluez-91d4b17160b80d34f30f60d7dcc99053fc69540a.tar.gz
advertising: Configure discoverable flag based on adapter settings
Until now advertising as peripheral was always setting General Discoverable flag set. With this patch this is set based on adapter discoverable setting.
Diffstat (limited to 'src/advertising.c')
-rw-r--r--src/advertising.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/advertising.c b/src/advertising.c
index 970c3d87b..f17a1f5c5 100644
--- a/src/advertising.c
+++ b/src/advertising.c
@@ -622,8 +622,12 @@ static int refresh_adv(struct btd_adv_client *client, mgmt_request_func_t func)
DBG("Refreshing advertisement: %s", client->path);
- if (client->type == AD_TYPE_PERIPHERAL)
- flags = MGMT_ADV_FLAG_CONNECTABLE | MGMT_ADV_FLAG_DISCOV;
+ if (client->type == AD_TYPE_PERIPHERAL) {
+ flags = MGMT_ADV_FLAG_CONNECTABLE;
+
+ if (btd_adapter_get_discoverable(client->manager->adapter))
+ flags |= MGMT_ADV_FLAG_DISCOV;
+ }
flags |= client->flags;
@@ -1106,3 +1110,9 @@ void btd_adv_manager_destroy(struct btd_adv_manager *manager)
manager_destroy(manager);
}
+
+void btd_adv_manager_refresh(struct btd_adv_manager *manager)
+{
+ queue_foreach(manager->clients, (queue_foreach_func_t)refresh_adv,
+ NULL);
+}