summaryrefslogtreecommitdiff
path: root/test/simple-agent
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-02-26 07:21:55 +0100
committerMarcel Holtmann <marcel@holtmann.org>2008-02-26 07:21:55 +0100
commit99cf3b6bbc863da93dc5af464e0211217d280ccb (patch)
treece2aebd266651fef31bac7af4f25671c9f8d1d13 /test/simple-agent
parentb530bfa969ba35511a206dd2aca3e6bd0d4d0aea (diff)
downloadconnman-99cf3b6bbc863da93dc5af464e0211217d280ccb.tar.gz
connman-99cf3b6bbc863da93dc5af464e0211217d280ccb.tar.bz2
connman-99cf3b6bbc863da93dc5af464e0211217d280ccb.zip
Add example for a simple agent
Diffstat (limited to 'test/simple-agent')
-rwxr-xr-xtest/simple-agent31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/simple-agent b/test/simple-agent
new file mode 100755
index 00000000..47a61f62
--- /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)