From: Theodore A. R. <ta...@gm...> - 2010-12-03 23:23:16
|
I've been trying to figure out how to register a timeout callback with the dispatcher so that my callback function will be invoked periodically by the dispatcher main loop. The BusDispatcher::add_timeout() method seems to take an internal timeout object as an argument which leads me to believe that I can't use that. I'm still in the learning dbus-c++ phase and my app is a rather simple server based on the echo demo, but I've stripped it down to only a Hello method and a single signal. My goal is to invoked the signal in the timeout. None of the examples in the source repo show how to do what I what, and google hasn't been too helpful. If someone has a link to an example of this, I would be most appreciative. Thanks. Ted Roth |
From: Andreas V. <li...@br...> - 2010-12-05 22:00:11
|
Am Fri, 3 Dec 2010 16:23:08 -0700 schrieb Theodore A. Roth: > I've been trying to figure out how to register a timeout callback with > the dispatcher so that my callback function will be invoked > periodically by the dispatcher main loop. The > BusDispatcher::add_timeout() method seems to take an internal timeout > object as an argument which leads me to believe that I can't use that. > > I'm still in the learning dbus-c++ phase and my app is a rather simple > server based on the echo demo, but I've stripped it down to only a > Hello method and a single signal. My goal is to invoked the signal in > the timeout. > > None of the examples in the source repo show how to do what I what, > and google hasn't been too helpful. If someone has a link to an > example of this, I would be most appreciative. Hello Ted, yes, BusDispatcher::add_timeout() is for another reason. To be honest I never needed such an feature. Are you sure the C backend of DBus provides such a feature? Could you name a function? I would solve this by writing an interface to a DBus service that provides you with configurable callbacks. :-) regards Andreas |
From: Jason G. <jgl...@go...> - 2010-12-06 14:31:19
|
You might try using g_timeout_add_seconds. We have used it with dbus-c++. http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/device.cc;h=b5ac6f5103d8a1c05e82b0f6633d7bd6b965b6a0;hb=HEAD <http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/device.cc;h=b5ac6f5103d8a1c05e82b0f6633d7bd6b965b6a0;hb=HEAD> -Jason On Sun, Dec 5, 2010 at 4:58 PM, Andreas Volz <li...@br...> wrote: > Am Fri, 3 Dec 2010 16:23:08 -0700 schrieb Theodore A. Roth: > > > I've been trying to figure out how to register a timeout callback with > > the dispatcher so that my callback function will be invoked > > periodically by the dispatcher main loop. The > > BusDispatcher::add_timeout() method seems to take an internal timeout > > object as an argument which leads me to believe that I can't use that. > > > > I'm still in the learning dbus-c++ phase and my app is a rather simple > > server based on the echo demo, but I've stripped it down to only a > > Hello method and a single signal. My goal is to invoked the signal in > > the timeout. > > > > None of the examples in the source repo show how to do what I what, > > and google hasn't been too helpful. If someone has a link to an > > example of this, I would be most appreciative. > > Hello Ted, > > yes, BusDispatcher::add_timeout() is for another reason. To be honest I > never needed such an feature. Are you sure the C backend of DBus > provides such a feature? Could you name a function? > > I would solve this by writing an interface to a DBus service that > provides you with configurable callbacks. :-) > > 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 > |
From: Theodore A. R. <ta...@gm...> - 2010-12-06 18:04:13
|
On Mon, Dec 6, 2010 at 7:31 AM, Jason Glasgow <jgl...@go...> wrote: > You might try using g_timeout_add_seconds. We have used it with dbus-c++. > http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/device.cc;h=b5ac6f5103d8a1c05e82b0f6633d7bd6b965b6a0;hb=HEAD > -Jason Jason, Right. That's exactly what I want to do, but doesn't using g_timeout_add_seconds() imply that you are using the glib event loop and thus have to link to glib? I need to integrate my dispatcher with our own event loops so need to be event loop agnostic and we want to avoid using glib if possible. I was under the (most likely mistaken) impression the the generic dispatcher provided its own event loop which got started when you invoke dispatcher.enter(). Sounds like I need to do some more homework into how the dispatcher works. ;-) I have written some simple python apps that use the glib event loop to send a heartbeat signal and I was hoping to achieve the same thing using the default dispatcher. Ted Roth > > On Sun, Dec 5, 2010 at 4:58 PM, Andreas Volz <li...@br...> wrote: >> >> Am Fri, 3 Dec 2010 16:23:08 -0700 schrieb Theodore A. Roth: >> >> > I've been trying to figure out how to register a timeout callback with >> > the dispatcher so that my callback function will be invoked >> > periodically by the dispatcher main loop. The >> > BusDispatcher::add_timeout() method seems to take an internal timeout >> > object as an argument which leads me to believe that I can't use that. >> > >> > I'm still in the learning dbus-c++ phase and my app is a rather simple >> > server based on the echo demo, but I've stripped it down to only a >> > Hello method and a single signal. My goal is to invoked the signal in >> > the timeout. >> > >> > None of the examples in the source repo show how to do what I what, >> > and google hasn't been too helpful. If someone has a link to an >> > example of this, I would be most appreciative. >> >> Hello Ted, >> >> yes, BusDispatcher::add_timeout() is for another reason. To be honest I >> never needed such an feature. Are you sure the C backend of DBus >> provides such a feature? Could you name a function? >> >> I would solve this by writing an interface to a DBus service that >> provides you with configurable callbacks. :-) >> >> 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 > > > ------------------------------------------------------------------------------ > 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 > > |
From: Jason G. <jgl...@go...> - 2010-12-06 19:59:20
|
see main() for how we attach the dbus-c++ dispatcher to the glib main loop. http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/main.cc;h=d7f64fe5f37b99e91d7eb2ef9e4566f01833e521;hb=HEAD#l102 -Jason On Mon, Dec 6, 2010 at 1:04 PM, Theodore A. Roth <ta...@gm...> wrote: > On Mon, Dec 6, 2010 at 7:31 AM, Jason Glasgow <jgl...@go...> wrote: > > You might try using g_timeout_add_seconds. We have used it with > dbus-c++. > > > http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/device.cc;h=b5ac6f5103d8a1c05e82b0f6633d7bd6b965b6a0;hb=HEAD > > -Jason > > Jason, > > Right. That's exactly what I want to do, but doesn't using > g_timeout_add_seconds() imply that you are using the glib event loop > and thus have to link to glib? > > I need to integrate my dispatcher with our own event loops so need to > be event loop agnostic and we want to avoid using glib if possible. > > I was under the (most likely mistaken) impression the the generic > dispatcher provided its own event loop which got started when you > invoke dispatcher.enter(). Sounds like I need to do some more homework > into how the dispatcher works. ;-) > > I have written some simple python apps that use the glib event loop to > send a heartbeat signal and I was hoping to achieve the same thing > using the default dispatcher. > > Ted Roth > > > > > On Sun, Dec 5, 2010 at 4:58 PM, Andreas Volz <li...@br...> > wrote: > >> > >> Am Fri, 3 Dec 2010 16:23:08 -0700 schrieb Theodore A. Roth: > >> > >> > I've been trying to figure out how to register a timeout callback with > >> > the dispatcher so that my callback function will be invoked > >> > periodically by the dispatcher main loop. The > >> > BusDispatcher::add_timeout() method seems to take an internal timeout > >> > object as an argument which leads me to believe that I can't use that. > >> > > >> > I'm still in the learning dbus-c++ phase and my app is a rather simple > >> > server based on the echo demo, but I've stripped it down to only a > >> > Hello method and a single signal. My goal is to invoked the signal in > >> > the timeout. > >> > > >> > None of the examples in the source repo show how to do what I what, > >> > and google hasn't been too helpful. If someone has a link to an > >> > example of this, I would be most appreciative. > >> > >> Hello Ted, > >> > >> yes, BusDispatcher::add_timeout() is for another reason. To be honest I > >> never needed such an feature. Are you sure the C backend of DBus > >> provides such a feature? Could you name a function? > >> > >> I would solve this by writing an interface to a DBus service that > >> provides you with configurable callbacks. :-) > >> > >> 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 > > > > > > > ------------------------------------------------------------------------------ > > 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 > > > > > |
From: Jason G. <jgl...@go...> - 2010-12-06 20:44:46
|
To answer your questions, yes we do use glib, and link against it. If you want to be event loop agnostic and avoid glib that is a different story. -Jason On Mon, Dec 6, 2010 at 2:59 PM, Jason Glasgow <jgl...@go...> wrote: > see main() for how we attach the dbus-c++ dispatcher to the glib main loop. > > > http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/main.cc;h=d7f64fe5f37b99e91d7eb2ef9e4566f01833e521;hb=HEAD#l102 > > -Jason > > On Mon, Dec 6, 2010 at 1:04 PM, Theodore A. Roth <ta...@gm...> wrote: > >> On Mon, Dec 6, 2010 at 7:31 AM, Jason Glasgow <jgl...@go...> >> wrote: >> > You might try using g_timeout_add_seconds. We have used it with >> dbus-c++. >> > >> http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/device.cc;h=b5ac6f5103d8a1c05e82b0f6633d7bd6b965b6a0;hb=HEAD >> > -Jason >> >> Jason, >> >> Right. That's exactly what I want to do, but doesn't using >> g_timeout_add_seconds() imply that you are using the glib event loop >> and thus have to link to glib? >> >> I need to integrate my dispatcher with our own event loops so need to >> be event loop agnostic and we want to avoid using glib if possible. >> >> I was under the (most likely mistaken) impression the the generic >> dispatcher provided its own event loop which got started when you >> invoke dispatcher.enter(). Sounds like I need to do some more homework >> into how the dispatcher works. ;-) >> >> I have written some simple python apps that use the glib event loop to >> send a heartbeat signal and I was hoping to achieve the same thing >> using the default dispatcher. >> >> Ted Roth >> >> > >> > On Sun, Dec 5, 2010 at 4:58 PM, Andreas Volz <li...@br...> >> wrote: >> >> >> >> Am Fri, 3 Dec 2010 16:23:08 -0700 schrieb Theodore A. Roth: >> >> >> >> > I've been trying to figure out how to register a timeout callback >> with >> >> > the dispatcher so that my callback function will be invoked >> >> > periodically by the dispatcher main loop. The >> >> > BusDispatcher::add_timeout() method seems to take an internal timeout >> >> > object as an argument which leads me to believe that I can't use >> that. >> >> > >> >> > I'm still in the learning dbus-c++ phase and my app is a rather >> simple >> >> > server based on the echo demo, but I've stripped it down to only a >> >> > Hello method and a single signal. My goal is to invoked the signal in >> >> > the timeout. >> >> > >> >> > None of the examples in the source repo show how to do what I what, >> >> > and google hasn't been too helpful. If someone has a link to an >> >> > example of this, I would be most appreciative. >> >> >> >> Hello Ted, >> >> >> >> yes, BusDispatcher::add_timeout() is for another reason. To be honest I >> >> never needed such an feature. Are you sure the C backend of DBus >> >> provides such a feature? Could you name a function? >> >> >> >> I would solve this by writing an interface to a DBus service that >> >> provides you with configurable callbacks. :-) >> >> >> >> 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 >> > >> > >> > >> ------------------------------------------------------------------------------ >> > 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 >> > >> > >> > > |
From: Vince L. <vla...@go...> - 2010-12-06 21:06:38
|
Hi Ted, On Mon, Dec 6, 2010 at 11:59 AM, Jason Glasgow <jgl...@go...> wrote: > see main() for how we attach the dbus-c++ dispatcher to the glib main loop. > > > http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/main.cc;h=d7f64fe5f37b99e91d7eb2ef9e4566f01833e521;hb=HEAD#l102 > > -Jason > dbus-c++ provides several flavors of dispatcher. The vanilla one (DBus::BusDispatcher) does implement its own event loop, entered by DBus::BusDispatcher::enter and exited by DBus::BusDispatcher::leave. There is a separate dispatcher for glib integration: DBus::Glib::BusDispatcher. When using the glib dispatcher, you still need to attach it, but, since it's using the glib main loop, the enter and leave routines are no-ops. You instead create a glib main loop and enter and leave the loop using the usual glib calls: g_main_loop_run and g_main_loop_quit. See the cashew link that Jason provided for an example of how to use the glib dispatcher. The add_timeout, rem_timeout, add_watch, and rem_watch methods on the default dispatcher seem promising at first glance, but the conversation quoted below suggests that you've already tried them with no luck. Andreas says in the thread below: > Are you sure the C backend of DBus provides such a feature? Could you name a function? The C backend for D-Bus is meant to allow integration of D-Bus events into an existing external event loop. So, it provides the ability for code implementing this event loop to provide a callback function for libdbus to call when libdbus wants to add a timeout that will be managed by this external event loop (and similarly for watches on fds that libdbus want the external event loop to manage). However, one would expect that the external event loop will... um... be an event loop, meaning that its public API allows timeouts and watches to be created, managed, and removed by arbitrary clients, not just by libdbus through the dbus binding. IMO, if the default dispatcher purports to be a real event loop (and it's not clear that it does, since it's intentionally very simple), it should allow timeouts and watches to be managed. It should do this just because it's an event loop, not because it's part of a D-Bus binding. Ted: An alternate approach would be to ignore the default dispatcher, look at how DBus::Glib::BusDispatcher is implemented, and follow the same model to implement DBus::EventLibThatTedPrefersInsteadOfGlib::BusDispatcher. Vince > > On Mon, Dec 6, 2010 at 1:04 PM, Theodore A. Roth <ta...@gm...> wrote: > >> On Mon, Dec 6, 2010 at 7:31 AM, Jason Glasgow <jgl...@go...> >> wrote: >> > You might try using g_timeout_add_seconds. We have used it with >> dbus-c++. >> > >> http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/device.cc;h=b5ac6f5103d8a1c05e82b0f6633d7bd6b965b6a0;hb=HEAD >> > -Jason >> >> Jason, >> >> Right. That's exactly what I want to do, but doesn't using >> g_timeout_add_seconds() imply that you are using the glib event loop >> and thus have to link to glib? >> >> I need to integrate my dispatcher with our own event loops so need to >> be event loop agnostic and we want to avoid using glib if possible. >> >> I was under the (most likely mistaken) impression the the generic >> dispatcher provided its own event loop which got started when you >> invoke dispatcher.enter(). Sounds like I need to do some more homework >> into how the dispatcher works. ;-) >> >> I have written some simple python apps that use the glib event loop to >> send a heartbeat signal and I was hoping to achieve the same thing >> using the default dispatcher. >> >> Ted Roth >> >> > >> > On Sun, Dec 5, 2010 at 4:58 PM, Andreas Volz <li...@br...> >> wrote: >> >> >> >> Am Fri, 3 Dec 2010 16:23:08 -0700 schrieb Theodore A. Roth: >> >> >> >> > I've been trying to figure out how to register a timeout callback >> with >> >> > the dispatcher so that my callback function will be invoked >> >> > periodically by the dispatcher main loop. The >> >> > BusDispatcher::add_timeout() method seems to take an internal timeout >> >> > object as an argument which leads me to believe that I can't use >> that. >> >> > >> >> > I'm still in the learning dbus-c++ phase and my app is a rather >> simple >> >> > server based on the echo demo, but I've stripped it down to only a >> >> > Hello method and a single signal. My goal is to invoked the signal in >> >> > the timeout. >> >> > >> >> > None of the examples in the source repo show how to do what I what, >> >> > and google hasn't been too helpful. If someone has a link to an >> >> > example of this, I would be most appreciative. >> >> >> >> Hello Ted, >> >> >> >> yes, BusDispatcher::add_timeout() is for another reason. To be honest I >> >> never needed such an feature. Are you sure the C backend of DBus >> >> provides such a feature? Could you name a function? >> >> >> >> I would solve this by writing an interface to a DBus service that >> >> provides you with configurable callbacks. :-) >> >> >> >> 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 >> > >> > >> > >> ------------------------------------------------------------------------------ >> > 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 >> > >> > >> > > |
From: Theodore A. R. <ta...@gm...> - 2010-12-06 22:08:22
|
On Mon, Dec 6, 2010 at 2:06 PM, Vince Laviano <vla...@go...> wrote: > Hi Ted, > On Mon, Dec 6, 2010 at 11:59 AM, Jason Glasgow <jgl...@go...> wrote: >> >> see main() for how we attach the dbus-c++ dispatcher to the glib main >> loop. >> >> http://git.chromium.org/gitweb/?p=cashew.git;a=blob;f=src/main.cc;h=d7f64fe5f37b99e91d7eb2ef9e4566f01833e521;hb=HEAD#l102 >> >> -Jason > > dbus-c++ provides several flavors of dispatcher. > The vanilla one (DBus::BusDispatcher) does implement its own event loop, > entered by DBus::BusDispatcher::enter and exited by > DBus::BusDispatcher::leave. > There is a separate dispatcher for glib integration: > DBus::Glib::BusDispatcher. When using the glib dispatcher, you still need > to attach it, but, since it's using the glib main loop, the enter and leave > routines are no-ops. You instead create a glib main loop and enter and leave > the loop using the usual glib calls: g_main_loop_run and g_main_loop_quit. > See the cashew link that Jason provided for an example of how to use the > glib dispatcher. > The add_timeout, rem_timeout, add_watch, and rem_watch methods on the > default dispatcher seem promising at first glance, but the conversation > quoted below suggests that you've already tried them with no luck. > Andreas says in the thread below: >> Are you sure the C backend of DBus provides such a feature? Could you name >> a function? > The C backend for D-Bus is meant to allow integration of D-Bus events into > an existing external event loop. So, it provides the ability for code > implementing this event loop to provide a callback function for libdbus to > call when libdbus wants to add a timeout that will be managed by this > external event loop (and similarly for watches on fds that libdbus want the > external event loop to manage). However, one would expect that the external > event loop will... um... be an event loop, meaning that its public API > allows timeouts and watches to be created, managed, and removed by arbitrary > clients, not just by libdbus through the dbus binding. IMO, if the default > dispatcher purports to be a real event loop (and it's not clear that it > does, since it's intentionally very simple), it should allow timeouts and > watches to be managed. It should do this just because it's an event loop, > not because it's part of a D-Bus binding. That's exactly the (false) assumption I was making about BusDispatcher. > Ted: An alternate approach would be to ignore the default dispatcher, look > at how DBus::Glib::BusDispatcher is implemented, and follow the same model > to implement DBus::EventLibThatTedPrefersInsteadOfGlib::BusDispatcher. > Vince Will have a look at that and see where it takes me. Thanks for the help guys. I think that will get me on the right track. Ted Roth |
From: Rafal D. <r....@ke...> - 2010-12-07 10:00:12
|
Here is a snippet of code from my application, This code is for periodic check if connection is alive You need to install DBus::DefaultTimeout (dt is pointer to this object) with DBus::BusDispatcher (dispatcher object) BTW framework is responsible for releasing dt memory (see internals of DBus::Callback_Base) bool const repeat=true; unsigned const timeout_ms = 3 * DEFAULT_TIMEOUT_MS;//DSP uses 10000 for Ping->Pong messages DBus::DefaultTimeout*const dt = new DBus::DefaultTimeout(timeout_ms, repeat, &dispatcher); dt->expired=new periodic(); periodic is a class which does processing on timeout: class periodic: public DBus::Callback_Base<void, DBus::DefaultTimeout &> { public: void call(DBus::DefaultTimeout & param) const { if( not ping_was_called.read_reset() ) { LWAR_ << "TIMEOUT: CLOSING THE CONNECTION " << blackfin << " last Ping received long time ago"; ::close( blackfin ); g_devices->invalidate();//Reset DBus collections - no connection with devices g_blocks->invalidate(); } } }; -----Original Message----- From: Theodore A. Roth [mailto:ta...@gm...] Sent: Fri 12/3/2010 11:23 PM To: dbu...@li... Subject: [dbus-cplusplus-devel] dispatcher timeout I've been trying to figure out how to register a timeout callback with the dispatcher so that my callback function will be invoked periodically by the dispatcher main loop. The BusDispatcher::add_timeout() method seems to take an internal timeout object as an argument which leads me to believe that I can't use that. I'm still in the learning dbus-c++ phase and my app is a rather simple server based on the echo demo, but I've stripped it down to only a Hello method and a single signal. My goal is to invoked the signal in the timeout. None of the examples in the source repo show how to do what I what, and google hasn't been too helpful. If someone has a link to an example of this, I would be most appreciative. Thanks. Ted Roth ------------------------------------------------------------------------------ Oracle to DB2 Conversion Guide: New IBM DB2 features make compatibility easy. Learn about native support for PL/SQL, new data types, scalar functions, improved concurrency, built-in packages, OCI, SQL*Plus, data movement tools, best practices and more - all designed to run applications on both DB2 and Oracle platforms. http://p.sf.net/sfu/oracle-sfdev2dev _______________________________________________ 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=oB79TrMa012804&from=r....@ke... |