diff --git a/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h b/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h index d59c29eb6..6263c0124 100644 --- a/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h +++ b/components/bt/esp_ble_mesh/api/esp_ble_mesh_defs.h @@ -491,6 +491,9 @@ typedef struct { /** Destination address of a received message. Not used for sending. */ uint16_t recv_dst; + /** RSSI of received packet. Not used for sending. */ + int8_t recv_rssi; + /** Received TTL value. Not used for sending. */ uint8_t recv_ttl: 7; diff --git a/components/bt/esp_ble_mesh/mesh_core/friend.c b/components/bt/esp_ble_mesh/mesh_core/friend.c index 966382cf6..dc27079c8 100644 --- a/components/bt/esp_ble_mesh/mesh_core/friend.c +++ b/components/bt/esp_ble_mesh/mesh_core/friend.c @@ -886,7 +886,7 @@ init_friend: frnd->clear.frnd = sys_be16_to_cpu(msg->prev_addr); BT_DBG("LPN 0x%04x rssi %d recv_delay %u poll_to %ums", - frnd->lpn, rx->rssi, frnd->recv_delay, frnd->poll_to); + frnd->lpn, rx->ctx.recv_rssi, frnd->recv_delay, frnd->poll_to); /** * Spec says: @@ -901,12 +901,13 @@ init_friend: } k_delayed_work_submit(&frnd->timer, - offer_delay(frnd, rx->rssi, msg->criteria)); + offer_delay(frnd, rx->ctx.recv_rssi, + msg->criteria)); friend_cred_create(rx->sub, frnd->lpn, frnd->lpn_counter, frnd->counter); - enqueue_offer(frnd, rx->rssi); + enqueue_offer(frnd, rx->ctx.recv_rssi); return 0; } diff --git a/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h b/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h index 48b9a188b..cdc620520 100644 --- a/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h +++ b/components/bt/esp_ble_mesh/mesh_core/include/mesh_access.h @@ -140,6 +140,9 @@ struct bt_mesh_msg_ctx { /** Destination address of a received message. Not used for sending. */ u16_t recv_dst; + /** RSSI of received packet. Not used for sending. */ + s8_t recv_rssi; + /** Received TTL value. Not used for sending. */ u8_t recv_ttl: 7; diff --git a/components/bt/esp_ble_mesh/mesh_core/net.c b/components/bt/esp_ble_mesh/mesh_core/net.c index 2bfba51d4..9f5bde937 100644 --- a/components/bt/esp_ble_mesh/mesh_core/net.c +++ b/components/bt/esp_ble_mesh/mesh_core/net.c @@ -1398,7 +1398,7 @@ void bt_mesh_net_recv(struct net_buf_simple *data, s8_t rssi, enum bt_mesh_net_if net_if) { NET_BUF_SIMPLE_DEFINE(buf, 29); - struct bt_mesh_net_rx rx = { .rssi = rssi }; + struct bt_mesh_net_rx rx = { .ctx.recv_rssi = rssi }; struct net_buf_simple_state state; BT_DBG("rssi %d net_if %u", rssi, net_if); diff --git a/components/bt/esp_ble_mesh/mesh_core/net.h b/components/bt/esp_ble_mesh/mesh_core/net.h index bc600cfd1..2a74f9779 100644 --- a/components/bt/esp_ble_mesh/mesh_core/net.h +++ b/components/bt/esp_ble_mesh/mesh_core/net.h @@ -296,7 +296,6 @@ struct bt_mesh_net_rx { local_match: 1, /* Matched a local element */ friend_match: 1; /* Matched an LPN we're friends for */ u16_t msg_cache_idx; /* Index of entry in message cache */ - s8_t rssi; }; /* Encoding context for Network/Transport data */