Use WiFi.Name property for network selection
[platform/upstream/connman.git] / test / monitor-elements
1 #!/usr/bin/python
2
3 import gobject
4
5 import dbus
6 import dbus.service
7 import dbus.mainloop.glib
8
9 def element_print(action, path):
10         print "%s [ %s ]" % (action, path)
11
12         if (action == "-"):
13                 return
14
15         element = dbus.Interface(bus.get_object("org.moblin.connman", path),
16                                                 "org.moblin.connman.Element")
17
18         properties = element.GetProperties()
19         for key in properties.keys():
20                 print "      %s = %s" % (key, properties[key])
21
22 def element_added(path):
23         element_print("+", path)
24
25 def element_updated(path):
26         element_print("*", path)
27
28 def element_removed(path):
29         element_print("-", path)
30
31 if __name__ == '__main__':
32         dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
33
34         bus = dbus.SystemBus()
35
36         bus.add_signal_receiver(element_added,
37                                 dbus_interface = "org.moblin.connman.Manager",
38                                                 signal_name = "ElementAdded")
39
40         bus.add_signal_receiver(element_updated,
41                                 dbus_interface = "org.moblin.connman.Manager",
42                                                 signal_name = "ElementUpdated")
43
44         bus.add_signal_receiver(element_removed,
45                                 dbus_interface = "org.moblin.connman.Manager",
46                                                 signal_name = "ElementRemoved")
47
48         mainloop = gobject.MainLoop()
49         mainloop.run()