embassy-net

Crates

git

Versions

default

Flavors

Skip to main content

Ieee802154Repr

Struct Ieee802154Repr 

pub struct Ieee802154Repr {
    pub frame_type: FrameType,
    pub security_enabled: bool,
    pub frame_pending: bool,
    pub ack_request: bool,
    pub sequence_number: Option<u8>,
    pub pan_id_compression: bool,
    pub frame_version: FrameVersion,
    pub dst_pan_id: Option<Pan>,
    pub dst_addr: Option<Address>,
    pub src_pan_id: Option<Pan>,
    pub src_addr: Option<Address>,
}
Expand description

The fields of an IEEE 802.15.4 MAC header.

The layout of the header depends on its own fields (which addresses are present, whether the PAN identifier is compressed), so the header is parsed and emitted as a whole.

Fields§

§frame_type: FrameType§security_enabled: bool§frame_pending: bool§ack_request: bool§sequence_number: Option<u8>§pan_id_compression: bool§frame_version: FrameVersion§dst_pan_id: Option<Pan>§dst_addr: Option<Address>§src_pan_id: Option<Pan>§src_addr: Option<Address>

Implementations§

§

impl Repr

pub fn parse(buf: &[u8]) -> Result<(Repr, usize), Error>

Parse the MAC header of a frame.

Returns the header and its length, the auxiliary security header included. The payload starts at that offset.

Errors:

  • Error if the buffer is shorter than the header, or longer than 127 bytes, or the frame version or an addressing mode is unknown.

pub const fn buffer_len(&self) -> usize

Return the length of the MAC header this will emit.

pub fn emit(&self, buf: &mut [u8])

Write the MAC header into the front of buf.

Writes exactly buffer_len bytes. A missing sequence number or PAN identifier is written as zero.

§Panics

Panics if buf is shorter than buffer_len.

Trait Implementations§

§

impl Clone for Repr

§

fn clone(&self) -> Repr

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Copy for Repr

§

impl Debug for Repr

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Display for Repr

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Eq for Repr

§

impl Format for Repr

Available on crate feature defmt only.
§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
§

impl PartialEq for Repr

§

fn eq(&self, other: &Repr) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
§

impl StructuralPartialEq for Repr

Auto Trait Implementations§

§

impl Freeze for Repr

§

impl RefUnwindSafe for Repr

§

impl Send for Repr

§

impl Sync for Repr

§

impl Unpin for Repr

§

impl UnsafeUnpin for Repr

§

impl UnwindSafe for Repr

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.