nrf-softdevice-s140

Crates

git

Versions

default

Flavors

pub unsafe fn sd_ble_gap_connect(
p_peer_addr: *const ble_gap_addr_t,
p_scan_params: *const ble_gap_scan_params_t,
p_conn_params: *const ble_gap_conn_params_t,
conn_cfg_tag: u8
) -> u32
Expand description

@brief Create a connection (GAP Link Establishment).

@note If a scanning procedure is currently in progress it will be automatically stopped when calling this function. The scanning procedure will be stopped even if the function returns an error.

@events @event{@ref BLE_GAP_EVT_CONNECTED, A connection was established.} @event{@ref BLE_GAP_EVT_TIMEOUT, Failed to establish a connection.} @endevents

@mscs @mmsc{@ref BLE_GAP_WL_SHARE_MSC} @mmsc{@ref BLE_GAP_CENTRAL_CONN_PRIV_MSC} @mmsc{@ref BLE_GAP_CENTRAL_CONN_MSC} @endmscs

@param[in] p_peer_addr Pointer to peer identity address. If @ref ble_gap_scan_params_t::filter_policy is set to use whitelist, then p_peer_addr is ignored. @param[in] p_scan_params Pointer to scan parameters structure. @param[in] p_conn_params Pointer to desired connection parameters. @param[in] conn_cfg_tag Tag identifying a configuration set by @ref sd_ble_cfg_set or @ref BLE_CONN_CFG_TAG_DEFAULT to use the default connection configuration.

@retval ::NRF_SUCCESS Successfully initiated connection procedure. @retval ::NRF_ERROR_INVALID_ADDR Invalid parameter(s) pointer supplied. @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. - Invalid parameter(s) in p_scan_params or p_conn_params. - Use of whitelist requested but whitelist has not been set, see @ref sd_ble_gap_whitelist_set. - Peer address was not present in the device identity list, see @ref sd_ble_gap_device_identities_set. @retval ::NRF_ERROR_NOT_FOUND conn_cfg_tag not found. @retval ::NRF_ERROR_INVALID_STATE The SoftDevice is in an invalid state to perform this operation. This may be due to an existing locally initiated connect procedure, which must complete before initiating again. @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR Invalid Peer address. @retval ::NRF_ERROR_CONN_COUNT The limit of available connections for this connection configuration tag has been reached. To increase the number of available connections, use @ref sd_ble_cfg_set with @ref BLE_GAP_CFG_ROLE_COUNT or @ref BLE_CONN_CFG_GAP. @retval ::NRF_ERROR_RESOURCES Either: - Not enough BLE role slots available. Stop one or more currently active roles (Central, Peripheral or Observer) and try again. - The event_length parameter associated with conn_cfg_tag is too small to be able to establish a connection on the selected @ref ble_gap_scan_params_t::scan_phys. Use @ref sd_ble_cfg_set to increase the event length.