All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test: Add device discovery filter
@ 2015-12-08 11:00 Gowtham Anandha Babu
  2016-01-19  5:13 ` Gowtham Anandha Babu
  2016-01-19  7:02 ` Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Gowtham Anandha Babu @ 2015-12-08 11:00 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda, Gowtham Anandha Babu

This patch adds the below mentioned device discovery
filters.
UUIDs, RSSI, Pathloss, Transport.
---
 test/test-discovery | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/test/test-discovery b/test/test-discovery
index 9a2c6b9..cea7768 100755
--- a/test/test-discovery
+++ b/test/test-discovery
@@ -115,6 +115,18 @@ if __name__ == '__main__':
 	option_list = [
 			make_option("-i", "--device", action="store",
 					type="string", dest="dev_id"),
+			make_option("-u", "--uuids", action="store",
+					type="string", dest="uuids",
+					help="Filtered service UUIDs [uuid1,uuid2,...]"),
+			make_option("-r", "--rssi", action="store",
+					type="int", dest="rssi",
+					help="RSSI threshold value"),
+			make_option("-p", "--pathloss", action="store",
+					type="int", dest="pathloss",
+					help="Pathloss threshold value"),
+			make_option("-t", "--transport", action="store",
+					type="string", dest="transport",
+					help="Type of scan to run (le/bredr/auto)"),
 			make_option("-c", "--compact",
 					action="store_true", dest="compact"),
 			]
@@ -144,6 +156,26 @@ if __name__ == '__main__':
 		if "org.bluez.Device1" in interfaces:
 			devices[path] = interfaces["org.bluez.Device1"]
 
+	scan_filter = dict()
+
+	if options.uuids:
+		uuids = []
+		uuid_list = options.uuids.split(',')
+		for uuid in uuid_list:
+			uuids.append(uuid)
+
+		scan_filter.update({ "UUIDs": uuids })
+
+	if options.rssi:
+		scan_filter.update({ "RSSI": dbus.Int16(options.rssi) })
+
+	if options.pathloss:
+		scan_filter.update({ "Pathloss": dbus.UInt16(options.pathloss) })
+
+	if options.transport:
+		scan_filter.update({ "Transport": options.transport })
+
+	adapter.SetDiscoveryFilter(scan_filter)
 	adapter.StartDiscovery()
 
 	mainloop = GObject.MainLoop()
-- 
1.9.1


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

* RE: [PATCH] test: Add device discovery filter
  2015-12-08 11:00 [PATCH] test: Add device discovery filter Gowtham Anandha Babu
@ 2016-01-19  5:13 ` Gowtham Anandha Babu
  2016-01-19  7:02 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Gowtham Anandha Babu @ 2016-01-19  5:13 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: bharat.panda

Ping.

> -----Original Message-----
> From: Gowtham Anandha Babu [mailto:gowtham.ab@samsung.com]
> Sent: Tuesday, December 08, 2015 4:31 PM
> To: linux-bluetooth@vger.kernel.org
> Cc: bharat.panda@samsung.com; Gowtham Anandha Babu
> Subject: [PATCH] test: Add device discovery filter
> 
> This patch adds the below mentioned device discovery filters.
> UUIDs, RSSI, Pathloss, Transport.
> ---
>  test/test-discovery | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/test/test-discovery b/test/test-discovery index
9a2c6b9..cea7768
> 100755
> --- a/test/test-discovery
> +++ b/test/test-discovery
> @@ -115,6 +115,18 @@ if __name__ == '__main__':
>  	option_list = [
>  			make_option("-i", "--device", action="store",
>  					type="string", dest="dev_id"),
> +			make_option("-u", "--uuids", action="store",
> +					type="string", dest="uuids",
> +					help="Filtered service UUIDs
> [uuid1,uuid2,...]"),
> +			make_option("-r", "--rssi", action="store",
> +					type="int", dest="rssi",
> +					help="RSSI threshold value"),
> +			make_option("-p", "--pathloss", action="store",
> +					type="int", dest="pathloss",
> +					help="Pathloss threshold value"),
> +			make_option("-t", "--transport", action="store",
> +					type="string", dest="transport",
> +					help="Type of scan to run
> (le/bredr/auto)"),
>  			make_option("-c", "--compact",
>  					action="store_true",
> dest="compact"),
>  			]
> @@ -144,6 +156,26 @@ if __name__ == '__main__':
>  		if "org.bluez.Device1" in interfaces:
>  			devices[path] = interfaces["org.bluez.Device1"]
> 
> +	scan_filter = dict()
> +
> +	if options.uuids:
> +		uuids = []
> +		uuid_list = options.uuids.split(',')
> +		for uuid in uuid_list:
> +			uuids.append(uuid)
> +
> +		scan_filter.update({ "UUIDs": uuids })
> +
> +	if options.rssi:
> +		scan_filter.update({ "RSSI": dbus.Int16(options.rssi) })
> +
> +	if options.pathloss:
> +		scan_filter.update({ "Pathloss":
> dbus.UInt16(options.pathloss) })
> +
> +	if options.transport:
> +		scan_filter.update({ "Transport": options.transport })
> +
> +	adapter.SetDiscoveryFilter(scan_filter)
>  	adapter.StartDiscovery()
> 
>  	mainloop = GObject.MainLoop()
> --
> 1.9.1


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

* Re: [PATCH] test: Add device discovery filter
  2015-12-08 11:00 [PATCH] test: Add device discovery filter Gowtham Anandha Babu
  2016-01-19  5:13 ` Gowtham Anandha Babu
@ 2016-01-19  7:02 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2016-01-19  7:02 UTC (permalink / raw)
  To: Gowtham Anandha Babu; +Cc: linux-bluetooth, bharat.panda

Hi Gowtham,

On Tue, Dec 08, 2015, Gowtham Anandha Babu wrote:
> This patch adds the below mentioned device discovery
> filters.
> UUIDs, RSSI, Pathloss, Transport.
> ---
>  test/test-discovery | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)

Sorry for the delay with this one, I seem to have missed it. Applied
now. Thanks.

Johan

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

end of thread, other threads:[~2016-01-19  7:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-08 11:00 [PATCH] test: Add device discovery filter Gowtham Anandha Babu
2016-01-19  5:13 ` Gowtham Anandha Babu
2016-01-19  7:02 ` Johan Hedberg

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.