Skip to main content

encode

Function encode 

Source
pub fn encode(
    format: Format,
    c: u8,
    address: &Address,
    ci: u8,
    payload: &[u8],
    out: &mut [u8],
) -> Result<usize>
Expand description

Encode a frame: link fields, CI and payload, with the CRCs format puts on the air (none for Format::Stripped). Returns the number of bytes written. For simulators and tests; sim::Telegram (feature oms) builds the payload of a secured one. Format B follows EN 13757-4 as decode reads it; no third-party format-B frame has confirmed either (D-006).

Error::InvalidLength when the frame cannot exist (L above 255), and Error::OutputTooSmall when out cannot hold it; nothing is a frame then.