XDK API  3.6.0
Documentation
Macros | Typedefs
BleL2cap.h File Reference
#include "BleTypes.h"
+ Include dependency graph for BleL2cap.h:

Macros

#define BLEL2CAP_MINIMUM_MTU   (0x17u)
 

Typedefs

typedef U8 BleL2capEvent
 

Detailed Description

Connection Oriented channels Introduction

The Bluetooth 4.1 specification brings the LE L2CAP connection oriented channels allowing two devices ( Through L2CAP Upper layer protocols or services) to exchange L2CAP frames. The LE L2CAP connection oriented Channels specification allows a device, called INITIATOR to create a LE L2CAP connection oriented to a remote device called RESPONDER. As INITIATOR, The LE L2CAP connection targets a remote LE L2CAP upper layer protocol/profile defined by the PSM (Protocol Service Multiplier). As RESPONDER, the LE L2CAP is listening for an incoming connection on a given PSM. During the connection the devices L2CAP capabilities are exchanged. An important remote device L2CAP capability information is the application MTU supported by the remote device. It defines the maximum length of the data packet that can be send to the remote device. Once connected, the device can exchange data packets ( with a length up to the remote device MTU size).

A device may act as both INITIATOR and RESPONDER at a same time.

Connection Oriented channels Introduction

Handlers

This implementation is using specific Handler of BleL2capHandler type, these handlers allow an Upper layer Protocol/ or Profile to provide its local capabilities to the LE l2CAP layer. The Handler shall be initiated and filled with local capabilities during when initiating a connection for the INITIATOR (BLEL2CAP_Connect) or when listening for an incoming connection as RESPONDER (BLEL2CAP_RegisterListenningHandler).

connection

As INITIATOR, The following fields are mandatory and shall be filled during BLEL2CAP_Connect for a connecting BleL2capHandler : bleL2capCallback: The Callback that will receive the LE L2CAP connection oriented channel event. connHandle: the physical connection handle identifying the remote device for which the LE L2CAP connection will be established. psm: The Protocol Service Multiplier (PSM) identifying the Upper layer/Upper protocol for which the local device is connecting t the remote device. rxBufferLen: The size of the Receiving buffer that may be allocated later using BLEL2CAP_AllocateReceiveBuffer, it will also be the local Maximum Payload Size (PSM) that a remote device will be able to send to the local device. If the local device is not able (or does not want) to receive data, it could set rxBufferLen to 0, otherwise the minimum allowed buffer length is BLEL2CAP_MINIMUM_MTU. (RxBufferLen == 0) or (RxBufferLen >= BLEL2CAP_MINIMUM_MTU) hciTxCredits : The number of HCI TX DATA packet allowed to be used by this handler, depending of the number additional HCI TX DATA buffers allocated with the NUM_TX_DATA_PACKETS configuration. If multiple HciBuffer are allowed then the L2CAP will queue in HCI buffer, the packet to send. More HCI data buffers are allocated more the bit-rate will be high.

Once connected the BLEL2CAPEVENT_CONNECTED event is reported in the LE L2CAP callback given in the L2CAP handler. During this event the parms field is a pointer to the impacted BleL2capHandler, the remoteUpperLayerMTU field of the BleL2capHandler have been filled by the L2CAP layer and represent the maximum size of data (MTU) that the remote device is able to receive(i.e. the maximum size that the local device will be then allowed to send to the remote device using BLEL2CAP_SendData).

for an incoming connection

As RESPONDER, The following fields are mandatory and shall be filled during BLEL2CAP_RegisterListenningHandler for a listening LE L2CAP handler: bleL2capCallback: The Callback that will receive the LE L2CAP connection oriented channel event. psm: The Protocol Service Multiplier (PSM) identifying the Upper layer/Upper protocol for which the local device is listening an incoming connection. rxBufferLen: The size of the Receiving buffer that may be allocated later using BLEL2CAP_AllocateReceiveBuffer, it will also be the local Maximum Payload Size (PSM) that a remote device will be able to send to the local device. If the local device is not able (or does not want) to receive data, it could set rxBufferLen to 0, otherwise the minimum allowed buffer length is BLEL2CAP_MINIMUM_MTU. (RxBufferLen == 0) or (RxBufferLen >= BLEL2CAP_MINIMUM_MTU) hciTxCredits : The number of HCI TX DATA packet allowed to be used by this handler, depending of the number additional HCI TX DATA buffers allocated with the NUM_TX_DATA_PACKETS configuration. If multiple HciBuffer are allowed then the L2CAP will queue in HCI buffer, the packet to send. More HCI data buffers are allocated more the bit-rate will be high.

Once connected the BLEL2CAPEVENT_CONNECTED event is reported in the LE L2CAP callback given in the L2CAP handler. During this event the parms field is a pointer to the impacted BleL2capHandler, the remoteUpperLayerMTU field of the BleL2capHandler have been filled by the L2CAp layer and represent the maximum size of data (MTU) that the remote device is able to receive(i.e. the maximum size that the local device will be then allowed to send to the remote device using BLEL2CAP_SendData).

Data.

It is up to the LE L2CAP layer to reassemble the complete LE L2CAP upper layer protocol or profile packet (named SDU in the Bluetooth Specification). The layer protocol or profile just allocate and give buffers to the L2CAP layer, then the L2CAP layer is in charge of filling these buffers upon data reception. The buffer are allocated for a given handler thanks to the BLEL2CAP_AllocateReceiveBuffer API, all the buffer allocated have the same length, which is the length provided during Handler initialisation (Connecting or listening) trough the rxBufferLen handler field. Once a complete packet is received the BLEL2CAPEVENT_LEFRAME_RXCOMPLETE event is reported in the LE L2CAP callback given in the L2CAP handler. During this event the parms field is containing a pointer to the impacted BleL2capHandler and a pointer to the receive buffer which is containing the received data, the received data length is provided as well and is from 1 byte to rxBufferLen bytes. Note that a receive buffer length cannot be less than 23 bytes.

Data.

Data are sent using the BLEL2CAP_SendData API, data are sent to a connected handler. The number of data bytes to send cannot exceed the remote device LE L2CAP MTU, provided in the remoteUpperLayerMTU field of the BleL2capHandler. It is up to the LE L2CAP layer to segment the complete LE L2CAP upper layer protocol or profile packet to send into several packet that could fill in the Bluetooth Low energy controllers. The segmentation is using HCI DATA transmit buffers and more HCI buffers are dedicated for the LE L2CAP upper layer protocol or profile, more segments can be sent to the Bluetooth Low energy controller, more the bit-rate will be high. Allocating HCI TX data buffer for this handler is done during handler initialisation.

Macro Definition Documentation

#define BLEL2CAP_MINIMUM_MTU   (0x17u)

BLEL2CAP_MINIMUM_MTU The minimum L2CAP MTU allowed by the Bluetooth Specification is 23 octets

Typedef Documentation

typedef U8 BleL2capEvent

BleL2capEvent This type is used as event received in the BleL2capCallback callback registered during the call of BLEL2CAP_RegisterChannelHandler() function. The possible values are described below:


All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:41 by doxygen 1.8.8