2024-03-04 05:08 AM
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?
2024-03-12 01:44 AM
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.
2024-03-13 07:45 AM
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
2024-04-12 08:43 AM
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.
2024-04-15 02:14 AM
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.
2024-04-15 02:17 AM
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.
2024-04-15 03:11 AM
I'm not sure whether we talk past each other here, but my original question still stands to be answered.
My workaround does not really seem like the intended way to do this. And I assume ST must have some way they imagined how this should be done ideally in coherence with MX and HAL, so I would like to know the recommanded way to change the advertising data.