diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-11-02 10:52:30 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-11-02 14:58:18 -0500 |
commit | 7f4a14cafe750fd18f7f9ac0282ad34b57881f3a (patch) | |
tree | 41c366d311b0f5efb4656866ce811c89e6a95d62 /test/test-push-notification | |
parent | 348bdb7f1d50b4db91fa2bbf8dcd7849eb43b077 (diff) | |
download | ofono-7f4a14cafe750fd18f7f9ac0282ad34b57881f3a.tar.bz2 |
test: Add test-push-notification script
Diffstat (limited to 'test/test-push-notification')
-rwxr-xr-x | test/test-push-notification | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/test-push-notification b/test/test-push-notification new file mode 100755 index 00000000..4dca0d46 --- /dev/null +++ b/test/test-push-notification @@ -0,0 +1,47 @@ +#!/usr/bin/python + +import gobject + +import sys +import dbus +import dbus.service +import dbus.mainloop.glib + +class PushNotificationAgent(dbus.service.Object): + @dbus.service.method("org.ofono.PushNotificationAgent", + in_signature="", out_signature="") + def Release(self): + print "Release" + mainloop.quit() + + @dbus.service.method("org.ofono.PushNotificationAgent", + in_signature="aya{sv}", out_signature="") + def ReceiveNotification(self, data, props): + for key in props.keys(): + print "Key: %s, Value: %s" % (key, props[key]) + + print "Received notification of size: %d" % len(data) + +if __name__ == '__main__': + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + + bus = dbus.SystemBus() + manager = dbus.Interface(bus.get_object("org.ofono", "/"), + "org.ofono.Manager") + + modems = manager.GetModems() + + for path, properties in modems: + if "org.ofono.PushNotification" not in properties["Interfaces"]: + continue + + pn = dbus.Interface(bus.get_object('org.ofono', path), + 'org.ofono.PushNotification') + + path = "/test/agent" + agent = PushNotificationAgent(bus, path) + pn.RegisterAgent(path) + print "Agent registered" + + mainloop = gobject.MainLoop() + mainloop.run() |