linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] Test script for LinkLossAlertLevel property
@ 2011-07-29 17:47 Claudio Takahasi
  2011-08-03  9:35 ` Johan Hedberg
  0 siblings, 1 reply; 6+ messages in thread
From: Claudio Takahasi @ 2011-07-29 17:47 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sheldon Demario

From: Sheldon Demario <sheldon.demario@openbossa.org>

Initial test script for Proximity Monitor. This patch allows the
user to set the Link Loss alert level of a given Reporter.
Usage example:
$test-proximity.py -i hci1 --device <mac> LinkLossAlertLevel mild
---
 test/test-proximity.py |   65 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100755 test/test-proximity.py

diff --git a/test/test-proximity.py b/test/test-proximity.py
new file mode 100755
index 0000000..04faf4e
--- /dev/null
+++ b/test/test-proximity.py
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+
+'''
+Proximity Monitor test script
+'''
+
+import gobject
+
+import sys
+import dbus
+import dbus.mainloop.glib
+from optparse import OptionParser, make_option
+
+def property_changed(name, value):
+
+	print "PropertyChanged('%s', '%s')" % (name, value)
+	mainloop.quit()
+
+if __name__ == "__main__":
+	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+	bus = dbus.SystemBus()
+
+	manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+					"org.bluez.Manager")
+
+	option_list = [
+		make_option("-i", "--adapter", action="store",
+			type="string", dest="dev_id"),
+		make_option("-b", "--device", action="store",
+			type="string", dest="address"),
+
+		]
+	parser = OptionParser(option_list=option_list)
+
+	(options, args) = parser.parse_args()
+
+	if options.dev_id:
+		adapter_path = manager.FindAdapter(options.dev_id)
+	else:
+		adapter_path = manager.DefaultAdapter()
+
+	adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
+							"org.bluez.Adapter")
+
+	if (len(args) < 1):
+		print "Usage: %s <command>" % (sys.argv[0])
+		print ""
+		print "  LinkLossAlertLevel <none|mild|high>"
+		sys.exit(1)
+
+	device_path = adapter.FindDevice(options.address)
+
+	bus.add_signal_receiver(property_changed, bus_name="org.bluez",
+				dbus_interface="org.bluez.Proximity",
+				signal_name="PropertyChanged")
+
+	proximity = dbus.Interface(bus.get_object("org.bluez",
+					device_path), "org.bluez.Proximity")
+
+	print "Proximity SetProperty('%s', '%s')" % (args[0], args[1])
+	proximity.SetProperty(args[0], args[1])
+
+	mainloop = gobject.MainLoop()
+	mainloop.run()
-- 
1.7.6


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

* Re: [PATCH BlueZ] Test script for LinkLossAlertLevel property
  2011-07-29 17:47 [PATCH BlueZ] Test script for LinkLossAlertLevel property Claudio Takahasi
@ 2011-08-03  9:35 ` Johan Hedberg
  2011-08-03 11:42   ` [PATCH BlueZ v2] " Claudio Takahasi
  0 siblings, 1 reply; 6+ messages in thread
From: Johan Hedberg @ 2011-08-03  9:35 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth, Sheldon Demario

Hi,

On Fri, Jul 29, 2011, Claudio Takahasi wrote:
> Initial test script for Proximity Monitor. This patch allows the
> user to set the Link Loss alert level of a given Reporter.
> Usage example:
> $test-proximity.py -i hci1 --device <mac> LinkLossAlertLevel mild
> ---
>  test/test-proximity.py |   65 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 65 insertions(+), 0 deletions(-)
>  create mode 100755 test/test-proximity.py

Please get rid of the .py suffix to be consistent with the other
scripts.

Johan

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

* [PATCH BlueZ v2] Test script for LinkLossAlertLevel property
  2011-08-03  9:35 ` Johan Hedberg
@ 2011-08-03 11:42   ` Claudio Takahasi
  2011-08-03 11:55     ` Claudio Takahasi
  0 siblings, 1 reply; 6+ messages in thread
From: Claudio Takahasi @ 2011-08-03 11:42 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sheldon Demario

From: Sheldon Demario <sheldon.demario@openbossa.org>

Initial test script for Proximity Monitor. This patch allows the
user to set the Link Loss alert level of a given Reporter.
Usage example:
$test-proximity -i hci1 --device <mac> LinkLossAlertLevel mild
---
 test/test-proximity |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 65 insertions(+), 0 deletions(-)
 create mode 100755 test/test-proximity

diff --git a/test/test-proximity b/test/test-proximity
new file mode 100755
index 0000000..04faf4e
--- /dev/null
+++ b/test/test-proximity
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+
+'''
+Proximity Monitor test script
+'''
+
+import gobject
+
+import sys
+import dbus
+import dbus.mainloop.glib
+from optparse import OptionParser, make_option
+
+def property_changed(name, value):
+
+	print "PropertyChanged('%s', '%s')" % (name, value)
+	mainloop.quit()
+
+if __name__ == "__main__":
+	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+	bus = dbus.SystemBus()
+
+	manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+					"org.bluez.Manager")
+
+	option_list = [
+		make_option("-i", "--adapter", action="store",
+			type="string", dest="dev_id"),
+		make_option("-b", "--device", action="store",
+			type="string", dest="address"),
+
+		]
+	parser = OptionParser(option_list=option_list)
+
+	(options, args) = parser.parse_args()
+
+	if options.dev_id:
+		adapter_path = manager.FindAdapter(options.dev_id)
+	else:
+		adapter_path = manager.DefaultAdapter()
+
+	adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
+							"org.bluez.Adapter")
+
+	if (len(args) < 1):
+		print "Usage: %s <command>" % (sys.argv[0])
+		print ""
+		print "  LinkLossAlertLevel <none|mild|high>"
+		sys.exit(1)
+
+	device_path = adapter.FindDevice(options.address)
+
+	bus.add_signal_receiver(property_changed, bus_name="org.bluez",
+				dbus_interface="org.bluez.Proximity",
+				signal_name="PropertyChanged")
+
+	proximity = dbus.Interface(bus.get_object("org.bluez",
+					device_path), "org.bluez.Proximity")
+
+	print "Proximity SetProperty('%s', '%s')" % (args[0], args[1])
+	proximity.SetProperty(args[0], args[1])
+
+	mainloop = gobject.MainLoop()
+	mainloop.run()
-- 
1.7.6


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

* Re: [PATCH BlueZ v2] Test script for LinkLossAlertLevel property
  2011-08-03 11:42   ` [PATCH BlueZ v2] " Claudio Takahasi
@ 2011-08-03 11:55     ` Claudio Takahasi
  2011-08-03 12:45       ` [PATCH BlueZ v3] " Claudio Takahasi
  0 siblings, 1 reply; 6+ messages in thread
From: Claudio Takahasi @ 2011-08-03 11:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sheldon Demario

Hi Johan,

Please ignore this v2 patch. EXTRA_DIST in Makefile.tools is missing!

Claudio.

On Wed, Aug 3, 2011 at 8:42 AM, Claudio Takahasi
<claudio.takahasi@openbossa.org> wrote:
> From: Sheldon Demario <sheldon.demario@openbossa.org>
>
> Initial test script for Proximity Monitor. This patch allows the
> user to set the Link Loss alert level of a given Reporter.
> Usage example:
> $test-proximity -i hci1 --device <mac> LinkLossAlertLevel mild
> ---
>  test/test-proximity |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 65 insertions(+), 0 deletions(-)
>  create mode 100755 test/test-proximity
>
> diff --git a/test/test-proximity b/test/test-proximity
> new file mode 100755
> index 0000000..04faf4e
> --- /dev/null
> +++ b/test/test-proximity
> @@ -0,0 +1,65 @@
> +#!/usr/bin/python
> +
> +'''
> +Proximity Monitor test script
> +'''
> +
> +import gobject
> +
> +import sys
> +import dbus
> +import dbus.mainloop.glib
> +from optparse import OptionParser, make_option
> +
> +def property_changed(name, value):
> +
> +       print "PropertyChanged('%s', '%s')" % (name, value)
> +       mainloop.quit()
> +
> +if __name__ == "__main__":
> +       dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
> +
> +       bus = dbus.SystemBus()
> +
> +       manager = dbus.Interface(bus.get_object("org.bluez", "/"),
> +                                       "org.bluez.Manager")
> +
> +       option_list = [
> +               make_option("-i", "--adapter", action="store",
> +                       type="string", dest="dev_id"),
> +               make_option("-b", "--device", action="store",
> +                       type="string", dest="address"),
> +
> +               ]
> +       parser = OptionParser(option_list=option_list)
> +
> +       (options, args) = parser.parse_args()
> +
> +       if options.dev_id:
> +               adapter_path = manager.FindAdapter(options.dev_id)
> +       else:
> +               adapter_path = manager.DefaultAdapter()
> +
> +       adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
> +                                                       "org.bluez.Adapter")
> +
> +       if (len(args) < 1):
> +               print "Usage: %s <command>" % (sys.argv[0])
> +               print ""
> +               print "  LinkLossAlertLevel <none|mild|high>"
> +               sys.exit(1)
> +
> +       device_path = adapter.FindDevice(options.address)
> +
> +       bus.add_signal_receiver(property_changed, bus_name="org.bluez",
> +                               dbus_interface="org.bluez.Proximity",
> +                               signal_name="PropertyChanged")
> +
> +       proximity = dbus.Interface(bus.get_object("org.bluez",
> +                                       device_path), "org.bluez.Proximity")
> +
> +       print "Proximity SetProperty('%s', '%s')" % (args[0], args[1])
> +       proximity.SetProperty(args[0], args[1])
> +
> +       mainloop = gobject.MainLoop()
> +       mainloop.run()
> --
> 1.7.6

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

* [PATCH BlueZ v3] Test script for LinkLossAlertLevel property
  2011-08-03 11:55     ` Claudio Takahasi
@ 2011-08-03 12:45       ` Claudio Takahasi
  2011-08-03 13:08         ` Johan Hedberg
  0 siblings, 1 reply; 6+ messages in thread
From: Claudio Takahasi @ 2011-08-03 12:45 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Sheldon Demario

From: Sheldon Demario <sheldon.demario@openbossa.org>

Initial test script for Proximity Monitor. This patch allows the
user to set the Link Loss alert level of a given Reporter.
Usage example:
$test-proximity -i hci1 --device <mac> LinkLossAlertLevel mild
---
 Makefile.tools      |    7 +++--
 test/test-proximity |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+), 3 deletions(-)
 create mode 100755 test/test-proximity

diff --git a/Makefile.tools b/Makefile.tools
index 1cd8c9e..91599c6 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -206,9 +206,10 @@ EXTRA_DIST += test/apitest test/sap-client test/hsplay test/hsmicro \
 		test/test-device test/test-service test/test-serial \
 		test/test-telephony test/test-network test/simple-agent \
 		test/simple-service test/simple-endpoint test/test-audio \
-		test/test-input test/test-attrib test/test-sap-server \
-		test/test-oob test/service-record.dtd test/service-did.xml \
-		test/service-spp.xml test/service-opp.xml test/service-ftp.xml
+		test/test-input test/test-attrib test/test-proximity \
+		test/test-sap-server test/test-oob test/service-record.dtd \
+		test/service-did.xml test/service-spp.xml \
+		test/service-opp.xml test/service-ftp.xml
 
 
 if HIDD
diff --git a/test/test-proximity b/test/test-proximity
new file mode 100755
index 0000000..04faf4e
--- /dev/null
+++ b/test/test-proximity
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+
+'''
+Proximity Monitor test script
+'''
+
+import gobject
+
+import sys
+import dbus
+import dbus.mainloop.glib
+from optparse import OptionParser, make_option
+
+def property_changed(name, value):
+
+	print "PropertyChanged('%s', '%s')" % (name, value)
+	mainloop.quit()
+
+if __name__ == "__main__":
+	dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+	bus = dbus.SystemBus()
+
+	manager = dbus.Interface(bus.get_object("org.bluez", "/"),
+					"org.bluez.Manager")
+
+	option_list = [
+		make_option("-i", "--adapter", action="store",
+			type="string", dest="dev_id"),
+		make_option("-b", "--device", action="store",
+			type="string", dest="address"),
+
+		]
+	parser = OptionParser(option_list=option_list)
+
+	(options, args) = parser.parse_args()
+
+	if options.dev_id:
+		adapter_path = manager.FindAdapter(options.dev_id)
+	else:
+		adapter_path = manager.DefaultAdapter()
+
+	adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path),
+							"org.bluez.Adapter")
+
+	if (len(args) < 1):
+		print "Usage: %s <command>" % (sys.argv[0])
+		print ""
+		print "  LinkLossAlertLevel <none|mild|high>"
+		sys.exit(1)
+
+	device_path = adapter.FindDevice(options.address)
+
+	bus.add_signal_receiver(property_changed, bus_name="org.bluez",
+				dbus_interface="org.bluez.Proximity",
+				signal_name="PropertyChanged")
+
+	proximity = dbus.Interface(bus.get_object("org.bluez",
+					device_path), "org.bluez.Proximity")
+
+	print "Proximity SetProperty('%s', '%s')" % (args[0], args[1])
+	proximity.SetProperty(args[0], args[1])
+
+	mainloop = gobject.MainLoop()
+	mainloop.run()
-- 
1.7.6


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

* Re: [PATCH BlueZ v3] Test script for LinkLossAlertLevel property
  2011-08-03 12:45       ` [PATCH BlueZ v3] " Claudio Takahasi
@ 2011-08-03 13:08         ` Johan Hedberg
  0 siblings, 0 replies; 6+ messages in thread
From: Johan Hedberg @ 2011-08-03 13:08 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth, Sheldon Demario

Hi,

On Wed, Aug 03, 2011, Claudio Takahasi wrote:
> Initial test script for Proximity Monitor. This patch allows the
> user to set the Link Loss alert level of a given Reporter.
> Usage example:
> $test-proximity -i hci1 --device <mac> LinkLossAlertLevel mild
> ---
>  Makefile.tools      |    7 +++--
>  test/test-proximity |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 69 insertions(+), 3 deletions(-)
>  create mode 100755 test/test-proximity

Applied. Thanks.

Johan

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

end of thread, other threads:[~2011-08-03 13:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-29 17:47 [PATCH BlueZ] Test script for LinkLossAlertLevel property Claudio Takahasi
2011-08-03  9:35 ` Johan Hedberg
2011-08-03 11:42   ` [PATCH BlueZ v2] " Claudio Takahasi
2011-08-03 11:55     ` Claudio Takahasi
2011-08-03 12:45       ` [PATCH BlueZ v3] " Claudio Takahasi
2011-08-03 13:08         ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).