diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-06-02 12:42:07 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-06-02 12:42:07 +0200 |
commit | 0ab3d8a8846de36b13cbbca62fb03e6b6826365a (patch) | |
tree | 07873ccbb0c9468c07d13870530a29d174e8c077 | |
download | json-dbus-bridge-examples-0ab3d8a8846de36b13cbbca62fb03e6b6826365a.tar.gz json-dbus-bridge-examples-0ab3d8a8846de36b13cbbca62fb03e6b6826365a.tar.xz |
[services] python hello world service
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-x | services/python/hello-world.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/services/python/hello-world.py b/services/python/hello-world.py new file mode 100755 index 0000000..9669f3c --- /dev/null +++ b/services/python/hello-world.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python2.5 + + +import gobject + +import dbus +import dbus.service +import dbus.mainloop.glib + + +class Service(dbus.service.Object): + def __init__(self): + busname = dbus.service.BusName("com.pengutronix.jdb.Hello", dbus.SessionBus()) + dbus.service.Object.__init__(self, None, "/", busname) + + + @dbus.service.method("com.pengutronix.jdb.Hello", + in_signature='', out_signature='s') + def HelloWorld(self): + return "Hello World!" + + @dbus.service.method("com.pengutronix.jdb.Hello", + in_signature='s', out_signature='s') + def Echo(self, text): + return text + +dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + +object = Service() + +mainloop = gobject.MainLoop() +mainloop.run() + |