Hello,
Using this link (https://devzone.nordicsemi.com/f/nordic-q-a/35675/how-to-use-static-passkey-for-a-no-display-no-output-peripheral) I'm able to add passkey protection to any characteristic by changing:
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm);
to
BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(&attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_ENC_WITH_MITM(&attr_md.write_perm);
What happens that if I try to read/write this characteristic, a popup comes out asking for passkey. When I enter the static key, the characteristic becomes accessible. But I want the same functionality when any central device wants to connect with this peripheral device. So that no device be able to connect to this peripheral unless passkey process is completed successfully. I searched the forums and am unable what should be changed to achieve this.
I'm using nRF52840, SDK16.0.0, SD7.0.1.
Regards.