pub trait RxClient {
// Required method
fn receive(
&self,
buf: &'static mut [u8],
frame_len: usize,
lqi: u8,
crc_valid: bool,
result: Result<(), ErrorCode>,
);
}
Expand description
Client for receiving packets.
Required Methods§
sourcefn receive(
&self,
buf: &'static mut [u8],
frame_len: usize,
lqi: u8,
crc_valid: bool,
result: Result<(), ErrorCode>,
)
fn receive( &self, buf: &'static mut [u8], frame_len: usize, lqi: u8, crc_valid: bool, result: Result<(), ErrorCode>, )
Packet was received.
§Arguments
buf
: Buffer containing the packet. This is the buffer provided viaRadioData::set_receive_buffer()
. The structure of this buffer is the same as in the TX case, as described in this HIL. That is, the first byte is reserved, and the full 802.15.4 starts with the PHR in the second byte.frame_len
: Length of the received frame, excluding the MAC footer. In other words, this length is PHR-MFR_SIZE. Note, this length does not correspond to the length of data from the start of the buffer. This length is from the third byte in the buffer (i.e.,buf[2:2+frame_length]
).lqi
: The Link Quality Indicator as measured by the receiver during the packet reception. This is on the scale as specified in the IEEE 802.15.4 specification (section 6.9.8), with value 0 being the lowest detectable signal and value 0xff as the highest quality detectable signal.crc_valid
: Whether the CRC check matched the received frame. Note, the MFR bytes are not required to be stored inbuf
so using this argument is the only reliable method for checking the CRC.result
: Status of the reception.Ok(())
when the packet was received normally. OnErr()
, valid errors are:ErrorCode::NOMEM
: Ack was requested, but there was no buffer available to transmit an ACK.ErrorCode::FAIL
: Internal error occurred.