Meshcore.Lpp (Meshcore v0.1.0)

Copy Markdown View Source

Decoder for Cayenne LPP (Low Power Payload) telemetry frames.

Mirrors Python's lpp_parse / lpp_json_encoder: a frame is a list of %{channel: integer, type: String.t(), value: term} maps. Multi-field types decode to maps (:gps → %{latitude:, longitude:, altitude:}), the gyrometer to a list, everything else to a number.

As in the Python library, a zero byte where a channel number is expected terminates parsing.

Summary

Functions

Parses a full LPP frame.

Parses a min/max/average (MMA) telemetry block: repeated channel, type, min, max, avg records.

Types

reading()

@type reading() :: %{channel: non_neg_integer(), type: String.t(), value: term()}

Functions

parse(buf)

@spec parse(binary()) :: {:ok, [reading()]} | {:error, term()}

Parses a full LPP frame.

Returns {:error, {:unknown_lpp_type, type}} or {:error, :truncated} for malformed input.

parse_mma(buf)

@spec parse_mma(binary()) :: {:ok, [map()]} | {:error, term()}

Parses a min/max/average (MMA) telemetry block: repeated channel, type, min, max, avg records.