diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
index c289869..d852aa6 100644
--- a/doc/adapter-api.txt
+++ b/doc/adapter-api.txt
Parameters that may be set in the filter dictionary
include the following:
- array{string} UUIDs : filtered service UUIDs
- int16 RSSI : RSSI threshold value
- uint16 Pathloss : Pathloss threshold value
- string Transport : type of scan to run
- bool ResetData : Reset advertisement data
-
- When a remote device is found that advertises any UUID
- from UUIDs, it will be reported if:
- - Pathloss and RSSI are both empty,
- - only Pathloss param is set, device advertise TX pwer,
- and computed pathloss is less than Pathloss param,
- - only RSSI param is set, and received RSSI is higher
- than RSSI param,
-
- Transport parameter determines the type of scan:
- "auto" - interleaved scan, default value
- "bredr" - BR/EDR inquiry
- "le" - LE scan only
-
- If "le" or "bredr" Transport is requested, and the
- controller doesn't support it, org.bluez.Error.Failed
- error will be returned. If "auto" transport is
- requested, scan will use LE, BREDR, or both, depending
- on what's currently enabled on the controller.
+ array{string} UUIDs
+
+ Filter by service UUIDs, empty means match
+ _any_ UUID.
+
+ When a remote device is found that advertises
+ any UUID from UUIDs, it will be reported if:
+ - Pathloss and RSSI are both empty.
+ - only Pathloss param is set, device advertise
+ TX pwer, and computed pathloss is less than
+ Pathloss param.
+ - only RSSI param is set, and received RSSI is
+ higher than RSSI param.
+
+ int16 RSSI
+
+ RSSI threshold value.
+
+ PropertiesChanged signals will be emitted
+ for already existing Device objects, with
+ updated RSSI value. If one or more discovery
+ filters have been set, the RSSI delta-threshold,
+ that is imposed by StartDiscovery by default,
+ will not be applied.
+
+ uint16 Pathloss
+
+ Pathloss threshold value.
+
+ PropertiesChanged signals will be emitted
+ for already existing Device objects, with
+ updated Pathloss value.
+
+ string Transport (Default "auto")
+
+ Transport parameter determines the type of
+ scan.
+
+ Possible values:
+ "auto" - interleaved scan
+ "bredr" - BR/EDR inquiry
+ "le" - LE scan only
+
+ If "le" or "bredr" Transport is requested,
+ and the controller doesn't support it,
+ org.bluez.Error.Failed error will be returned.
+ If "auto" transport is requested, scan will use
+ LE, BREDR, or both, depending on what's
+ currently enabled on the controller.
+
+ bool DuplicateData (Default: true)
+
+ Disables duplicate detection of advertisement
+ data.
+
+ When enabled PropertiesChanged signals will be
+ generated for either ManufacturerData and
+ ServiceData everytime they are discovered.
When discovery filter is set, Device objects will be
created as new devices with matching criteria are
discoverable which enables listening to
non-connectable and non-discoverable devices.
- PropertiesChanged signals will be emitted
- for already existing Device objects, with updated RSSI
- value. If one or more discovery filters have been set,
- the RSSI delta-threshold, that is imposed by
- StartDiscovery by default, will not be applied.
-
- If ResetData is enabled PropertiesChanged signals will
- be generated for either ManufacturerData and ServiceData
- everytime they are discovered.
-
When multiple clients call SetDiscoveryFilter, their
filters are internally merged, and notifications about
new devices are sent to all clients. Therefore, each
diff --git a/src/adapter.c b/src/adapter.c
index 0186051..a571b18 100644
--- a/src/adapter.c
+++ b/src/adapter.c
uint16_t pathloss;
int16_t rssi;
GSList *uuids;
- bool reset;
+ bool duplicate;
};
struct watch_client {
return true;
}
-static bool parse_reset_data(DBusMessageIter *value,
+static bool parse_duplicate_data(DBusMessageIter *value,
struct discovery_filter *filter)
{
if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN)
return false;
- dbus_message_iter_get_basic(value, &filter->reset);
+ dbus_message_iter_get_basic(value, &filter->duplicate);
return true;
}
{ "RSSI", parse_rssi },
{ "Pathloss", parse_pathloss },
{ "Transport", parse_transport },
- { "ResetData", parse_reset_data },
+ { "DuplicateData", parse_duplicate_data },
{ }
};
(*filter)->pathloss = DISTANCE_VAL_INVALID;
(*filter)->rssi = DISTANCE_VAL_INVALID;
(*filter)->type = get_scan_type(adapter);
- (*filter)->reset = false;
+ (*filter)->duplicate = false;
dbus_message_iter_init(msg, &iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
goto invalid_args;
DBG("filtered discovery params: transport: %d rssi: %d pathloss: %d "
- " reset data: %s ", (*filter)->type, (*filter)->rssi,
- (*filter)->pathloss, (*filter)->reset ? "true" : "false");
+ " duplicate data: %s ", (*filter)->type, (*filter)->rssi,
+ (*filter)->pathloss, (*filter)->duplicate ? "true" : "false");
return true;
return got_match;
}
-static void filter_reset_data(void *data, void *user_data)
+static void filter_duplicate_data(void *data, void *user_data)
{
struct watch_client *client = data;
- bool *reset = user_data;
+ bool *duplicate = user_data;
- if (*reset || !client->discovery_filter)
+ if (*duplicate || !client->discovery_filter)
return;
- *reset = client->discovery_filter->reset;
+ *duplicate = client->discovery_filter->duplicate;
}
static void update_found_devices(struct btd_adapter *adapter,
struct eir_data eir_data;
bool name_known, discoverable;
char addr[18];
- bool reset = false;
+ bool duplicate = false;
memset(&eir_data, 0, sizeof(eir_data));
eir_parse(&eir_data, data, data_len);
device_add_eir_uuids(dev, eir_data.services);
if (adapter->discovery_list)
- g_slist_foreach(adapter->discovery_list, filter_reset_data,
- &reset);
+ g_slist_foreach(adapter->discovery_list, filter_duplicate_data,
+ &duplicate);
if (eir_data.msd_list) {
- device_set_manufacturer_data(dev, eir_data.msd_list, reset);
+ device_set_manufacturer_data(dev, eir_data.msd_list, duplicate);
adapter_msd_notify(adapter, dev, eir_data.msd_list);
}
if (eir_data.sd_list)
- device_set_service_data(dev, eir_data.sd_list, reset);
+ device_set_service_data(dev, eir_data.sd_list, duplicate);
if (bdaddr_type != BDADDR_BREDR)
device_set_flags(dev, eir_data.flags);
diff --git a/src/device.c b/src/device.c
index 516958e..fd7a641 100644
--- a/src/device.c
+++ b/src/device.c
}
void device_set_manufacturer_data(struct btd_device *dev, GSList *list,
- bool reset)
+ bool duplicate)
{
- if (reset)
+ if (duplicate)
bt_ad_clear_manufacturer_data(dev->ad);
g_slist_foreach(list, add_manufacturer_data, dev);
}
void device_set_service_data(struct btd_device *dev, GSList *list,
- bool reset)
+ bool duplicate)
{
- if (reset)
+ if (duplicate)
bt_ad_clear_service_data(dev->ad);
g_slist_foreach(list, add_service_data, dev);
diff --git a/src/device.h b/src/device.h
index 5f56918..8505617 100644
--- a/src/device.h
+++ b/src/device.h
void btd_device_add_uuid(struct btd_device *device, const char *uuid);
void device_add_eir_uuids(struct btd_device *dev, GSList *uuids);
void device_set_manufacturer_data(struct btd_device *dev, GSList *list,
- bool reset);
-void device_set_service_data(struct btd_device *dev, GSList *list, bool reset);
+ bool duplicate);
+void device_set_service_data(struct btd_device *dev, GSList *list,
+ bool duplicate);
void device_probe_profile(gpointer a, gpointer b);
void device_remove_profile(gpointer a, gpointer b);
struct btd_adapter *device_get_adapter(struct btd_device *device);