ble_mesh: Init device name during proxy server init
Device name will be reset when deinit mesh stack. If not
initializing device name during the next mesh stack init,
it will fail to set the device name when using bluedroid.
@@ -109,7 +109,7 @@ static enum {
MESH_GATT_PROXY,
} gatt_svc = MESH_GATT_NONE;
-static char device_name[DEVICE_NAME_SIZE + 1] = "ESP-BLE-MESH";
+static char device_name[DEVICE_NAME_SIZE + 1];
int bt_mesh_set_device_name(const char *name)
{
@@ -1416,6 +1416,7 @@ int bt_mesh_proxy_init(void)
bt_mesh_gatts_conn_cb_register(&conn_callbacks);
+ strncpy(device_name, "ESP-BLE-MESH", DEVICE_NAME_SIZE);
return bt_mesh_gatts_set_local_device_name(device_name);
}
