strongpoint
strongpoint

Reputation: 69

parse the following ibeacon packet

I am trying to parse this ibeacon packet received by scanning through a hci socket

b'\x01\x03\x00\x18\xbe\x99m\xf3\x14\x1e\x02\x01\x1a\x1a\xffL\x00\x02\x15e\xec\xe2\x90\xc7\xdbM\xd0\xb8\x1aV\xa6-b 2\x00\x00\x00\x02\xc5\xcc'

hex format 01 03 00 18 be 99 6d f3 14 1e 02 01 1a 1a ff 4c 00 02 15 65 ec e2 90 c7 db 4d d0 b8 1a 56 a6 2d 62 20 32 00 00 00 02 c5 cc

the parameters after applying the parser are 'UUID': '65ece290c7db4dd0b81a56a62d622032', 'MAJOR': '0000', 'MINOR': '0002', 'TX': -59, 'RSSI': -60 I am not sure if the RSSI portion of this parsing is right.

Referring to this https://stackoverflow.com/a/19040616/10355673 the last bit of the beacon advertising packet is the TX power value. so how do we get the rssi value? here, I have taken rssi to be cc and tx to be c5. Is this correct?

Upvotes: 0

Views: 728

Answers (1)

davidgyoung
davidgyoung

Reputation: 64951

There are flags headers before the manufacturer advertisement sequence shown below, but you really don't care about the flags. Here are the bytes you care about:

 ff # manufacturee adv type
 4c 00 # apple Bluetooth company code
 02 15  # iBeacon type code
 65 ec e2 90 c7 db 4d d0 b8 1a 56 a6 2d 62 20 32 # proximity uuid
 00 00 # major 
 00 02 # minor
 c5 # measured power (tx power)
 cc # crc

Proximity UUUD: 65ece290-c7db-4dd0-b81a-56a62d622032, Major: 0, Minor: 2, Measured Power: -59 dBm

The RSSI is not part of the transmitted packet, but a measurement taken by the receiver based on the strength of the signal. It will typically be a slightly different value for each packet that is received. You get this value from an API on a mobile device or embedded system that fetches it from the bluetooth chip.

Upvotes: 1

Related Questions