Expand description
Analyzer/canboatjs JSON records → wire frames (convert --from json,
the gateway bridges’ stdin TX, and the wasm bindings). Behind its own
feature because it is the one place a real JSON parser (serde_json)
is warranted.
Analyzer JSON records → wire frames: the driver behind canboat convert --from json, the gateway bridges’ stdin TX, and the wasm
bindings.
The input is line-delimited analyzer JSON, one record per line, in
either shape the analyzer emits: bare -json (unwrapped, fields
keyed by human name) or -camel (wrapped {"<pgnId>":{…}}, fields
keyed by camelCase id). The camel wrapper id names the exact PGN
variant and is the recommended form — bare records resolve by PGN
number alone and are rejected when the number is ambiguous (e.g. the
126208 group functions).
The -nv flavour ({"value":N,"name":"…"} per lookup/measured
field) is the lossless interchange form: the raw value is written
back verbatim. Plain scalars are accepted for numeric and lookup
fields, and strings for string / lookup-label / hex-binary fields;
date/time/duration display strings are NOT parsed back — feed -nv
JSON for those.
Repeating sets arrive exactly as the analyzer emits them: "list"
(set 1) and "list2" (set 2) arrays inside fields, one object per
iteration.
Bare physical values are read against the unit system the stream’s
{"version":…,"units":…} banner declares — degrees in a "std"
stream, radians in an "si" one. Without a banner the caller’s
assumption stands (--units, SI by default). -nv raw values are
unit-agnostic and unaffected.
This lives in the canboat crate behind the json-input feature
rather than in the engine because it is the one place a real
JSON parser is warranted — nested repeating lists and -nv objects
are beyond analyzer_json’s deliberate substring-scan minimalism —
and serde_json has no business in the core’s dependency closure.
The cli feature folds it in, so the binary always has it.
Structs§
- Json
Frame Reader - A
FrameSourcethat reads analyzer-JSON lines fromsrcand yields the re-encoded frames. Lines that fail to encode are skipped with a warning (mirroring the analyzer’s tolerance of undecodable input).
Functions§
- frame_
from_ json - Encode one analyzer-JSON line.
Ok(None)for records that are not messages (the{"version":…}startup header).