Hello everyone,
I developed an application that makes it possible to scan devices and retransmit your advertisements. In addition to enabling the connection with peripheral devices, it also allows the connection to a central device, retransmitting data via the NUS service from the central to the peripherals.
Currently, I filter the devices that I want to retransmit the advertising through the following code in the scan_evt_handler() function.
case NRF_BLE_SCAN_EVT_NOT_FOUND:
if(memcmp("\xac\x31\x38",&p_scan_evt->params.p_not_found->peer_addr.addr[3],3) == 0){
...
}
As I understand it, I'm actually receiving all the advertising but I only perform the retransmission if the condition of the device starting with MAC 38:31:AC is satisfied, correct? For performance reasons would it be better to use a MAC filter so that this filtering is done in Softdevice or would there be no difference? If there is a difference, I want to carry out this implementation, but I haven't seen any example that the implementation is carried out from a MAC range.
In the filter implementations I found, I see that the filter is applied to a specific MAC, but what I want is to listen to all devices that start with MAC 38:31:AC, is it possible to do this? If yes, could you provide me with an example?
My other doubt would be in relation to retransmission through NUS. Is it possible when retransmitting data from the peripheral or central, choose the device I'm going to connect to and send the data through the MAC of this device? I saw some examples doing this by the connection identifier, but I would like to know who to direct the data to according to the MAC, as I will not maintain a connection with peripherals, I just connect to send data. In short, I would like to establish a connection and send data only if the device has a specific MAC.
How to do this, can you give me an example?
I'm open to suggestions, I'd like to do this with the best possible performance, either with a whitelist or filters. Thank you very much.
I'm using nRF 52840, Softdevice S140, nRF5 SDK 17.0.2 and my application has a nus central + nus + beacon.