Struct nrf52833_hal::ieee802154::Packet[][src]

pub struct Packet { /* fields omitted */ }

An IEEE 802.15.4 packet

This Packet is a PHY layer packet. It’s made up of the physical header (PHR) and the PSDU (PHY service data unit). The PSDU of this Packet will always include the MAC level CRC, AKA the FCS (Frame Control Sequence) – the CRC is fully computed in hardware and automatically appended on transmission and verified on reception.

The API lets users modify the usable part (not the CRC) of the PSDU via the deref and copy_from_slice methods. These methods will automatically update the PHR.

See figure 119 in the Product Specification of the nRF52840 for more details

Implementations

impl Packet[src]

pub const CAPACITY: u8[src]

Maximum amount of usable payload (CRC excluded) a single packet can contain, in bytes

pub fn new() -> Packet[src]

Returns an empty packet (length = 0)

pub fn copy_from_slice(&mut self, src: &[u8])[src]

Fills the packet payload with given src data

Panics

This function panics if src is larger than Self::CAPACITY

pub fn len(&self) -> u8[src]

Returns the size of this packet’s payload

pub fn set_len(&mut self, len: u8)[src]

Changes the size of the packet’s payload

Panics

This function panics if len is larger than Self::CAPACITY

pub fn lqi(&self) -> u8[src]

Returns the LQI (Link Quality Indicator) of the received packet

Note that the LQI is stored in the Packet’s internal buffer by the hardware so the value returned by this method is only valid after a Radio.recv operation. Operations that modify the Packet, like copy_from_slice or set_len+deref_mut, will overwrite the stored LQI value.

Also note that the hardware will not compute a LQI for packets smaller than 3 bytes so this method will return an invalid value for those packets.

Trait Implementations

impl Deref for Packet[src]

type Target = [u8]

The resulting type after dereferencing.

impl DerefMut for Packet[src]

Auto Trait Implementations

impl Send for Packet

impl Sync for Packet

impl Unpin for Packet

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<Src, Dst> LosslessTryInto<Dst> for Src where
    Dst: LosslessTryFrom<Src>, 
[src]

impl<Src, Dst> LossyInto<Dst> for Src where
    Dst: LossyFrom<Src>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.