Struct microbit::hal::ieee802154::Packet[][src]

pub struct Packet { /* fields omitted */ }
Expand description

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.

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

Dereferences the value.

impl DerefMut for Packet[src]

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

Mutably dereferences the value.

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Az for T[src]

pub fn az<Dst>(self) -> Dst where
    T: Cast<Dst>, 
[src]

Casts the value.

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> CheckedAs for T[src]

pub fn checked_as<Dst>(self) -> Option<Dst> where
    T: CheckedCast<Dst>, 
[src]

Casts the value.

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

pub fn lossless_try_into(self) -> Option<Dst>[src]

Performs the conversion.

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

pub fn lossy_into(self) -> Dst[src]

Performs the conversion.

impl<T> OverflowingAs for T[src]

pub fn overflowing_as<Dst>(self) -> (Dst, bool) where
    T: OverflowingCast<Dst>, 
[src]

Casts the value.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> SaturatingAs for T[src]

pub fn saturating_as<Dst>(self) -> Dst where
    T: SaturatingCast<Dst>, 
[src]

Casts the value.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> UnwrappedAs for T[src]

pub fn unwrapped_as<Dst>(self) -> Dst where
    T: UnwrappedCast<Dst>, 
[src]

Casts the value.

impl<T> WrappingAs for T[src]

pub fn wrapping_as<Dst>(self) -> Dst where
    T: WrappingCast<Dst>, 
[src]

Casts the value.