adapter: Add support for Limited Discoverable mode
RFC 1/1 adapter: Add support for Limited Discoverable mode
This allows to set adapter in Limited Discoverable mode for up to 60 seconds. Any registered advertising instances flags are updated as well.
--- doc/adapter-api.txt | 20 ++++++++ src/adapter.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/adapter.h | 1 + src/advertising.c | 4 +- 4 files changed, 155 insertions(+), 1 deletion(-)
doc/adapter-api.txt +20 -0
@@ -225,6 +225,26 @@ Properties string Address [readonly] For any new adapter this settings defaults to false. + boolean LimitedDiscoverable [readwrite, experimental] + + Switch an adapter to limited discoverable or + non-discoverable to either make it visible or hide it. + This is a global setting and should only be used by the + settings application. + + Adapter can be in limited discoverable mode for up to + 60 seconds. DiscoverableTimeout is honored but capped to + 60 seconds limit. + + In case the adapter is switched off or already + general discoverable, setting this value will fail. + + When changing the Powered property the new state of + this property will be updated via a PropertiesChanged + signal. + + For any new adapter this settings defaults to false. + boolean Pairable [readwrite] Switch an adapter to pairable or non-pairable. This is
src/adapter.c +131 -0
167 lines not on this page · raw message
src/adapter.h +1 -0
@@ -75,6 +75,7 @@ bool btd_adapter_get_pairable(struct btd_adapter *adapter);bool btd_adapter_get_powered (struct btd_adapter *adapter);bool btd_adapter_get_connectable (struct btd_adapter *adapter);bool btd_adapter_get_discoverable (struct btd_adapter *adapter); +bool btd_adapter_get_limited (struct btd_adapter *adapter);struct btd_gatt_database *btd_adapter_get_database (struct btd_adapter *adapter);
src/advertising.c +3 -1
@@ -625,7 +625,9 @@ static int refresh_adv(struct btd_adv_client *client, mgmt_request_func_t func)if (client->type ==AD_TYPE_PERIPHERAL ) { flags =MGMT_ADV_FLAG_CONNECTABLE ; -if (btd_adapter_get_discoverable (client->manager->adapter)) +if (btd_adapter_get_limited (client->manager->adapter)) + flags |=MGMT_ADV_FLAG_LIMITED_DISCOV ; +else if (btd_adapter_get_discoverable (client->manager->adapter)) flags |=MGMT_ADV_FLAG_DISCOV ; }
Signature · 1 line
2.14.3