7 import dbus.mainloop.glib
9 def element_print(action, path):
10 print "%s [ %s ]" % (action, path)
15 element = dbus.Interface(bus.get_object("org.moblin.connman", path),
16 "org.moblin.connman.Element")
18 properties = element.GetProperties()
19 for key in properties.keys():
20 print " %s = %s" % (key, properties[key])
22 def element_added(path):
23 element_print("+", path)
25 def element_updated(path):
26 element_print("*", path)
28 def element_removed(path):
29 element_print("-", path)
31 if __name__ == '__main__':
32 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
34 bus = dbus.SystemBus()
36 bus.add_signal_receiver(element_added,
37 dbus_interface = "org.moblin.connman.Manager",
38 signal_name = "ElementAdded")
40 bus.add_signal_receiver(element_updated,
41 dbus_interface = "org.moblin.connman.Manager",
42 signal_name = "ElementUpdated")
44 bus.add_signal_receiver(element_removed,
45 dbus_interface = "org.moblin.connman.Manager",
46 signal_name = "ElementRemoved")
48 mainloop = gobject.MainLoop()