[][src]Function lorawan::maccommands::parse_mac_commands

pub fn parse_mac_commands(data: &[u8], uplink: bool) -> MacCommandIterator

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::maccommands::MacCommand> =
    lorawan::maccommands::parse_mac_commands(&data[..], true).collect();