Android Question BLE With Android 8.1

Steve_ES

Member
Licensed User
Hello All,

I'm working through setting up a low power data link using an HM-10 and B4A. Using the iBeacon example I'm now getting the advertised data, and that's as far as I've got. A few questions:

There's an error referencing a member of a class that I can't resolve. The log entry in question is this:
"Class not found: b4a.example.customlistview, trying: b4a.example3.customlistview"

I don't remember what SDK level this example project was compiled with but I changed it to 27 which is needed work for my test using a Google Pixel. For SDK 27 are these the only permissions I need:

android.permission.BLUETOOTH
android.permission.BLUETOOTH_ADMIN
android.permission.ACCESS.COARSE_LOCATION*

Thanks,
Steve
 

Steve_ES

Member
Licensed User
Thank you, that's basically working, but a couple of questions:

When the embedded device is an iBeacon broadcaster the example project can only observe the broadcast reliably when the broadcast interval is fast, on the order of every 100ms. If the broadcast interval is at the desired value (1 sec or 3 sec) then many retries are needed to observe the broadcast. I recall seeing a thread on this awhile back but I can't find it.

One more thing, on the occasions when the beacon is observed the Map values are recorded in the log file as follows:
(MyMap) {1=[B@872faa9, -1=[B@90a682e, 22=[B@6c08fcf, 2=[B@4e87d5c, 10=[B@e579865, 9=[B@ed8d93a, 0=[B@16059eb}
So 7 entries are recorded, with the key values of 1, -1, 22, 2, 10, 9, and 0. I can't find how to related these fields back to any of the service or characteristic UUIDs or the iBeacon UUID. What am I missing here?
 

Steve_ES

Member
Licensed User
This is the raw data coming from my iBeacon device, trying to relate that to what is reported by the example project referenced above:

Raw data from iBeacon
0x0201061AFF4C00021574278BDAB6444520
8F0C720EAF05993500FFFFE1C5071600B0000
000000302E0FF020A000709484D536F6674


DataFields:
Len Type Value
02 1 0x06
1A FF 4C000215 --> Company =4C, Beacon=01 0x15 bytes following
74278BDAB64445208F0C720EAF059935 --> iBeacon UUID
00FF --> Minor
FFE1 --Major
C5 --> RSSI​
07 16 00B000 --> Service UUID
0000000 --> Data​
03 02 E0FF --> Service UUID for this device = 0xFFE0
02 0A 00 --> Tx Power Level = 0dbm
07 09 484D536F6674 --> ASCII string devicename="HMSoft"

I can see that the Key values in MyMap logged in the example project correspond to the raw values shown here.

The fields types shown here are 01,FF,16,02,0A and 09. This sort-of corresponds to the logged MyMap values:
(MyMap) {1=[B@872faa9, -1=[B@90a682e, 22=[B@6c08fcf, 2=[B@4e87d5c, 10=[B@e579865, 9=[B@ed8d93a, 0=[B@16059eb}

So what's the "0" value at the end?
What are the logged data fields, which all seem to have a header of "[B@"? The second data field has a type FF(hex), which is shown in MyMap as -1 (decimal), with a value of "[B@90a682e". How do I parse that field? That doesn't correspond to the raw data I'm seeing?

Thanks,
Steve
 
Top