[maemo-developers] Re: [maemo-users] Using osso_iap_cb example
On Mon, Jul 24, 2006 at 11:24:24PM -0700, Brad Burleson wrote: > I'm trying to capture the events generated when the 770 goes on and > off-line, and I've written a simple test program just to mess around. The > callback gets registered, but I never see any output from the callback. I > suspect it's something simple. > > Anyone got any ideas? (I think maemo-developers is a better forum for this) It seems that the callback isn't actually registered (on D-BUS) until you call some osso-ic function that does something on D-BUS. So, after calling osso_iap_connect() you might have a better chance. Of course there's then the side effect that you have requested a connection and the system will try to keep it on indefinitely. If that's a problem (you only want to monitor), you should be able to use the ICD D-BUS API directly and listen for the "status_changed" signal: http://www.maemo.org/platform/docs/howtos/howto_connectivity_guide.html#DBUSInterfaceICD Cheers, Jari -- Jari Tenhunen, stardate [-29]6121.15 :wq ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers
[maemo-developers] Re: [maemo-users] Using osso_iap_cb example
On 7/31/06, Kalle Valo <[EMAIL PROTECTED]> wrote: Alvis Koon writes:> If you don't run into gtk_main() or some event handling loop, you> won't be able to process events (callbacks), isn't it? You are correct. libosso-ic needs D-BUS dispatcher to work. Forexample, one can use dbus_connection_setup_with_g_main() with GLibmain loop. Ok, so I got my daemon to work just fine by calling gtk_main() (as well as using status_changed). Thanks to all for the help, you guys were spot on. My only problem is that gtk_main() transfers control away from my daemon. Is it possible to attach to the GLib main loop and return back to my own code from time to time (the project I'm working on has it's own internal scheduler and I'm not up for a big rewrite now)? For now, I've simply written a custom daemon that monitors "status_changed" messages and executes the desired script. While I think that a custom daemon is the wrong solution to this problem it may be useful - How about diaperd? (Dbus IAP Execute Uh. something... Despite the bad humor, it may be useful to finish. Brad. PS And sorry for misdirecting this to users - the danger of auto completion and inattention. ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers
Re: [maemo-developers] Re: [maemo-users] Using osso_iap_cb example
Brad Burleson wrote: > My only problem is that gtk_main() transfers control away from my daemon. > Is it possible to attach to the GLib main loop and return back to my own > code from time to time (the project I'm working on has it's own internal > scheduler and I'm not up for a big rewrite now)? You can do: g_timeout_add(, function, user_data); or g_idle_add(function, user_data); to get regularily back to your code. Note that function should return TRUE to get called again (and again). But neither of these is really a good solution. When working with glib, you should use it's scheduler for things to go smooth. -- Santtu Lakkala ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers
Re: [maemo-developers] Re: [maemo-users] Using osso_iap_cb example
2006/8/1, Brad Burleson <[EMAIL PROTECTED]>: My only problem is that gtk_main() transfers control away from my daemon. Is it possible to attach to the GLib main loop and return back to my own code from time to time (the project I'm working on has it's own internal scheduler and I'm not up for a big rewrite now)? Sure, you can even just run the GLib main loop "by hand" within a loop while doing other stuff. See gtk_events_pending () for details. There is also g_idle_add() and g_timeout_add() if it is not crucial to execute the code at exact times (they launch their callbacks at "when there is nothing else going on" and "no sooner than" respectively). -- Kalle Vahlman, [EMAIL PROTECTED] Powered by http://movial.fi Interesting stuff at http://syslog.movial.fi ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers