Skip to main content

Module wireless

Module wireless 

Source
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.
Telegramoms
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 the L field), checking every CRC. The data without CRCs is copied into out, which must hold at least L + 1 bytes.
encode_a
Encode a frame in format A: link fields, CI and payload, with a CRC after every block. Returns the number of bytes written. For simulators and tests.
openoms
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 L field is l, in format.