#[repr(u8)]pub enum MType {
JoinRequest = 0,
JoinAccept = 1,
UnconfirmedDataUp = 2,
UnconfirmedDataDown = 3,
ConfirmedDataUp = 4,
ConfirmedDataDown = 5,
RejoinRequest = 6,
Proprietary = 7,
}Expand description
LoRaWAN message types as encoded in the high 3 bits of the MHDR byte.
Use MType::from_mhdr to extract from a raw MHDR byte, or
Mhdr::m_type when you already have a Mhdr wrapper.
All variants are routed through the matching crate::Payload variant
when you parse with crate::LoraPacket::from_wire.
§Examples
use lora_packet::MType;
assert_eq!(MType::from_mhdr(0x40).unwrap(), MType::UnconfirmedDataUp);
assert_eq!(MType::from_mhdr(0xE0).unwrap(), MType::Proprietary);Variants§
JoinRequest = 0
Device join request (OTAA, MHDR bits = 000).
JoinAccept = 1
Server response to a join request (MHDR bits = 001).
UnconfirmedDataUp = 2
Uplink data without acknowledgment (MHDR bits = 010).
UnconfirmedDataDown = 3
Downlink data without acknowledgment (MHDR bits = 011).
ConfirmedDataUp = 4
Uplink data with acknowledgment (MHDR bits = 100).
ConfirmedDataDown = 5
Downlink data with acknowledgment (MHDR bits = 101).
RejoinRequest = 6
Rejoin request (LoRaWAN 1.1 only, MHDR bits = 110).
Proprietary = 7
Proprietary message body (MHDR bits = 111).
Implementations§
Source§impl MType
impl MType
Sourcepub const fn from_mhdr(mhdr: u8) -> Result<Self>
pub const fn from_mhdr(mhdr: u8) -> Result<Self>
Parse the 3-bit MType field from an MHDR byte.
§Errors
Returns Error::InvalidMType when the field does not match any defined value.
All 3-bit patterns are currently defined, so this never fails in practice,
but the signature is kept fallible for forward compatibility.