Skip to main content
A.D.
Associate III
March 4, 2024
Question

Recommanded way to change Advertising Data (specifically complete local name) via API call

  • March 4, 2024
  • 6 replies
  • 2024 views

When using the STM32WB5MMG, what is the recommanded way to change the AdvData (specifically complete local name) during runtime?

 

I see that CubeMX stores the data in "a_AdvData" in app_ble.c

But there is no API call to change that variable. Would it be a good approach to implement a "setter" for that value in user code section?

Alternative would be to call aci_gap_update_adv_data, but that does not change the "a_AdvData". So when I call "APP_BLE_Init" after using aci_gap_update_adv_data, the AdvData is again reset to value stored in "a_AdvData".

 

So, what is the recommanded way to do this?

This topic has been closed for replies.

6 replies

A.D.
A.D.Author
Associate III
March 12, 2024

I would like to push this topic, as I really can't find any guidance in the official documentation for a recommended way to change advertising data in code, while still being able to use the api calls.

Explorer II
March 13, 2024

I'm interested on this also and I think that it isn't a niche topic while the documentation is very lacking thus it would be nice to have an answer from some ST employee

STTwo-32
ST Technical Moderator
April 12, 2024

Hello @A.D. 

The advertising information is represented by advertising data elements, which are standardized on the Bluetooth SIG. So, I suggest you to take a look at the Bluetooth Core Specification V5.4 for more details.

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
A.D.
A.D.Author
Associate III
April 15, 2024

Thank you for your answer @STTwo-32.

Unfortunately I don't need help with "what" to use as advertising data. That is very clear to me and right now I already set an example value for that via CubeMX with field "AD_TYPE_COMPLETE_LOCAL_NAME".

But I don't want to set a fixed local name via CubeMX but have to create the local name on the fly with the configured serial number.

And my problem now is how to change the local name correctly, so it works optimally with the HAL function calls.

 

My current best guess is to add a setter function in User Code section in app_ble.c to change the global array "a_AdvData". I can then expose that setter to other parts of the code.

STTwo-32
ST Technical Moderator
April 15, 2024

Hello @A.D. 

Since your original problem is solved. I suggest you Select a best Answer and create a new post for your new request.

Best regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.