Mistake on this page?
Report an issue in GitHub or email us
Data Structures | Macros | Typedefs
STACK_L2CAP_API

Data Structures

struct  l2cCocReg_t
 Connection oriented channel registration structure. More...
 
struct  l2cCocConnectInd_t
 Connection oriented channel connect indication structure. More...
 
struct  l2cCocDisconnectInd_t
 Connection oriented channel disconnect indication structure. More...
 
struct  l2cCocDataInd_t
 Connection oriented channel data indication structure. More...
 
struct  l2cCocDataCnf_t
 Connection oriented channel disconnect indication structure. More...
 
struct  l2cCocEnConnectInd_t
 Enhanced connection oriented channel connect indication structure. More...
 
struct  l2cCocEnReconfigInd_t
 Enhanced connection oriented channel reconfiguration indication structure. More...
 
union  l2cCocEvt_t
 Connection oriented channel event structure. More...
 
struct  l2cCfg_t
 Configurable parameters. More...
 

Macros

#define L2C_COC_REG_ID_NONE   0
 Invalid channel registration ID for connection oriented channels. More...
 
#define L2C_COC_CID_NONE   0
 Invalid channel ID for connection oriented channels. More...
 
#define L2C_SIGNAL_ID_INVALID   0
 Invalid signal identifier. More...
 
#define L2C_MAX_EN_CHAN   5
 Max number of channels per enhanced connection request. More...
 
#define L2C_PAYLOAD_START   (HCI_ACL_HDR_LEN + L2C_HDR_LEN)
 Start of L2CAP payload in an HCI ACL packet buffer. More...
 
#define L2C_SIG_PKT_BASE_LEN   (HCI_ACL_HDR_LEN + L2C_HDR_LEN + L2C_SIG_HDR_LEN)
 L2CAP signaling packet base length, including HCI header. More...
 
#define L2C_LE_SDU_PKT_BASE_LEN   (HCI_ACL_HDR_LEN + L2C_HDR_LEN + L2C_LE_SDU_HDR_LEN)
 L2CAP LE SDU packet base length, including HCI header. More...
 
#define L2C_SIG_RSP_FLAG   0x01
 Signaling response code flag. More...
 

Typedefs

typedef uint16_t l2cCocRegId_t
 Connection oriented channel registration ID. More...
 
typedef void(* l2cDataCback_t) (uint16_t handle, uint16_t len, uint8_t *pPacket)
 This callback function sends a received L2CAP packet to the client. More...
 
typedef void(* l2cCtrlCback_t) (wsfMsgHdr_t *pMsg)
 This callback function sends control messages to the client. More...
 
typedef void(* l2cCocCback_t) (l2cCocEvt_t *pMsg)
 This callback function sends data and other events to connection oriented channels clients. More...
 
typedef uint8_t(* l2cCocAcceptCb_t) (dmConnId_t connId, uint8_t numChans)
 This callback function asks clients of connection oriented channels if a given number of channels can be created on the PSM. More...
 
typedef uint16_t(* l2cCocAuthorCback_t) (dmConnId_t connId, l2cCocRegId_t regId, uint16_t psm)
 This callback function is used for authoriztion of connection oriented channels. More...
 

L2CAP Control Callback Events

Control callback message events

#define L2C_CTRL_FLOW_ENABLE_IND   0
 Data flow enabled. More...
 
#define L2C_CTRL_FLOW_DISABLE_IND   1
 Data flow disabled. More...
 

L2CAP COC Channel Roles

Connection oriented channel initiator/acceptor role

#define L2C_COC_ROLE_NONE   0x00
 No role (unallocated) More...
 
#define L2C_COC_ROLE_INITIATOR   0x01
 Channel initiator. More...
 
#define L2C_COC_ROLE_ACCEPTOR   0x02
 Channel acceptor. More...
 

L2CAP COC Data Confirm Codes

Connection oriented channel data confirm status values

#define L2C_COC_DATA_SUCCESS   0
 Data request successful. More...
 
#define L2C_COC_DATA_ERR_MEMORY   1
 Out of memory. More...
 
#define L2C_COC_DATA_ERR_OVERFLOW   2
 Transaction overflow. More...
 

L2CAP COC Callback Events

Connection oriented channel callback events.

#define L2C_COC_CBACK_START   0x70
 L2C callback event starting value. More...
 
#define L2C_COC_CBACK_CBACK_END   L2C_COC_DATA_CNF
 L2C callback event ending value. More...
 

L2CAP Initialization

Initialization and registration functions

void L2cInit (void)
 Initialize L2C subsystem. More...
 
void L2cMasterInit (void)
 Initialize L2C for operation as a Bluetooth LE master. More...
 
void L2cSlaveInit (void)
 Initialize L2C for operation as a Bluetooth LE slave. More...
 

L2CAP CID Functions

Register and send data over a CID

void L2cRegister (uint16_t cid, l2cDataCback_t dataCback, l2cCtrlCback_t ctrlCback)
 called by the L2C client, such as ATT or SMP, to register for the given CID. More...
 
void L2cDataReq (uint16_t cid, uint16_t handle, uint16_t len, uint8_t *pL2cPacket)
 Send an L2CAP data packet on the given CID. More...
 
void L2cDmSigReq (uint16_t handle, uint8_t code, uint16_t len, uint8_t *pParam)
 Build and send a signaling packet. More...
 

L2CAP COC Functions

Connection Oriented Channels Functions

void L2cCocInit (void)
 Initialize L2C connection oriented channel subsystem. More...
 
l2cCocRegId_t L2cCocRegister (l2cCocCback_t cback, l2cCocReg_t *pReg)
 Register to use a connection oriented channel, as either a channel acceptor, initiator, or both. If registering as channel acceptor then the PSM is specified. After registering a connection can be established by the client using this registration instance. More...
 
void L2cCocDeregister (l2cCocRegId_t regId)
 Deregister and deallocate a connection oriented channel registration instance. This function should only be called if there are no active channels using this registration instance. More...
 
void L2cCocSetAcceptCback (l2cCocRegId_t regId, l2cCocAcceptCb_t cback)
 Set the channel accept callback. More...
 
uint16_t L2cCocConnectReq (dmConnId_t connId, l2cCocRegId_t regId, uint16_t psm)
 Initiate a connection to the given peer PSM. More...
 
void L2cCocDisconnectReq (uint16_t cid)
 Disconnect the channel for the given CID. More...
 
void L2cCocDataReq (uint16_t cid, uint16_t len, uint8_t *pPayload)
 Send an L2CAP data packet on the given connection oriented CID. More...
 
bool_t L2cCocEnhancedConnectReq (dmConnId_t connId, l2cCocRegId_t regId, uint16_t psm, uint16_t credits, uint8_t numChan)
 Send a request to open enhanced credit based channels. More...
 
bool_t L2cCocEnhancedReconfigReq (dmConnId_t connId, uint16_t mtu, uint16_t mps, uint8_t numChan, uint16_t *pChanList)
 Send a request to reconfigure enhanced credit based channels. More...
 
void L2cCocErrorTest (uint16_t result)
 For testing purposes only. More...
 
void L2cCocCreditSendTest (uint16_t cid, uint16_t credits)
 For testing purposes only. More...
 

L2CAP Connection Parameter Update Functions

void L2cDmConnUpdateReq (uint16_t handle, hciConnSpec_t *pConnSpec)
 For internal use only. This function is called by DM to send an L2CAP connection update request. More...
 
void L2cDmConnUpdateRsp (uint8_t identifier, uint16_t handle, uint16_t result)
 For internal use only. This function is called by DM to send an L2CAP connection update response. More...
 

L2CAP Packet Constants

#define L2C_HDR_LEN   4
 L2CAP packet header length. More...
 
#define L2C_MIN_MTU   23
 Minimum packet payload MTU for LE. More...
 
#define L2C_SIG_HDR_LEN   4
 L2CAP signaling command header length. More...
 
#define L2C_LE_SDU_HDR_LEN   2
 L2CAP LE SDU data header length. More...
 

L2CAP Parameter Lengths

Signaling packet parameter lengths

#define L2C_SIG_CONN_UPDATE_REQ_LEN   8
 Connection update request length. More...
 
#define L2C_SIG_CONN_UPDATE_RSP_LEN   2
 Connection update response length. More...
 
#define L2C_SIG_CMD_REJ_LEN   2
 Command reject length. More...
 
#define L2C_SIG_DISCONN_REQ_LEN   4
 Disconnection request length. More...
 
#define L2C_SIG_DISCONN_RSP_LEN   4
 Disconnection response length. More...
 
#define L2C_SIG_LE_CONN_REQ_LEN   10
 LE connection request length. More...
 
#define L2C_SIG_LE_CONN_RSP_LEN   10
 LE connection response length. More...
 
#define L2C_SIG_FLOW_CTRL_CREDIT_LEN   4
 Flow control credit lenghth. More...
 
#define L2C_SIG_EN_CONNECT_REQ_LEN   8
 Enhanced credit based connection request. More...
 
#define L2C_SIG_EN_CONNECT_RSP_LEN   8
 Enhanced credit based connection response. More...
 
#define L2C_SIG_EN_RECONFIG_REQ_LEN   4
 Enhanced credit based reconfiguration request. More...
 
#define L2C_SIG_EN_RECONFIG_RSP_LEN   2
 Enhanced credit based reconfiguration response. More...
 

L2CAP Connection Identifiers

BLE Defined Connection Identifiers (CID)

#define L2C_CID_ATT   0x0004
 CID for attribute protocol. More...
 
#define L2C_CID_LE_SIGNALING   0x0005
 CID for LE signaling. More...
 
#define L2C_CID_SMP   0x0006
 CID for security manager protocol. More...
 

L2CAP Signaling Codes

#define L2C_SIG_CMD_REJ   0x01
 Comand reject. More...
 
#define L2C_SIG_DISCONNECT_REQ   0x06
 Disconnect request. More...
 
#define L2C_SIG_DISCONNECT_RSP   0x07
 Disconnect response. More...
 
#define L2C_SIG_CONN_UPDATE_REQ   0x12
 Connection parameter update request. More...
 
#define L2C_SIG_CONN_UPDATE_RSP   0x13
 Connection parameter update response. More...
 
#define L2C_SIG_LE_CONNECT_REQ   0x14
 LE credit based connection request. More...
 
#define L2C_SIG_LE_CONNECT_RSP   0x15
 LE credit based connection response. More...
 
#define L2C_SIG_FLOW_CTRL_CREDIT   0x16
 LE flow control credit. More...
 
#define L2C_SIG_EN_CONNECT_REQ   0x17
 Enhanced credit based connection request. More...
 
#define L2C_SIG_EN_CONNECT_RSP   0x18
 Enhanced credit based connection response. More...
 
#define L2C_SIG_EN_RECONFIG_REQ   0x19
 Enhanced credit based reconfiguration request. More...
 
#define L2C_SIG_EN_RECONFIG_RSP   0x1A
 Enhanced credit based reconfiguration response. More...
 

L2CAP Command Rejection Codes

BLE defined Command rejection reason codes

#define L2C_REJ_NOT_UNDERSTOOD   0x0000
 Command not understood. More...
 
#define L2C_REJ_MTU_EXCEEDED   0x0001
 Signaling MTU exceeded. More...
 
#define L2C_REJ_INVALID_CID   0x0002
 Invalid CID in request. More...
 

L2CAP Connection Parameter Update Result Codes

BLE defined result codes

#define L2C_CONN_PARAM_ACCEPTED   0x0000
 Connection parameters accepted. More...
 
#define L2C_CONN_PARAM_REJECTED   0x0001
 Connection parameters rejected. More...
 

L2CAP Connection Result Codes

BLE defined result codes

#define L2C_CONN_SUCCESS   0x0000
 Connection successful. More...
 
#define L2C_CONN_NONE   0x0001
 No connection result value available. More...
 
#define L2C_CONN_FAIL_PSM   0x0002
 Connection refused LE_PSM not supported. More...
 
#define L2C_CONN_FAIL_RES   0x0004
 Connection refused no resources available. More...
 
#define L2C_CONN_FAIL_AUTH   0x0005
 Connection refused insufficient authentication. More...
 
#define L2C_CONN_FAIL_AUTHORIZ   0x0006
 Connection refused insufficient authorization. More...
 
#define L2C_CONN_FAIL_KEY_SIZE   0x0007
 Connection refused insufficient encryption key size. More...
 
#define L2C_CONN_FAIL_ENC   0x0008
 Connection Refused insufficient encryption. More...
 
#define L2C_CONN_FAIL_INVALID_SCID   0x0009
 Connection refused invalid source CID. More...
 
#define L2C_CONN_FAIL_ALLOCATED_SCID   0x000A
 Connection refused source CID already allocated. More...
 
#define L2C_CONN_FAIL_UNACCEPT_PARAM   0x000B
 Connection refused unacceptable parameters. More...
 
#define L2C_CONN_FAIL_INVALID_PARAM   0x000C
 Connection refused invalid parameters. More...
 

L2CAP Interal Connection Result Codes

Proprietary codes not sent in any L2CAP packet.

#define L2C_CONN_FAIL_TIMEOUT   0xF000
 Request timeout. More...
 

L2CAP Signaling Parameter Value Ranges

#define L2C_PSM_MIN   0x0001
 PSM minimum. More...
 
#define L2C_PSM_MAX   0x00FF
 PSM maximum. More...
 
#define L2C_CID_DYN_MIN   0x0040
 CID dynamic minimum. More...
 
#define L2C_CID_DYN_MAX   0x007F
 CID dynamic maximum. More...
 
#define L2C_MTU_MIN   0x0017
 MTU minimum. More...
 
#define L2C_MPS_MIN   0x0017
 MPS minimum. More...
 
#define L2C_MPS_MAX   0xFFFD
 MPS maximum. More...
 
#define L2C_CREDITS_MAX   0xFFFF
 Credits maximum. More...
 

L2CAP Enhanced Connection Reconfigure Result Codes

#define L2C_RECONFIG_FAIL_MTU   0x0001
 Enhanced Reconfiguration refuded - cannot reduce MTU. More...
 
#define L2C_RECONFIG_FAIL_MPS   0x0002
 Enhanced Reconfiguration refuded - cannot reduce MPS on more than one channel. More...
 
#define L2C_RECONFIG_FAIL_CID   0x0003
 Enhanced Reconfiguration refuded - invalid CID. More...
 
#define L2C_RECONFIG_FAIL_PARAM   0x0004
 Enhanced Reconfiguration refuded - unacceptable parameters. More...
 

Detailed Description

Macro Definition Documentation

#define L2C_CID_ATT   0x0004

CID for attribute protocol.

Definition at line 82 of file l2c_defs.h.

#define L2C_CID_DYN_MAX   0x007F

CID dynamic maximum.

Definition at line 157 of file l2c_defs.h.

#define L2C_CID_DYN_MIN   0x0040

CID dynamic minimum.

Definition at line 156 of file l2c_defs.h.

#define L2C_CID_LE_SIGNALING   0x0005

CID for LE signaling.

Definition at line 83 of file l2c_defs.h.

#define L2C_CID_SMP   0x0006

CID for security manager protocol.

Definition at line 84 of file l2c_defs.h.

#define L2C_COC_CBACK_CBACK_END   L2C_COC_DATA_CNF

L2C callback event ending value.

Definition at line 92 of file l2c_api.h.

#define L2C_COC_CBACK_START   0x70

L2C callback event starting value.

Definition at line 80 of file l2c_api.h.

#define L2C_COC_CID_NONE   0

Invalid channel ID for connection oriented channels.

Definition at line 53 of file l2c_api.h.

#define L2C_COC_DATA_ERR_MEMORY   1

Out of memory.

Definition at line 72 of file l2c_api.h.

#define L2C_COC_DATA_ERR_OVERFLOW   2

Transaction overflow.

Definition at line 73 of file l2c_api.h.

#define L2C_COC_DATA_SUCCESS   0

Data request successful.

Definition at line 71 of file l2c_api.h.

#define L2C_COC_REG_ID_NONE   0

Invalid channel registration ID for connection oriented channels.

Definition at line 50 of file l2c_api.h.

#define L2C_COC_ROLE_ACCEPTOR   0x02

Channel acceptor.

Definition at line 64 of file l2c_api.h.

#define L2C_COC_ROLE_INITIATOR   0x01

Channel initiator.

Definition at line 63 of file l2c_api.h.

#define L2C_COC_ROLE_NONE   0x00

No role (unallocated)

Definition at line 62 of file l2c_api.h.

#define L2C_CONN_FAIL_ALLOCATED_SCID   0x000A

Connection refused source CID already allocated.

Definition at line 138 of file l2c_defs.h.

#define L2C_CONN_FAIL_AUTH   0x0005

Connection refused insufficient authentication.

Definition at line 133 of file l2c_defs.h.

#define L2C_CONN_FAIL_AUTHORIZ   0x0006

Connection refused insufficient authorization.

Definition at line 134 of file l2c_defs.h.

#define L2C_CONN_FAIL_ENC   0x0008

Connection Refused insufficient encryption.

Definition at line 136 of file l2c_defs.h.

#define L2C_CONN_FAIL_INVALID_PARAM   0x000C

Connection refused invalid parameters.

Definition at line 140 of file l2c_defs.h.

#define L2C_CONN_FAIL_INVALID_SCID   0x0009

Connection refused invalid source CID.

Definition at line 137 of file l2c_defs.h.

#define L2C_CONN_FAIL_KEY_SIZE   0x0007

Connection refused insufficient encryption key size.

Definition at line 135 of file l2c_defs.h.

#define L2C_CONN_FAIL_PSM   0x0002

Connection refused LE_PSM not supported.

Definition at line 131 of file l2c_defs.h.

#define L2C_CONN_FAIL_RES   0x0004

Connection refused no resources available.

Definition at line 132 of file l2c_defs.h.

#define L2C_CONN_FAIL_TIMEOUT   0xF000

Request timeout.

Definition at line 147 of file l2c_defs.h.

#define L2C_CONN_FAIL_UNACCEPT_PARAM   0x000B

Connection refused unacceptable parameters.

Definition at line 139 of file l2c_defs.h.

#define L2C_CONN_NONE   0x0001

No connection result value available.

Definition at line 130 of file l2c_defs.h.

#define L2C_CONN_PARAM_ACCEPTED   0x0000

Connection parameters accepted.

Definition at line 121 of file l2c_defs.h.

#define L2C_CONN_PARAM_REJECTED   0x0001

Connection parameters rejected.

Definition at line 122 of file l2c_defs.h.

#define L2C_CONN_SUCCESS   0x0000

Connection successful.

Definition at line 129 of file l2c_defs.h.

#define L2C_CREDITS_MAX   0xFFFF

Credits maximum.

Definition at line 161 of file l2c_defs.h.

#define L2C_CTRL_FLOW_DISABLE_IND   1

Data flow disabled.

Definition at line 46 of file l2c_api.h.

#define L2C_CTRL_FLOW_ENABLE_IND   0

Data flow enabled.

Definition at line 45 of file l2c_api.h.

#define L2C_HDR_LEN   4

L2CAP packet header length.

Definition at line 42 of file l2c_defs.h.

#define L2C_LE_SDU_HDR_LEN   2

L2CAP LE SDU data header length.

Definition at line 45 of file l2c_defs.h.

#define L2C_LE_SDU_PKT_BASE_LEN   (HCI_ACL_HDR_LEN + L2C_HDR_LEN + L2C_LE_SDU_HDR_LEN)

L2CAP LE SDU packet base length, including HCI header.

Definition at line 58 of file l2c_defs.h.

#define L2C_MAX_EN_CHAN   5

Max number of channels per enhanced connection request.

Definition at line 49 of file l2c_defs.h.

#define L2C_MIN_MTU   23

Minimum packet payload MTU for LE.

Definition at line 43 of file l2c_defs.h.

#define L2C_MPS_MAX   0xFFFD

MPS maximum.

Definition at line 160 of file l2c_defs.h.

#define L2C_MPS_MIN   0x0017

MPS minimum.

Definition at line 159 of file l2c_defs.h.

#define L2C_MTU_MIN   0x0017

MTU minimum.

Definition at line 158 of file l2c_defs.h.

#define L2C_PAYLOAD_START   (HCI_ACL_HDR_LEN + L2C_HDR_LEN)

Start of L2CAP payload in an HCI ACL packet buffer.

Definition at line 52 of file l2c_defs.h.

#define L2C_PSM_MAX   0x00FF

PSM maximum.

Definition at line 155 of file l2c_defs.h.

#define L2C_PSM_MIN   0x0001

PSM minimum.

Definition at line 154 of file l2c_defs.h.

#define L2C_RECONFIG_FAIL_CID   0x0003

Enhanced Reconfiguration refuded - invalid CID.

Definition at line 170 of file l2c_defs.h.

#define L2C_RECONFIG_FAIL_MPS   0x0002

Enhanced Reconfiguration refuded - cannot reduce MPS on more than one channel.

Definition at line 169 of file l2c_defs.h.

#define L2C_RECONFIG_FAIL_MTU   0x0001

Enhanced Reconfiguration refuded - cannot reduce MTU.

Definition at line 168 of file l2c_defs.h.

#define L2C_RECONFIG_FAIL_PARAM   0x0004

Enhanced Reconfiguration refuded - unacceptable parameters.

Definition at line 171 of file l2c_defs.h.

#define L2C_REJ_INVALID_CID   0x0002

Invalid CID in request.

Definition at line 114 of file l2c_defs.h.

#define L2C_REJ_MTU_EXCEEDED   0x0001

Signaling MTU exceeded.

Definition at line 113 of file l2c_defs.h.

#define L2C_REJ_NOT_UNDERSTOOD   0x0000

Command not understood.

Definition at line 112 of file l2c_defs.h.

#define L2C_SIG_CMD_REJ   0x01

Comand reject.

Definition at line 91 of file l2c_defs.h.

#define L2C_SIG_CMD_REJ_LEN   2

Command reject length.

Definition at line 66 of file l2c_defs.h.

#define L2C_SIG_CONN_UPDATE_REQ   0x12

Connection parameter update request.

Definition at line 94 of file l2c_defs.h.

#define L2C_SIG_CONN_UPDATE_REQ_LEN   8

Connection update request length.

Definition at line 64 of file l2c_defs.h.

#define L2C_SIG_CONN_UPDATE_RSP   0x13

Connection parameter update response.

Definition at line 95 of file l2c_defs.h.

#define L2C_SIG_CONN_UPDATE_RSP_LEN   2

Connection update response length.

Definition at line 65 of file l2c_defs.h.

#define L2C_SIG_DISCONN_REQ_LEN   4

Disconnection request length.

Definition at line 67 of file l2c_defs.h.

#define L2C_SIG_DISCONN_RSP_LEN   4

Disconnection response length.

Definition at line 68 of file l2c_defs.h.

#define L2C_SIG_DISCONNECT_REQ   0x06

Disconnect request.

Definition at line 92 of file l2c_defs.h.

#define L2C_SIG_DISCONNECT_RSP   0x07

Disconnect response.

Definition at line 93 of file l2c_defs.h.

#define L2C_SIG_EN_CONNECT_REQ   0x17

Enhanced credit based connection request.

Definition at line 99 of file l2c_defs.h.

#define L2C_SIG_EN_CONNECT_REQ_LEN   8

Enhanced credit based connection request.

Definition at line 72 of file l2c_defs.h.

#define L2C_SIG_EN_CONNECT_RSP   0x18

Enhanced credit based connection response.

Definition at line 100 of file l2c_defs.h.

#define L2C_SIG_EN_CONNECT_RSP_LEN   8

Enhanced credit based connection response.

Definition at line 73 of file l2c_defs.h.

#define L2C_SIG_EN_RECONFIG_REQ   0x19

Enhanced credit based reconfiguration request.

Definition at line 101 of file l2c_defs.h.

#define L2C_SIG_EN_RECONFIG_REQ_LEN   4

Enhanced credit based reconfiguration request.

Definition at line 74 of file l2c_defs.h.

#define L2C_SIG_EN_RECONFIG_RSP   0x1A

Enhanced credit based reconfiguration response.

Definition at line 102 of file l2c_defs.h.

#define L2C_SIG_EN_RECONFIG_RSP_LEN   2

Enhanced credit based reconfiguration response.

Definition at line 75 of file l2c_defs.h.

#define L2C_SIG_FLOW_CTRL_CREDIT   0x16

LE flow control credit.

Definition at line 98 of file l2c_defs.h.

#define L2C_SIG_FLOW_CTRL_CREDIT_LEN   4

Flow control credit lenghth.

Definition at line 71 of file l2c_defs.h.

#define L2C_SIG_HDR_LEN   4

L2CAP signaling command header length.

Definition at line 44 of file l2c_defs.h.

#define L2C_SIG_LE_CONN_REQ_LEN   10

LE connection request length.

Definition at line 69 of file l2c_defs.h.

#define L2C_SIG_LE_CONN_RSP_LEN   10

LE connection response length.

Definition at line 70 of file l2c_defs.h.

#define L2C_SIG_LE_CONNECT_REQ   0x14

LE credit based connection request.

Definition at line 96 of file l2c_defs.h.

#define L2C_SIG_LE_CONNECT_RSP   0x15

LE credit based connection response.

Definition at line 97 of file l2c_defs.h.

#define L2C_SIG_PKT_BASE_LEN   (HCI_ACL_HDR_LEN + L2C_HDR_LEN + L2C_SIG_HDR_LEN)

L2CAP signaling packet base length, including HCI header.

Definition at line 55 of file l2c_defs.h.

#define L2C_SIG_RSP_FLAG   0x01

Signaling response code flag.

Definition at line 106 of file l2c_defs.h.

#define L2C_SIGNAL_ID_INVALID   0

Invalid signal identifier.

Definition at line 56 of file l2c_api.h.

Typedef Documentation

typedef uint8_t(* l2cCocAcceptCb_t) (dmConnId_t connId, uint8_t numChans)

This callback function asks clients of connection oriented channels if a given number of channels can be created on the PSM.

Parameters
connIdDM connection ID.
numChansnumber of channels requested.
Returns
number of channels permitted by client.

Definition at line 269 of file l2c_api.h.

typedef uint16_t(* l2cCocAuthorCback_t) (dmConnId_t connId, l2cCocRegId_t regId, uint16_t psm)

This callback function is used for authoriztion of connection oriented channels.

Parameters
connIdDM connection ID.
regIdThe registration instance requiring authorization.
psmThe PSM of the registration instance.
Returns
L2C_CONN_SUCCESS if authorization is successful, any other value for failure.

Definition at line 282 of file l2c_api.h.

typedef void(* l2cCocCback_t) (l2cCocEvt_t *pMsg)

This callback function sends data and other events to connection oriented channels clients.

Parameters
pMsgPointer to message structure.
Returns
None.

Definition at line 256 of file l2c_api.h.

typedef uint16_t l2cCocRegId_t

Connection oriented channel registration ID.

Definition at line 100 of file l2c_api.h.

typedef void(* l2cCtrlCback_t) (wsfMsgHdr_t *pMsg)

This callback function sends control messages to the client.

Parameters
pMsgPointer to message structure.
Returns
None.

Definition at line 244 of file l2c_api.h.

typedef void(* l2cDataCback_t) (uint16_t handle, uint16_t len, uint8_t *pPacket)

This callback function sends a received L2CAP packet to the client.

Parameters
handleThe connection handle.
lenThe length of the L2CAP payload data in pPacket.
pPacketA buffer containing the packet.
Returns
None.

Definition at line 233 of file l2c_api.h.

Enumeration Type Documentation

anonymous enum

COC callback events.

Enumerator
L2C_COC_CONNECT_IND 

L2C callback event starting value.

Channel connect indication

L2C_COC_DISCONNECT_IND 

Channel disconnect indication.

L2C_COC_EN_CONNECT_IND 

Received enhanced connection indication.

L2C_COC_EN_RECONFIG_IND 

Received enhanced reconfiguration indication.

L2C_COC_DATA_IND 

Received data indication.

L2C_COC_DATA_CNF 

Transmit data confirm.

Definition at line 82 of file l2c_api.h.

Function Documentation

uint16_t L2cCocConnectReq ( dmConnId_t  connId,
l2cCocRegId_t  regId,
uint16_t  psm 
)

Initiate a connection to the given peer PSM.

Parameters
connIdDM connection ID.
regIdThe associated registration instance.
psmPeer PSM.
Returns
Local CID or L2C_COC_CID_NONE none if failure.
void L2cCocCreditSendTest ( uint16_t  cid,
uint16_t  credits 
)

For testing purposes only.

Parameters
cidThe local channel identifier.
creditsCredits to send.
Returns
None.
void L2cCocDataReq ( uint16_t  cid,
uint16_t  len,
uint8_t *  pPayload 
)

Send an L2CAP data packet on the given connection oriented CID.

Parameters
cidThe local channel identifier.
lenThe length of the payload data in pPacket.
pPayloadPacket payload data.
Returns
None.
void L2cCocDeregister ( l2cCocRegId_t  regId)

Deregister and deallocate a connection oriented channel registration instance. This function should only be called if there are no active channels using this registration instance.

Parameters
regIdRegistration instance ID.
Returns
None.
void L2cCocDisconnectReq ( uint16_t  cid)

Disconnect the channel for the given CID.

Parameters
cidChannel ID.
Returns
None.
bool_t L2cCocEnhancedConnectReq ( dmConnId_t  connId,
l2cCocRegId_t  regId,
uint16_t  psm,
uint16_t  credits,
uint8_t  numChan 
)

Send a request to open enhanced credit based channels.

Parameters
connIdDM connection ID.
regIdThe associated registration instance.
psmThe protocol slave multiplexer.
creditsThe initial number of credits for each CID channel.
numChanThe number of channels to create - L2C_MAX_EN_CHAN max.
Returns
FALSE if unable make request, else TRUE.
bool_t L2cCocEnhancedReconfigReq ( dmConnId_t  connId,
uint16_t  mtu,
uint16_t  mps,
uint8_t  numChan,
uint16_t *  pChanList 
)

Send a request to reconfigure enhanced credit based channels.

Parameters
connIdDM connection ID.
mtuThe maximum transmission unit of each source CID channel.
mpsThe maximum payload size on each source CID channel.
numChanThe number of channels to create (1 to L2C_MAX_EN_CHAN).
pChanListA list of local CID to reconfigure (L2C_MAX_EN_CHAN channels, set unused to 0).
Returns
FALSE if unable make request, else TRUE.
void L2cCocErrorTest ( uint16_t  result)

For testing purposes only.

Parameters
resultResult code
Returns
None.
void L2cCocInit ( void  )

Initialize L2C connection oriented channel subsystem.

Returns
None.
l2cCocRegId_t L2cCocRegister ( l2cCocCback_t  cback,
l2cCocReg_t pReg 
)

Register to use a connection oriented channel, as either a channel acceptor, initiator, or both. If registering as channel acceptor then the PSM is specified. After registering a connection can be established by the client using this registration instance.

Parameters
cbackClient callback function.
pRegRegistration parameter structure.
Returns
Registration instance ID or L2C_COC_REG_ID_NONE if registration failed.
void L2cCocSetAcceptCback ( l2cCocRegId_t  regId,
l2cCocAcceptCb_t  cback 
)

Set the channel accept callback.

Parameters
regIdRegistration instance ID.
cbackClient callback function.
Returns
None.
void L2cDataReq ( uint16_t  cid,
uint16_t  handle,
uint16_t  len,
uint8_t *  pL2cPacket 
)

Send an L2CAP data packet on the given CID.

Parameters
cidThe channel identifier.
handleThe connection handle. The client receives this handle from DM.
lenThe length of the payload data in pPacket.
pL2cPacketA buffer containing the packet.
Returns
None.
void L2cDmConnUpdateReq ( uint16_t  handle,
hciConnSpec_t pConnSpec 
)

For internal use only. This function is called by DM to send an L2CAP connection update request.

Parameters
handleThe connection handle.
pConnSpecPointer to the connection specification structure.
Returns
None.
void L2cDmConnUpdateRsp ( uint8_t  identifier,
uint16_t  handle,
uint16_t  result 
)

For internal use only. This function is called by DM to send an L2CAP connection update response.

Parameters
identifierIdentifier value previously passed from L2C to DM.
handleThe connection handle.
resultConnection update response result.
Returns
None.
void L2cDmSigReq ( uint16_t  handle,
uint8_t  code,
uint16_t  len,
uint8_t *  pParam 
)

Build and send a signaling packet.

Parameters
handleThe connection handle.
codeType of command.
lenLength of the parameter.
pParamparameters of command to send.
Returns
None.
void L2cInit ( void  )

Initialize L2C subsystem.

Returns
None.
void L2cMasterInit ( void  )

Initialize L2C for operation as a Bluetooth LE master.

Returns
None.
void L2cRegister ( uint16_t  cid,
l2cDataCback_t  dataCback,
l2cCtrlCback_t  ctrlCback 
)

called by the L2C client, such as ATT or SMP, to register for the given CID.

Parameters
cidchannel identifier.
dataCbackCallback function for L2CAP data received for this CID.
ctrlCbackCallback function for control events for this CID.
Returns
None.
void L2cSlaveInit ( void  )

Initialize L2C for operation as a Bluetooth LE slave.

Returns
None.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.