From 59c1e9a25db12fec86d24322e067d448212b6d9b Mon Sep 17 00:00:00 2001 From: wangjialiang Date: Wed, 7 Apr 2021 17:09:58 +0800 Subject: [PATCH] ble_mesh: stack: the count_log field should be set to 0 when HBS is sent. For MESH/NODE/CFG/HBS/BV-02-C --- components/bt/esp_ble_mesh/mesh_core/cfg_srv.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c b/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c index c6606efba8..c49cea5309 100644 --- a/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c +++ b/components/bt/esp_ble_mesh/mesh_core/cfg_srv.c @@ -3202,19 +3202,18 @@ static void heartbeat_sub_set(struct bt_mesh_model *model, } if (sub_src == BLE_MESH_ADDR_UNASSIGNED || - sub_dst == BLE_MESH_ADDR_UNASSIGNED || - sub_period == 0x00) { + sub_dst == BLE_MESH_ADDR_UNASSIGNED || + sub_period == 0x00) { /* Only an explicit address change to unassigned should * trigger clearing of the values according to * MESH/NODE/CFG/HBS/BV-02-C. */ if (sub_src == BLE_MESH_ADDR_UNASSIGNED || - sub_dst == BLE_MESH_ADDR_UNASSIGNED) { + sub_dst == BLE_MESH_ADDR_UNASSIGNED) { cfg->hb_sub.src = BLE_MESH_ADDR_UNASSIGNED; cfg->hb_sub.dst = BLE_MESH_ADDR_UNASSIGNED; cfg->hb_sub.min_hops = BLE_MESH_TTL_MAX; cfg->hb_sub.max_hops = 0U; - cfg->hb_sub.count = 0U; } period_ms = 0; @@ -3240,6 +3239,11 @@ static void heartbeat_sub_set(struct bt_mesh_model *model, hb_sub_send_status(model, ctx, STATUS_SUCCESS); + /* For case MESH/NODE/CFG/HBS/BV-02-C, set count_log to 0 + * when Heartbeat Subscription Status message is sent. + */ + cfg->hb_sub.count = 0U; + /* MESH/NODE/CFG/HBS/BV-01-C expects the MinHops to be 0x7f after * disabling subscription, but 0x00 for subsequent Get requests. */