From: Freyensee, J. P <jam...@in...> - 2009-06-09 23:12:04
|
Hello: I am struggling to understand how I could do an asynchronous call using dbus-c++ and was wondering if anyone has any currently working example code, explanation, or a tutorial to help me out. This is what I know (I believe at least). For asynchronous calls I need to call the dbus function dbus_bool_t dbus_pending_call_set_notify ( DBusPendingCall * pending, DBusPendingCallNotifyFunction function, void * user_data, DBusFreeFunction free_user_data ) This happens when the constructor PendingCall::PendingCall(PendingCall::Private *p) : _pvt(p) {} is called. I believe this PendingCall::PendingCall() constructor called when the function in Connection.cpp: PendingCall Connection::send_async(Message &msg, int timeout) is called. Now I was thinking that a new, unwritten function in object.cpp needs be written as follows that would call send_async(): PendingCall ObjectProxy::_invoke_method_async(CallMessage &call) { if (call.path() == NULL) call.path(path().c_str()); if (call.destination() == NULL) call.destination(service().c_str()); return conn().send_async(call); } This is actually pretty similar to Message ObjectProxy::_invoke_method(CallMessage &call) {} in Object.cpp. The big question is how do I use this dbus-c++ framework to set the (DBusPendingCallNotifyFunction function, void * user_data) parameters of the dbus_pending_call_set_notify() function? I figure I need to set some parameters in the CallMessage object in ObjectProxy::_invoke_method_async() and/or the Message object in the Connection::send_async(). However, I don't know what to do and how to do it. Second question- is there anything else I am missing that I would need to do to make the callback operation work right in this dbus-c++ framework? Thank you for the help! Regards, Jay Freyensee |