Documentation
¶
Overview ¶
Command roundtrip replays a candump log (candump -L / -l format) through the n2k decode pipeline and verifies that every decoded message re-encodes back to the bytes that were on the wire.
Usage:
go run ./cmd/roundtrip capture.log candump -L vcan0 | go run ./cmd/roundtrip -
Each CAN frame is fed through the same adapter the live pipeline uses (including fast-packet assembly), then every assembled payload is decoded with pgn.DecodeMessage and re-encoded with pgn.EncodeMessage, which returns a decoded message's original wire payload verbatim rather than reconstructing it field by field. By default every message is printed as a wire / re-encode byte pair (with a marker line under any differing bytes) followed by a summary; -quiet suppresses the per-message output. The result is classified per message:
exact re-encoded bytes match the wire bytes exactly
padded bytes match except for trailing 0xFF padding on one side
value-equal bytes differ, but decoding the re-encoded payload yields an
identical struct (usually reserved-bit or padding conventions)
MISMATCH re-encoded payload decodes to different field values
The whole log is always processed and the exit status is always 0 (2 for usage or I/O errors). Pass -report <file> to additionally collect every imperfect message (anything not exact/padded) plus the closing summary into a file for later review.