hiding GATT peripheral services till Passkey pairing

Vikrant More <vikrant8051@...>

Hello World !!
I modified $zephyr_base/sample/bluetooth/peripheral/src/main.c as mentioned above.

Using nRF Blinky Android App, I can toggle LED1 on nRF52840-PDK board & can read & receive notification about Button1 status.

But anyone with that App can access my peripheral device.

If I enabled  BT_GATT_PERM_READ_AUTHEN & BT_GATT_PERM_WRITE_AUTHEN for characteristic using BT_GATT_DESCRIPTOR then only paired device could access it.

For password based pairing, we have to access peripheral's UART terminal since it throws random passkey on it.

How to make it static one?

If I reboot the board, why MAC address get updated ?

If I reboot the board, I have to pair it again with Smartphone. Why it so ?
How to avoid this ?

What changes I have to make, so that once paired peripheral will not allow other device to access it unless & until I pressed some button on it ?

How to enable GATT connection, only after password protected pairing process has completed with Smartphone ?

When I do experiments with nRF connect App I can connect to other BLE devices surrounding to me but I can't see services running on them. How to achive that ?

Thank You !!