Android Question BLEmanager2: after disconnect the BLE module hangs

peacemaker

Expert
Licensed User
Longtime User
HI, All

I'm trying BLE exchange between B4R and B4A codes. Using https://www.b4x.com/android/forum/threads/aes256-encrypted-ble-esp32-b4a-example.145872/.
All works OK only one connection try, but when "disconnect" is made (by manager.disconnect function) - new "Scan and connect" is impossible anymore.

Scanning is stopped after timeout. But the BLE device is alive for sure - Chrome-browser easily continue connecting and disconnecting from this BLE device (based on ESP32 module), and reading a GATT characteristic is OK also any time after connect.

But if to use the Airplane Mode for a second on the Android13 (device is in my post footer) - again B4A app scans and connects OK. Again only once.
1690635152253.png

Looks like BLEmanager2 lib does not disconnect well...

Any ideas ?
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Example project is attached: it's just combined BLEexample and Bluetooth example (with selecting devices from the list).
Please, just try to connect to your BLE-device, disconnect (after successfull connection) - and connect again.

I see now that error is ... second connection just does not work (disconnected in several seconds), until re-powering the BLE module (airplane mode for a second):

Error log of second try:
Found: orion_v.0.262_8_083AF2A78E, 08:3A:F2:A7:8E:AE, RSSI = -51, (MyMap) {1=[B@b78387c, 8=[B@f4e0505, 0=[B@9dd95a}
Found: , 0F:CD:F9:B1:05:B7, RSSI = -43, (MyMap) {-1=[B@32eec81, 0=[B@3d03126}
connecting
Disconnected

Log of first normal connection:
** Activity (main) Resume **
Found: orion_v.0.262_8_083AF2A78E, 08:3A:F2:A7:8E:AE, RSSI = -61, (MyMap) {1=[B@8823f56, 8=[B@1455bd7, 0=[B@bcdccc4}
Found: , 15:D2:6E:63:2F:DB, RSSI = -37, (MyMap) {-1=[B@d99de73, 0=[B@c3cf130}
connecting
Discovering services.
Connected
 

Attachments

  • BLEExample_peacemaker.zip
    12.5 KB · Views: 71
Upvote 0
Top