I need to connect to other units according to their MAC address. I'm assuming that this:
Where this:
I need to connect to other units according to their MAC address. I'm assuming that this:
Hi
Try something like this (assuming there are no conflicting filters already set in your project:
err_code = nrf_ble_scan_copy_addr_to_sd_gap_addr(&m_mac_filter, target_mac_addr); err_code = nrf_ble_scan_filter_set(&m_scan, SCAN_ADDR_FILTER, &m_mac_filter); m_mac_filter.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_STATIC;
err_code = nrf_ble_scan_filters_enable(&m_scan, NRF_BLE_SCAN_ADDR_FILTER, false); APP_ERROR_CHECK(err_code);
Setting up and enabling a filter should be done before you start scanning.
Best regards,
Simon
Hi,
Thanks for that, but it's not answering my question in terms of the syntax for the mac address. I guess this:
target_mac_addr
is where the mac address itself is stored, but what type of variable is this?
So , for example is it a string of hie kind of format:
45:67:A5:76:AA:FF
Or just a hex number such as
4567A576AAFF
Or...?
Thanks!
no valid text here
Seems like you got the assistance you needed from my colleague Vidar in your other ticket: Can connect to uart_peripheral by UUID, but can't connect to a non-Zephyr product
In the future, try to keep to one ticket per subject, or let us know if you have multiple, so we can confer/discuss internally to avoid any miscommunication.
Let me know if you have any further questions here or if this case can be closed.
Best regards,
Simon
Hi. I didn't specifically raise another ticket. There was a discussion going on a parallel issue and I mentioned that I wanted to try connecting with a MAC address instead and I was waiting for an answer.
Sorting that has enabled me to move on to the next problem.
You can close this thread.