S145 SoftDevice for nRF54LS05 API documentation 10.0.0
Loading...
Searching...
No Matches

◆ sd_ble_gap_connect()

uint32_t sd_ble_gap_connect ( ble_gap_addr_t const * p_peer_addr,
ble_gap_scan_params_t const * p_scan_params,
ble_gap_conn_params_t const * p_conn_params,
uint8_t conn_cfg_tag )

#include <ble_gap.h>

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 generated
BLE_GAP_EVT_CONNECTEDA connection was established.
BLE_GAP_EVT_TIMEOUTFailed to establish a connection.
Relevant Message Sequence Charts
Whitelist Sharing
Central Connection Establishment with Private Peer
Central Connection Establishment and Termination
Parameters
[in]p_peer_addrPointer to peer identity address. If ble_gap_scan_params_t::filter_policy is set to use whitelist, then p_peer_addr is ignored.
[in]p_scan_paramsPointer to scan parameters structure.
[in]p_conn_paramsPointer to desired connection parameters.
[in]conn_cfg_tagTag identifying a configuration set by sd_ble_cfg_set or BLE_CONN_CFG_TAG_DEFAULT to use the default connection configuration.
Return values
NRF_SUCCESSSuccessfully initiated connection procedure.
NRF_ERROR_INVALID_ADDRInvalid parameter(s) pointer supplied.
NRF_ERROR_INVALID_PARAMInvalid parameter(s) supplied.
NRF_ERROR_NOT_FOUNDconn_cfg_tag not found.
NRF_ERROR_INVALID_STATEThe SoftDevice is in an invalid state to perform this operation.
  • A locally initiated connect procedure must complete before initiating again.
BLE_ERROR_GAP_INVALID_BLE_ADDRInvalid Peer address.
NRF_ERROR_CONN_COUNTThe limit of available connections for this connection configuration tag has been reached. To increase the number of available connections, use sd_ble_cfg_set with BLE_GAP_CFG_ROLE_COUNT or BLE_CONN_CFG_GAP.
NRF_ERROR_RESOURCESEither:
  • 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 ble_gap_scan_params_t::scan_phys. Use sd_ble_cfg_set to increase the event length.
NRF_ERROR_NOT_SUPPORTEDUnsupported PHYs supplied to the call.