Android Question BLE vs iBLE

iCAB

Well-Known Member
Licensed User
Longtime User
Hi There

Can someone tell me why the information outputted to the log screen is different between the 2 implementations?
https://www.b4x.com/android/forum/threads/ble-2-bluetooth-low-energy.59937/
https://www.b4x.com/android/forum/threads/ble-bluetooth-low-energy-library.46099/#content

A typical B4A output looks like:
B4X:
Found: , 6E:A6:00:FE:D2:8D, RSSI = -39, (MyMap) {1=[B@5c30ea4, 10=[B@95b640d, -1=[B@373bfc2, 0=[B@ec1f1d3}

A typical B4I output looks like:
B4X:
Found: , 0ED03A0B-1294-C733-AE1B-3A16B2B9DE3D, RSSI = -89, (read only map) {
    kCBAdvDataIsConnectable = 1;
    kCBAdvDataTxPowerLevel = 12;
}

Using B4I, I am able to detect a device using its name, while with B4A I don't see the device (maybe it's there by there is no easy way for me to identify it)
Also with B4I you can see the device UUID, while I don't see the same info with B4A

Please advise.

Thanks,
iCAB
 

f0raster0

Well-Known Member
Licensed User
Longtime User
in my last project I used this:
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Can someone tell me why the information outputted to the log screen is different between the 2 implementations?
The underlying APIs are completely different so the output is different. Don't try to extract anything from this string.

B4X:
For Each Key As Int In AdvertisingData.Keys
 Dim b() As Byte = AdvertisingData.Get(Key)
 Log(Key & ": " & BytesToString(b, 0, b.Length, "utf8")) 'not safe. can throw an exception
  Log(Key & ": " & bc.HexFromBytes(b)) 'safe
Next
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Thanks guys for your reply,

@Erel
Is there anything common in the returned data to identify the same device in B4A and B4I?

Thank you!
 
Upvote 0

iCAB

Well-Known Member
Licensed User
Longtime User
Hi Erel,

Please see the output that I am getting. That's why I am unable to use the name properly.
The first section of the file outputted using B4A, the second section is using B4I.
The device I am looking for is "WWA1 BLE"

Thanks for your help, greatly appreciated!
 

Attachments

  • B4A_B4I output.txt
    9.4 KB · Views: 256
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
try the code in post #2
change the uuid with your uuid from your device
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…