Thursday, March 31, 2011

[android-developers] Reading From Serial Ports Disrupts Bluetooth

I have an app that checks for data on the serial ports. It uses JNI to
read from /dev/ttys*. When it does not find the data on the serial
ports, it then uses the Java APIs to open a bluetooth socket and check
for the data via bluetooth.

The problem is that the BluetoothSocket.connect call fails with
"java.io.IOException: Connection timed out".

If we change the code, such that we don't first check the serial port,
then the bluetooth connection succeeds.

We were also testing with a second bluetooth app, the bluetooth chat
sample, that consistently worked. However, when we ran the first app,
followed by the bluetooth chat, then the bluetooth chat also failed. A
reboot of the phone, or toggle of the bluetooth, allowed the bluetooth
chat to succeed.

So all I can gather, is that somehow, reading from the serial ports is
causing bluetooth to fail. Please note that not all Android phones
have support for /dev/ttys*.

Does anybody have any idea why the serial ports would mess with
bluetooth?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate