SCAN_NAME_FILTER not working.

Hello, 

                 I have one use case. I am using NRF52840 in my project. I have one central device and there will be many peripheral devices.I want to the central device to get connected only to specific devices using advertisement name. For this I have used certain filters for scanning. The code is as follows:-

    char arr[5][40] =
    { "sensor-AQ100WCD00000011",
      "sensor-AQ300SHD00000012",
      "sensor-AQ100WCD00000013",
      "sensor-AQ100WCD00000014",
      "sensor-AQ100WCD00000015"
    };

void scan_start_new(void) {
    ret_code_t ret;
    nrf_ble_scan_init_t init_scan;
    ret_code_t          err_code;

      


    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);

    err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_UUID_FILTER, &m_aqss_uuid);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_UUID_FILTER, &m_aqts_uuid);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_NAME_FILTER, arr);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_NAME_FILTER && NRF_BLE_SCAN_UUID_FILTER, false);
    APP_ERROR_CHECK(err_code);

   
  
}

What is happening with my code is the central device gets connected only to 1st device "sensor-AQ100WCD00000011"  from the array. The rest device ID are getting scanned but central device is not getting connected to them. What might have caused this issue? How can my central device connect to all the devices mentioned in the arr?

My sdk_config parameters are set as follows:-

#ifndef NRF_BLE_SCAN_FILTER_ENABLE
#define NRF_BLE_SCAN_FILTER_ENABLE 1
#endif
// <o> NRF_BLE_SCAN_UUID_CNT - Number of filters for UUIDs.
#ifndef NRF_BLE_SCAN_UUID_CNT
#define NRF_BLE_SCAN_UUID_CNT 2
#endif

// <o> NRF_BLE_SCAN_NAME_CNT - Number of name filters.
#ifndef NRF_BLE_SCAN_NAME_CNT
#define NRF_BLE_SCAN_NAME_CNT 5
#endif

// <o> NRF_BLE_SCAN_SHORT_NAME_CNT - Number of short name filters.
#ifndef NRF_BLE_SCAN_SHORT_NAME_CNT
#define NRF_BLE_SCAN_SHORT_NAME_CNT 0
#endif

// <o> NRF_BLE_SCAN_ADDRESS_CNT - Number of address filters.
#ifndef NRF_BLE_SCAN_ADDRESS_CNT
#define NRF_BLE_SCAN_ADDRESS_CNT 0
#endif

// <o> NRF_BLE_SCAN_APPEARANCE_CNT - Number of appearance filters.
#ifndef NRF_BLE_SCAN_APPEARANCE_CNT
#define NRF_BLE_SCAN_APPEARANCE_CNT 0
#endif

Thanks & Regards,

Snehal

Related