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

How to enable notification on NRF52832 peer?

Hi,

I develop application using BLE. In my scenario two NRF52832 operate in two different roles (Client and Server). I have ready to run app (as server) and can communicate with MCP on Android platform using notification. But have problem with enabling notification on NRF52832 (CENTRAL role). I do not need pairing devices nor storing communication parameters. It is enough that with each new connection I will enable/disable notification. How to do it? Many threads are discussing notifications on Android and/or iOS platforms. And how to enable notification on NRF52/51?

Parents
  • Yes, if you don't pair with device then you cannot assume it will remember GATT Server state after disconnecting. You simply find Client Characteristic Configuration Descriptor (CCCD) attached to Characteristic you want to enable Notifications on and write particular bit into it (Write or Write with Response (G)ATT methods should do the job). CCCD has 16-bit value, enable/disable Notifications bit is the lowest one (but remember that BLE uses little endian encoding so depending on data string interpretation you want to write 0x0001 or 0x0100).

  • Thank you for the hint. I found an example of how to do this. Unfortunately, in the example given there are "magic numbers":) In particular I do not know how to find a cccd handle for given characteristic (in the example == 16). Is the cccd handler always first on the list of handlers? Of course there is no problem with recomputing CRC-16 for different parameters.

Reply
  • Thank you for the hint. I found an example of how to do this. Unfortunately, in the example given there are "magic numbers":) In particular I do not know how to find a cccd handle for given characteristic (in the example == 16). Is the cccd handler always first on the list of handlers? Of course there is no problem with recomputing CRC-16 for different parameters.

Children
No Data
Related