summaryrefslogtreecommitdiff
path: root/test/list-profiles
blob: b9b9103a36eda294622eb7f0deffed77bcc2401c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python

import dbus

bus = dbus.SystemBus()

manager = dbus.Interface(bus.get_object("net.connman", "/"),
					"net.connman.Manager")

properties = manager.GetProperties()

active = properties["ActiveProfile"]

for path in properties["Profiles"]:
	if (active == path):
		print "[ %s ]  <== active" % (path)
	else:
		print "[ %s ]" % (path)

	profile = dbus.Interface(bus.get_object("net.connman", path),
						"net.connman.Profile")

	properties = profile.GetProperties()
	for key in properties.keys():
		if key in ["Services"]:
			list = ""
			for path in properties["Services"]:
				val = str(path)
				list = list + val[val.rfind("/") + 1:] + " "
			print "    Services = [ %s]" % (list)
		else:
			print "    %s = %s" % (key, properties[key])

	print