Adventures in BLE Beacons, Day 4

Started trying to parse the advertising packets. I get something back like this dump.

The reference I found for the iBeacon format indicates that the data I'm looking for is in the manufacturer-specific data, which I dumped:

f1:02:0a:f4:64:34 is not a valid iBeacon.           
Manufacturer data:        
59 00 02 15  45 4e 56 53                         
42 00 00 00  33 05 00 00
6e 25 cb d8  01 00 01 00
d3  

So I see the first uint16_t representing the manufacturer ID I set in the sketch running on the Bluefruit:

#define MANUFACTURER_ID 0x0059

What I don't see is the UUID that I set in the sketch:

uint8_t beaconID[16] = {
    0x68, 0x65, 0x6c, 0x6c,
    0x6f, 0x2c, 0x20, 0x77,
    0x6f, 0x72, 0x6c, 0x64,
    0x21, 0x6b, 0x64, 0x69
};

When I run the locate app on my phone, though:

locate app running on the Nexus 5X

Note that f1:02:0a:f4:64:34 is my nRF52 device. The UUID that the app sees translates to

uint8_t beaconID[16] = {
    0x45, 0x4e, 0x56, 0x53,
    0x42, 0x00, 0x00, 0x00,
    0x5a, 0x29, 0x00, 0x00,
    0x8e, 0xb7, 0x31, 0xf1
};

The first eight bytes match the manufacturer data at offset 3.

Reading the mbed page on iBeacons gives some idea of what's supposed to go in the header. None of this matches what I'm seeing so far.

The next thing I wanted to try was turning off the additional scan response data, so I started picking through the code. And that's when I remembered I hadn't updated the beaconsense code to use my updated scheme (fixed UUID, major -> sensor, minor -> reading), and was still using the packet UUID format.

All right, let's try this out real quick. Now we get

Beacon: f1:02:0a:f4:64:34
Manufacturer data: 
59 00 02 15  68 65 6c 6c 
6f 2c 20 77  6f 72 6c 64
21 6b 64 69  02 00 10 27
d3  

And with the corresponding updates to the scanner code:

-----
Beacon: f1:02:0a:f4:64:34
        Major: 2
        Minor: 10000
Beacon: f1:02:0a:f4:64:34
        Major: 2
        Minor: 10000
Beacon: f1:02:0a:f4:64:34
        Major: 2
        Minor: 10000
Beacon: f1:02:0a:f4:64:34
        Major: 2
        Minor: 10000
Beacon: f1:02:0a:f4:64:34
        Major: 0
        Minor: 100
Beacon: f1:02:0a:f4:64:34
        Major: 0
        Minor: 100
Beacon: f1:02:0a:f4:64:34
        Major: 0
        Minor: 100

Voilá! Looks like we're getting somewhere.


Tags: , , ,