On Sat, Sep 13, 2008 at 6:08 PM, sfora dim <sfora.dim at gmail.com> wrote:
> On Thu, Aug 21, 2008 at 8:10 PM, Avery Pennarun <apenwarr at gmail.com> wrote:
>> On Thu, Aug 21, 2008 at 12:54 PM, sfora dim <sfora.dim at gmail.com> wrote:
>>> I need the clients to be able to call the daemon's exported functions,
>>> to be able to pass it all sorts of data arguments, and most
>>> importantly, I need them to be able to register a callback at the
>>> daemon. Once the daemon finishes the task, it should call the given
>>> callback.
>>>> dbus is designed for exactly such situations.
>> I was thinking how to implement this. Maybe the clients should pass
> the callback's dbus method name, which will be used, in turn, by the
> server with a method-call message. Do you think that would work ?
Well, in most situations you just send a message and register a
*local* callback function in your app to be called when the reply
message comes back. It's perfectly okay for the server to take a long
time (minutes!) before it responds. Just don't use send_and_block(),
use send() and register a callback.
If the server function you want to call needs to call your callback
multiple times (for example to set up notifications or a progress
report) you'll have to do something more complicated.
Have fun,
Avery