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
  • 71 replies, none of them is the solution. Why Nordic changes the original simple API "ble_advdata_set", the new API really sucks !!!

  • I found a solution that seems to work fine. Once you have started the advertising, just use ble_advdata_encode to encode your data and write it to the buffer used when you first called sd_ble_gap_adv_set_configure . Do not call the sd_ble_gap_adv_set_configure function again, only encode the data. Your advertising data will be updated every time you do this. This might not be the recommend way for doing this, but I did not encounter any errors yet.

  • I am in the same situation as you. I think that advdata_buffer_p is new advertising data and len is the lenght of that data, but dont take my word for it.

    I would also like to see the set_advdata_buffer(); function - struggling a bit in here.

  • If you want you can prevent using two buffers with a little trick. Just use a NULL pointer while you're changing the data. This is my update function, which uses encoded data. If your data is not encoded, just call the ble_advdata_encode() function before.

  • Alexander, ... guys, you are not using the "Advertising module", I'm right?
    I conclude that when I saw you "adv_params" parameters.

  • If you mean the ble_advertising.c module, then yes I don't use it.

    In my opinion, those functions are not well implemented. You can see my explanation in another ticket I created.

  • Hey Spirit...Can you please post your advertising_init() function which you used with along with update()  function which is working in SDK14.2 or if possible the whole code...That would a great favor...!

Reply
  • Hey Spirit...Can you please post your advertising_init() function which you used with along with update()  function which is working in SDK14.2 or if possible the whole code...That would a great favor...!

Children
  • I knew it.
    I'm using a whitelist so for now I "must" stay with an Advertising module Disappointed

    I'm sorry, but I'm on vacation right now and I don't have the code of my project with me.

  • I don't see the connection between using a whitelist and using the advertising module. The module is just a wrapper for the softdevice functions, which I use directly instead. I even see a problem using the module, because ble_advertising_start() overwrites the advertising parameters to BLE_GAP_ADV_FP_ANY.

  • , tnx for info, I will try without a module to.

    Can you please show me your adv_init funciton?
    EDIT: I saw now your function in the other topic.

    Do you have any of your project(s) on some-sort-of github too?

  • I posted some explanation to the function here, but if you just need the code:

    EDIT: Sorry, but I have no github projects.

  • Guys, I don't know if you already seen that, but... in the SDK15.1 the Advertising module has a new function - ble_advertising_advdata_update ;)