Skip to main content

Module l2cap

Module l2cap 

Source
Expand description

NimBLE L2CAP connection-oriented channels (CoC): a credit-based data pipe that runs parallel to GATT (both over a GAP connection), exposed as operations on the BleDriver.

Requires a NimBLE build with CoC enabled (CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM > 0); the whole module is #[cfg]-gated on that. A channel is opened either by listening on a PSM (l2cap_create_server) or by connecting to a peer’s PSM (l2cap_connect). Both, plus received SDUs and flow-control notifications, are delivered to the single l2cap_subscribe hook.

Flow control is credit-based and manual: after handling a L2capEvent::Received you replenish the peer’s credits with l2cap_recv_ready; a l2cap_send that runs out of credits reports SendOutcome::Stalled and resumes on L2capEvent::TxUnstalled.

Structs§

L2capChan
An opaque handle to an open L2CAP channel (wraps *mut ble_l2cap_chan).

Enums§

L2capEvent
An L2CAP CoC event, delivered on the host task to the single l2cap_subscribe hook. The hook returns an ATT-style status (0 = ok); it is only consulted for Accept, where non-zero rejects the peer.
SendOutcome
The result of a non-erroring l2cap_send.