--- test/test-proximity | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/test/test-proximity b/test/test-proximity index b08a62a..3cb98cc 100755 --- a/test/test-proximity +++ b/test/test-proximity @@ -13,10 +13,12 @@ import dbus import dbus.mainloop.glib from optparse import OptionParser, make_option -def property_changed(name, value): +def properties_changed(interface, changed, invalidated): + if interface != "org.bluez.ProximityMonitor": + return - print("PropertyChanged('%s', '%s')" % (name, value)) - mainloop.quit() + for name, value in changed.iteritems(): + print("Property %s changed: %s" % (name, str(value))) if __name__ == "__main__": dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) @@ -54,15 +56,19 @@ if __name__ == "__main__": device_path = adapter.FindDevice(options.address) - bus.add_signal_receiver(property_changed, bus_name="org.bluez", - dbus_interface="org.bluez.ProximityMonitor", - signal_name="PropertyChanged") + bus.add_signal_receiver(properties_changed, bus_name="org.bluez", + path=device_path, + dbus_interface="org.freedesktop.DBus.Properties", + signal_name="PropertiesChanged") proximity = dbus.Interface(bus.get_object("org.bluez", device_path), "org.bluez.ProximityMonitor") + device_prop = dbus.Interface(bus.get_object("org.bluez", device_path), + "org.freedesktop.DBus.Properties") + print("Proximity SetProperty('%s', '%s')" % (args[0], args[1])) - proximity.SetProperty(args[0], args[1]) + device_prop.Set("org.bluez.ProximityMonitor", args[0], args[1]) mainloop = gobject.MainLoop() mainloop.run() -- 1.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html