Hi Nordic,
I want to establish a user controlled connection to a ble_peripheral. I am using the Sdk 15.3, s140 and the nrf52840.
The idea is: Ble_central show all scanned devices, then based on a command, the user selects to whom it should connect. Similar as the ble_app_interactive idea, but there a bonding is always implemented.
In our application, with every BLE_GAP_EVT_ADV_REPORT event, the p_ble_evt->evt.gap_evt.params.adv_report.peer_addr is saved.
The intention is to use it then with the sd_ble_gap_connect() function.
static ble_gap_conn_params_t const m_connection_param =
{
NRF_BLE_SCAN_MIN_CONNECTION_INTERVAL,
NRF_BLE_SCAN_MAX_CONNECTION_INTERVAL,
NRF_BLE_SCAN_SLAVE_LATENCY,
NRF_BLE_SCAN_SUPERVISION_TIMEOUT
};
/**< Scan parameters requested for scanning and connection. */
static ble_gap_scan_params_t const m_scan_param =
{
.active = 0x01,
.interval = NRF_BLE_SCAN_SCAN_INTERVAL,
.window = NRF_BLE_SCAN_SCAN_WINDOW,
.filter_policy = BLE_GAP_SCAN_FP_WHITELIST,
.timeout = SCAN_DURATION_WITELIST,
.scan_phys = BLE_GAP_PHY_1MBPS,
};
err_code = sd_ble_gap_connect(&p_ble_evt->evt.gap_evt.params.adv_report.peer_addr,
&m_scan_param,
&m_connection_param,
APP_BLE_CONN_CFG_TAG);
This returns 07 as an error which is invalid param.
Is there something that i'm missing?
In the ble_app_interactive example, the peer_addr is took from the bonding data. Is this the only possibility?
Thank you in advance.