Struct rubble::l2cap::Sender[][src]

pub struct Sender<'a> {
    pdu: u8,
    tx: &'a mut dyn Producer,
    channel: Channel,
}
Expand description

Provides a way to send a L2CAP message with preallocated storage.

This can be done either in response to an incoming packet (via ProtocolObj::process_msg), or as a device-initiated packet (eg. an attribute notification).

Fields

pdu: u8

The protocol’s max. outgoing PDU size.

tx: &'a mut dyn Producer

Data PDU channel.

channel: Channel

Channel to which the response will be addressed.

Implementations

Creates a Sender from a Producer, ensuring that sufficient free space is available to fit a PDU described by chdata.

If there is not enough space in tx, returns None.

Enqueues an L2CAP message to be sent over the data connection.

L2CAP header (including the destination endpoint’s channel) and the data channel PDU header will be added automatically.

This will fail if there’s not enough space left in the TX queue.

Enqueues an L2CAP message encoded by a closure.

L2CAP header and data channel PDU header will be added automatically. The closure f only has to write the protocol PDU to transmit over L2CAP.

The L2CAP implementation will ensure that there are exactly Protocol::RSP_PDU_SIZE Bytes available in the ByteWriter passed to the closure.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.