Skip to main content

Mac

Trait Mac 

Source
pub trait Mac<'a> {
Show 15 methods // Required methods fn initialize(&self) -> Result<(), ErrorCode>; fn set_config_client(&self, client: &'a dyn ConfigClient); fn set_transmit_client(&self, client: &'a dyn TxClient); fn set_receive_client(&self, client: &'a dyn RxClient); fn set_receive_buffer(&self, buffer: &'static mut [u8]); fn get_address(&self) -> u16; fn get_address_long(&self) -> [u8; 8]; fn get_pan(&self) -> u16; fn set_address(&self, addr: u16); fn set_address_long(&self, addr: [u8; 8]); fn set_pan(&self, id: u16); fn config_commit(&self); fn is_on(&self) -> bool; fn start(&self) -> Result<(), ErrorCode>; fn transmit( &self, full_mac_frame: &'static mut [u8], frame_len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>;
}

Required Methods§

Source

fn initialize(&self) -> Result<(), ErrorCode>

Initializes the layer.

Source

fn set_config_client(&self, client: &'a dyn ConfigClient)

Sets the notified client for configuration changes

Source

fn set_transmit_client(&self, client: &'a dyn TxClient)

Sets the notified client for transmission completions

Source

fn set_receive_client(&self, client: &'a dyn RxClient)

Sets the notified client for frame receptions

Source

fn set_receive_buffer(&self, buffer: &'static mut [u8])

Sets the buffer for packet reception

Source

fn get_address(&self) -> u16

The short 16-bit address of the radio

Source

fn get_address_long(&self) -> [u8; 8]

The long 64-bit address of the radio

Source

fn get_pan(&self) -> u16

The 16-bit PAN id of the radio

Source

fn set_address(&self, addr: u16)

Sets the short 16-bit address of the radio

Source

fn set_address_long(&self, addr: [u8; 8])

Sets the long 64-bit address of the radio

Source

fn set_pan(&self, id: u16)

Sets the 16-bit PAN id of the radio

Source

fn config_commit(&self)

Must be called after one or more calls to set_*. If set_* is called without calling config_commit, there is no guarantee that the underlying hardware configuration (addresses, pan ID) is in line with this MAC protocol implementation. The specified config_client is notified on completed reconfiguration.

Source

fn is_on(&self) -> bool

Indicates whether or not the MAC protocol is active and can send frames

Source

fn start(&self) -> Result<(), ErrorCode>

Start the radio.

This serves as a passthrough to the underlying radio’s start method.

§Return

Ok(()) on success. On Err(), valid errors are:

  • ErrorCode::FAIL: Internal error occurred.
Source

fn transmit( &self, full_mac_frame: &'static mut [u8], frame_len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>

Transmits complete MAC frames, which must be prepared by an ieee802154::device::MacDevice before being passed to the Mac layer. Returns the frame buffer in case of an error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, R: Radio<'a>, A: Alarm<'a>> Mac<'a> for XMac<'a, R, A>

Source§

impl<'a, R: Radio<'a>> Mac<'a> for AwakeMac<'a, R>