pub trait RxClient {
// Required method
fn receive<'a>(
&self,
buf: &'a [u8],
header: Header<'a>,
lqi: u8,
data_offset: usize,
data_len: usize,
);
}
Expand description
Trait to be implemented by users of the IEEE 802.15.4 device that wish to receive frames.
The callback is triggered whenever a valid frame is received, verified and unsecured (via the IEEE 802.15.4 security procedure) successfully.
Required Methods§
Sourcefn receive<'a>(
&self,
buf: &'a [u8],
header: Header<'a>,
lqi: u8,
data_offset: usize,
data_len: usize,
)
fn receive<'a>( &self, buf: &'a [u8], header: Header<'a>, lqi: u8, 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.
buf
: The entire buffer containing the frame, including extra bytes in front used for the physical layer.header
: A fully-parsed representation of the MAC header, with the caveat that the auxiliary security header is still included if the frame was previously secured.lqi
: The link quality indicator of the received frame.data_offset
: Offset of the data payload relative tobuf
, so that the payload of the frame is contained inbuf[data_offset..data_offset + data_len]
.data_len
: Length of the data payload