Skip to main content

encode_data_segment

Function encode_data_segment 

Source
pub fn encode_data_segment(
    data: &[u8],
    toggle: bool,
    last: bool,
) -> Result<SdoPayload>
Expand description

Encode a data segment carrying 1..=7 bytes of data.

Used for both the download-segment request and the upload-segment response (identical layout). toggle alternates each segment (the first is false); last marks the final segment. Returns Error::BadLength if data is longer than 7 bytes. An empty final segment (0 bytes) is allowed, so a zero-length value can be transferred.