Skip to content

Read Eddystone TLM advertisement data #1310

Answered by Ripper346
Ripper346 asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, I looked into beacontools library and the code below gives the correct values. I write it so if anyone land on the question has a complete answer.

from construct import Struct, Int16ub, Int32ub, GreedyRange, Byte

UnencryptedTLMFrame = Struct(
    "frame_type" / Byte,
    "tlm_version" / Byte,
    "voltage" / Int16ub,
    "temperature" / Int16ub,
    "advertising_count" / Int32ub,
    "seconds_since_boot" / Int32ub,
)
frame = GreedyRange(UnencryptedTLMFrame)
parsed = frame.parse(b' \x00\x0b\xa3\x14\x80\x00\xc5\xf9\x03\x10\t\x08!')
parsed[0].voltage /= float(1000)
parsed[0].temperature /= float(256)

with struct it is (in the end you only missed the >)

frame_type, version, voltage, temp…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@Ripper346
Comment options

@dlech
Comment options

@Ripper346
Comment options

@Ripper346
Comment options

Answer selected by Ripper346
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants