Fix service property monitoring handling
authorMarcel Holtmann <marcel@holtmann.org>
Mon, 1 Feb 2010 01:34:06 +0000 (17:34 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 1 Feb 2010 01:34:06 +0000 (17:34 -0800)
test/monitor-services

index 9b293c7..f1d7cf1 100755 (executable)
@@ -13,11 +13,8 @@ def extract_values(values):
        val += " }"
        return val
 
-def property_changed(name, value, path, interface):
-       iface = interface[interface.rfind(".") + 1:]
-       ipath = path[path.rfind("/") + 1:]
-       if iface not in ["Service"]:
-               return
+def property_changed(name, value, path):
+       service = path[path.rfind("/") + 1:]
        if name in ["Profiles", "Services", "Providers", "Technologies",
                                                "Devices", "Networks"]:
                val = "["
@@ -30,7 +27,7 @@ def property_changed(name, value, path, interface):
                val = int(value)
        else:
                val = str(value)
-       print "{%s} [%s] %s = %s" % (iface, ipath, name, val)
+       print "[%s] %s = %s" % (service, name, val)
 
 if __name__ == '__main__':
        dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -38,10 +35,10 @@ if __name__ == '__main__':
        bus = dbus.SystemBus()
 
        bus.add_signal_receiver(property_changed,
-                                       bus_name="org.moblin.connman",
-                                       signal_name = "PropertyChanged",
-                                               path_keyword="path",
-                                               interface_keyword="interface")
+                               bus_name="org.moblin.connman",
+                               dbus_interface="org.moblin.connman.Service",
+                               signal_name = "PropertyChanged",
+                               path_keyword="path")
 
        mainloop = gobject.MainLoop()
        mainloop.run()