Functions | |
uint32_t | sd_ble_l2cap_ch_setup (uint16_t conn_handle, uint16_t *p_local_cid, ble_l2cap_ch_setup_params_t const *p_params) |
Set up an L2CAP channel. More... | |
uint32_t | sd_ble_l2cap_ch_release (uint16_t conn_handle, uint16_t local_cid) |
Release an L2CAP channel. More... | |
uint32_t | sd_ble_l2cap_ch_rx (uint16_t conn_handle, uint16_t local_cid, ble_data_t const *p_sdu_buf) |
Receive an SDU on an L2CAP channel. More... | |
uint32_t | sd_ble_l2cap_ch_tx (uint16_t conn_handle, uint16_t local_cid, ble_data_t const *p_sdu_buf) |
Transmit an SDU on an L2CAP channel. More... | |
uint32_t | sd_ble_l2cap_ch_flow_control (uint16_t conn_handle, uint16_t local_cid, uint16_t credits, uint16_t *p_credits) |
Advanced SDU reception flow control. More... | |
uint32_t sd_ble_l2cap_ch_flow_control | ( | uint16_t | conn_handle, |
uint16_t | local_cid, | ||
uint16_t | credits, | ||
uint16_t * | p_credits | ||
) |
Advanced SDU reception flow control.
Adjust the way the SoftDevice issues credits to the peer. This may issue additional credits to the peer using an LE Flow Control Credit packet.
L2CAP Channel advanced SDU reception flow control |
[in] | conn_handle | Connection Handle. |
[in] | local_cid | Local Channel ID of the L2CAP channel or BLE_L2CAP_CID_INVALID to set the value that will be used for newly created channels. |
[in] | credits | Number of credits that the SoftDevice will make sure the peer has every time it starts using a new reception buffer.
|
[out] | p_credits | NULL or pointer to a uint16_t. If a valid pointer is provided, it will be written by the SoftDevice with the number of credits that is or will be available to the peer. If the value written by the SoftDevice is 0 when credits parameter was set to 0, the peer will not be able to send more data until more credits are provided by calling this function again with credits > 0. This parameter is ignored when local_cid is set to BLE_L2CAP_CID_INVALID. |
NRF_SUCCESS | Flow control parameters accepted. |
NRF_ERROR_INVALID_ADDR | Invalid pointer supplied. |
BLE_ERROR_INVALID_CONN_HANDLE | Invalid Connection Handle. |
NRF_ERROR_INVALID_STATE | Invalid State to perform operation (Setup or release is in progress for an L2CAP channel). |
NRF_ERROR_NOT_FOUND | CID not found. |
uint32_t sd_ble_l2cap_ch_release | ( | uint16_t | conn_handle, |
uint16_t | local_cid | ||
) |
Release an L2CAP channel.
This sends a Disconnection Request packet to a peer.
BLE_L2CAP_EVT_CH_RELEASED | Release complete. |
L2CAP Channel Release |
[in] | conn_handle | Connection Handle. |
[in] | local_cid | Local Channel ID of the L2CAP channel. |
NRF_SUCCESS | Successfully queued request for transmission. |
BLE_ERROR_INVALID_CONN_HANDLE | Invalid Connection Handle. |
NRF_ERROR_INVALID_STATE | Invalid State to perform operation (Setup or release is in progress for the L2CAP channel). |
NRF_ERROR_NOT_FOUND | CID not found. |
uint32_t sd_ble_l2cap_ch_rx | ( | uint16_t | conn_handle, |
uint16_t | local_cid, | ||
ble_data_t const * | p_sdu_buf | ||
) |
Receive an SDU on an L2CAP channel.
This may issue additional credits to the peer using an LE Flow Control Credit packet.
BLE_L2CAP_EVT_CH_RX | The SDU is received. |
L2CAP Channel SDU Receive |
[in] | conn_handle | Connection Handle. |
[in] | local_cid | Local Channel ID of the L2CAP channel. |
[in] | p_sdu_buf | Pointer to the SDU data buffer. |
NRF_SUCCESS | Buffer accepted. |
NRF_ERROR_INVALID_ADDR | Invalid pointer supplied. |
BLE_ERROR_INVALID_CONN_HANDLE | Invalid Connection Handle. |
NRF_ERROR_INVALID_STATE | Invalid State to perform operation (Setup or release is in progress for an L2CAP channel). |
NRF_ERROR_NOT_FOUND | CID not found. |
NRF_ERROR_RESOURCES | Too many SDU data buffers supplied. Wait for a BLE_L2CAP_EVT_CH_RX event and retry. |
uint32_t sd_ble_l2cap_ch_setup | ( | uint16_t | conn_handle, |
uint16_t * | p_local_cid, | ||
ble_l2cap_ch_setup_params_t const * | p_params | ||
) |
Set up an L2CAP channel.
This function is used to:
BLE_L2CAP_EVT_CH_SETUP | Setup successful. |
BLE_L2CAP_EVT_CH_SETUP_REFUSED | Setup failed. |
L2CAP Channel Setup |
[in] | conn_handle | Connection Handle. |
[in,out] | p_local_cid | Pointer to a uint16_t containing Local Channel ID of the L2CAP channel:
|
[in] | p_params | L2CAP channel parameters. |
NRF_SUCCESS | Successfully queued request or response for transmission. |
NRF_ERROR_BUSY | The stack is busy, process pending events and retry. |
NRF_ERROR_INVALID_ADDR | Invalid pointer supplied. |
BLE_ERROR_INVALID_CONN_HANDLE | Invalid Connection Handle. |
NRF_ERROR_INVALID_PARAM | Invalid parameter(s) supplied. |
NRF_ERROR_INVALID_LENGTH | Supplied higher rx_mps than has been configured on this link. |
NRF_ERROR_INVALID_STATE | Invalid State to perform operation (L2CAP channel already set up). |
NRF_ERROR_NOT_FOUND | CID not found. |
NRF_ERROR_RESOURCES | The limit has been reached for available L2CAP channels, see ble_l2cap_conn_cfg_t::ch_count. |
uint32_t sd_ble_l2cap_ch_tx | ( | uint16_t | conn_handle, |
uint16_t | local_cid, | ||
ble_data_t const * | p_sdu_buf | ||
) |
Transmit an SDU on an L2CAP channel.
BLE_L2CAP_EVT_CH_TX | The SDU is transmitted. |
L2CAP Channel SDU Transmit |
[in] | conn_handle | Connection Handle. |
[in] | local_cid | Local Channel ID of the L2CAP channel. |
[in] | p_sdu_buf | Pointer to the SDU data buffer. |
NRF_SUCCESS | Successfully queued L2CAP SDU for transmission. |
NRF_ERROR_INVALID_ADDR | Invalid pointer supplied. |
BLE_ERROR_INVALID_CONN_HANDLE | Invalid Connection Handle. |
NRF_ERROR_INVALID_STATE | Invalid State to perform operation (Setup or release is in progress for the L2CAP channel). |
NRF_ERROR_NOT_FOUND | CID not found. |
NRF_ERROR_DATA_SIZE | Invalid SDU length supplied, must not be more than ble_l2cap_ch_tx_params_t::tx_mtu provided in BLE_L2CAP_EVT_CH_SETUP event. |
NRF_ERROR_RESOURCES | Too many SDUs queued for transmission. Wait for a BLE_L2CAP_EVT_CH_TX event and retry. |