Expand description
Wireless M-Bus link layer (EN 13757-4): frame formats A and B.
Both formats start with the same 10 bytes:
L C M M A A A A A A
^^^ ^^^^^^^^^^^ address: ID (4, BCD, LSB first), version, device type
manufacturer (LE, three letters)Format A (modes S, T and C with preamble A): every block carries its own CRC.
Block 1 is those 10 bytes, then blocks of 16 bytes, the last one shorter. L counts
the bytes after itself without the CRCs.
Format B (mode C with preamble B): block 1 has no CRC; block 2 (up to 118 bytes
including its CRC) ends with a CRC over blocks 1 and 2; a longer frame has a third
block with its own CRC. L counts the bytes after itself with the CRCs.
Stripped: the receiver already removed the CRCs; L counts the bytes after it.
CRCs are CRC-16/EN-13757, most significant byte first. The decoder copies the data without CRCs into a caller buffer, so the frame borrows from that buffer.
Re-exports§
pub use crate::app::Address;
Modules§
- control
- C-field values a meter sends.
Structs§
- Frame
- A decoded wireless frame, CRCs removed.
- Telegram
oms - A received wireless telegram, opened: link layer and application, decrypted where a key was found.
Enums§
- Format
- Frame format.
Functions§
- decode
- Decode a frame from
raw(starting at theLfield), checking every CRC. The data without CRCs is copied intoout, which must hold at leastL + 1bytes. - encode
- Encode a frame: link fields, CI and payload, with the CRCs
formatputs on the air (none forFormat::Stripped). Returns the number of bytes written. For simulators and tests;sim::Telegram(featureoms) builds the payload of a secured one. Format B follows EN 13757-4 asdecodereads it; no third-party format-B frame has confirmed either (D-006). - open
oms - One call from radio bytes to records: check and strip the CRCs, parse every layer,
and decrypt (and authenticate) with the meter’s key from
keys. - wire_
len - Number of bytes on the air for a frame whose
Lfield isl, informat.