0

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?

3
  • I am not sure how the string you show as the beacon packet is formatted. Typically this is shown as a series of bytes in hex format. (each byte is 2 characters 0-9 or a-f). But the string shown often has three characters (e.g. 99m, ffL, 15e, etc). What is this encoding? Commented Dec 7, 2018 at 23:10
  • @davidgyoung after applying struct.unpack on the byte string it becomes 01030018be996df3141e02011a1aff4c00021565ece290c7db4dd0b81a56a62d62203200000002c5cc I guess this is the hex format you are looking for? Commented Dec 7, 2018 at 23:47
  • cleaner 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 Commented Dec 7, 2018 at 23:54

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.