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

Apply a different characteristic value for each connection handle

I have an nRF52840 based peripheral running SDK 15.3.

I have a custom service with a write characteristic and a read characteristic. The peripheral supports multiple connections. I would like for the read characteristic's value to be unique for each connection (i.e. unique for each central). Is this possible?

For example. Assume the Bluetooth service is performing an echo of the data written by the central. Let's assume there are two central devices connected (central_1 and central_2). Assume central_1 is connected on connection handle 1 and central 2 is connected on connection handle 2. The desired behavior is:

  • If central_1 writes a value of 10 on connection handle 1 then the read characteristic is set to 10 for connection handle 1.
  • If central_2 writes a value of 20 on connection handle 2 then the read characteristic is set to 20 for connection handle 2.
  • Reading on connection handle 1 should always return the value of 10 and reading on connection handle 2 should always return the value of 20

Is there a way to accomplish this?

Related