test: Show autoconnect and state in services list
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Fri, 4 May 2012 13:06:50 +0000 (16:06 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 4 May 2012 13:26:41 +0000 (15:26 +0200)
Show the autoconnect "A" and state "R"eady or "O"nline
indicators in the services list.

test/test-connman

index 473af62..67b0c85 100755 (executable)
@@ -27,9 +27,21 @@ if len(sys.argv) < 2:
 def print_services(services):
        for path, properties in services:
                identifier = path[path.rfind("/") + 1:]
+               state = " "
+               autoconnect = "  "
 
                if properties["Favorite"] == dbus.Boolean(1):
                        favorite = "*"
+
+                       if properties["AutoConnect"] == dbus.Boolean(1):
+                               autoconnect = " A"
+                       else:
+                               autoconnect = "  "
+
+                       if properties["State"] == "ready":
+                               state = "R"
+                       elif properties["State"] == "online":
+                               state = "O"
                else:
                        favorite = " "
 
@@ -38,7 +50,8 @@ def print_services(services):
                else:
                        name = "{" + properties["Type"] + "}"
 
-               print "%s %-26s { %s }" % (favorite, name, identifier)
+               print "%s%s%s %-26s { %s }" % (favorite, autoconnect, state,
+                                              name, identifier)
 
 if sys.argv[1] == "state":
        properties = manager.GetProperties()