Re: IOBluetoothDeviceRegisterForDisconnectNotification
Re: IOBluetoothDeviceRegisterForDisconnectNotification
- Subject: Re: IOBluetoothDeviceRegisterForDisconnectNotification
- From: Joseph Kelly <email@hidden>
- Date: Fri, 20 Oct 2006 09:38:07 -0700
Christian,
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...
Joe
On Oct 20, 2006, at 7:53 AM, Christian Martin wrote:
Hi Joseph,
Thx for your rapid answer.
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.
Thx.
Christian Martin
B.Sc. Math/Computer
From: Joseph Kelly <email@hidden>
To: Christian Martin <email@hidden>
Subject: Re: IOBluetoothDeviceRegisterForDisconnectNotification
Date: Thu, 19 Oct 2006 13:57:21 -0700
The Apple Bluetooth implementation is not thread safe. In order
for it to work correctly, you must make all calls from the main
thread.
Joe K.
On Oct 19, 2006, at 12:57 PM, Christian Martin wrote:
IOBluetoothDeviceRegisterForDisconnectNotification
_________________________________________________________________
Say hello to the next generation of Search. Live Search – try it
now. http://www.live.com/?mkt=en-ca
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden