Android Question BLE2 versus iBLE

Arf

Well-Known Member
Licensed User
Longtime User
I have made a little app to connect to a RN4677 bluetooth device, in both B4i and B4A.
The app is based on the BleCentral examples.

All works fine in the b4i app, but I cannot connect in the b4a version. I spied some differences between the two:

In b41, in the Manager_DeviceFound event, the Name and DeviceID I get are:
DeviceFound: SpiroDongle,EF7B4C8E-79DF-4F44-9D81-569BF2198715
in B4A, I get:
DeviceFound: SpiroDongle,D8:80:39:F0:D0:FC

So the device ID is a UUID in b4i and a MAC address in b4A.

I then connect to the given DeviceID, in ios, success, in b4A, I always hit the Manager_Disconnected event.

Has anyone got any ideas as to what I might try to get the b4a version connecting? Options seem limited!
 

monic

Active Member
Licensed User
Longtime User
Can you share your log?

If hitting the disconnect does that mean it connected at some point?
 
Last edited:
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
Hi Jamie,
I'll post code shortly. There is something I don't understand in your code though:

manager.Scan2(Array (serviceId), False)
This will only find peripherals that have a UUID that matches the "serviceID" in your argument.
The serviceID in your app is going to be
"0000ffe0-0000-1000-8000-00805f9b34fb", and I think that UUID is from the first Ble example project, so I would think it would be highly unlikely to happen to match the UUID of your AIO module. So, I don't understand how a scan finds your module!

Anyway, my scan is an open scan and it finds my device and connects to it in the same way. I have tried to use all the UUIDS that are listed in LightBlue as arguments for the scan function, and my device is never found.. it is only found with a null argument for ServiceID.

Do you what you get for DeviceID from your AIO module in the DeviceFound event?

Thanks
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
Here's my (unfiltered) log:

Scan Start
DeviceFound: SpiroDongle,D8:80:39:F0:D0:FC
Connecting to SpiroDongle
connect() - device: D8:80:39:F0:D0:FC, auto: true
registerApp()
registerApp() - UUID=00b5817f-3725-4ccd-b978-5a0e8db12cab
onClientRegistered() - status=0 clientIf=7
stopLeScan()
STATE_ON
onClientConnectionState() - status=133 clientIf=7 device=D8:80:39:F0:D0:FC
close()
unregisterApp() - mClientIf=7
Connection failed
 
Upvote 0

Arf

Well-Known Member
Licensed User
Longtime User
I've tried a few devices, with android 5, 6 and 7 and it seems to be consistent with all of them.
I guess it's something to do with the GATT implementation on the bluetooth module side (in the remote device I'm connecting to).
 
Upvote 0
Top