-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method interface, is it not complete, how to put async callback? #31
Comments
Txdbus was designed from scratch to provide a good async interface to the On Sat, Jun 20, 2015 at 5:54 PM, funky12 [email protected] wrote:
|
Funky12, my apologies for not actually answering your question. The latter half of your text was somehow cut off from the e-mail notification I received and I only now saw the rest of it via the Github web page. If you haven't already, take a look at the "Explicit Interface Specification" section from the txdbus documentation: http://pythonhosted.org/txdbus/ The line you reference where "Method('exampleMethod'...)" is called is simply defining the signature of the DBus method. You actually invoke the remote method via "proxy_obj.callRemote("exampleMethod"...)". The callRemote() method will return a Twisted Deferred to the eventual results of the call and the addCallback/addErrback methods on the deferred instance are what you're looking for. A good handle on Deferreds is essential for the use of Twisted so you'll want to brush up on that documentation if you're fuzzy on the details. Sorry for the miscommunication. Let me know if I can help further. |
Hi
Browsing to the code, it looks like Method interface is not complete. In ur code u have implemented
Method('exampleMethod', arguments='s', returns='s' )
So it takes arguments and returns only...
But the original package is
http://dbus.freedesktop.org/doc/dbus-python/api/dbus.decorators-module.html
We have decorators which takes many additional param.
For example I need async_callback to be added and I would implement what would happen if the remote call lead to error.
In normal python package, I do
<
@method(MY_INTFACE, in_signature='', out_signature='', async_callbacks=('async_cb', 'async_eb'))
def DoSomething(self, async_cb, async_eb):
"""Do Something"""
d = self.remote.doSomething()
return self.add_callbacks(d, async_cb, async_eb)
/>
How can I achieve similar thing in tx_dbus.
class MyObj (objects.DBusObject):
The text was updated successfully, but these errors were encountered: