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

How long do pointers to characteristic data need to be valid?

The documentation is lacking critical details about what the soft devices do with characteristic data you give it. When you create or update a characteristic you need to give it a pointer to the data. At this point two things can happen:

  1. The data is copied to some internal buffer and the pointer is discarded.
  2. The pointer is saved and used later (e.g. when the characteristic is read).

Which is it? This should be documented for every function that takes pointers like this as it can lead to horrible horrible bugs if you assume 1, but it's actually 2.

Another example of where this needs to be documented is setting/updating connection parameters. In fact nearly every soft device function takes pointer arguments so there is a lot of dangerous ambiguity in the API.

Parents Reply Children
No Data
Related