The L2C subsystem implements the LE L2CAP protocol. It is a substantially scaled-down version of regular Bluetooth L2CAP.
L2C interfaces to HCI to send and receive ACL packets. The ATT and SMP protocol layers interface to L2C to send and receive L2CAP packets. L2C also interfaces to DM to perform the L2CAP connection update procedure.
In the TX data path, the main function of L2C is building L2CAP packets and sending them to HCI. L2C also implements flow control for the TX data path. L2C may in the future implement admission control in the TX path, allowing more optimal buffer sharing between multiple simultaneous links.
In the RX data path, its main function is receiving packets from HCI and routing them to either SMP or ATT. L2C also implements the connection parameter update procedure.
For full API, see L2CAP API
Module l2c_api contains the API. Module l2c_main contains the main API function implementation, main event handler, and functions for processing packets. Module l2c_master contains API functions and other functions used only when operating as an LE master. Module l2c_slave contains API functions and other functions used only when operating as an LE slave. Module lcc_coc contains functions for L2CAP Connection Oriented Channels.
This section describes example scenarios for initialization and connection.
Figure 2 shows the initialization process. In this example, the system supports operation as both a master and a slave so L2cMasterInit() and L2cSlaveInit() are called. Then function L2cSlaveHandlerInit() is called after L2cSlaveHandler() is set up in the WSF OS implementation.
Figure 3 shows the operation of the data path with ATT shown as an example L2C client. ATT calls L2cDataReq() to send a packet to L2C. Then L2C calls HciSendAclData() to send the packet to HCI. In the receive direction, HCI calls HciAclDataCback() to send a packet to L2C. L2C calls ATT callback function attDataCback() to send the packet to ATT.
Figure 4 shows a connection parameter update procedure with the stack operating as a slave. DM calls L2cDmConnUpdateReq() to initiate the process. L2C builds and sends an L2CAP Connection Parameter Update Request. The peer device receives the request and initiates a connection update procedure. When the procedure completes, an HCI LE Connection Update Complete Event is sent from HCI to DM. Then the L2CAP Connection Parameter Update Response is received from the peer and L2C calls DmL2cConnUpdateCnf().