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

S110 API variables questions

In the nRF51 SDK examples, some pass the parameter adv_params off the stack as a locally declared vaiable in the context of the function and some pass static global variables.

For this API, and others, which is correct (or are both valid, i.e., the softdevice makes local copies) ? Local variables which are only valid in the function context or global variables?

Does the softdevice keep the pointers around or does it locally copy the data?

Parents
  • The SoftDevice will copy all the data it needs for API calls. Some calls will have in/out or out-values you might want to keep around or double-check against (lengths written, attribute handles assigned, etc.), but this is up to you.

    (In the few cases where pointers have to live for a while, the SoftDevice would have to send you a heads-up when memory can be freed. This is currently done when handling long writes, using MEM_REQUEST.)

Reply
  • The SoftDevice will copy all the data it needs for API calls. Some calls will have in/out or out-values you might want to keep around or double-check against (lengths written, attribute handles assigned, etc.), but this is up to you.

    (In the few cases where pointers have to live for a while, the SoftDevice would have to send you a heads-up when memory can be freed. This is currently done when handling long writes, using MEM_REQUEST.)

Children
No Data
Related