TI BLE-Stack for Bluetooth 4.2 API Documentation  3.01.00.07
Data Structures | Macros | Typedefs | Functions
l2cap.h File Reference

Detailed Description

L2CAP layer interface.

Go to the source code of this file.

Data Structures

struct  l2capChannelEstEvt_t
 L2CAP_CHANNEL_ESTABLISHED_EVT message format. More...
 
struct  l2capChannelInfo_t
 Local channel information format. More...
 
struct  l2capChannelTermEvt_t
 L2CAP_CHANNEL_TERMINATED_EVT message format. More...
 
struct  l2capCmdReject_t
 Command Reject format. More...
 
struct  l2capCoCInfo_t
 Connection oriented channel information format. More...
 
struct  l2capConnectReq_t
 Connection Request format. More...
 
struct  l2capConnectRsp_t
 Connection Response format. More...
 
struct  l2capCreditEvt_t
 L2CAP_OUT_OF_CREDIT_EVT or L2CAP_PEER_CREDIT_THRESHOLD_EVT message format. More...
 
struct  l2capDataEvent_t
 OSAL L2CAP_DATA_EVENT message format. More...
 
struct  l2capDisconnectReq_t
 Disconnection Request format (src/dst CIDs are relative to sender of request). More...
 
struct  l2capDisconnectRsp_t
 Disconnection Response format (src/dst CIDs are relative to sender of request). More...
 
struct  l2capFlowCtrlCredit_t
 Flow Control Credit format. More...
 
union  l2capInfo_t
 Information Response Data field. More...
 
struct  l2capInfoReq_t
 Information Request format. More...
 
struct  l2capInfoRsp_t
 Information Response format. More...
 
struct  l2capInvalidCID_t
 Invalid CID in Request format. More...
 
struct  l2capNumCtrlDataPktEvt_t
 L2CAP_NUM_CTRL_DATA_PKT_EVT message format. More...
 
struct  l2capPacket_t
 L2CAP packet structure. More...
 
struct  l2capParamUpdateReq_t
 Connection Parameter Update Request format. More...
 
struct  l2capParamUpdateRsp_t
 Connection Parameter Update Response format. More...
 
struct  l2capPsm_t
 L2CAP PSM structure. Allocated one for each registered PSM. More...
 
struct  l2capPsmInfo_t
 PSM information format. More...
 
union  l2capReasonData_t
 Command Reject Reason Data format. More...
 
struct  l2capSendSduDoneEvt_t
 L2CAP_SEND_SDU_DONE_EVT message format. More...
 
union  l2capSignalCmd_t
 Union of all L2CAP Signaling commands. More...
 
struct  l2capSignalEvent_t
 OSAL L2CAP_SIGNAL_EVENT message format. More...
 
struct  l2capUserCfg_t
 User configurable variables format. More...
 

Macros

#define invalidLocalCID   reasonData.invalidCID.localCID
 local CID
 
#define invalidRemoteCID   reasonData.invalidCID.remoteCID
 remote CID
 
#define L2CAP_CHANNEL_ESTABLISHED_EVT   0x60
 Channel Established Event.
 
#define L2CAP_CHANNEL_TERMINATED_EVT   0x61
 Channel Terminated Event.
 
#define L2CAP_CID_ATT   0x0004
 Attribute Protocol.
 
#define L2CAP_CID_GENERIC   0x0007
 Generic (proprietary channel)
 
#define L2CAP_CID_NULL   0x0000
 Illegal Identifier.
 
#define L2CAP_CID_SIG   0x0005
 L2CAP Signaling.
 
#define L2CAP_CID_SMP   0x0006
 Security Management Protocol.
 
#define L2CAP_CLOSED   0x00
 Closed - no channel associated with this CID.
 
#define L2CAP_CMD_REJECT   0x01
 Command Reject.
 
#define L2CAP_CONN_INSUFFICIENT_AUTHEN   0x0005
 Connection refused - insufficient authentication.
 
#define L2CAP_CONN_INSUFFICIENT_AUTHOR   0x0006
 Connection refused - insufficient authorization.
 
#define L2CAP_CONN_INSUFFICIENT_ENCRYPT   0x0008
 Connection refused - insufficient encryption.
 
#define L2CAP_CONN_INSUFFICIENT_KEY_SIZE   0x0007
 Connection refused - insufficient encryption key size.
 
#define L2CAP_CONN_NO_RESOURCES   0x0004
 Connection refused - no resources available.
 
#define L2CAP_CONN_PARAMS_ACCEPTED   0x0000
 Connection Parameters accepted.
 
#define L2CAP_CONN_PARAMS_REJECTED   0x0001
 Connection Parameters rejected.
 
#define L2CAP_CONN_PENDING_SEC_VERIFY   0xFFFF
 Connection security verification pending (used locally). Note - PSM must send back a Connection Response.
 
#define L2CAP_CONN_PSM_NOT_SUPPORTED   0x0002
 Connection refused - LE_PSM not supported.
 
#define L2CAP_CONN_SUCCESS   0x0000
 Connection successful.
 
#define L2CAP_CONNECT_REQ   0x14
 LE Credit Based Connection Request.
 
#define L2CAP_CONNECT_RSP   0x15
 LE Credit Based Connection Response.
 
#define L2CAP_DISCONNECT_REQ   0x06
 Disconnection Request.
 
#define L2CAP_DISCONNECT_RSP   0x07
 Disconnection Response.
 
#define L2CAP_DYNAMIC_CID_MAX   0x007F
 Dynamic Channel Identifier Max.
 
#define L2CAP_DYNAMIC_CID_MIN   0x0040
 Dynamic Channel Identifier Min.
 
#define L2CAP_DYNAMIC_PSM_MAX   0x00FF
 Dynamic PSM max.
 
#define L2CAP_DYNAMIC_PSM_MIN   0x0080
 Dynamic PSM min.
 
#define L2CAP_EXTENDED_FEATURES_SIZE   4
 Length of Extended Features bit mask.
 
#define L2CAP_FIXED_CHANNELS   0x00000080
 Fixed channels are supported.
 
#define L2CAP_FIXED_CHANNELS_ATT   0x10
 Fixed Channel ATT is supported.
 
#define L2CAP_FIXED_CHANNELS_SIG   0x20
 Fixed Channel L2CAP Signaling is supported.
 
#define L2CAP_FIXED_CHANNELS_SIZE   8
 Length of Fixed Channels bit mask.
 
#define L2CAP_FIXED_CHANNELS_SMP   0x40
 Fixed Channel SMP is supported.
 
#define L2CAP_FIXED_PSM_MAX   0x007F
 Fixed LE PSM max.
 
#define L2CAP_FIXED_PSM_MIN   0x0001
 Fixed LE PSM min.
 
#define L2CAP_FLOW_CTRL_CREDIT   0x16
 LE Flow Control Credit.
 
#define L2CAP_HDR_SIZE   4
 Basic L2CAP header: Length (2 bytes) + Channel ID (2 bytes)
 
#define L2CAP_INFO_CONNLESS_MTU   0x0001
 Connectionless MTU.
 
#define L2CAP_INFO_EXTENDED_FEATURES   0x0002
 Extended features supported.
 
#define L2CAP_INFO_FIXED_CHANNELS   0x0003
 Fixed channels supported.
 
#define L2CAP_INFO_NOT_SUPPORTED   0x0001
 L2CAP Not supported.
 
#define L2CAP_INFO_REQ   0x0a
 Information Request - not supported.
 
#define L2CAP_INFO_RSP   0x0b
 Information Response - not supported.
 
#define L2CAP_INFO_SUCCESS   0x0000
 L2CAP Success.
 
#define L2CAP_INVALID_PSM   0x0000
 Invalid PSM.
 
#define L2CAP_LEN_FIELD_SIZE   2
 SDU Length field size.
 
#define L2CAP_MTU_SIZE   23
 Minimum supported information payload for the Basic information frame (B-frame)
 
#define L2CAP_NUM_CO_CHANNELS_DEFAULT   3
 Default maximum number of L2CAP Connection Oriented Channels.
 
#define L2CAP_NUM_CTRL_DATA_PKT_EVT   0x65
 Available Ctrl Data Packets Event.
 
#define L2CAP_NUM_FIXED_CHANNELS   4
 Number of Fixed channels: one for each of ATT, Signaling, SMP and Generic channels.
 
#define L2CAP_NUM_PSM_DEFAULT   3
 Default maximum number of L2CAP Protocol/Service Multiplexers (PSM)
 
#define L2CAP_NUM_SIG_COMMANDS   1
 Number of Signaling Commands: one for Connection Parameter Update Request.
 
#define L2CAP_OPEN   0x01
 Open - channel is open.
 
#define L2CAP_OUT_OF_CREDIT_EVT   0x62
 Out Of Credit Event.
 
#define L2CAP_PARAM_UPDATE_REQ   0x12
 Connection Parameter Update Request.
 
#define L2CAP_PARAM_UPDATE_RSP   0x13
 Connection Parameter Update Response.
 
#define L2CAP_PDU_SIZE   ( L2CAP_HDR_SIZE + L2CAP_MTU_SIZE )
 L2CAP PDU Size. More...
 
#define L2CAP_PEER_CREDIT_THRESHOLD_EVT   0x63
 Peer Credit Threshold Event.
 
#define L2CAP_PENDING_CONN_RSP   0x02
 Waiting for Connection Response.
 
#define L2CAP_PENDING_DISCONN_RSP   0x03
 Waiting for Disconnection Response.
 
#define L2CAP_PENDING_INFO_RSP   0x05
 Waiting for Info Response.
 
#define L2CAP_PENDING_PARAM_UPDATE_RSP   0x04
 Waiting for Connection Parameter Update Response.
 
#define L2CAP_PENDING_SEC_VERIFY   0x06
 Waiting for Security Verification from local PSM.
 
#define L2CAP_REJECT_CMD_NOT_UNDERSTOOD   0x0000
 Command not understood.
 
#define L2CAP_REJECT_INVALID_CID   0x0002
 Invalid CID in request.
 
#define L2CAP_REJECT_SIGNAL_MTU_EXCEED   0x0001
 Signaling MTU exceeded.
 
#define L2CAP_RTX_TIMEOUT   30
 L2CAP Response Timeout Expired (RTX) More...
 
#define L2CAP_SDU_SIZE   512
 Maximum SDU size (PSM's MTU) that can be received on a Connection Oriented Channel.
 
#define L2CAP_SEND_SDU_DONE_EVT   0x64
 Send SDU Done Event.
 
#define L2CAP_SIG_MTU_SIZE   23
 Minimum supported information payload for the Control frame (C-frame)
 
#define L2CAP_TERM_BY_PEER_PSM   0x0002
 Channel terminated by peer PSM.
 
#define L2CAP_TERM_BY_PSM   0x0001
 Channel terminated by local PSM.
 
#define L2CAP_TERM_LINK_DOWN   0x0000
 Physical link gone down.
 
#define L2CAP_TERM_MAX_CREDIT_EXCEED   0x0003
 Credit count exceeded 65535.
 
#define L2CAP_TERM_MEM_ALLOC_ERROR   0x0009
 Memory allocation error occurred.
 
#define L2CAP_TERM_PSM_MTU_EXCEED   0x0005
 Total length of payload received exceeded local PSM's MTU.
 
#define L2CAP_TERM_RX_ERROR   0x0007
 LE-frame was received with error.
 
#define L2CAP_TERM_RX_PKT_NO_CREDIT   0x0006
 LE-frame was received from peer device that has a credit of count zero.
 
#define L2CAP_TERM_SDU_LEN_EXCEED   0x0004
 Total length of payload received exceeded SDU length specified in first LE-frame of SDU.
 
#define L2CAP_TERM_TX_ERROR   0x0008
 Error happened while trying to send LE-frame.
 
#define maxSignalMTU   reasonData.signalMTU
 max signal MTU
 

Typedefs

typedef uint16(* pfnVerifySecCB_t) (uint16 connHandle, uint8 id, l2capConnectReq_t *pReq)
 Callback function prototype to verify security when a Connection Request is received. More...
 

Functions

void * L2CAP_bm_alloc (uint16 size)
 L2CAP implementation of the allocator functionality. More...
 
uint16 L2CAP_BuildCmdReject (uint8 *pBuf, uint8 *pCmd)
 Build Command Reject. More...
 
uint16 L2CAP_BuildConnectReq (uint8 *pBuf, uint8 *pData)
 Build Connection Request. More...
 
uint16 L2CAP_BuildInfoRsp (uint8 *pBuf, uint8 *pData)
 Build Information Response. More...
 
uint16 L2CAP_BuildParamUpdateRsp (uint8 *pBuf, uint8 *pData)
 Build Connection Parameter Update Response. More...
 
bStatus_t L2CAP_ChannelInfo (uint16 CID, l2capChannelInfo_t *pInfo)
 Get information about a given active Connection Oriented Channel. More...
 
bStatus_t L2CAP_CmdReject (uint16 connHandle, uint8 id, l2capCmdReject_t *pCmdReject)
 Send Command Reject. More...
 
bStatus_t L2CAP_ConnectReq (uint16 connHandle, uint16 psm, uint16 peerPsm)
 Send Connection Request. More...
 
bStatus_t L2CAP_ConnectRsp (uint16 connHandle, uint8 id, uint16 result)
 Send Connection Response. More...
 
bStatus_t L2CAP_ConnParamUpdateReq (uint16 connHandle, l2capParamUpdateReq_t *pUpdateReq, uint8 taskId)
 Send Connection Parameter Update Request. More...
 
bStatus_t L2CAP_ConnParamUpdateRsp (uint16 connHandle, uint8 id, l2capParamUpdateRsp_t *pUpdateRsp)
 Send Connection Parameter Update Response. More...
 
bStatus_t L2CAP_DeregisterPsm (uint8 taskId, uint16 psm)
 Deregister a Protocol/Service Multiplexer with L2CAP. More...
 
bStatus_t L2CAP_DisconnectReq (uint16 CID)
 Send Disconnection Request. More...
 
bStatus_t L2CAP_FlowCtrlCredit (uint16 CID, uint16 peerCredits)
 Send Flow Control Credit. More...
 
uint16 L2CAP_GetMTU (void)
 Get the maximum payload size that L2CAP is capable of receiving. More...
 
uint16 L2CAP_GetParamValue (void)
 Get the L2CAP parameter value. More...
 
void L2CAP_HostNumCompletedPkts (uint16 connHandle, uint16 numCompletedPkts)
 Host Number of Completed Packets. More...
 
bStatus_t L2CAP_InfoReq (uint16 connHandle, l2capInfoReq_t *pInfoReq, uint8 taskId)
 Send Information Request. More...
 
bStatus_t L2CAP_ParseConnectReq (l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
 Parse Connection Request message. More...
 
bStatus_t L2CAP_ParseFlowCtrlCredit (l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
 Parse Flow Control Credit message. More...
 
bStatus_t L2CAP_ParseInfoReq (l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
 Parse Information Request message. More...
 
bStatus_t L2CAP_ParseParamUpdateReq (l2capSignalCmd_t *pCmd, uint8 *pData, uint16 len)
 Parse Connection Parameter Update Request. More...
 
bStatus_t L2CAP_PsmChannels (uint16 psm, uint8 numCIDs, uint16 *pCIDs)
 Get all active channels for a given registered PSM. More...
 
bStatus_t L2CAP_PsmInfo (uint16 psm, l2capPsmInfo_t *pInfo)
 Get information about a given registered PSM. More...
 
bStatus_t L2CAP_RegisterApp (uint8 taskId, uint16 CID)
 Register a protocol/application with an L2CAP fixed channel. More...
 
void L2CAP_RegisterFlowCtrlTask (uint8 taskId)
 Register task to recevie L2CAP Flow Control events when there are data buffers available for sending messages. More...
 
bStatus_t L2CAP_RegisterPsm (l2capPsm_t *pPsm)
 Register a Protocol/Service Multiplexer (PSM) with L2CAP. More...
 
bStatus_t L2CAP_SendData (uint16 connHandle, l2capPacket_t *pPkt)
 Send data packet over an L2CAP fixed channel established over a physical connection. More...
 
bStatus_t L2CAP_SendSDU (l2capPacket_t *pPkt)
 Send data packet over an L2CAP connection oriented channel established over a physical connection. More...
 
void L2CAP_SetBufSize (uint16 dataPktLen, uint8 numDataPkts)
 This API is used by the upper layer to set the maximum data packet size and the number of data packets allowed by the Controller. More...
 
void L2CAP_SetControllerToHostFlowCtrl (uint16 hostBuffSize, uint8 flowCtrlMode)
 Turn flow control on or off for data packets sent from the Controller to the Host. More...
 
void L2CAP_SetParamValue (uint16 value)
 Set the L2CAP parameter value. More...
 
void L2CAP_SetUserConfig (l2capUserCfg_t *pUserCfg)
 Set the user configurable variables for the L2CAP layer. More...
 
Copyright 2017, Texas Instruments Incorporated