Include test script for connection service
[platform/upstream/connman.git] / test / monitor-services
1 #!/usr/bin/python
2
3 import gobject
4
5 import dbus
6 import dbus.mainloop.glib
7
8 def property_changed(name, value, path, interface):
9         iface = interface[interface.rfind(".") + 1:]
10         ipath = path[path.rfind("/") + 1:]
11         if iface not in ["Service"]:
12                 return
13         if name in ["Profiles", "Services",
14                                 "Devices", "Networks", "Connections"]:
15                 val = "["
16                 for i in value:
17                         val = val + " " + i[i.rfind("/") + 1:]
18                 val = val + " ]"
19         elif name in ["Strength", "Priority"]:
20                 val = int(value)
21         else:
22                 val = str(value)
23         print "{%s} [%s] %s = %s" % (iface, ipath, name, val)
24
25 if __name__ == '__main__':
26         dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
27
28         bus = dbus.SystemBus()
29
30         bus.add_signal_receiver(property_changed,
31                                         bus_name="org.moblin.connman",
32                                         signal_name = "PropertyChanged",
33                                                 path_keyword="path",
34                                                 interface_keyword="interface")
35
36         mainloop = gobject.MainLoop()
37         mainloop.run()