Function hid_io_protocol::payload_len[][src]

pub fn payload_len(packet_data: &[u8]) -> Result<u32, HidIoParseError>

Determines payload of packet from a byte stream

Arguments

Remarks

Uses a packet byte stream to determine payload length. This length does not include the first 2 packet bytes in the overall packet length. The length does include the bytes used for the packet Id.

struct HidIo_Packet {
   ... (6 bits)
   uint8_t           upper_len:2; // Upper 2 bits of length field (generally unused)
   uint8_t           len;         // Lower 8 bits of length field
   ...
};