Bluetooth Low Energy Host Stack  Rev. 4
API Reference Manual
L2CA

Overview


 

Files

file  l2ca_cb_interface.h
 
file  l2ca_types.h
 

Data Structures

struct  l2caLeCbConnectionRequest_t
 
struct  l2caLeCbConnectionComplete_t
 
struct  l2caLeCbDisconnection_t
 
struct  l2caLeCbNoPeerCredits_t
 
struct  l2caLeCbLocalCreditsNotification_t
 

Macros

#define gL2capCidNull_c
 
#define gL2capCidAtt_c
 
#define gL2capCidSignaling_c
 
#define gL2capCidSmp_c
 
#define gL2capCidSigAssignedFirst_c
 
#define gL2capCidSigAssignedLast_c
 
#define gL2capCidLePsmDynamicFirst_c
 
#define gL2capCidLePsmDynamicLast_c
 
#define gL2capCidNotApplicable_c
 
#define gL2caLePsmSigAssignedFirst_c
 
#define gL2caLePsmSigAssignedLast_c
 
#define gL2caLePsmDynamicFirst_c
 
#define gL2caLePsmDynamicLast_c
 
#define gL2capDefaultMtu_c
 
#define gL2capDefaultMps_c
 
#define gL2capMaximumMps_c
 
#define gExpandAsEnum_m(a, b, c)
 
#define gExpandAsTable_m(a, b, c)
 
#define gLePsmSigAssignedNumbersTable_m(entry)
 
#define gL2caLePsmSigAssignedCount_c
 
#define gL2caLePsmDynamicCount_c
 
#define gL2caMaxLePsmSupported_c
 

Typedefs

typedef l2caControlCallback_t l2caLeCbControlCallback_t
 
typedef void(* l2caLeCbDataCallback_t) (deviceId_t deviceId, uint16_t channelId, uint8_t *pPacket, uint16_t packetLength)
 
typedef void(* l2caGenericCallback_t) (deviceId_t deviceId, uint8_t *pPacket, uint16_t packetLength)
 
typedef void(* l2caControlCallback_t) (l2capControlMessageType_t messageType, void *pMessage)
 

Enumerations

enum  l2caLeCbConnectionRequestResult_t {
  gSuccessful_c, gLePsmNotSupported_c, gNoResourcesAvailable_c, gInsufficientAuthentication_c,
  gInsufficientAuthorization_c, gInsufficientEncryptionKeySize_c, gInsufficientEncryption_c, gInvalidSourceCid_c,
  gSourceCidAreadyAllocated_c, gCommandRejected_c, gResponseTimeout_c
}
 
enum  l2caLePsmSigAssignedType_t { gLePsmSigAssignedNumbersTable_m }
 
enum  l2caCommandRejectReasonType_t { gCommandNotUnderstood_c, gSignalingMtuExceeded_c, gInvalidCidInRequestd_c }
 
enum  l2capControlMessageType_t {
  gL2ca_LePsmConnectRequest_c, gL2ca_LePsmConnectionComplete_c, gL2ca_LePsmDisconnectNotification_c, gL2ca_NoPeerCredits_c,
  gL2ca_LocalCreditsNotification_c
}
 

Functions

bleResult_t L2ca_RegisterLeCbCallbacks (l2caLeCbDataCallback_t pCallback, l2caLeCbControlCallback_t pCtrlCallback)
 
bleResult_t L2ca_RegisterLePsm (uint16_t lePsm, uint16_t lePsmMtu)
 
bleResult_t L2ca_DeregisterLePsm (uint16_t lePsm)
 
bleResult_t L2ca_ConnectLePsm (uint16_t lePsm, deviceId_t deviceId, uint16_t initialCredits)
 
bleResult_t L2ca_DisconnectLeCbChannel (deviceId_t deviceId, uint16_t channelId)
 
bleResult_t L2ca_CancelConnection (uint16_t lePsm, deviceId_t deviceId, l2caLeCbConnectionRequestResult_t refuseReason)
 
bleResult_t L2ca_SendLeCbData (deviceId_t deviceId, uint16_t channelId, uint8_t *pPacket, uint16_t packetLength)
 
bleResult_t L2ca_SendLeCredit (deviceId_t deviceId, uint16_t channelId, uint16_t credits)
 

Data Structure Documentation

◆ l2caLeCbConnectionRequest_t

struct l2caLeCbConnectionRequest_t
Data Fields
deviceId_t deviceId
uint16_t lePsm
uint16_t peerMtu
uint16_t peerMps
uint16_t initialCredits

◆ l2caLeCbConnectionComplete_t

struct l2caLeCbConnectionComplete_t
Data Fields
deviceId_t deviceId
uint16_t cId
uint16_t peerMtu
uint16_t peerMps
uint16_t initialCredits
l2caLeCbConnectionRequestResult_t result

◆ l2caLeCbDisconnection_t

struct l2caLeCbDisconnection_t
Data Fields
deviceId_t deviceId
uint16_t cId

◆ l2caLeCbNoPeerCredits_t

struct l2caLeCbNoPeerCredits_t
Data Fields
deviceId_t deviceId
uint16_t cId

◆ l2caLeCbLocalCreditsNotification_t

struct l2caLeCbLocalCreditsNotification_t
Data Fields
deviceId_t deviceId
uint16_t cId
uint16_t localCredits

Function Documentation

◆ L2ca_RegisterLeCbCallbacks()

bleResult_t L2ca_RegisterLeCbCallbacks ( l2caLeCbDataCallback_t  pCallback,
l2caLeCbControlCallback_t  pCtrlCallback 
)


Registers callbacks for credit based data and control events on L2CAP.

Parameters
[in]pCallbackCallback function for data plane messages
[in]pCtrlCallbackCallback function for control plane messages
Returns
Result of the operation

◆ L2ca_RegisterLePsm()

bleResult_t L2ca_RegisterLePsm ( uint16_t  lePsm,
uint16_t  lePsmMtu 
)


Registers the LE_PSM from the L2CAP.

Parameters
[in]lePsmBluetooth SIG or Vendor LE_PSM
[in]lePsmMtuMTU of the registered PSM
Returns
Result of the operation

◆ L2ca_DeregisterLePsm()

bleResult_t L2ca_DeregisterLePsm ( uint16_t  lePsm)


Unregisters the LE_PSM from the L2CAP.

Parameters
[in]lePsmBluetooth SIG or Vendor LE_PSM
Returns
Result of the operation
Precondition
A LE_PSM must be registered a priori

◆ L2ca_ConnectLePsm()

bleResult_t L2ca_ConnectLePsm ( uint16_t  lePsm,
deviceId_t  deviceId,
uint16_t  initialCredits 
)


Initiates a connection with a peer device for a registered LE_PSM.

Parameters
[in]lePsmBluetooth SIG or Vendor LE_PSM
[in]deviceIdThe DeviceID for which the command is intended
[in]initialCreditsInitial credits
Returns
Result of the operation
Precondition
A LE_PSM must be registered a priori

◆ L2ca_DisconnectLeCbChannel()

bleResult_t L2ca_DisconnectLeCbChannel ( deviceId_t  deviceId,
uint16_t  channelId 
)


Disconnects a peer device for a registered LE_PSM.

Parameters
[in]deviceIdThe DeviceID for which the command is intended
[in]channelIdThe L2CAP Channel Id assigned on the initiator
Returns
Result of the operation
Precondition
A connection must have already been created
Remarks
Once this command is issued, all incoming data in transit for this device shall be discarded and any new additional outgoing data shall be discarded.

◆ L2ca_CancelConnection()

bleResult_t L2ca_CancelConnection ( uint16_t  lePsm,
deviceId_t  deviceId,
l2caLeCbConnectionRequestResult_t  refuseReason 
)


Terminates an L2CAP channel.

Parameters
[in]lePsmBluetooth SIG or Vendor LE_PSM
[in]deviceIdThe DeviceID for which the command is intended
[in]refuseReasonReason to refuse the channel creation
Returns
Result of the operation
Remarks
This interface can be used for a connection pending creation.

◆ L2ca_SendLeCbData()

bleResult_t L2ca_SendLeCbData ( deviceId_t  deviceId,
uint16_t  channelId,
uint8_t *  pPacket,
uint16_t  packetLength 
)


Sends a data packet through a Credit-Based Channel.

Parameters
[in]deviceIdThe DeviceID for which the command is intended
[in]channelIdThe L2CAP Channel Id assigned on the initiator
[in]pPacketData buffer to be transmitted
[in]packetLengthLength of the data buffer
Returns
Result of the operation
Precondition
An L2CAP Credit Based connection must be in place

◆ L2ca_SendLeCredit()

bleResult_t L2ca_SendLeCredit ( deviceId_t  deviceId,
uint16_t  channelId,
uint16_t  credits 
)


Sends credits to a device when capable of receiving additional LE-frames

Parameters
[in]deviceIdThe DeviceID to which credits are given
[in]channelIdThe L2CAP Channel Id assigned on the initiator
[in]creditsNumber of credits to be given
Returns
Result of the operation
Precondition
An L2CAP Credit Based connection must be in place