From: Marcel Holtmann Date: Tue, 26 Feb 2008 06:21:55 +0000 (+0100) Subject: Add example for a simple agent X-Git-Tag: 0.1~399 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=99cf3b6bbc863da93dc5af464e0211217d280ccb;p=platform%2Fupstream%2Fconnman.git Add example for a simple agent --- diff --git a/test/Makefile.am b/test/Makefile.am index ca88b98..8f8214f 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,4 +1,4 @@ -EXTRA_DIST = list-interfaces start-scanning +EXTRA_DIST = list-interfaces start-scanning simple-agent MAINTAINERCLEANFILES = Makefile.in diff --git a/test/simple-agent b/test/simple-agent new file mode 100755 index 0000000..47a61f6 --- /dev/null +++ b/test/simple-agent @@ -0,0 +1,31 @@ +#!/usr/bin/python + +import gobject + +import dbus +import dbus.service +import dbus.mainloop.glib + +class Agent(dbus.service.Object): + @dbus.service.method("org.freedesktop.connman.Agent", + in_signature='', out_signature='') + def Release(self): + print("Release") + mainloop.quit() + +if __name__ == '__main__': + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + + bus = dbus.SystemBus() + manager = dbus.Interface(bus.get_object('org.freedesktop.connman', "/"), + 'org.freedesktop.connman.Manager') + + path = "/test/agent" + object = Agent(bus, path) + + manager.RegisterAgent(path) + + mainloop = gobject.MainLoop() + mainloop.run() + + #manager.UnregisterAgent(path)