ble_mesh: Make RSSI value available to mesh applications

This commit is contained in:
lly 2019-10-24 09:51:16 +08:00
parent 32387250bc
commit c344a4a3b9
5 changed files with 11 additions and 5 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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 */