Allow selective option for current built-in plugins
[connman] / test / list-networks
index 3b29a8e..e8fb00a 100755 (executable)
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import dbus
+import string
 
 bus = dbus.SystemBus()
 
@@ -9,14 +10,27 @@ manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
 
 properties = manager.GetProperties()
 
+def convert_ssid(ssid_list):
+       ssid = ""
+       for byte in ssid_list:
+               if (str(byte) in string.printable):
+                       ssid = ssid + str(byte)
+               else:
+                       ssid = ssid + "."
+       return ssid
+
 for path in properties["Devices"]:
        device = dbus.Interface(bus.get_object("org.moblin.connman", path),
                                                "org.moblin.connman.Device")
 
        properties = device.GetProperties()
 
-       if (properties["Type"] != "wifi" and properties["Type"] != "wimax"):
-               continue;
+       try:
+               if properties["Type"] not in ["wifi", "wimax",
+                                       "bluetooth", "cellular"]:
+                       continue
+       except:
+               continue
 
        print "[ %s ]" % (path)
 
@@ -29,6 +43,12 @@ for path in properties["Devices"]:
                print "    [ %s ]" % (path)
 
                for key in properties.keys():
-                       print "        %s = %s" % (key, properties[key])
+                       if key == "WiFi.SSID":
+                               ssid = convert_ssid(properties[key])
+                               print "        %s = [ %s ]" % (key, ssid)
+                       elif key in ["Strength", "Priority"]:
+                               print "        %s = %d" % (key, properties[key])
+                       else:
+                               print "        %s = %s" % (key, properties[key])
 
        print