Embassy
nrf-softdevice-s113

Crates

git

Versions

default

Flavors

pub unsafe fn sd_ble_l2cap_ch_setup(
conn_handle: u16,
p_local_cid: *mut u16,
p_params: *const ble_l2cap_ch_setup_params_t
) -> u32
Expand description

@brief Set up an L2CAP channel.

@details This function is used to: - Request setup of an L2CAP channel: sends an LE Credit Based Connection Request packet to a peer. - Reply to a setup request of an L2CAP channel (if called in response to a @ref BLE_L2CAP_EVT_CH_SETUP_REQUEST event): sends an LE Credit Based Connection Response packet to a peer.

@note A call to this function will require the application to keep the SDU data buffer alive until the SDU data buffer is returned in @ref BLE_L2CAP_EVT_CH_RX or @ref BLE_L2CAP_EVT_CH_SDU_BUF_RELEASED event.

@events @event{@ref BLE_L2CAP_EVT_CH_SETUP, Setup successful.} @event{@ref BLE_L2CAP_EVT_CH_SETUP_REFUSED, Setup failed.} @endevents

@mscs @mmsc{@ref BLE_L2CAP_CH_SETUP_MSC} @endmscs

@param[in] conn_handle Connection Handle. @param[in,out] p_local_cid Pointer to a uint16_t containing Local Channel ID of the L2CAP channel: - As input: @ref BLE_L2CAP_CID_INVALID when requesting setup of an L2CAP channel or local_cid provided in the @ref BLE_L2CAP_EVT_CH_SETUP_REQUEST event when replying to a setup request of an L2CAP channel. - As output: local_cid for this channel. @param[in] p_params L2CAP channel parameters.

@retval ::NRF_SUCCESS Successfully queued request or response for transmission. @retval ::NRF_ERROR_BUSY The stack is busy, process pending events and retry. @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. @retval ::NRF_ERROR_INVALID_LENGTH Supplied higher rx_mps than has been configured on this link. @retval ::NRF_ERROR_INVALID_STATE Invalid State to perform operation (L2CAP channel already set up). @retval ::NRF_ERROR_NOT_FOUND CID not found. @retval ::NRF_ERROR_RESOURCES The limit has been reached for available L2CAP channels, see @ref ble_l2cap_conn_cfg_t::ch_count.