Skip to main content

encode_frame

Function encode_frame 

Source
pub fn encode_frame(
    type_id: u8,
    tag: u16,
    payload: &[u8],
    out: &mut [u8],
) -> Result<usize, FrameEncodeError>
Expand description

Encode (type_id, tag, payload) as a complete DongLoRa Protocol frame (COBS-encoded, 0x00-terminated). Returns the number of bytes written to out.

out must be at least MAX_WIRE_FRAME bytes to satisfy the worst case across all frame shapes. Smaller buffers succeed when the actual frame fits.