Require bonding for service notifications

Posted on
  • Hello,

    I'm trying to figure out how-to require bonding to be notified about service value changes. I'm using nRF Connect for debugging and this only works partially:

    • Reading prompts for the key, as expected (requires bonding)
    • Notifications work without bonding

      NRF.setServices(
      {
      0x180d: {
        0x2a37: {
          notify: true,
          value: [0x06, 0],
          readable: true,
          security: {
            read: {
              mitm: true,
              encrypted: true,
            },
          }
        },
      }
      }
      )
      

    Am I missing something? I tried doing for notify, what I did for read but without success.

    Thanks in advance!

  • Sorry for the delay - I missed this. I guess maybe for notifications to require encryption, it's actually the CCCD that needs to have the encrypted flag set on it.

    What I'd suggest is maybe you check NRF.getSecurityStatus and then you don't do updateServices if you're not bonded? That way you won't end up pushing notifications out even if the device can request them

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Require bonding for service notifications

Posted by Avatar for Franz @Franz

Actions