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

Advertising Manufacturer data wrong after connect->disconnect

I implemented  manufacturer specific advertising to transmit important data without having to connect to the ble peripheral. These data can change over time so I need to be able to update them.

I adapted advertising_init. I also programmed a function to update the advertising data: the latter stops advertising, calls ble_advdata_set and then restarts advertising

All of this works fine until I connect to the peripheral using nrf-connect. After I disconnect, the manufacturer specific part of the advertising packet is wrong.

Shall I call ble_advdata_set again after disconnect and if so where is the best place to do it ?

I am using sdk 14.2 and the softdevice 132

Thanks in advance,

Christian

Parents
  • I might have found the origin of the problem:

    To update the advertising information, I was calling the functions advertising_stop to stop it, ble_advdata_set  (ble_advdata.c) to update the manufacturer data and  advertising_start (main.c of the ble_app_template example) to restart advertising.

    The latter function calls  ble_advertising_start passing m_advertising as a parameter. I then noticed that m_advertising was not updated by ble_advdata_set probably causing the trouble.

    I also use the same advertising update function to suspend whitelisting (with m_advertising.whitelist_temporarily_disabled = true; ) and display a flag in the manufacturer data to tell the user that the peripheral is bondable.

    In order to solve the problem, I replaced the call to ble_advdata_set with a call to advertising_init. I find it a bit ugly but at least it works.

    I realy need to:

    - enable and disable whitelisting

    - update the manufacturer data

    Is there a way to do it without stoping and restarting advertising ?

    if not is there a way to do a cleaner implementation without rewriting the ble_advertising functions ?

    Christian

Reply
  • I might have found the origin of the problem:

    To update the advertising information, I was calling the functions advertising_stop to stop it, ble_advdata_set  (ble_advdata.c) to update the manufacturer data and  advertising_start (main.c of the ble_app_template example) to restart advertising.

    The latter function calls  ble_advertising_start passing m_advertising as a parameter. I then noticed that m_advertising was not updated by ble_advdata_set probably causing the trouble.

    I also use the same advertising update function to suspend whitelisting (with m_advertising.whitelist_temporarily_disabled = true; ) and display a flag in the manufacturer data to tell the user that the peripheral is bondable.

    In order to solve the problem, I replaced the call to ble_advdata_set with a call to advertising_init. I find it a bit ugly but at least it works.

    I realy need to:

    - enable and disable whitelisting

    - update the manufacturer data

    Is there a way to do it without stoping and restarting advertising ?

    if not is there a way to do a cleaner implementation without rewriting the ble_advertising functions ?

    Christian

Children
No Data
Related