STM32WB05: How to change default device name (MP1_XXXXXX) in iBeacon advertising ?
Hello,
I am working with STM32WB05KN in beacon mode (non-connectable advertising, legacy advertising).
I am configuring advertising manually using:
aci_gap_set_advertising_configuration()
aci_gap_set_advertising_data_nwk()
aci_gap_set_advertising_enable()
My advertising data contains only:
Flags (0x01)
Manufacturer specific data (iBeacon format)
aci_gap_init(PRIVACY_DISABLED, HCI_ADDR_PUBLIC);
:
:
uint8_t adv_data[] = {
/* Advertising data: Flags AD Type */
0x02,
0x01,
0x06,
/* Advertising data: manufacturer specific data */
26, /* len */
AD_TYPE_MANUFACTURER_SPECIFIC_DATA, /* manufacturer type */
0x30, 0x00, /* Company identifier code (Default is 0x0030 - STMicroelectronics: To be customized for specific identifier) */
0x02, /* ID */
0x15, /* Length of the remaining payload */
0xE2, 0x0A, 0x39, 0xF4, 0x73, 0xF5, 0x4B, 0xC4, /* Location UUID */
0xA1, 0x2F, 0x17, 0xD1, 0xAD, 0x07, 0xA9, 0x61,
0x00, 0x00, /* Major number */
0x00, 0x00, /* Minor number */
0xC8 /* 2's complement of the Tx power (-56dB --> (uint8_t)-56) */
};
ret = aci_gap_set_advertising_data_nwk(0, ADV_COMPLETE_DATA, sizeof(adv_data), adv_data);
if(ret != BLE_STATUS_SUCCESS) {
PRINT_DBG("aci_gap_set_advertising_data_nwk() failed: 0x%02x\r\n", ret);
}
else {
PRINT_DBG("aci_gap_set_advertising_data_nwk() --> SUCCESS\r\n");
}
However, when scanning from a mobile phone, the device name appears as:
MP1_47F8AA
I did not explicitly set any device name in my application.
My Questions:
Where does the default name “MP1_XXXXXX” come from in STM32WB05?
What is the correct way to override this name when using the *_nwk advertising APIs?
Should I:
Use aci_gap_set_device_name()?
Or include AD type 0x09 (Complete Local Name) inside advertising data?
If I add the Local Name in advertising, what is the recommended approach considering the 31-byte legacy advertising limit with iBeacon payload?
My goal is to deploy ~100 beacon devices in the field, each with:
Unique Major/Minor
Optional unique device name
Any best practice recommendations are appreciated.
Thank you.
Edited to apply source code formatting - please see How to insert source code for future reference.
