AltBeacon setBeaconLayout()

user3494145 picture user3494145 · Nov 8, 2015 · Viewed 10.4k times · Source

I would like to know what the Beacon Code stands for. I mean, as far as I know it should identify the beacon layout. Does this mean that I can customize any sort of layout and assign to it any sort of Beacon Code? I mean, can I write something like that:

setBeaconLayout("m:2-3=abcd,i:4-13,i:14-23,p:24-24,d:25-25")?

Thanks for your help

Answer

Aray Karjauv picture Aray Karjauv · Mar 8, 2016

According to AltBeacon docs:

m - matching byte sequence for this beacon type to parse (exactly one required)

s - ServiceUuid for this beacon type to parse (optional, only for Gatt-based beacons)

i - identifier (at least one required, multiple allowed)

p - power calibration field (exactly one required)

d - data field (optional, multiple allowed)

x - extra layout. Signifies that the layout is secondary to a primary layout with the same matching byte sequence (or ServiceUuid). Extra layouts do not require power or identifier fields and create Beacon objects without identifiers.

Example of a parser string for AltBeacon:

"m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25"

This signifies that the beacon type will be decoded when an advertisement is found with 0xbeac in bytes 2-3, and a three-part identifier will be pulled out of bytes 4-19, bytes 20-21 and bytes 22-23, respectively. A signed power calibration value will be pulled out of byte 24, and a data field will be pulled out of byte 25.

here is the list of some beacon layouts

ALTBEACON      m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25
EDDYSTONE TLM  x,s:0-1=feaa,m:2-2=20,d:3-3,d:4-5,d:6-7,d:8-11,d:12-15
EDDYSTONE UID  s:0-1=feaa,m:2-2=00,p:3-3:-41,i:4-13,i:14-19
EDDYSTONE URL  s:0-1=feaa,m:2-2=10,p:3-3:-41,i:4-20v
IBEACON        m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24