Question
STM32WB55 Device Name is not changed in GAP/GATT
Hey,
I try to change the device name for my broadcast inside the initialization of the Ble_Hci_Gap_Gatt_Init() funtion. My implementation is the following:
static void Ble_Hci_Gap_Gatt_Init(void){
uint8_t index;
uint16_t gap_service_handle, gap_dev_name_char_handle, gap_appearance_char_handle;
const uint8_t *bd_addr;
uint16_t appearance[1] = { BLE_CFG_GAP_APPEARANCE };
/**
* Initialize HCI layer
*/
/*HCI Reset to synchronise BLE Stack*/
hci_reset();
/**
* Write the BD Address
*/
bd_addr = BleGetBdAddress();
aci_hal_write_config_data(CONFIG_DATA_PUBADDR_OFFSET,
CONFIG_DATA_PUBADDR_LEN,
(uint8_t*) bd_addr
);
/**
* Set TX Power to 0dBm.
*/
aci_hal_set_tx_power_level(1, CFG_TX_POWER);
/**
* Initialize GATT interface
*/
aci_gatt_init();
/**
* Initialize GAP interface
*/
const char *name = "STM32WB";
aci_gap_init(GAP_PERIPHERAL_ROLE,
0,
APPBLE_GAP_DEVICE_NAME_LENGTH,
&gap_service_handle,
&gap_dev_name_char_handle,
&gap_appearance_char_handle
);
if (aci_gatt_update_char_value(gap_service_handle,
gap_dev_name_char_handle,
0,
strlen(name),
(uint8_t *) name))
{
BLE_DBG_SVCCTL_MSG("Device Name aci_gatt_update_char_value failed.\n");
}
if(aci_gatt_update_char_value(gap_service_handle,
gap_appearance_char_handle,
0,
2,
(uint8_t *)&appearance))
{
BLE_DBG_SVCCTL_MSG("Appearance aci_gatt_update_char_value failed.\n");
}
/**
* Initialize Default PHY
*/
hci_le_set_default_phy(ALL_PHYS_PREFERENCE,TX_1M,RX_1M);
}With the debugger I can see that every function returns a BLE_SUCCESS, but nothing is changed. My BLE scanner app shows me "P2PSRV1" as the device name.
What can I do to set the correct name?
Thanks a lot,
Ben
