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.
I used as a reference the ble_app_interactive experimental example and the ble_central/ble_app_hrs_c. My intention is to connect to a peripheral based on the user selection as the ble_app_interactive example, but also having the whitelist enable as in the ble_app_hrs_c example. Is this possible?
The issue that i'm facing is on the very first call of the scan_start()
/**@brief Connection parameters requested for connection.
*/
static ble_gap_conn_params_t const m_connection_param =
{
MIN_CONNECTION_INTERVAL,
MAX_CONNECTION_INTERVAL,
SLAVE_LATENCY,
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,
.scan_phys = BLE_GAP_PHY_1MBPS,
};
void scan_init(void)
{
ret_code_t err_code;
nrf_ble_scan_init_t init_scan;
memset(&init_scan, 0, sizeof(init_scan));
init_scan.p_scan_param = &m_scan_param;
init_scan.p_conn_param = &m_connection_param;
//init_scan.connect_if_match = true;
init_scan.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);
APP_ERROR_CHECK(err_code);
}
void scan_start(void)
{
ret_code_t err_code;
if (nrf_fstorage_is_busy(NULL))
{
m_memory_access_in_progress = true;
NRF_LOG_INFO("nrf_fstorage_is_busy");
return;
}
NRF_LOG_INFO("scan_start");
err_code = nrf_ble_scan_start(&m_scan);
if(err_code!= NRF_SUCCESS){
NRF_LOG_INFO("Starting scan error %d", err_code);
}
APP_ERROR_CHECK(err_code);
}
On application init I'm calling first the scan_init() and then scan_start(), however, i get inside this last function a return error of 7:
Starting scan error 7
It is related with the scan_parameter because when i remove them, the error goes away and the application works fine just that without whitelist. But I'm using the same settings as the ble_app_hrs_c example.
Any ideas?