I am using one of peripheral examples ble_app_hids_keyboard from nordic SDK for understanding the re connection mechanism. I am using nrfConnect app. I have a few questions regarding that
1. Does the central device(in this case android phone) always tries to automatically reconnect when nrf52 comes in range after an out of range situation and advertise? If so is there any good example in SK that shows automatic reconnection?
2. Can a peripheral device initiate reconnection?(Note: The device has been previously connected to phone and then gone out of range)
If your device have bonded with the phone, then when in range of each other the central(phone) will try to reconnect to the peripheral as long as the peripheral is advertising. You can have a look at the heart rate example in the SDK. After you have connected to the device using nRF Connect, you can bond by pressing the three dots in the upper right corner then bond.
No, it is the central that decides which peripheral it connects to, so it will initate the reconnection.
Thanks for the answer. Also in my case the central and peripheral are both Nordic devices(nrf52 series) In this case is there any Nordic API which helps central to automatically reconnect after an out of range situation
I suggest you have a look at heart rate example on the central side.