summaryrefslogtreecommitdiff
path: root/test/monitor-connman
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2011-04-18 13:59:26 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2011-04-19 11:30:57 +0200
commit5a3891e6a038b0fb49869333db6f48b87ff6fe13 (patch)
treebb65e04c7ec81f912872b9a38e916500433f5947 /test/monitor-connman
parent5d20c30a8e1f21d082f0f57b9367fc28dc2300d6 (diff)
downloadconnman-5a3891e6a038b0fb49869333db6f48b87ff6fe13.tar.gz
connman-5a3891e6a038b0fb49869333db6f48b87ff6fe13.tar.bz2
connman-5a3891e6a038b0fb49869333db6f48b87ff6fe13.zip
monitor-connman: Listen to session method calls
Diffstat (limited to 'test/monitor-connman')
-rwxr-xr-xtest/monitor-connman17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/monitor-connman b/test/monitor-connman
index 9e2a8301..cf8f7a67 100755
--- a/test/monitor-connman
+++ b/test/monitor-connman
@@ -5,6 +5,8 @@ import gobject
import dbus
import dbus.mainloop.glib
+from dbus.lowlevel import MethodCallMessage, HANDLER_RESULT_NOT_YET_HANDLED
+
def property_changed(name, value, path, interface):
iface = interface[interface.rfind(".") + 1:]
if name in ["Strength", "Priority"]:
@@ -13,6 +15,17 @@ def property_changed(name, value, path, interface):
val = str(value)
print "{%s} [%s] %s = %s" % (iface, path, name, val)
+def message_filter(connection, message):
+ if not isinstance(message, MethodCallMessage):
+ return HANDLER_RESULT_NOT_YET_HANDLED
+
+ interface = message.get_interface()
+ path = message.get_path()
+ name = message.get_member()
+ args = message.get_args_list()
+
+ property_changed(name, args, path, interface)
+
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
@@ -24,5 +37,9 @@ if __name__ == '__main__':
path_keyword="path",
interface_keyword="interface")
+ bus.add_match_string("member=Change,interface=net.connman.Session")
+ bus.add_match_string("member=Update,interface=net.connman.Notification")
+ bus.add_message_filter(message_filter)
+
mainloop = gobject.MainLoop()
mainloop.run()