nrf-softdevice-s113

Crates

git

Versions

default

Flavors

pub unsafe fn sd_ble_l2cap_ch_flow_control(
conn_handle: u16,
local_cid: u16,
credits: u16,
p_credits: *mut u16
) -> u32
Expand description

@brief Advanced SDU reception flow control.

@details 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.

@mscs @mmsc{@ref BLE_L2CAP_CH_FLOW_CONTROL_MSC} @endmscs

@param[in] conn_handle Connection Handle. @param[in] local_cid Local Channel ID of the L2CAP channel or @ref BLE_L2CAP_CID_INVALID to set the value that will be used for newly created channels. @param[in] credits Number of credits that the SoftDevice will make sure the peer has every time it starts using a new reception buffer. - @ref BLE_L2CAP_CREDITS_DEFAULT is the default value the SoftDevice will use if this function is not called. - If set to zero, the SoftDevice will stop issuing credits for new reception buffers the application provides or has provided. SDU reception that is currently ongoing will be allowed to complete. @param[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 @ref BLE_L2CAP_CID_INVALID.

@note Application should take care when setting number of credits higher than default value. In this case the application must make sure that the SoftDevice always has reception buffers available (see @ref sd_ble_l2cap_ch_rx) for that channel. If the SoftDevice does not have such buffers available, packets may be NACKed on the Link Layer and all Bluetooth traffic on the connection handle may be stalled until the SoftDevice again has an available reception buffer. This applies even if the application has used this call to set the credits back to default, or zero.

@retval ::NRF_SUCCESS Flow control parameters accepted. @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. @retval ::NRF_ERROR_INVALID_STATE Invalid State to perform operation (Setup or release is in progress for an L2CAP channel). @retval ::NRF_ERROR_NOT_FOUND CID not found.