Add support for more advanced service property listing
authorMarcel Holtmann <marcel@holtmann.org>
Sun, 20 Dec 2009 06:11:32 +0000 (22:11 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 20 Dec 2009 06:11:32 +0000 (22:11 -0800)
test/list-services

index 522e122c5765a75d38c51c7b3aa56e1c245c28f1..107dba8c41be54c1e89ee3ba770b578f2531cc47 100755 (executable)
@@ -2,6 +2,17 @@
 
 import dbus
 
+def extract_values(values):
+       val = "{"
+       for key in values.keys():
+               val += " " + key + "="
+               if key in ["MTU"]:
+                       val += int(values[key])
+               else:
+                       val += str(values[key])
+       val += " }"
+       return val
+
 bus = dbus.SystemBus()
 
 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
@@ -18,7 +29,15 @@ for path in properties["Services"]:
        print "[ %s ]" % (path)
 
        for key in properties.keys():
-               if key in ["Strength"]:
+               if key in ["IPv4", "Ethernet"]:
+                       val = extract_values(properties[key])
+               elif key in ["Favorite", "AutoConnect",
+                               "SetupRequired", "PassphraseRequired"]:
+                       if properties[key] == dbus.Boolean(1):
+                               val = "true"
+                       else:
+                               val = "false"
+               elif key in ["Strength"]:
                        val = int(properties[key])
                else:
                        val = str(properties[key])