Hi Lionel,

A little addition to Olivier's precious help.

Olivier Tilloy a écrit :
Hi Lionel,

Lionel Dricot wrote:
Hello,

For our plugin architecture, we want our plugin to get its data via
DBUS. As most dbus user know, we cannot wait for the answer and have to
make asynchronous method calls. I was wondering what is the easiest way
to do that in Elisa.

Making asynchronous dbus calls is explained at
http://dbus.freedesktop.org/doc/dbus-python/doc/tutorial.html#making-asynchronous-method-calls.

On top of that we have dbus helpers in the HAL plugin
(elisa-plugins/elisa/plugins/hal/dbus_helper.py) which you might be
interested in (particularly the call_async_dbus_method function).
These helpers may better be shared in the code of the core, but that's
another matter.

I remember Florian or Olivier talking about "Elisa Services".  Would it
be of any help for us here ? (and what is it exactly ?). Maybe the
controller of each plugin is already in its own thread so there's no
need for that and we can just call dbus in the controller but I'm not
sure about that.

Asynchronism in Elisa is completely handled by twisted, so you are
guaranteed that making asynchronous calls will (by definition!) not be
blocking.
Well, that's a bit of an overstatement that might get misinterpreted: Twisted does not make blocking code magically not blocking. If you write blocking code, it will block. What Twisted give you is: 1) deferred mechanism to handle asynchronous operations (being notified when they finish, chaining them, etc.) 2) facilities to thread operations that you really could not break down in non blocking ones

A service would be useful for a task running in the background during
the whole lifetime of Elisa, but as I understand your question this is
not what you need here.

Thanks a lot for replies,

Lionel


Cheers,

Olivier

Reply via email to