Skip to main content

Module compact

Module compact 

Source
Expand description

Compact frames (EN 13757-3:2018 Annex G): values without their DIF/VIF layout.

A meter sends a full frame now and then (CI 78/7A/72) and compact frames (CI 79/7B/73) in between. A compact frame carries the format signature — a CRC of the full frame’s DIF, DIFE, VIF and VIFE bytes — the full-frame CRC of the records it stands for, and the data bytes only. A receiver keeps the layouts it has seen, keyed by signature, and rebuilds the full records from them.

compact:  79  signature(2, LE)  full-frame CRC(2, LE)  data…
format:   69  length  signature(2, LE)  DIF VIF … (the layout only)

The cache is the caller’s: implement Formats over a map or a database, or use the fixed-size FormatCache in firmware. Format::of computes a full frame’s layout and signature to put into it.

Structs§

Compact
A compact frame’s application data.
Format
A record layout: the DIF/DIFE/VIF/VIFE bytes of every record, and their signature.
FormatCache
A fixed-size cache of N layouts of at most B bytes, replacing the oldest: enough for the handful of meters a firmware listens to, without an allocator.

Traits§

Formats
Where compact frames find their layouts.