All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] adapter-api: Rename ResetData to DuplicateData filter
@ 2017-08-29 12:56 Luiz Augusto von Dentz
  2017-08-29 12:56 ` [PATCH v2 2/3] client: Use " Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2017-08-29 12:56 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Since essencially what this filter would be doing is disable duplicate
for data use it instead of ResetData.

Also inline the documentation of each filter option to make it easier to
read what each option does.
---
 doc/adapter-api.txt | 92 +++++++++++++++++++++++++++++++++--------------------
 src/adapter.c       | 32 +++++++++----------
 src/device.c        |  8 ++---
 src/device.h        |  5 +--
 4 files changed, 81 insertions(+), 56 deletions(-)

diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
index c2898694d..d852aa6b9 100644
--- a/doc/adapter-api.txt
+++ b/doc/adapter-api.txt
@@ -54,30 +54,64 @@ Methods		void StartDiscovery()
 			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
@@ -85,16 +119,6 @@ Methods		void StartDiscovery()
 			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 01860515d..a571b1870 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -155,7 +155,7 @@ struct discovery_filter {
 	uint16_t pathloss;
 	int16_t rssi;
 	GSList *uuids;
-	bool reset;
+	bool duplicate;
 };
 
 struct watch_client {
@@ -2216,13 +2216,13 @@ static bool parse_transport(DBusMessageIter *value,
 	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;
 }
@@ -2235,7 +2235,7 @@ struct filter_parser {
 	{ "RSSI", parse_rssi },
 	{ "Pathloss", parse_pathloss },
 	{ "Transport", parse_transport },
-	{ "ResetData", parse_reset_data },
+	{ "DuplicateData", parse_duplicate_data },
 	{ }
 };
 
@@ -2274,7 +2274,7 @@ static bool parse_discovery_filter_dict(struct btd_adapter *adapter,
 	(*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 ||
@@ -2320,8 +2320,8 @@ static bool parse_discovery_filter_dict(struct btd_adapter *adapter,
 		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;
 
@@ -5618,15 +5618,15 @@ static bool is_filter_match(GSList *discovery_filter, struct eir_data *eir_data,
 	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,
@@ -5640,7 +5640,7 @@ 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);
@@ -5741,16 +5741,16 @@ static void update_found_devices(struct btd_adapter *adapter,
 	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 516958e0b..fd7a64134 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1624,9 +1624,9 @@ static void add_manufacturer_data(void *data, void *user_data)
 }
 
 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);
@@ -1649,9 +1649,9 @@ static void add_service_data(void *data, void *user_data)
 }
 
 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 5f56918ed..850561729 100644
--- a/src/device.h
+++ b/src/device.h
@@ -77,8 +77,9 @@ bool device_attach_att(struct btd_device *dev, GIOChannel *io);
 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);
-- 
2.13.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/3] client: Use DuplicateData filter
  2017-08-29 12:56 [PATCH v2 1/3] adapter-api: Rename ResetData to DuplicateData filter Luiz Augusto von Dentz
@ 2017-08-29 12:56 ` Luiz Augusto von Dentz
  2017-08-29 12:56 ` [PATCH v2 3/3] mesh: " Luiz Augusto von Dentz
  2017-08-31 12:06 ` [PATCH v2 1/3] adapter-api: Rename ResetData to " Luiz Augusto von Dentz
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2017-08-29 12:56 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Also use the term duplicate instead of reset to make it more clear
the intent of the filter.
---
 client/main.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/client/main.c b/client/main.c
index 825647d5e..87eb13165 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1267,7 +1267,7 @@ struct set_discovery_filter_args {
 	dbus_int16_t pathloss;
 	char **uuids;
 	size_t uuids_len;
-	dbus_bool_t reset;
+	dbus_bool_t duplicate;
 };
 
 static void set_discovery_filter_setup(DBusMessageIter *iter, void *user_data)
@@ -1295,9 +1295,9 @@ static void set_discovery_filter_setup(DBusMessageIter *iter, void *user_data)
 		dict_append_entry(&dict, "Transport", DBUS_TYPE_STRING,
 						&args->transport);
 
-	if (args->reset)
-		dict_append_entry(&dict, "ResetData", DBUS_TYPE_BOOLEAN,
-						&args->reset);
+	if (args->duplicate)
+		dict_append_entry(&dict, "DuplicateData", DBUS_TYPE_BOOLEAN,
+						&args->duplicate);
 
 	dbus_message_iter_close_container(iter, &dict);
 }
@@ -1322,7 +1322,7 @@ static gint filtered_scan_pathloss = DISTANCE_VAL_INVALID;
 static char **filtered_scan_uuids;
 static size_t filtered_scan_uuids_len;
 static char *filtered_scan_transport;
-static bool filtered_scan_reset_data;
+static bool filtered_scan_duplicate_data;
 
 static void cmd_set_scan_filter_commit(void)
 {
@@ -1334,7 +1334,7 @@ static void cmd_set_scan_filter_commit(void)
 	args.transport = filtered_scan_transport;
 	args.uuids = filtered_scan_uuids;
 	args.uuids_len = filtered_scan_uuids_len;
-	args.reset = filtered_scan_reset_data;
+	args.duplicate = filtered_scan_duplicate_data;
 
 	if (check_default_ctrl() == FALSE)
 		return;
@@ -1404,14 +1404,14 @@ static void cmd_set_scan_filter_transport(const char *arg)
 	cmd_set_scan_filter_commit();
 }
 
-static void cmd_set_scan_filter_reset_data(const char *arg)
+static void cmd_set_scan_filter_duplicate_data(const char *arg)
 {
 	if (!arg || !strlen(arg))
-		filtered_scan_reset_data = false;
+		filtered_scan_duplicate_data = false;
 	else if (!strcmp(arg, "on"))
-		filtered_scan_reset_data = true;
+		filtered_scan_duplicate_data = true;
 	else if (!strcmp(arg, "off"))
-		filtered_scan_reset_data = false;
+		filtered_scan_duplicate_data = false;
 	else {
 		rl_printf("Invalid option: %s\n", arg);
 		return;
@@ -2473,9 +2473,10 @@ static const struct {
 				"Set scan filter pathloss, and clears rssi" },
 	{ "set-scan-filter-transport", "[transport]",
 		cmd_set_scan_filter_transport, "Set scan filter transport" },
-	{ "set-scan-filter-reset-data", "[on/off]",
-		cmd_set_scan_filter_reset_data, "Set scan filter reset data",
-							mode_generator },
+	{ "set-scan-filter-duplicate-data", "[on/off]",
+			cmd_set_scan_filter_duplicate_data,
+				"Set scan filter duplicate data",
+				mode_generator },
 	{ "set-scan-filter-clear", "", cmd_set_scan_filter_clear,
 						"Clears discovery filter." },
 	{ "scan",         "<on/off>", cmd_scan, "Scan for devices",
-- 
2.13.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 3/3] mesh: Use DuplicateData filter
  2017-08-29 12:56 [PATCH v2 1/3] adapter-api: Rename ResetData to DuplicateData filter Luiz Augusto von Dentz
  2017-08-29 12:56 ` [PATCH v2 2/3] client: Use " Luiz Augusto von Dentz
@ 2017-08-29 12:56 ` Luiz Augusto von Dentz
  2017-08-31 12:06 ` [PATCH v2 1/3] adapter-api: Rename ResetData to " Luiz Augusto von Dentz
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2017-08-29 12:56 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Also use the term duplicate instead of reset to make it more clear
the intent of the filter.
---
 mesh/main.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mesh/main.c b/mesh/main.c
index b06f4352a..96ac78544 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -1575,7 +1575,7 @@ struct set_discovery_filter_args {
 	dbus_int16_t pathloss;
 	char **uuids;
 	size_t uuids_len;
-	dbus_bool_t reset;
+	dbus_bool_t duplicate;
 };
 
 static void set_discovery_filter_setup(DBusMessageIter *iter, void *user_data)
@@ -1602,9 +1602,9 @@ static void set_discovery_filter_setup(DBusMessageIter *iter, void *user_data)
 	if (args->transport != NULL)
 		dict_append_entry(&dict, "Transport", DBUS_TYPE_STRING,
 						&args->transport);
-	if (args->reset)
-		dict_append_entry(&dict, "ResetData", DBUS_TYPE_BOOLEAN,
-						&args->reset);
+	if (args->duplicate)
+		dict_append_entry(&dict, "DuplicateData", DBUS_TYPE_BOOLEAN,
+						&args->duplicate);
 
 	dbus_message_iter_close_container(iter, &dict);
 }
@@ -1639,7 +1639,7 @@ static void set_scan_filter_commit(void)
 	args.transport = filtered_scan_transport;
 	args.uuids = filtered_scan_uuids;
 	args.uuids_len = filtered_scan_uuids_len;
-	args.reset = TRUE;
+	args.duplicate = TRUE;
 
 	if (check_default_ctrl() == FALSE)
 		return;
-- 
2.13.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/3] adapter-api: Rename ResetData to DuplicateData filter
  2017-08-29 12:56 [PATCH v2 1/3] adapter-api: Rename ResetData to DuplicateData filter Luiz Augusto von Dentz
  2017-08-29 12:56 ` [PATCH v2 2/3] client: Use " Luiz Augusto von Dentz
  2017-08-29 12:56 ` [PATCH v2 3/3] mesh: " Luiz Augusto von Dentz
@ 2017-08-31 12:06 ` Luiz Augusto von Dentz
  2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2017-08-31 12:06 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

On Tue, Aug 29, 2017 at 3:56 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> Since essencially what this filter would be doing is disable duplicate
> for data use it instead of ResetData.
>
> Also inline the documentation of each filter option to make it easier to
> read what each option does.
> ---
>  doc/adapter-api.txt | 92 +++++++++++++++++++++++++++++++++--------------------
>  src/adapter.c       | 32 +++++++++----------
>  src/device.c        |  8 ++---
>  src/device.h        |  5 +--
>  4 files changed, 81 insertions(+), 56 deletions(-)
>
> diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
> index c2898694d..d852aa6b9 100644
> --- a/doc/adapter-api.txt
> +++ b/doc/adapter-api.txt
> @@ -54,30 +54,64 @@ Methods             void StartDiscovery()
>                         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
> @@ -85,16 +119,6 @@ Methods             void StartDiscovery()
>                         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 01860515d..a571b1870 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -155,7 +155,7 @@ struct discovery_filter {
>         uint16_t pathloss;
>         int16_t rssi;
>         GSList *uuids;
> -       bool reset;
> +       bool duplicate;
>  };
>
>  struct watch_client {
> @@ -2216,13 +2216,13 @@ static bool parse_transport(DBusMessageIter *value,
>         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;
>  }
> @@ -2235,7 +2235,7 @@ struct filter_parser {
>         { "RSSI", parse_rssi },
>         { "Pathloss", parse_pathloss },
>         { "Transport", parse_transport },
> -       { "ResetData", parse_reset_data },
> +       { "DuplicateData", parse_duplicate_data },
>         { }
>  };
>
> @@ -2274,7 +2274,7 @@ static bool parse_discovery_filter_dict(struct btd_adapter *adapter,
>         (*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 ||
> @@ -2320,8 +2320,8 @@ static bool parse_discovery_filter_dict(struct btd_adapter *adapter,
>                 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;
>
> @@ -5618,15 +5618,15 @@ static bool is_filter_match(GSList *discovery_filter, struct eir_data *eir_data,
>         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,
> @@ -5640,7 +5640,7 @@ 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);
> @@ -5741,16 +5741,16 @@ static void update_found_devices(struct btd_adapter *adapter,
>         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 516958e0b..fd7a64134 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -1624,9 +1624,9 @@ static void add_manufacturer_data(void *data, void *user_data)
>  }
>
>  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);
> @@ -1649,9 +1649,9 @@ static void add_service_data(void *data, void *user_data)
>  }
>
>  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 5f56918ed..850561729 100644
> --- a/src/device.h
> +++ b/src/device.h
> @@ -77,8 +77,9 @@ bool device_attach_att(struct btd_device *dev, GIOChannel *io);
>  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);
> --
> 2.13.5

Applied.


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-31 12:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-29 12:56 [PATCH v2 1/3] adapter-api: Rename ResetData to DuplicateData filter Luiz Augusto von Dentz
2017-08-29 12:56 ` [PATCH v2 2/3] client: Use " Luiz Augusto von Dentz
2017-08-29 12:56 ` [PATCH v2 3/3] mesh: " Luiz Augusto von Dentz
2017-08-31 12:06 ` [PATCH v2 1/3] adapter-api: Rename ResetData to " Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.