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

Updating Advertising Service Data

Good afternoon,

I'm running advertising with a uint16_t service data associated with a 16-bit service UUID.

I would like to update the service data regularly without the need to update the whole advertising package.

Is there a way to do this similarly to the flags_set() function in the BLE Advertising Module? When I try to accomplish it by recurring to "uint8_t * p_service_data = ble_advdata_parse(p_advertising->adv_data.adv_data.p_data, p_advertising->adv_data.adv_data.len, BLE_GAP_AD_TYPE_SERVICE_DATA)" I can never return the correct offset in the advertising data related to the Service Data field - it always returns 0 offset - and therefore can't access the actual Service Data to update it. Any suggestions to accomplish this?

Thank you,

João

Parents
  • Hi,

    If ble_advdata_parse() always returns NULL it indicates that your advertising packets doesn't contain any Service Data. Have you confirmed that your packet actually contains a Service Data field before you call ble_advdata_parse()? You can easily see if the field is there with nRF Connect for mobile for example. 

    If it is there, can you upload your code? 

Reply
  • Hi,

    If ble_advdata_parse() always returns NULL it indicates that your advertising packets doesn't contain any Service Data. Have you confirmed that your packet actually contains a Service Data field before you call ble_advdata_parse()? You can easily see if the field is there with nRF Connect for mobile for example. 

    If it is there, can you upload your code? 

Children
No Data
Related