From 86cad8b825f52777a14e8384cc180e103f35c61a Mon Sep 17 00:00:00 2001 From: mbroek Date: Fri, 26 Jun 2020 11:12:28 +0200 Subject: [PATCH 1/2] When a generic mesh model message is received "bt_mesh_generic_server_cb_evt_to_btc" copies the ctx values to cb_params for the mesh stack. recv_rssi was not copied. This means the rssi could not be read when receiving generic server messages using ble_mesh. --- components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c | 1 + 1 file changed, 1 insertion(+) diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c index 7a9c5348f8..38839b61a4 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c @@ -742,6 +742,7 @@ void bt_mesh_generic_server_cb_evt_to_btc(u8_t evt_type, cb_params.ctx.recv_ttl = ctx->recv_ttl; cb_params.ctx.recv_op = ctx->recv_op; cb_params.ctx.recv_dst = ctx->recv_dst; + cb_params.ctx.recv_rssi = ctx->recv_rssi; if (val && len) { length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value); From 96865524c720bc4a106e641c31be3c85519c73d6 Mon Sep 17 00:00:00 2001 From: lly Date: Mon, 29 Jun 2020 20:06:32 +0800 Subject: [PATCH 2/2] ble_mesh: stack: Copy recv_rssi for other received messages Follow the commit: 2b80cb688359c2f8136307edbc75f3d1952848f7, copy the recv_rssi for other mesh messages. --- components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c | 2 ++ components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c | 1 + components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c | 1 + components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c | 2 ++ components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c | 2 ++ components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c | 2 ++ 6 files changed, 10 insertions(+) diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c index 5c15b11480..c874454078 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_config_model.c @@ -351,6 +351,7 @@ void bt_mesh_config_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, params.ctx.recv_ttl = ctx->recv_ttl; params.ctx.recv_op = ctx->recv_op; params.ctx.recv_dst = ctx->recv_dst; + params.ctx.recv_rssi = ctx->recv_rssi; cb_params.error_code = 0; cb_params.params = ¶ms; @@ -751,6 +752,7 @@ void bt_mesh_config_server_cb_evt_to_btc(u8_t evt_type, cb_params.ctx.recv_ttl = ctx->recv_ttl; cb_params.ctx.recv_op = ctx->recv_op; cb_params.ctx.recv_dst = ctx->recv_dst; + cb_params.ctx.recv_rssi = ctx->recv_rssi; if (val && len) { length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value); diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c index 38839b61a4..4664a83d68 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_generic_model.c @@ -419,6 +419,7 @@ void bt_mesh_generic_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, params.ctx.recv_ttl = ctx->recv_ttl; params.ctx.recv_op = ctx->recv_op; params.ctx.recv_dst = ctx->recv_dst; + params.ctx.recv_rssi = ctx->recv_rssi; cb_params.error_code = 0; cb_params.params = ¶ms; diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c index abb37bd2b3..e3be0c34c3 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_health_model.c @@ -285,6 +285,7 @@ void bt_mesh_health_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, params.ctx.recv_ttl = ctx->recv_ttl; params.ctx.recv_op = ctx->recv_op; params.ctx.recv_dst = ctx->recv_dst; + params.ctx.recv_rssi = ctx->recv_rssi; cb_params.error_code = 0; cb_params.params = ¶ms; diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c index 8816931446..1adaac4f67 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c @@ -263,6 +263,7 @@ void bt_mesh_lighting_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, params.ctx.recv_ttl = ctx->recv_ttl; params.ctx.recv_op = ctx->recv_op; params.ctx.recv_dst = ctx->recv_dst; + params.ctx.recv_rssi = ctx->recv_rssi; cb_params.error_code = 0; cb_params.params = ¶ms; @@ -557,6 +558,7 @@ void bt_mesh_lighting_server_cb_evt_to_btc(u8_t evt_type, cb_params.ctx.recv_ttl = ctx->recv_ttl; cb_params.ctx.recv_op = ctx->recv_op; cb_params.ctx.recv_dst = ctx->recv_dst; + cb_params.ctx.recv_rssi = ctx->recv_rssi; if (val && len) { length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value); diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c index 2021f81a07..682b4d70f8 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c @@ -501,6 +501,7 @@ void bt_mesh_sensor_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, params.ctx.recv_ttl = ctx->recv_ttl; params.ctx.recv_op = ctx->recv_op; params.ctx.recv_dst = ctx->recv_dst; + params.ctx.recv_rssi = ctx->recv_rssi; cb_params.error_code = 0; cb_params.params = ¶ms; @@ -874,6 +875,7 @@ void bt_mesh_sensor_server_cb_evt_to_btc(u8_t evt_type, cb_params.ctx.recv_ttl = ctx->recv_ttl; cb_params.ctx.recv_op = ctx->recv_op; cb_params.ctx.recv_dst = ctx->recv_dst; + cb_params.ctx.recv_rssi = ctx->recv_rssi; if (val && len) { length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value); diff --git a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c index 6dd93b31a3..68862ac380 100644 --- a/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c +++ b/components/bt/esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c @@ -265,6 +265,7 @@ void bt_mesh_time_scene_client_cb_evt_to_btc(u32_t opcode, u8_t evt_type, params.ctx.recv_ttl = ctx->recv_ttl; params.ctx.recv_op = ctx->recv_op; params.ctx.recv_dst = ctx->recv_dst; + params.ctx.recv_rssi = ctx->recv_rssi; cb_params.error_code = 0; cb_params.params = ¶ms; @@ -461,6 +462,7 @@ void bt_mesh_time_scene_server_cb_evt_to_btc(u8_t evt_type, cb_params.ctx.recv_ttl = ctx->recv_ttl; cb_params.ctx.recv_op = ctx->recv_op; cb_params.ctx.recv_dst = ctx->recv_dst; + cb_params.ctx.recv_rssi = ctx->recv_rssi; if (val && len) { length = (len <= sizeof(cb_params.value)) ? len : sizeof(cb_params.value);