udark / underdark-android

Bluetooth peer-to-peer mesh networking for Android
http://underdark.io
Other
219 stars 56 forks source link

Transmission between android device is not working #3

Open CyborgRahil opened 8 years ago

CyborgRahil commented 8 years ago

each time i got this,

D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=5

i use moto g,Hp tablet ,Samsung s4 for testing.

virl commented 8 years ago

@rahil1991 Android bluetooth is very buggy on particular devices. Thanks for the device models — most probably they have device-specific Bluetooth bugs.

If you happen to fix the issue or find workaround, feel free to submit pull request.

mrp14 commented 8 years ago

Same thing here on Asus Zenfone 2 Laser (ASUS_Z00ED). Maybe it's because we should call all BLE interaction code in UIThread, as stated here : http://stackoverflow.com/a/20507449/2806497 ?

virl commented 8 years ago

@mrp14 Library is specifically designed to call all Bluetooth API methods only on main threads (except for reading/writing of BluetoothSocket, which is explicitly permitted to be used from another threads).

But, of course, maybe there is a bug somewhere in the code of the library.

mrp14 commented 8 years ago

I finally saw that you queuing system only use UI Thread. I tried to call the connect method into UIThread but with no changes. The problem mustn't be there.

Here is what i'm getting in the log :

bt accept() failed for uuid [[UUID]] java.io.IOException: read failed, socket might closed or timeout, read ret: -1

virl commented 8 years ago

@mrp14 Due to Android models fragmentation and very unstable Bluetooth stack (prior to 7.0), it can either be a bug in stack itself or the library. Anyway, it can be debugged and fixed only using real device that it occurs on.

mrp14 commented 8 years ago

That's exactly what i'm trying to do, maybe it would be useful for others too. Do you have any clue on how I can investigate this IOException ? I'm gonna try some others BLE librairies and demo apps on this device to see if there is a way to get it working.

EDIT :

Here is the full log :

05-24 10:16:07.976  29907-29907/? D/underdark﹕ bt listening started
05-24 10:16:07.988  29907-29929/? D/underdark﹕ bt listening channel 0 uuid 1B9839E4-040B-48B2-AE5F-61B6000392FB
05-24 10:16:07.989  29907-29930/? D/underdark﹕ bt listening channel 1 uuid 6FB34FD8-579F-4915-88FF-71B2000392FB
05-24 10:16:07.995  29907-29931/? D/underdark﹕ bt listening channel 2 uuid 8CC0C5A1-1E22-4C95-89D7-3639000392FB
05-24 10:16:08.161  29907-29907/? D/underdark﹕ bt listening stopped
05-24 10:16:08.163  29907-29930/? E/underdark﹕ bt accept() failed for uuid 6FB34FD8-579F-4915-88FF-71B2000392FBjava.io.IOException: read failed, socket might closed or timeout, read ret: -1
05-24 10:16:08.163  29907-29931/? E/underdark﹕ bt accept() failed for uuid 8CC0C5A1-1E22-4C95-89D7-3639000392FBjava.io.IOException: read failed, socket might closed or timeout, read ret: -1
05-24 10:16:08.163  29907-29929/? E/underdark﹕ bt accept() failed for uuid 1B9839E4-040B-48B2-AE5F-61B6000392FBjava.io.IOException: read failed, socket might closed or timeout, read ret: -1

As you can see, bt listeting is stopped before the accept method has finished.

I tried to remove the stop call in the activity onStop (to see what happens), and I'm now getting :

ble advertise failed: ADVERTISE_FAILED_DATA_TOO_LARGE

EDIT 2 :

I reduced advertiseData sent (only device name) : I'm not getting the data too large error anymore, but socket accept method hangs and never returns.

virl commented 8 years ago

@mrp14 Maybe it's some specific bug in that version of the BT stack that limits listening to only 3 channels. Or maybe using BLE conflicts with RFCOMM listening methods of Bluetooth API.

You can try to reproduce the bug with pure Bluetooth/BLE Android API — create same amount of listening BluetoothServerSockets and try to advertise something on BLE.

mrp14 commented 8 years ago

I'm going to try it. BTW, is the Solidarity app source code available somewhere ? I would be interested to dig in it.

virl commented 8 years ago

@mrp14 I've wrote message to your email.

azizimusa commented 4 years ago

send me the solidarity source code. I want it as well