cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the order of advertising elements in BLE

ledi001
Associate III

Hi,

i use the example BLE_p2pServer_ota with STM32WBA55. When i scan the device, i get the advertising elements in this order:

2024-11-03_10h11_22.png

I want to swap the first both elements. How and in which file can I change this order?

 

 

 

1 REPLY 1
_Joe_
ST Employee

Hi Ledi,

you can manage ADV data in the app_ble.c

In BLE project by default, TX power Level is removed from the ADV data with the following code:

status = aci_gap_delete_ad_type(AD_TYPE_TX_POWER_LEVEL);
if (status != BLE_STATUS_SUCCESS)
{
  LOG_INFO_APP("==>> delete tx power level - fail, result: 0x%02X\n", status);
}

Then you can add it in the you want here:

/* Advertising Data */
uint8_t a_AdvData[26] =
{
  6, AD_TYPE_COMPLETE_LOCAL_NAME, 'H', 'R', '_', 'X', 'X',  /* Complete name */
  2, AD_TYPE_TX_POWER_LEVEL, 0x??,

BR, Joé