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

Updating advertising data (manuf. spec. data) in SDK15

Hello guys! And girls Slight smile

My project is working as expected in SDK14.2.
I'm updating adv data (manuf. spec. data) without any problem with this function



But in SDK15 the function ble_advdata_set() has been deprecated.
The migration guide is says to use ble_advdata_encode() and sd_ble_gap_adv_set_configure() instead.

So I changed it to something like this



And of course... it's not working. :)
I'm getting a very strange error at sd_ble_gap_adv_set_configure() --> app: ERROR 12801 [Unknown error code]

Any idea why?
What I'm doing wrong?
What I have to change to get this working like in the SDK14.2?

Parents
  • Try this code:

  • I also tried this, and recieve error 12, with a ble_advdata_encode(). May be we should encode data directly to m_advertising.enc_advdata? like when we initialize advertising?

  • This case was rather long and have already dragged out in time. So to move on, have you just considered taking an SDKv15 example and try to modify it to your needs, and then drag in your own specific application code to that project?

    From quickly reading the case it seems you have been presented with a workaround to stop, update and re-start advertisement. This should work.

    I understand neither of the above are ideal solutions from an implementation perspective, but from the end customer perspective they likely will never see the difference. 

    Best regards,
    Kenneth

  • Yes, I know that but why use a "re-start" method if this is not really necessary? 
    apparently agrees with me :)

    Anyway... can I assume that this is a Nordic final answer related to this problem?

  • Please consider this as a final answer in this case.

  • Ok, thank you

  • Hello Haakonsh,

    Question to your reply : "Yes! You need at least two buffers to switch between."

    If I use two buffers one after another, do I need to flush the buffers before using it again in sd_ble_gap_adv_set_configure? or I just have to assign them one after another?

Reply
  • Hello Haakonsh,

    Question to your reply : "Yes! You need at least two buffers to switch between."

    If I use two buffers one after another, do I need to flush the buffers before using it again in sd_ble_gap_adv_set_configure? or I just have to assign them one after another?

Children
  • You just have to assign the one after the other. The SoftDevice requires only that you send it a pointer to an address that is different from the previous buffer, the content can remain the same. 

  • But my content changes every time(battery voltage value. I tried to refer eddystone and hrs example but couldn't go so far).

    manuf_specific_data.company_identifier = battVolt_1;

    this line is called every time when there is time out of timer. So, data is updated.

    Now is it good approach to use if else to assign new data(new buffer) at every cycle? Or am I at wrong approach?

    I set NULL too in _configure but didnt work.

    I will try to read this whole thread but it is quite long so if you can help in this!

  • "Now is it good approach to use if else to assign new data(new buffer) at every cycle? Or am I at wrong approach?"

    That sounds like what I would have done.


  • But sir code still stopped working at _configure().

    I tried to do debugging on keil.

    I did searched infocenter and different threads but could not get the idea about id,pc,info(i know definitions but how to use them to get to the error).

  • Thank you Haakonsh for your help.

    I made mistake by misunderstanding the pointer and buffer, Sorry!

    This thread helped me.