Adding connman-test subpackage
[framework/connectivity/connman.git] / test / list-profiles
1 #!/usr/bin/python
2
3 import dbus
4
5 bus = dbus.SystemBus()
6
7 manager = dbus.Interface(bus.get_object("net.connman", "/"),
8                                         "net.connman.Manager")
9
10 properties = manager.GetProperties()
11
12 active = properties["ActiveProfile"]
13
14 for path in properties["Profiles"]:
15         if (active == path):
16                 print "[ %s ]  <== active" % (path)
17         else:
18                 print "[ %s ]" % (path)
19
20         profile = dbus.Interface(bus.get_object("net.connman", path),
21                                                 "net.connman.Profile")
22
23         properties = profile.GetProperties()
24         for key in properties.keys():
25                 if key in ["Services"]:
26                         list = ""
27                         for path in properties["Services"]:
28                                 val = str(path)
29                                 list = list + val[val.rfind("/") + 1:] + " "
30                         print "    Services = [ %s]" % (list)
31                 else:
32                         print "    %s = %s" % (key, properties[key])
33
34         print