Hello:
I have set the scanning module to search devices by MAC address. It finds the devices that are using a Static Random address, but it cannot find the ones using a Public Static address.
I can see and connect to both using NRF Connect BLE. I am using the Rigardo module.
Here is the code I use to start the scanning module:
ret_code_t connect_to_mac(uint8_t mac[]) {
ret_code_t err_code;
if (isConnected()) {
uint8_t mac[6];
getCurrentMac(mac);
disconnect_from_mac(mac);
}
nrf_ble_scan_stop();
nrf_ble_scan_all_filter_remove(&m_scan);
nrf_ble_scan_init_t init_scan;
ble_gap_addr_t m_mac_filter;
m_mac_filter.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC;
err_code = nrf_ble_scan_copy_addr_to_sd_gap_addr(&m_mac_filter, mac);
if (err_code == NRF_SUCCESS) {
memset(&init_scan, 0, sizeof(init_scan));
init_scan.connect_if_match = true;
init_scan.conn_cfg_tag = APP_BLE_CONN_CFG_TAG;
m_mac_filter.addr_type = BLE_GAP_ADDR_TYPE_PUBLIC;
err_code = nrf_ble_scan_init(&m_scan, &init_scan, scan_evt_handler);
if (err_code == NRF_SUCCESS) {
err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_ADDR_FILTER, &m_mac_filter.addr);
}
if (err_code == NRF_SUCCESS) {
err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_ADDR_FILTER, false);
}
if (err_code == NRF_SUCCESS) {
err_code = scan_start();
if (err_code == NRF_SUCCESS) {
#ifdef DEBUG
char *msg = malloc(255);
sprintf(msg, "SCANNING FOR %x:%x:%x:%x:%x:%x TYPE %d",
m_mac_filter.addr[0],
m_mac_filter.addr[1],
m_mac_filter.addr[2],
m_mac_filter.addr[3],
m_mac_filter.addr[4],
m_mac_filter.addr[5],
m_mac_filter.addr_type);
err_code = sendStatusToUART(msg);
free(msg);
#else
err_code = sendStatusToUART(STATUS_SCANNING);
#endif
}
}
BLE_ERROR_CHECK(err_code);
} else {
sendErrorToUART(ERROR_INVALID_MAC);
}
return err_code;
}
Can you please point me to any ideas? The only difference between the two devices is that one MAC is public (using Rigardo defined hardware address) and the other is Random Static.
Are there any limitations on the softdevice for hardware public address?
Thanks,
Juan