dot15d4_frame

Struct FrameBuilder

Source
pub struct FrameBuilder<'p, T> { /* private fields */ }
Expand description

A helper for building IEEE 802.15.4 frames.

Implementations§

Source§

impl<'p> FrameBuilder<'p, Ack>

Source

pub fn new_imm_ack(sequence_number: u8) -> Self

Create a new builder for an immediate acknowledgment frame.

Source

pub fn new_ack() -> Self

Create a new builder for an acknowledgment frame.

Source§

impl<'p> FrameBuilder<'p, Beacon>

Source

pub fn new_beacon() -> Self

Create a new builder for a beacon frame.

Source§

impl<'p> FrameBuilder<'p, EnhancedBeacon>

Source

pub fn new_enhanced_beacon() -> Self

Create a new builder for an enhanced beacon frame.

Source§

impl<'p> FrameBuilder<'p, Data>

Source

pub fn new_data(payload: &'p [u8]) -> Self

Create a new builder for a data frame.

Source§

impl<'p, T> FrameBuilder<'p, T>

Source

pub fn set_sequence_number(self, sequence_number: u8) -> Self

Set the frame sequence number.

§Note

This method disables sequence number suppression.

Source

pub fn set_dst_pan_id(self, pan_id: u16) -> Self

Set the destination PAN ID.

Source

pub fn set_src_pan_id(self, pan_id: u16) -> Self

Set the source PAN ID.

Source

pub fn set_dst_address(self, address: Address) -> Self

Set the destination address.

§Note

Based on the address, the addressing mode will be set.

Source

pub fn set_src_address(self, address: Address) -> Self

Set the source address.

§Note

Based on the address, the addressing mode will be set.

Source

pub fn add_header_information_element( self, ie: HeaderInformationElementRepr, ) -> Self

Add a header Information Element.

§Note

This method will enable the Information Elements Present bit in the frame control. The frame version will be set to IEEE 802.15.4-2020.

Source

pub fn add_payload_information_element( self, ie: PayloadInformationElementRepr, ) -> Self

Add a payload Information Element.

§Note

This method will enable the Information Elements Present bit in the frame control. The frame version will be set to IEEE 802.15.4-2020.

Source

pub fn set_payload(self, payload: &'p [u8]) -> Self

Set the frame payload.

Source

pub fn finalize(self) -> Result<FrameRepr<'p>>

Finalize the frame builder, returning the frame representation.

§Note

This method will check and set if PAN ID compression is possible, depending on the frame version.

Auto Trait Implementations§

§

impl<'p, T> Freeze for FrameBuilder<'p, T>

§

impl<'p, T> RefUnwindSafe for FrameBuilder<'p, T>
where T: RefUnwindSafe,

§

impl<'p, T> Send for FrameBuilder<'p, T>
where T: Send,

§

impl<'p, T> Sync for FrameBuilder<'p, T>
where T: Sync,

§

impl<'p, T> Unpin for FrameBuilder<'p, T>
where T: Unpin,

§

impl<'p, T> UnwindSafe for FrameBuilder<'p, T>
where T: UnwindSafe,

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> 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 = Infallible

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.