Struct rubble::link::responder::Responder [−][src]
pub struct Responder<C: Config> {
tx: <<C as Config>::PacketQueue as PacketQueue>::Producer,
rx: Option<<<C as Config>::PacketQueue as PacketQueue>::Consumer>,
l2cap: L2CAPState<C::ChannelMapper>,
}
Expand description
Data channel packet processor.
This hooks up to the Real-Time part of the LE Link Layer via a packet queue. This part can run at a lower priority (eg. being driven in the apps idle loop) and receives and transmits packets using the packet queue.
Some LL Control PDUs sent as part of the Link Layer Control Protocol (LLCP) are answered by
the responder directly, and all L2CAP data is forwarded to an L2CAPState<M>
. Note that most
LLCPDUs are handled directly by the real-time code.
Fields
tx: <<C as Config>::PacketQueue as PacketQueue>::Producer
rx: Option<<<C as Config>::PacketQueue as PacketQueue>::Consumer>
l2cap: L2CAPState<C::ChannelMapper>
Implementations
pub fn new(
tx: <<C as Config>::PacketQueue as PacketQueue>::Producer,
rx: <<C as Config>::PacketQueue as PacketQueue>::Consumer,
l2cap: L2CAPState<C::ChannelMapper>
) -> Self
pub fn new(
tx: <<C as Config>::PacketQueue as PacketQueue>::Producer,
rx: <<C as Config>::PacketQueue as PacketQueue>::Consumer,
l2cap: L2CAPState<C::ChannelMapper>
) -> Self
Creates a new packet processor hooked up to data channel packet queues.
Returns true
when this responder has work to do.
If this returns true
, process
may be called to process incoming packets and send
outgoing ones.
Processes a single incoming packet in the packet queue.
Returns Error::Eof
if there are no incoming packets in the RX queue.
pub fn l2cap(
&mut self
) -> L2CAPStateTx<'_, C::ChannelMapper, <<C as Config>::PacketQueue as PacketQueue>::Producer>
pub fn l2cap(
&mut self
) -> L2CAPStateTx<'_, C::ChannelMapper, <<C as Config>::PacketQueue as PacketQueue>::Producer>
Obtains access to the L2CAP instance.
fn with_rx<R>(
&mut self,
f: impl FnOnce(&mut <<C as Config>::PacketQueue as PacketQueue>::Consumer, &mut Self) -> R
) -> R
fn with_rx<R>(
&mut self,
f: impl FnOnce(&mut <<C as Config>::PacketQueue as PacketQueue>::Consumer, &mut Self) -> R
) -> R
A helper method that splits self
into the rx
and the remaining Self
.
This can possibly be removed after RFC 2229 (Closures Capture Disjoint Fields) is implemented in stable Rust.