From: Rafal D. <r....@ke...> - 2010-08-17 07:55:24
|
Hello, I'm trying to use ObjectAdaptor::Continuation to handle DBus message asynchronously. Is there anywhere an example how to do it? It seems that I should call return_now( continuation ); to finish DBus call, but how to setup return value of the call? I see there are structures like MessageIter and Message MessageIter &it = continuation->writer(); Message &dbus_msg = it.msg(); but I'm not sure how to use it. Regards Rafał -- Asylia ExchangeDefender Message Security: Click below to verify authenticity http://www.exchangedefender.com/verify.asp?id=o7H7go7Z012122&from=r....@ke... |
From: Andreas V. <li...@br...> - 2010-12-05 22:10:16
|
Am Tue, 17 Aug 2010 09:42:52 +0200 schrieb Rafal Dzbęk: > Hello, > > I'm trying to use ObjectAdaptor::Continuation to handle DBus message > asynchronously. > Is there anywhere an example how to do it? > > It seems that I should call > return_now( continuation ); > to finish DBus call, but how to setup return value of the call? > > I see there are structures like MessageIter and Message > MessageIter &it = continuation->writer(); > Message &dbus_msg = it.msg(); > but I'm not sure how to use it. Hello, to be honest I'm not the original author of DBus-C++. I never used ObjectAdaptor::Continuation and also don't know it's reason. Have you found out more about it? Please tell us. regards Andreas |
From: Rafal D. <r....@ke...> - 2010-12-07 10:01:07
|
ObjectAdaptor::Continuation are for implementation of DBus calls which can not complete processing immediatly and have to wait for some external event. For instance my application exposes some DBus interface for some DSP devices. It connects to these devices via TCPIP. Thre is some protocol with Request Reply messages. Most of the time processing is like: 1) Linux client application issues DBus call 2) DBus-C++ server application translates it to TCP/IP messages and sends requests, it cannot answer immediatly and cannot block/wait - DBus-C++ server is supposed to be able handle many requests at the same time (altough it is single threaded - DBus-C++ is dispatching by means of select/pool) 3) To suspend the call DBus-C++ server application calls return_later(&my_dsp_on_tag); where my_dsp_on_tag is some unique object of DBus::Tag type, it is used at completion time to recover original context of client call return_later internally calls exception, this is ugly and slow/inefficent way to transfer control but it is done that way and it works object.cpp: void ObjectAdaptor::return_later(const Tag *tag) { ReturnLaterError rle = { tag }; throw rle; } at some other place in this module: catch(ReturnLaterError &rle) { _continuations[rle.tag] = new Continuation(conn(), cmsg, rle.tag); } 4) when processing can be completed (external event occured, Reply is sent) the following code should executed if( DBus::ObjectAdaptor::Continuation*c = find_continuation(&my_dsp_on_tag) ) { uint32_t const ret=0; c->writer() << ret; return_now(c, my_dsp_on_tag); } So c->writer() stream is used to pass output parameters (in this case only one). Note that you can write anything to it and it can have nothing to do with original prototype of DBus method. So it is not type safe. For instance if you write c->writer() << 0; instead of c->writer() << ret; then it is wrong for strongly typed DBus client because you are returning int32_t instead of uint32_t (uint32_t is declared return type in xml interface). -----Original Message----- From: Andreas Volz [mailto:li...@br...] Sent: Sun 12/5/2010 10:07 PM To: dbu...@li... Subject: Re: [dbus-cplusplus-devel] Setting DBus call return value in ObjectAdaptor::Continuation Am Tue, 17 Aug 2010 09:42:52 +0200 schrieb Rafal Dzbek: > Hello, > > I'm trying to use ObjectAdaptor::Continuation to handle DBus message > asynchronously. > Is there anywhere an example how to do it? > > It seems that I should call > return_now( continuation ); > to finish DBus call, but how to setup return value of the call? > > I see there are structures like MessageIter and Message > MessageIter &it = continuation->writer(); > Message &dbus_msg = it.msg(); > but I'm not sure how to use it. Hello, to be honest I'm not the original author of DBus-C++. I never used ObjectAdaptor::Continuation and also don't know it's reason. Have you found out more about it? Please tell us. regards Andreas ------------------------------------------------------------------------------ What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d _______________________________________________ dbus-cplusplus-devel mailing list dbu...@li... https://lists.sourceforge.net/lists/listinfo/dbus-cplusplus-devel -- Asylia ExchangeDefender Message Security: Click below to verify authenticity http://www.exchangedefender.com/verify.asp?id=oB7A0hhw019111&from=r....@ke... |