Expand description
Provides types and methods for parsing LoRaWAN payloads.
§Examples
use lorawan::parser::*;
use lorawan::keys::*;
let data = vec![0x40, 0x04, 0x03, 0x02, 0x01, 0x80, 0x01, 0x00, 0x01,
0xa6, 0x94, 0x64, 0x26, 0x15, 0xd6, 0xc3, 0xb5, 0x82];
if let Ok(PhyPayload::Data(DataPayload::Encrypted(phy))) = parse(data) {
let key = AES128([1; 16]);
let decrypted = phy.decrypt(None, Some(&key), 1).unwrap();
if let FRMPayload::Data(data_payload) =
decrypted.frm_payload() {
println!("{}", String::from_utf8_lossy(data_payload));
}
} else {
panic!("failed to parse data payload");
}
Structs§
- AppNonce represents a 24-bit network server nonce.
- DecryptedDataPayload represents a decrypted DataPayload.
- DecryptedJoinAcceptPayload represents a decrypted JoinAccept.
- DevAddr represents a 32-bit device address.
- DevNonce represents a 16-bit device nonce.
- EUI64 represents a 64-bit EUI.
- EncryptedDataPayload represents an encrypted data payload.
- EncryptedJoinAcceptPayload represents an encrypted JoinAccept.
- FCtrl represents the FCtrl from FHDR.
- FHDR represents FHDR from DataPayload.
- FRMMacCommands represents the mac commands.
- JoinAcceptPayload represents a JoinRequest.
- MHDR represents LoRaWAN MHDR.
- NwkAddr represents a 24-bit network address.
Enums§
- DataPayload is a type that represents a ConfirmedDataUp, ConfirmedDataDown, UnconfirmedDataUp or UnconfirmedDataDown.
- FRMPayload represents the FRMPayload that can either be the application data or mac commands.
- JoinAcceptPayload is a type that represents a JoinAccept.
- MType gives the possible message types of the PhyPayload.
- Major gives the supported LoRaWAN payload formats.
- PhyPayload is a type that represents a physical LoRaWAN payload.
Traits§
- Trait with the sole purpose to make clear distinction in some implementations between types that just happen to have AsRef and those that want to have the given implementations (like MICAble and MHDRAble).
- Helper trait for EncryptedDataPayload and DecryptedDataPayload.
- Helper trait to add mhdr to all types that should have it.
- Helper trait to add mic to all types that should have it.
Functions§
- Parses a payload as LoRaWAN physical payload.
- Parses a payload as LoRaWAN physical payload.