ble_mesh: Make RSSI value available to mesh applications
This commit is contained in:
parent
89a681fd4a
commit
67cb3062a6
5 changed files with 11 additions and 5 deletions
|
@ -491,6 +491,9 @@ typedef struct {
|
||||||
/** Destination address of a received message. Not used for sending. */
|
/** Destination address of a received message. Not used for sending. */
|
||||||
uint16_t recv_dst;
|
uint16_t recv_dst;
|
||||||
|
|
||||||
|
/** RSSI of received packet. Not used for sending. */
|
||||||
|
int8_t recv_rssi;
|
||||||
|
|
||||||
/** Received TTL value. Not used for sending. */
|
/** Received TTL value. Not used for sending. */
|
||||||
uint8_t recv_ttl: 7;
|
uint8_t recv_ttl: 7;
|
||||||
|
|
||||||
|
|
|
@ -886,7 +886,7 @@ init_friend:
|
||||||
frnd->clear.frnd = sys_be16_to_cpu(msg->prev_addr);
|
frnd->clear.frnd = sys_be16_to_cpu(msg->prev_addr);
|
||||||
|
|
||||||
BT_DBG("LPN 0x%04x rssi %d recv_delay %u poll_to %ums",
|
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:
|
* Spec says:
|
||||||
|
@ -901,12 +901,13 @@ init_friend:
|
||||||
}
|
}
|
||||||
|
|
||||||
k_delayed_work_submit(&frnd->timer,
|
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,
|
friend_cred_create(rx->sub, frnd->lpn, frnd->lpn_counter,
|
||||||
frnd->counter);
|
frnd->counter);
|
||||||
|
|
||||||
enqueue_offer(frnd, rx->rssi);
|
enqueue_offer(frnd, rx->ctx.recv_rssi);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,9 @@ struct bt_mesh_msg_ctx {
|
||||||
/** Destination address of a received message. Not used for sending. */
|
/** Destination address of a received message. Not used for sending. */
|
||||||
u16_t recv_dst;
|
u16_t recv_dst;
|
||||||
|
|
||||||
|
/** RSSI of received packet. Not used for sending. */
|
||||||
|
s8_t recv_rssi;
|
||||||
|
|
||||||
/** Received TTL value. Not used for sending. */
|
/** Received TTL value. Not used for sending. */
|
||||||
u8_t recv_ttl: 7;
|
u8_t recv_ttl: 7;
|
||||||
|
|
||||||
|
|
|
@ -1398,7 +1398,7 @@ void bt_mesh_net_recv(struct net_buf_simple *data, s8_t rssi,
|
||||||
enum bt_mesh_net_if net_if)
|
enum bt_mesh_net_if net_if)
|
||||||
{
|
{
|
||||||
NET_BUF_SIMPLE_DEFINE(buf, 29);
|
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;
|
struct net_buf_simple_state state;
|
||||||
|
|
||||||
BT_DBG("rssi %d net_if %u", rssi, net_if);
|
BT_DBG("rssi %d net_if %u", rssi, net_if);
|
||||||
|
|
|
@ -296,7 +296,6 @@ struct bt_mesh_net_rx {
|
||||||
local_match: 1, /* Matched a local element */
|
local_match: 1, /* Matched a local element */
|
||||||
friend_match: 1; /* Matched an LPN we're friends for */
|
friend_match: 1; /* Matched an LPN we're friends for */
|
||||||
u16_t msg_cache_idx; /* Index of entry in message cache */
|
u16_t msg_cache_idx; /* Index of entry in message cache */
|
||||||
s8_t rssi;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Encoding context for Network/Transport data */
|
/* Encoding context for Network/Transport data */
|
||||||
|
|
Loading…
Reference in a new issue