Struct capsules::ieee802154::virtual_mac::MuxMac
[−]
[src]
pub struct MuxMac<'a> { mac: &'a MacDevice<'a>, users: List<'a, MacUser<'a>>, inflight: Cell<Option<&'a MacUser<'a>>>, }
IEE 802.15.4 MAC device muxer that keeps a list of MAC users and sequences any pending transmission requests. Any received frames from the underlying MAC device are sent to all users.
Fields
mac: &'a MacDevice<'a>
users: List<'a, MacUser<'a>>
inflight: Cell<Option<&'a MacUser<'a>>>
Methods
impl<'a> MuxMac<'a>
[src]
pub const fn new(mac: &'a MacDevice<'a>) -> MuxMac<'a>
[src]
pub fn add_user(&self, user: &'a MacUser<'a>)
[src]
Registers a MAC user with this MAC mux device. Each MAC user should only be registered once.
fn get_next_op_if_idle(&self) -> Option<(&'a MacUser<'a>, Op)>
[src]
Gets the next MacUser
and operation to perform if an operation is not
already underway.
fn perform_op_async(&self, node: &'a MacUser<'a>, op: Op)
[src]
Performs a non-idle operation on a MacUser
asynchronously: that is, if the
transmission operation results in immediate failure, then return the
buffer to the MacUser
via its transmit client.
fn perform_op_sync(
&self,
node: &'a MacUser<'a>,
op: Op
) -> Option<(ReturnCode, Option<&'static mut [u8]>)>
[src]
&self,
node: &'a MacUser<'a>,
op: Op
) -> Option<(ReturnCode, Option<&'static mut [u8]>)>
Performs a non-idle operation on a MacUser
synchronously, returning
the error code and the buffer immediately.
fn do_next_op_async(&self)
[src]
Begins the next outstanding transmission if there is no ongoing
operation and there is a user waiting to transmit a frame.
Since this is being called asynchronously, return any buffers to the active
tx_client
via the send_done
callback in the event of failure.
fn do_next_op_sync(
&self,
new_node: &MacUser<'a>
) -> Option<(ReturnCode, Option<&'static mut [u8]>)>
[src]
&self,
new_node: &MacUser<'a>
) -> Option<(ReturnCode, Option<&'static mut [u8]>)>
Begins the next outstanding transmission if there is no ongoing
operation and there is a user waiting to transmit a frame. Since this is
being called synchronously, there is a need to identify the MacUser that
just queued its transmission request. This can only be done by comparing
the raw pointer references of the two users, since there is no
type-level way to guarantee that the enqueued user is actually in this Mux device's
users
list. It's safe because the raw pointer references are never
dereferenced.
If the newly-enqueued transmission is immediately executed by this mux device but fails immediately, return the buffer synchronously.
Trait Implementations
impl<'a> TxClient for MuxMac<'a>
[src]
fn send_done(&self, spi_buf: &'static mut [u8], acked: bool, result: ReturnCode)
[src]
When transmission is complete or fails, return the buffer used for transmission to the client. result
indicates whether or not the transmission was successful. Read more
impl<'a> RxClient for MuxMac<'a>
[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
)
When a frame is received, this callback is triggered. The client only receives an immutable borrow of the buffer. Only completely valid, unsecured frames that have passed the incoming security procedure are exposed to the client. Read more