From d79e95e6e038fca23dabde1ae6001414983dc0e8 Mon Sep 17 00:00:00 2001 From: lly Date: Wed, 19 Aug 2020 17:56:13 +0800 Subject: [PATCH] ble_mesh: nimble: Fix updating ccc handle with wrong value --- .../mesh_core/nimble_host/mesh_bearer_adapt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c b/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c index 2cdb0a6d1..6d1e06c6a 100644 --- a/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c +++ b/components/bt/esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c @@ -207,7 +207,10 @@ static int dsc_disced(uint16_t conn_handle, const struct ble_gatt_error *error, switch (error->status) { case 0: - bt_mesh_gattc_info[i].ccc_handle = dsc->handle; + if (bt_mesh_gattc_info[i].ccc_handle == 0 && dsc && + BLE_UUID16(&dsc->uuid)->value == BLE_MESH_UUID_GATT_CCC_VAL) { + bt_mesh_gattc_info[i].ccc_handle = dsc->handle; + } break; case BLE_HS_EDONE: @@ -291,7 +294,8 @@ static int chr_disced(uint16_t conn_handle, const struct ble_gatt_error *error, break; } } - ble_gattc_disc_all_dscs(conn_handle, bt_mesh_gattc_info[j].data_out_handle, 0xffff, dsc_disced, (void *)j); + ble_gattc_disc_all_dscs(conn_handle, bt_mesh_gattc_info[j].data_out_handle, bt_mesh_gattc_info[j].end_handle, + dsc_disced, (void *)j); } else { ble_gattc_disc_all_chrs(conn_handle, bt_mesh_gattc_info[j].start_handle, bt_mesh_gattc_info[j].end_handle, chr_disced, (void *)j);