Meshcore.Parsing (Meshcore v0.1.0)

Copy Markdown View Source

Parsers for the binary sub-structures carried by status, telemetry and ACL responses.

Summary

Functions

Parses an access-control list: 7 byte entries (6 byte key prefix, 1 byte permission). Empty (all-zero) slots are skipped.

Parses a repeater/room status block.

Functions

parse_acl(buf)

@spec parse_acl(binary()) :: [%{key: String.t(), perm: 0..255}]

Parses an access-control list: 7 byte entries (6 byte key prefix, 1 byte permission). Empty (all-zero) slots are skipped.

parse_status(data, pubkey_prefix \\ nil, offset \\ 0)

@spec parse_status(binary(), String.t() | nil, non_neg_integer()) :: map()

Parses a repeater/room status block.

offset is where the numeric fields start; for push frames that is 8 (code + reserved + 6 byte key prefix) and the key prefix is taken from the data. When pubkey_prefix is given (binary response path) it is used verbatim and the offset is 0.

Frames shorter than 52 bytes after the offset are zero-padded, as the Python parser tolerates short reads. :recv_errors is nil for frames from firmware older than v1.12.0.