L2CAP

group group_ble_common_api_l2cap_definitions

Contains the L2CAP specific definitions and data structures used in the L2CAP APIs.

Enums

enum cy_en_ble_l2cap_command_rej_reason_t

cy_en_ble_l2cap_command_rej_reason_t: Reason for command reject event - CY_BLE_EVT_L2CAP_COMMAND_REJ.

Values:

enumerator CY_BLE_L2CAP_COMMAND_NOT_UNDERSTOOD

Command Not Understood.

enumerator CY_BLE_L2CAP_SIGNALLING_MTU_EXCEEDED

Signaling L2CAP MTU exceeded.

enumerator CY_BLE_L2CAP_INVALID_CID_IN_REQUEST

Invalid Connection Identifier in request.

enum cy_en_ble_l2cap_result_param_t

cy_en_ble_l2cap_result_param_t: The result code of call back structures for L2CAP.

Values:

enumerator CY_BLE_L2CAP_RESULT_SUCCESS

Operation Successful.

enumerator CY_BLE_L2CAP_RESULT_COMMAND_TIMEOUT

Command timeout, if L2CAP signaling channel timeout occurs, app should disconnect.

enumerator CY_BLE_L2CAP_RESULT_INCORRECT_SDU_LENGTH

Invalid SDU length.

enumerator CY_BLE_L2CAP_RESULT_NOT_ENOUGH_CREDITS

Not enough Credit to perform this operation.

enumerator CY_BLE_L2CAP_RESULT_CREDIT_OVERFLOW

Credit overflow.

Total Credit exceeded 65535 (maximum)

enumerator CY_BLE_L2CAP_RESULT_UNACCEPTABLE_CREDIT_VALUE

Invalid Credit value, receive Credit is Zero.

struct cy_stc_ble_l2cap_cbfc_psm_info_t
#include <>

L2CAP Credit based flow Connection parameter.

Public Members

uint16_t l2capPsm

PSM value of the higher-level protocol.

uint16_t creditLwm

Upper Layer defined Receive Credit Low Mark.

struct cy_stc_ble_l2cap_cbfc_connection_info_t
#include <>

L2CAP Credit based flow Connection parameter.

Public Members

uint16_t mtu

L2CAP MTU - Maximum SDU Size.

The L2CAP MTU field specifies the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Request can receive on this channel. L2CAP implementations shall support a minimum L2CAP MTU size of 23 octets.

uint16_t mps

MPS - Maximum PDU Size.

The MPS field specifies the maximum payload size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Request is capable of receiving on this channel. L2CAP implementations shall support a minimum MPS of 23 octets and may support a maximum MPS up to 65488 octets.

uint16_t credit

Initial Number of Credits.

The initial credit value indicates the number of LE-frames that the peer device can send to the L2CAP layer entity sending the LE Credit Based Connection Request. The initial credit value shall be in the range of 0 to

struct cy_stc_ble_l2cap_cbfc_conn_req_info_t
#include <>

Connect request parameter.

Public Members

cy_stc_ble_l2cap_cbfc_connection_info_t connParam

L2CAP Credit based flow Connection parameter.

uint16_t remotePsm

Remote PSM value.

uint16_t localPsm

Local PSM value.

uint8_t bdHandle

bd handle of the remote device

struct cy_stc_ble_l2cap_state_info_t
#include <>

L2cap flow control state.

Public Members

uint8_t flowState

States indicated by flowState variable.

CY_BLE_STACK_STATE_BUSY (0x01) = CY_BLE_STACK_STATE_BUSY indicates to the application that the BLE Stack’s internal buffers are about to be filled, and the remaining buffers are required to respond to the peer BLE device. After this event, the application shall not initiate GATT, GAP Security, or L2CAP data transactions. However the application shall respond to peer initiated transactions to prevent BLE protocol timeouts from occurring. Application-initiated data transactions can be resumed after the CY_BLE_EVT_STACK_BUSY_STATUS event when parameter ‘CY_BLE_STACK_STATE_FREE’ is received.

CY_BLE_STACK_STATE_FREE (0x00) = CY_BLE_STACK_STATE_FREE indicates application that pending transactions are completed and sufficient buffers are available to process application-initiated transactions. The ‘CY_BLE_EVT_STACK_BUSY_STATUS’ event with ‘CY_BLE_STACK_STATE_FREE’ indicates to the application whether the BLE Stack’s internal buffer state has transitioned from ‘CY_BLE_STACK_STATE_BUSY’ to ‘CY_BLE_STACK_STATE_FREE’.

uint8_t bdHandle

bd handle of the remote device

struct cy_stc_ble_l2cap_cbfc_conn_resp_info_t
#include <>

Connect response parameter.

Public Members

cy_stc_ble_l2cap_cbfc_connection_info_t connParam

L2CAP Credit based flow Connection parameter.

uint16_t localCid

This parameter specifies the local L2CAP channel end-point for this new L2CAP channel.

On receipt of L2CAP Connect Request command from the peer, the local L2CAP will temporarily create a channel. This parameter identifies the new channel. If the upper-layer PSM chooses to reject this connection, this temporary channel will be closed.

uint16_t response

This parameter specifies the response of the upper layer for the new L2CAP channel establishment request from the peer.

It must be set to a value as specified in L2CAP Connect Result Codes. Refer to Bluetooth 5.0 core specification, Volume 3, Part A, section 4.23 for more details.

struct cy_stc_ble_l2cap_cbfc_credit_info_t
#include <>

Connect response parameter.

Public Members

uint16_t localCid

This parameter specifies the local L2CAP channel end-point for this new L2CAP channel.

On receipt of L2CAP Connect Request command from the peer, the local L2CAP will temporarily create a channel. This parameter identifies the new channel. If the upper-layer PSM chooses to reject this connection, this temporary channel will be closed.

uint16_t credit

The credit value field represents number of Credits the receiving device can increment.

The credit value field is a number between 1 and 65535.

struct cy_stc_ble_l2cap_cbfc_tx_data_info_t
#include <>

Tx Data parameter.

Public Members

uint8_t *buffer

Transmit data.

uint16_t bufferLength

L2CAP Data Packet length.

It shall be the minimum of local L2CAP MTU and peer L2CAP MTU size.

uint16_t localCid

This parameter specifies the local channel end-point for the L2CAP channel.

For the initiator of L2CAP channel establishment, this must be set to the value indicated by the CY_BLE_EVT_L2CAP_CBFC_CONN_CNF event. For the responder, the upper- layer protocol obtains this value when it receives the event CY_BLE_EVT_L2CAP_CBFC_CONN_IND.

struct cy_stc_ble_l2cap_cbfc_disconn_req_info_t
#include <>

Disconnect request parameter.

Public Members

uint16_t localCid

This parameter specifies the local channel end-point for the L2CAP channel.

For the initiator of L2CAP channel establishment, this must be set to the value indicated by the CY_BLE_EVT_L2CAP_CBFC_CONN_CNF event. For the responder, the upper- layer protocol obtains this value when it receives the event CY_BLE_EVT_L2CAP_CBFC_CONN_IND.

struct cy_stc_ble_l2cap_conn_update_param_rsp_info_t
#include <>

Connection parameter update response parameter.

Public Members

uint16_t result

This field indicates the response to the Connection Parameter Update Request.

uint8_t bdHandle

bd handle of the remote device

struct cy_stc_ble_l2cap_queue_flow_control_info_t
#include <>

L2CAP queue flow control with water level marking.

Public Members

uint8_t bdHandle

bd handle of remote device

uint8_t lowWaterMark

low water mark level

uint8_t highWaterMark

high water level

struct cy_stc_ble_l2cap_cbfc_conn_ind_param_t
#include <>

Connect indication parameter.

Public Members

cy_stc_ble_l2cap_cbfc_connection_info_t connParam

L2CAP Credit based flow Connection parameter.

uint16_t lCid

Local CID.

uint16_t psm

Local PSM value.

uint8_t bdHandle

bd handle of the remote device

struct cy_stc_ble_l2cap_cbfc_conn_cnf_param_t
#include <>

Connect confirmation parameter.

Public Members

cy_stc_ble_l2cap_cbfc_connection_info_t connParam

L2CAP Credit based flow Connection parameter.

uint16_t lCid

Local CID.

uint16_t response

Response codes for Connection parameter update request.

uint8_t bdHandle

bd handle of the remote device

struct cy_stc_ble_l2cap_cbfc_disconn_cnf_param_t
#include <>

Disconnect confirmation parameter.

Public Members

uint16_t lCid

Local CID.

cy_en_ble_l2cap_result_param_t result

The result field indicates the outcome of the connection request.

The result value of 0x0000 indicates success while a non-zero value indicates the connection request failed or is pending.

struct cy_stc_ble_l2cap_cbfc_rx_param_t
#include <>

Receive Data parameter.

Public Members

uint8_t *rxData

Received L2cap Data.

uint16_t rxDataLength

Received L2cap Data Length.

uint16_t lCid

Local CID.

cy_en_ble_l2cap_result_param_t result

A result value of 0x0000 indicates success, while a non-zero value indicates an error condition (e.g.

peer device violating Credit flow, or L2CAP MTU size limit).

struct cy_stc_ble_l2cap_cbfc_low_rx_credit_param_t
#include <>

Rx Credit info parameter.

Public Members

uint16_t lCid

Local CID.

uint16_t credit

The number of Credits (LE-frames)

struct cy_stc_ble_l2cap_cbfc_low_tx_credit_param_t
#include <>

Tx Credit info parameter.

Public Members

uint16_t lCid

Local CID.

uint16_t credit

The number of Credits (LE-frames)

cy_en_ble_l2cap_result_param_t result

A result value of 0x0000 indicates success, while a non-zero value indicates an error condition (e.g.

Credit overflow, or if total number of Credits crosses specification defined maximum limit of 0xFFFF).

struct cy_stc_ble_l2cap_cbfc_rx_data_param_t
#include <>

Data Write parameter.

Public Members

uint16_t lCid

Local CID.

cy_en_ble_l2cap_result_param_t result

A result value of 0x0000 indicates success, while a non-zero value indicates an error condition.

uint8_t *buffer

Currently NULL.

For future usage

uint16_t bufferLength

Currently 0.

For future usage

struct cy_stc_ble_l2cap_conn_update_rsp_param_t
#include <>

L2CAP Connection parameters Update response.

Public Members

uint16_t result

connection parameter update response received from the master.

Accepted = 0x0000 Rejected = 0x0001

uint8_t bdHandle

Peer bdHandle.

struct cy_stc_ble_l2cap_cmd_rej_param_t
#include <>

L2CAP command reject parameter.

Public Members

cy_en_ble_l2cap_command_rej_reason_t result

Reason for command reject.

uint8_t bdHandle

Peer bdHandle.