pub enum Payload {
JoinRequest(JoinRequest),
JoinAccept(JoinAccept),
Data(Data),
RejoinRequest(RejoinRequest),
Proprietary(Vec<u8>),
}Expand description
Discriminated union over the five LoRaWAN message variants.
The variant is always determined by LoraPacket::m_type / the MHDR.
Use the LoraPacket::as_data / LoraPacket::as_join_request
helpers when you want to peek without an exhaustive match.
§Examples
use lora_packet::{LoraPacket, Payload};
let bytes = hex::decode("0039363463336913aa05693574323831338ef1c1d5ec6c")?;
let packet = LoraPacket::from_wire(&bytes)?;
if let Payload::JoinRequest(jr) = &packet.payload {
assert_eq!(jr.dev_nonce.as_bytes(), &[0xf1, 0x8e]);
}Variants§
JoinRequest(JoinRequest)
OTAA Join Request.
JoinAccept(JoinAccept)
Server-issued Join Accept (plaintext fields; the wire form is encrypted).
Data(Data)
Confirmed or unconfirmed Data frame, uplink or downlink.
RejoinRequest(RejoinRequest)
LoRaWAN 1.1 Rejoin Request (one of three types).
Proprietary(Vec<u8>)
Proprietary message body (opaque bytes).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Payload
impl<'de> Deserialize<'de> for Payload
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Payload
impl StructuralPartialEq for Payload
Auto Trait Implementations§
impl Freeze for Payload
impl RefUnwindSafe for Payload
impl Send for Payload
impl Sync for Payload
impl Unpin for Payload
impl UnsafeUnpin for Payload
impl UnwindSafe for Payload
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more