Android Question Astream_error on bluetooth app - Samsung Galaxy

Arf

Well-Known Member
Licensed User
Longtime User
Hi chaps,
My bluetooth app has been working for ages on my Nexus 7, I have just tried it on a Galaxy Tab 3 (7in), and I'm getting an unexpected error when my bluetooth device connects to it. Just hoping for a little more info on the logs, as I am not quite sure what to look more closely at.
Here's a bit of the log below:

** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (unit_comms) Create **
** Service (unit_comms) Start **
connected: true
alive
java.io.IOException: Transport endpoint is not connected
java.io.IOException: Transport endpoint is not connected
java.io.IOException: Transport endpoint is not connected
** Activity (main) Resume **

So the app receives an incoming bluetooth packet (sets 'connected' as true, then replies with an 'alive' packet, and it seems the IOexception is occurring when it tries to send data back to my bluetooth device.

Why would there be no problem on the nexus 7, but problem on the galaxy? Any insights appreciated!
 

Arf

Well-Known Member
Licensed User
Longtime User
Actually maybe more a bluetooth error than an Astream error, misleading thread title.
I'm occasionally getting a different error (after connect: true)

java.io.IOException: Software caused connection abort

That doesn't happen on the nexus either.
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
Aaaaargh this is killing me! 6 hours of going in circles.

Is there any way I can get more info into this "java.io.IOException: Software caused connection abort" error through the B4A debug interface?
As far as I can tell the connection gets broken on the OS side when the app tried to send data to my bluetooth device, only with Samsung Galaxy.

The only possible lead I have managed to dig up is that my bluetooth device has a CoD (Class of Device) of 00H, which happarently some android devices don't trust. I changed it to 01H, but do you think that made a difference?? Hell no.

I get precisely the same error if I run Erel's bluetooth chat tutorial, the exact same project works just fine on the nexus.
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
So, I've now set up the module in my bluetooth device with a virtual com port cable conected to my PC, from where I can easily modify all the modifiable parameters within the bluetooth module, and try repeatedly connect to it with the galaxy tab running Erels' ChatActivity tutorial.
I've changed the pin code, the class of device, name of device, everything I possibly can, and each time, I always get the same result:

ignoring event: badmin_discoverystarted
ignoring event: badmin_devicefound
ADEUNIS:00:18:B2:02:5A:2C
ignoring event: badmin_discoveryfinished
connected: false
java.io.IOException: Connection refused

On what grounds would it possibly refuse a connection??

that's if I try connect to the module from the galaxy. If i try make a connection from the module to the galaxy, I just get a NO CARRIER error. The galaxy detects fine though.
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
So after some further digging, I noticed that the SM-T210 (model code for the galaxy tablet) doesn't list SPP as bluetooth profile it supports.
Also that the latest version of Android it supports is 4.1.2, which also apparently uses an older bluez stack which has known problems with RFCOMM.

So the questions are, does an implementation like in the Bluetooth chat tutorial need SPP support from Android, or should it work regardless?
Second, I'm thinking I should try ListenInsecure (Admin As BluetoothAdmin, Port As Int). I've no clue what to use as the port argument though, does anyone know how I can determine this? Thanks
 
Upvote 0
Top