I'm developing a Peripheral with a rather intricate connection process and doing a lot of testing.
I find that if a Central connects, and then the Peripheral tries to send a notification via sd_ble_gatts_hvx() before the Central has enabled notifications, and before it has ever Bonded with that Central, the call fails with BLE_ERROR_GATTS_SYS_ATTR_MISSING.
However, if the devices have previously Bonded the Central immediately encrypts the link once it connects. Then if the Peripheral tries to send the notification before the Central enables notifications, the call succeeds! I've confirmed this with a Bluetooth sniffer.
Is this expected behavior for the SoftDevice? What information is used to allow the SD to not return an error in the second case?
I am using s132 v5.1.0, SDK v14.2, nRF52832.