pub fn parse_mac_commands(data: &[u8], uplink: bool) -> MacCommandIterator<'_>Notable traits for MacCommandIterator<'a>impl<'a> Iterator for MacCommandIterator<'a>    type Item = MacCommand<'a>;
Expand description

Parses bytes to mac commands if possible.

Could return error if some values are out of range or the payload does not end at mac command boundry.

Argument

  • bytes - the data from which the MAC commands are to be built.
  • uplink - whether the packet is uplink or downlink.

Examples

let mut data = vec![0x02, 0x03, 0x00];
let mac_cmds: Vec<lorawan_encoding::maccommands::MacCommand> =
    lorawan_encoding::maccommands::parse_mac_commands(&data[..], true).collect();