Print more detailed information about the signal
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 12 Dec 2008 22:12:23 +0000 (23:12 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 12 Dec 2008 22:12:23 +0000 (23:12 +0100)
test/monitor-connman

index 86c7d42..2c4b9bd 100755 (executable)
@@ -5,19 +5,20 @@ import gobject
 import dbus
 import dbus.mainloop.glib
 
-def property_changed(name, value, path):
-       print "[%s] %s = %s" % (path, name, str(value))
+def property_changed(name, value, path, interface):
+       iface = interface[interface.rfind(".") + 1:]
+       print "{%s} [%s] %s = %s" % (iface, path, name, str(value))
 
 if __name__ == '__main__':
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
 
        bus = dbus.SystemBus()
-       manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
-                                               "org.moblin.connman.Manager")
 
        bus.add_signal_receiver(property_changed,
+                                       bus_name="org.moblin.connman",
                                        signal_name = "PropertyChanged",
-                                                       path_keyword="path")
+                                               path_keyword="path",
+                                               interface_keyword="interface")
 
        mainloop = gobject.MainLoop()
        mainloop.run()