Hello,
I'm trying to change Bluetooth name at runtime using Zephyr on the nRF700-DK. So for now I have a name defined with CONFIG_BT_DEVICE_NAME in my prj.conf that I tried to override using the following code (based on this ticket ). Unfortunately, my device always appears with the old name. Is something missing in my prj.conf file ?
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static const struct bt_data sd[] =
{
BT_DATA_BYTES(BT_DATA_UUID128_ALL, MY_SERVICE_UUID),
};
static struct bt_data ad[] =
{
BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR), BT_LE_ADV_OPT_USE_NAME ),
BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
};
static void bt_ready(int err)
{
if (err)
{
printk("BLE init failed with error code %d\n", err);
return;
}
//Configure connection callbacks
bt_conn_cb_register(&conn_callbacks);
prj.conf :
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
CONFIG_NEWLIB_LIBC=y
#Global attroibutes
CONFIG_GPIO=y
#SPI attributes
CONFIG_SPI=y
#PWM attributes
CONFIG_NRFX_PWM0=y
#BLE attributes
CONFIG_BT=y
CONFIG_BT_NUS=y
CONFIG_BT_GATT_DYNAMIC_DB=y
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_MAX_CONN=1
CONFIG_BT_L2CAP_TX_BUF_COUNT=5
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="My_Device"
Thank you,
Best regards