static void nrf_ble_scan_on_adv_report(nrf_ble_scan_t const * const p_scan_ctx,
ble_gap_evt_adv_report_t const * const p_adv_report)
{
scan_evt_t scan_evt;
#if (NRF_BLE_SCAN_FILTER_ENABLE == 1)
uint8_t filter_cnt = 0;
uint8_t filter_match_cnt = 0;
#endif
printf("Entering %s \n",__FUNCTION__);
memset(&scan_evt, 0, sizeof(scan_evt));
scan_evt.p_scan_params = &p_scan_ctx->scan_params;
// If the whitelist is used, do not check the filters and return.
if (is_whitelist_used(p_scan_ctx))
{
scan_evt.scan_evt_id = NRF_BLE_SCAN_EVT_WHITELIST_ADV_REPORT;
scan_evt.params.p_not_found = p_adv_report;
p_scan_ctx->evt_handler(&scan_evt);
UNUSED_RETURN_VALUE(sd_ble_gap_scan_start(NULL, &p_scan_ctx->scan_buffer));
nrf_ble_scan_connect_with_target(p_scan_ctx, p_adv_report);
return;
}
printf("Entering %s len %d \n",__FUNCTION__,p_adv_report->data.len);
printf("Entering %s data %s",__FUNCTION__, p_adv_report->data.p_data);
printf("Entering nrf_ble_scan_connect_with_target %s",__FUNCTION__);
/* removed the logic for diffrent filters from here */
nrf_ble_scan_connect_with_target(p_scan_ctx, p_adv_report);
// If the event handler is not NULL, notify the main application.
if (p_scan_ctx->evt_handler != NULL)
{
p_scan_ctx->evt_handler(&scan_evt);
}
// Resume the scanning.
UNUSED_RETURN_VALUE(sd_ble_gap_scan_start(NULL, &p_scan_ctx->scan_buffer));
printf("scanning started %s \n",__FUNCTION__);
}
static void scan_init(void)
{
ret_code_t err_code;
nrf_ble_scan_init_t init_scan;
printf("Entering %s \n",__FUNCTION__);
memset(&init_scan, 0, sizeof(init_scan));
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);
/* removed filter setting from here */
printf("Exiting %s err_code %d \n",__FUNCTION__,err_code);
}
referring to ble_app_multilink_central app
above mentioned code changes i have done to remove filter logic from the connection sequence.
-i am trying to remove filters from the code some how nrf_ble_scan_on_ble_evt() function BLE_GAP_EVT_CONNECTED event is not getting
generated.
sd_ble_gap_connect is returning 0(success) still the connection is not getting established