I'm currently trying to update data periodically in the advertising response packet. After successfully initializing and starting advertising, I configure srdata within a ble_advertising_init_t struct to contain my desired manufacturer data. However, the function "sd_ble_gap_adv_set_configure" within "ble_advertising_init" yields error 8 which to my understanding indicates "NRF_ERROR_INVALID_STATE". I have tried implementing changes according to ble_gap.h yet the error still persists. Could I get some more clarification on these points from ble_gap.h:
* @retval ::NRF_ERROR_INVALID_STATE Invalid state to perform operation. * - It is invalid to provide non-NULL advertising set parameters while advertising. * - It is invalid to provide the same data buffers while advertising. To update * advertising data, provide new advertising buffers.
Also, is there a better way to update the advertising response packet?
Thanks in advance.
The easiest way for you to update advertising/response data would be to stop advertising, update the data then start advertising again. If you want to update the advertisement data while advertising you would have to use other buffers. You have to provide new advertising buffers. There have been some threads about this on the forum.
Here are a relevant thread.