6 import dbus.mainloop.glib
8 def extract_values(values):
10 for key in values.keys():
11 val += " " + key + "="
12 val += str(values[key])
16 def extract_list(list):
23 def property_changed(name, value, path):
24 service = path[path.rfind("/") + 1:]
25 if name in ["Profiles", "Services", "Providers", "Technologies",
26 "Devices", "Networks"]:
29 val = val + " " + i[i.rfind("/") + 1:]
31 elif name in ["IPv4", "IPv4.Configuration",
32 "IPv6", "IPv6.Configuration",
34 val = extract_values(value)
35 elif name in ["Nameservers", "Nameservers.Configuration",
36 "Domains", "Domains.Configuration"]:
37 val = extract_list(value)
38 elif name in ["Strength", "Priority"]:
42 print "[%s] %s = %s" % (service, name, val)
44 if __name__ == '__main__':
45 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
47 bus = dbus.SystemBus()
49 bus.add_signal_receiver(property_changed,
50 bus_name="org.moblin.connman",
51 dbus_interface="org.moblin.connman.Service",
52 signal_name = "PropertyChanged",
55 mainloop = gobject.MainLoop()