site_archiver@lists.apple.com Delivered-To: bluetooth-dev@lists.apple.com Christian, Joe On Oct 20, 2006, at 7:53 AM, Christian Martin wrote: Hi Joseph, Thx for your rapid answer. Thx. Christian Martin B.Sc. Math/Computer From: Joseph Kelly <joeman@mac.com> To: Christian Martin <cmartin64x@hotmail.com> Subject: Re: IOBluetoothDeviceRegisterForDisconnectNotification Date: Thu, 19 Oct 2006 13:57:21 -0700 Joe K. On Oct 19, 2006, at 12:57 PM, Christian Martin wrote: _______________________________________________ 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... It's not impossible. First I would verify that the thread restriction I claim is indeed true for the C apis (I've been using the ObjectiveC api). This would probably involve getting the bluetooth working first by calling your C functions (that you're wrapping in JNI) in a purely C environment using main and non-main threads -- query, connect, open channel, send/receive, close channel, disconnect. Second, if you find that it doesn't work except on the main thread, you might investigate whether you can set up the main thread before you run the jvm. I would be fairly certain (your mileage may vary ;-) that once you enter the jvm that it sits in a runloop and fields window manager events. You could add a bunch of sources to the main thread's runloop, and your jni functions could post requests to the main thread by triggering those sources, which would then carry out the bluetooth operation on the main thread. Etc. If you plan on talking to one device at a time, this should be fairly straightforward. For simultaneous devices, you might have to implement a command queue of some kind. I'm CC'ing this back to the list in hopes that someone more knowledgeable about Bluetooth, Java, threading, etc. than I will chime in... I am currently working on a Java Application which would need some call into the api of bluetooth. So, I did a JNI to wrap it up. Now, according to what you are saying JAVA/JNI/Bluetooth is not possible ! Please let me know if there is an avenue that I am missing... I am seriously stuck here. The Apple Bluetooth implementation is not thread safe. In order for it to work correctly, you must make all calls from the main thread. IOBluetoothDeviceRegisterForDisconnectNotification _________________________________________________________________ Say hello to the next generation of Search. Live Search – try it now. http://www.live.com/?mkt=en-ca This email sent to site_archiver@lists.apple.com
participants (1)
-
Joseph Kelly