--- test/test-thermometer | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/test-thermometer b/test/test-thermometer index 9216264..2ca260f 100755 --- a/test/test-thermometer +++ b/test/test-thermometer @@ -16,9 +16,9 @@ from optparse import OptionParser, make_option class Watcher(dbus.service.Object): @dbus.service.method("org.bluez.ThermometerWatcher", - in_signature="a{sv}", out_signature="") - def MeasurementReceived(self, measure): - print(measure["Measurement"], " measurement received") + in_signature="oa{sv}", out_signature="") + def MeasurementReceived(self, device, measure): + print("%s measurement received from %s" % (measure["Measurement"], device)) print("Exponent: ", measure["Exponent"]) print("Mantissa: ", measure["Mantissa"]) print("Unit: ", measure["Unit"]) @@ -66,23 +66,23 @@ if __name__ == "__main__": adapter = dbus.Interface(bus.get_object("org.bluez", adapter_path), "org.bluez.Adapter") + thermometer_manager = dbus.Interface(bus.get_object("org.bluez", + adapter_path), "org.bluez.ThermometerManager") + device_path = adapter.FindDevice(options.address) bus.add_signal_receiver(property_changed, bus_name="org.bluez", dbus_interface="org.bluez.Thermometer", signal_name="PropertyChanged") - thermometer = dbus.Interface(bus.get_object("org.bluez", - device_path), "org.bluez.Thermometer") - path = "/test/watcher" watcher = Watcher(bus, path) - thermometer.RegisterWatcher(path) + thermometer_manager.RegisterWatcher(path) if len(args) > 0: if args[0] == "EnableIntermediateMeasurement": - thermometer.EnableIntermediateMeasurement(path) + thermometer_manager.EnableIntermediateMeasurement(path) else: print("unknown command") sys.exit(1) -- 1.7.11.3 -- 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