From f02d095ff1fd57ba687d2c7a94bba473feed468c Mon Sep 17 00:00:00 2001 From: lly Date: Mon, 18 May 2020 15:21:47 +0800 Subject: [PATCH] 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. --- components/bt/esp_ble_mesh/mesh_core/proxy_server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/proxy_server.c b/components/bt/esp_ble_mesh/mesh_core/proxy_server.c index 4305a3ebb..be4703c10 100644 --- a/components/bt/esp_ble_mesh/mesh_core/proxy_server.c +++ b/components/bt/esp_ble_mesh/mesh_core/proxy_server.c @@ -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); }