Struct capsules::ieee802154::virtual_mac::MacUser
[−]
[src]
pub struct MacUser<'a> { mux: &'a MuxMac<'a>, operation: MapCell<Op>, next: ListLink<'a, MacUser<'a>>, tx_client: Cell<Option<&'a TxClient>>, rx_client: Cell<Option<&'a RxClient>>, }
Keep state for each Mac user. All users of the virtualized MAC interface
need to create one of these and register it with the MAC device muxer
MuxMac
by calling MuxMac#add_user
. Then, each MacUser
behaves exactly
like an independent MAC device, except MAC device state is shared between
all MacUsers because there is only one MAC device. For example, the MAC
device address is shared, so calling set_address
on one MacUser
sets the
MAC address for all MacUser
s.
Fields
mux: &'a MuxMac<'a>
operation: MapCell<Op>
next: ListLink<'a, MacUser<'a>>
tx_client: Cell<Option<&'a TxClient>>
rx_client: Cell<Option<&'a RxClient>>
Methods
impl<'a> MacUser<'a>
[src]
impl<'a> MacUser<'a>
[src]
fn send_done(&self, spi_buf: &'static mut [u8], acked: bool, result: ReturnCode)
[src]
fn receive<'b>(
&self,
buf: &'b [u8],
header: Header<'b>,
data_offset: usize,
data_len: usize
)
[src]
&self,
buf: &'b [u8],
header: Header<'b>,
data_offset: usize,
data_len: usize
)
Trait Implementations
impl<'a> ListNode<'a, MacUser<'a>> for MacUser<'a>
[src]
impl<'a> MacDevice<'a> for MacUser<'a>
[src]
fn set_transmit_client(&self, client: &'a TxClient)
[src]
Sets the transmission client of this MAC device
fn set_receive_client(&self, client: &'a RxClient)
[src]
Sets the receive client of this MAC device
fn get_address(&self) -> u16
[src]
The short 16-bit address of the MAC device
fn get_address_long(&self) -> [u8; 8]
[src]
The long 64-bit address (EUI-64) of the MAC device
fn get_pan(&self) -> u16
[src]
The 16-bit PAN ID of the MAC device
fn set_address(&self, addr: u16)
[src]
Set the short 16-bit address of the MAC device
fn set_address_long(&self, addr: [u8; 8])
[src]
Set the long 64-bit address (EUI-64) of the MAC device
fn set_pan(&self, id: u16)
[src]
Set the 16-bit PAN ID of the MAC device
fn config_commit(&self)
[src]
This method 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 device implementation. Read more
fn is_on(&self) -> bool
[src]
Returns if the MAC device is currently on.
fn prepare_data_frame(
&self,
buf: &'static mut [u8],
dst_pan: PanID,
dst_addr: MacAddress,
src_pan: PanID,
src_addr: MacAddress,
security_needed: Option<(SecurityLevel, KeyId)>
) -> Result<Frame, &'static mut [u8]>
[src]
&self,
buf: &'static mut [u8],
dst_pan: PanID,
dst_addr: MacAddress,
src_pan: PanID,
src_addr: MacAddress,
security_needed: Option<(SecurityLevel, KeyId)>
) -> Result<Frame, &'static mut [u8]>
Prepares a mutable buffer slice as an 802.15.4 frame by writing the appropriate header bytes into the buffer. This needs to be done before adding the payload because the length of the header is not fixed. Read more
fn transmit(&self, frame: Frame) -> (ReturnCode, Option<&'static mut [u8]>)
[src]
Transmits a frame that has been prepared by the above process. If the transmission process fails, the buffer inside the frame is returned so that it can be re-used. Read more