![]() |
Cordio Stack and Cordio Profiles
r2p3-02rel0
|
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... | |
| 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. | |
| #define | L2C_COC_CID_NONE 0 |
| Invalid channel ID for connection oriented channels. | |
| #define | L2C_PAYLOAD_START (HCI_ACL_HDR_LEN + L2C_HDR_LEN) |
| Start of L2CAP payload in an HCI ACL packet buffer. | |
| #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. | |
| #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. | |
| #define | L2C_SIG_RSP_FLAG 0x01 |
| Signaling response code flag. | |
Typedefs | |
| typedef uint16_t | l2cCocRegId_t |
| Connection oriented channel registration ID. | |
| 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 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 | |
| #define | L2C_CTRL_FLOW_ENABLE_IND 0 |
| Data flow enabled. | |
| #define | L2C_CTRL_FLOW_DISABLE_IND 1 |
| Data flow disabled. | |
L2CAP COC Channel Roles | |
| #define | L2C_COC_ROLE_NONE 0x00 |
| No role (unallocated) | |
| #define | L2C_COC_ROLE_INITIATOR 0x01 |
| Channel initiator. | |
| #define | L2C_COC_ROLE_ACCEPTOR 0x02 |
| Channel acceptor. | |
L2CAP COC Data Confirm Codes | |
| #define | L2C_COC_DATA_SUCCESS 0 |
| Data request successful. | |
| #define | L2C_COC_DATA_ERR_MEMORY 1 |
| Out of memory. | |
| #define | L2C_COC_DATA_ERR_OVERFLOW 2 |
| Transaction overflow. | |
L2CAP COC Callback Events | |
| enum | { L2C_COC_CONNECT_IND = L2C_COC_CBACK_START, L2C_COC_DISCONNECT_IND, L2C_COC_DATA_IND, L2C_COC_DATA_CNF } |
| COC callback events. More... | |
| #define | L2C_COC_CBACK_START 0x70 |
| L2C callback event starting value. | |
| #define | L2C_COC_CBACK_CBACK_END L2C_COC_DATA_CNF |
| L2C callback event ending value. | |
L2CAP Initialization | |
| 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 | |
| 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... | |
L2CAP COC 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... | |
| 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... | |
| 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. | |
| #define | L2C_MIN_MTU 23 |
| Minimum packet payload MTU for LE. | |
| #define | L2C_SIG_HDR_LEN 4 |
| L2CAP signaling command header length. | |
| #define | L2C_LE_SDU_HDR_LEN 2 |
| L2CAP LE SDU data header length. | |
L2CAP Parameter Lengths | |
| #define | L2C_SIG_CONN_UPDATE_REQ_LEN 8 |
| Connection update request length. | |
| #define | L2C_SIG_CONN_UPDATE_RSP_LEN 2 |
| Connection update response length. | |
| #define | L2C_SIG_CMD_REJ_LEN 2 |
| Command reject length. | |
| #define | L2C_SIG_DISCONN_REQ_LEN 4 |
| Disconnection request length. | |
| #define | L2C_SIG_DISCONN_RSP_LEN 4 |
| Disconnection response length. | |
| #define | L2C_SIG_LE_CONN_REQ_LEN 10 |
| LE connection request length. | |
| #define | L2C_SIG_LE_CONN_RSP_LEN 10 |
| LE connection response length. | |
| #define | L2C_SIG_FLOW_CTRL_CREDIT_LEN 4 |
| Flow control credit lenghth. | |
L2CAP Connection Identifiers | |
| #define | L2C_CID_ATT 0x0004 |
| CID for attribute protocol. | |
| #define | L2C_CID_LE_SIGNALING 0x0005 |
| CID for LE signaling. | |
| #define | L2C_CID_SMP 0x0006 |
| CID for security manager protocol. | |
L2CAP Signaling Codes | |
| #define | L2C_SIG_CMD_REJ 0x01 |
| Comand reject. | |
| #define | L2C_SIG_DISCONNECT_REQ 0x06 |
| Disconnect request. | |
| #define | L2C_SIG_DISCONNECT_RSP 0x07 |
| Disconnect response. | |
| #define | L2C_SIG_CONN_UPDATE_REQ 0x12 |
| Connection parameter update request. | |
| #define | L2C_SIG_CONN_UPDATE_RSP 0x13 |
| Connection parameter update response. | |
| #define | L2C_SIG_LE_CONNECT_REQ 0x14 |
| LE credit based connection request. | |
| #define | L2C_SIG_LE_CONNECT_RSP 0x15 |
| LE credit based connection response. | |
| #define | L2C_SIG_FLOW_CTRL_CREDIT 0x16 |
| LE flow control credit. | |
L2CAP Command Rejection Codes | |
| #define | L2C_REJ_NOT_UNDERSTOOD 0x0000 |
| Command not understood. | |
| #define | L2C_REJ_MTU_EXCEEDED 0x0001 |
| Signaling MTU exceeded. | |
| #define | L2C_REJ_INVALID_CID 0x0002 |
| Invalid CID in request. | |
L2CAP Connection Parameter Update Result Codes | |
| #define | L2C_CONN_PARAM_ACCEPTED 0x0000 |
| Connection parameters accepted. | |
| #define | L2C_CONN_PARAM_REJECTED 0x0001 |
| Connection parameters rejected. | |
L2CAP Connection Result Codes | |
| #define | L2C_CONN_SUCCESS 0x0000 |
| Connection successful. | |
| #define | L2C_CONN_NONE 0x0001 |
| No connection result value available. | |
| #define | L2C_CONN_FAIL_PSM 0x0002 |
| Connection refused LE_PSM not supported. | |
| #define | L2C_CONN_FAIL_RES 0x0004 |
| Connection refused no resources available. | |
| #define | L2C_CONN_FAIL_AUTH 0x0005 |
| Connection refused insufficient authentication. | |
| #define | L2C_CONN_FAIL_AUTHORIZ 0x0006 |
| Connection refused insufficient authorization. | |
| #define | L2C_CONN_FAIL_KEY_SIZE 0x0007 |
| Connection refused insufficient encryption key size. | |
| #define | L2C_CONN_FAIL_ENC 0x0008 |
| Connection Refused insufficient encryption. | |
| #define | L2C_CONN_FAIL_INVALID_SCID 0x0009 |
| Connection refused invalid source CID. | |
| #define | L2C_CONN_FAIL_ALLOCATED_SCID 0x000A |
| Connection refused source CID already allocated. | |
| #define | L2C_CONN_FAIL_UNACCEPT_PARAM 0x000B |
| Connection refused unacceptable parameters. | |
L2CAP Interal Connection Result Codes | |
| #define | L2C_CONN_FAIL_TIMEOUT 0xF000 |
| Request timeout. | |
L2CAP Signaling Parameter Value Ranges | |
| #define | L2C_PSM_MIN 0x0001 |
| PSM minimum. | |
| #define | L2C_PSM_MAX 0x00FF |
| PSM maximum. | |
| #define | L2C_CID_DYN_MIN 0x0040 |
| CID dynamic minimum. | |
| #define | L2C_CID_DYN_MAX 0x007F |
| CID dynamic maximum. | |
| #define | L2C_MTU_MIN 0x0017 |
| MTU minimum. | |
| #define | L2C_MPS_MIN 0x0017 |
| MPS minimum. | |
| #define | L2C_MPS_MAX 0xFFFD |
| MPS maximum. | |
| #define | L2C_CREDITS_MAX 0xFFFF |
| Credits maximum. | |
| typedef void(* l2cCtrlCback_t) (wsfMsgHdr_t *pMsg) |
| typedef void(* l2cCocCback_t) (l2cCocEvt_t *pMsg) |
| 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.
| connId | DM connection ID. |
| regId | The registration instance requiring authorization. |
| psm | The PSM of the registration instance. |
| anonymous enum |
COC callback events.
| Enumerator | |
|---|---|
| L2C_COC_CONNECT_IND |
Channel connect indication. |
| L2C_COC_DISCONNECT_IND |
Channel disconnect indication. |
| L2C_COC_DATA_IND |
Received data indication. |
| L2C_COC_DATA_CNF |
Transmit data confirm. |
Definition at line 74 of file l2c_api.h.
| void L2cInit | ( | void | ) |
Initialize L2C subsystem.
| void L2cMasterInit | ( | void | ) |
Initialize L2C for operation as a Bluetooth LE master.
| void L2cSlaveInit | ( | void | ) |
Initialize L2C for operation as a Bluetooth LE slave.
| 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.
| cid | channel identifier. |
| dataCback | Callback function for L2CAP data received for this CID. |
| ctrlCback | Callback function for control events for this CID. |
Send an L2CAP data packet on the given CID.
| cid | The channel identifier. |
| handle | The connection handle. The client receives this handle from DM. |
| len | The length of the payload data in pPacket. |
| pL2cPacket | A buffer containing the packet. |
| void L2cCocInit | ( | void | ) |
Initialize L2C connection oriented channel subsystem.
| 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.
| cback | Client callback function. |
| pReg | Registration parameter structure. |
| 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.
| regId | Registration instance ID. |
| uint16_t L2cCocConnectReq | ( | dmConnId_t | connId, |
| l2cCocRegId_t | regId, | ||
| uint16_t | psm | ||
| ) |
Initiate a connection to the given peer PSM.
| connId | DM connection ID. |
| regId | The associated registration instance. |
| psm | Peer PSM. |
| void L2cCocDisconnectReq | ( | uint16_t | cid | ) |
Disconnect the channel for the given CID.
| cid | Channel ID. |
Send an L2CAP data packet on the given connection oriented CID.
| cid | The local channel identifier. |
| len | The length of the payload data in pPacket. |
| pPayload | Packet payload data. |
| void L2cCocErrorTest | ( | uint16_t | result | ) |
For testing purposes only.
| result | Result code |
For testing purposes only.
| cid | The local channel identifier. |
| credits | Credits to send. |
| 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.
| handle | The connection handle. |
| pConnSpec | Pointer to the connection specification structure. |
For internal use only. This function is called by DM to send an L2CAP connection update response.
| identifier | Identifier value previously passed from L2C to DM. |
| handle | The connection handle. |
| result | Connection update response result. |