Add test script for just monitoring the manager interface
[platform/upstream/connman.git] / test / monitor-manager
1 #!/usr/bin/python
2
3 import gobject
4
5 import dbus
6 import dbus.mainloop.glib
7
8 def property_changed(name, value):
9         if name in ["Profiles", "Services", "Providers",
10                                                 "Devices", "Networks"]:
11                 val = "["
12                 for i in value:
13                         val = val + " " + i[i.rfind("/") + 1:]
14                 val = val + " ]"
15         elif name in ["AvailableTechnologies", "EnabledTechnologies",
16                                                 "ConnectedTechnologies",
17                                 "AvailableDebugs", "EnabledDebugs"]:
18                 val = "["
19                 for i in value:
20                         val = val + " " + i
21                 val = val + " ]"
22         elif name in ["Strength", "Priority"]:
23                 val = int(value)
24         else:
25                 val = str(value)
26         print "%s = %s" % (name, val)
27
28 if __name__ == '__main__':
29         dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
30
31         bus = dbus.SystemBus()
32
33         bus.add_signal_receiver(property_changed,
34                                 bus_name="org.moblin.connman",
35                                 dbus_interface="org.moblin.connman.Manager",
36                                         signal_name = "PropertyChanged")
37
38         mainloop = gobject.MainLoop()
39         mainloop.run()