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

Determines payload of packet from a byte stream

Arguments

  • packet_data - Vector of bytes

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
   ...
};