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?

Parents Reply
  • Can you describe in more detail exactly how would you use the BLE link context manager to accomplish what I described above?

    Is the BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event the only way to supply the unique data to each client?

    Can the context manager be used to provide unique notifications per each connection?

    It appears the context manager does not actually set the characteristic value for each connection. It looks like it just supplies a storage area to store the values for multiple connections and then on RW_AUTHORIZE_REQUEST the actual response is set. Is my understanding correct?

Children
No Data
Related