hello I am using nrf52832. I am advertising some data and scanning (on the same microcontroller) for other nrf52 devices(which will have the same firmware). When the other nrf52 comes closer than certain rssi threshold, I have to transmit this other device data(self ID, other device ID, rssi) to the gateway (which is based on esp32). I have completed the advertising, scanning and getting the data that needs to be sent to the gateway. However, I need suggestion as to how to send this data to the gateway. I am considering two options.
Option 1: I modify the advertisement packet and include this new data that should be sent to the gateway. The gateway will scan for the devices and get the advertisement and decode the required data. But this modified advertisement should be sent only once and go back to default advertisement after that. And this modified advertisement will be different for different device. I tried to use radio notification interrupt to know that the modified packet has been advertised so that I can update it to default advertisement using ble_advertising_advdata_update but somehow it is not working. I can further work on this if it is a good approach.
Option 2: I can make a separate service like nordic Uart and advertise it once I need to send data to the gateway. The gateway scans with this service name, and get the data. For this, I need to add another service and advertise it, along-with already default advertisement and scanning. Also, once I send the data to the gateway using nordic uart, I can stop the nordic uart advertisement and service, and go back to default advertisement and scanning which is running to know if other nrf52 devices have come closer or not
Option 3: You can tell me if above two options are not suitable.
P.S. I am using Segger Embedded Studio and SDK 15.3. I am using nrf52 DK but I need to upload this to nrf52832 custom board.
Regards,
Sheryar Shahzad