Re: polling for bluetooth events
site_archiver@lists.apple.com Delivered-To: Bluetooth-dev@lists.apple.com Joe K. On Mar 7, 2008, at 12:55 PM, Hans-Christoph Steiner wrote: Here's the code in question: .hc http://at.or.at/hans/ _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/bluetooth-dev/joeman%40mac.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.a... Much of the user space Bluetooth API depends on run loops, i.e. for getting data to and from the kernel. It's surprising that your GUI framework itself does not rely on run loops. How does it respond to user input etc. ? Unfortunately, I found that some Bluetooth calls only run reliably on the main thread, at least on Tiger and earlier. Maybe you could explain your architecture a bit more. The model I've been using is I set up a callback for when data comes from the device, then I just return and wait; when the user does something which causes me to send commands to the device, and when I return from doing that (i.e. program flow returns to the event manager and the runloop code) I then get my data-in callbacks which I respond to. I am currently in the process of adding bluetooth HID support to Pure Data, a realtime, visual programming language for sound, video, etc. The GUI is all written in Tcl/Tk, so we are not handling a CFRunLoop at all. I have gotten device searching and connection working by using CFRunLoopRun() then sticking CFRunLoopStop(CFRunLoopGetCurrent()) the end of the of the inquiry completion callback. I am trying to get the same thing working for getting events, but I haven't been able to. Ideally, I would be able to poll for bluetooth events, is there a way to do that, outside of creating a separate thread to handle the event callbacks? Maybe something with CFRunLoopRunInMode()? http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/ externals/io/wiiremote/ ---------------------------------------------------------------------- ------ This email sent to joeman@mac.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Joseph Kelly