This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Dynamic notification change

Hi all

I am using a nRF52840 with SDK 15.3.0 and s140_nrf52_6.1.1 soft device.

My application is a multi-peripheral device that has a common service, each peripheral can have different characteristic read/write permissions for this service. There can be many centrals, each central has its own unique security-key. If a central wants to connect it first NFC taps passing its security-key and BDA to the peripheral, the peripheral responds by advertising with a whitelist containing the single BDA - this all works very well.

If a central has no read permission for a specific characteristic then notifications should be disabled, the multi-peripheral knows before advertising if notifications should be enabled or not.

Is there a way to change the notification bit in the CCCD for the peripheral before advertising bearing in mind there may already be one or more centrals connected to the common service. I have searched the docs and devZone and not found a way to do this. There are ways to update the CCCD when there is a connection handle, although the CCCD is not updated until the next connection - but not for updating before a connection.

Does anyone have any ideas?

Thanks.

Parents Reply
  • Thanks for your reply Jared.

    If the user has no read permissions I'm returning BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED from BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST when the user tries to read the characteristic, which works fine, but as already mentioned a user can still enable notifications. Is it possible to return an error like BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED from BLE_GATTS_EVT_WRITE when a user tries to enable notifications? Or could there be another way?

Children
Related