3 Replies Latest reply on Dec 15, 2016 2:10 AM by user_1377889

    Update Characteristic on read request

    finke_1659276

      Hi,

      is there any way to update the data of a Characteristic during a read request?

      I want to update the data by writing a new value to the Characteristic when I receive a read request. The client should read the updated data then.

      Hope you can help.

        • 1. Re: Update Characteristic on read request
          jrow

          This is not currently possible in the latest official BLE stack component. There is a CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ event which can be enabled on a per-attribute basis that tells the application code that a read has been requested, but the data is pre-loaded for transfer to the client before this event is triggered, and so it is not possible to actually modify the value before it is delivered back to the client. I am unsure whether this is going to change in the near future.

             

          As an alternative (though perhaps not as clean as the modify-on-read scenario), you could make the characteristic support both write and notify or indicate, then have the server notify/indicate the immediate new value to the client after the client writes a simple value to the same characteristic. At a protocol level, this is not all that different from what actually happens with a read request.

          • 2. Re: Update Characteristic on read request
            finke_1659276

            That might be possible for custom services. I also need this for predefined services, such as "Device Information". I couldn't understand why Cypress doesn't give the possibility to do this. I'm sure not the only one who might need this.

            • 3. Re: Update Characteristic on read request
              user_1377889

              As jrow said "This is not currently possible in the latest official BLE stack component." The BLE stack is given by the Bluetooth association and so ensures that all "official" versions can interact with each other on all iso layers.

                 

               

                 

              Bob

              1 of 1 people found this helpful