I am developing a device based on nrf52840, this is peripheral. But I want to change the code so that I can only connect to my device using my application (in other cases, for example, using nRF Connect, my BLU device rejected the connection attempt).
I know that there is a filtering option - a whitelist, but this is filtering by MAC addresses (i.e. filtering by device) and it is limited by the amount of controller memory. I want the smartphone to be able to connect to the device only if my application is installed on it. How to do it?
The connection at the BLE level neither knows nor cares anything about what app may or may not be used.
So you are going to have to do this in your own protocol - some sort of authentication/authorisation between app & peripheral.
Thanks for the answer.I understand correctly that this can only be done by writing to the characteristic? That is, a connection with the device will be established in any case, and then, if the peripheral does not receive a confirmation command (the application must write data to the characteristic), then it will disconnect. Is the algorithm like this?
All BLE communications happens via Characteristics - so, yes.