Added a way to get the RSSI of the last received packet

This commit is contained in:
Adam Dunkels 2013-11-22 15:10:44 +01:00
parent 6265219775
commit 3788b08780
2 changed files with 12 additions and 0 deletions

View file

@ -257,6 +257,8 @@ static struct timer reass_timer;
#define sicslowpan_len uip_len
#endif /* SICSLOWPAN_CONF_FRAG */
static int last_rssi;
/*-------------------------------------------------------------------------*/
/* Rime Sniffer support for one single listener to enable powertrace of IP */
/*-------------------------------------------------------------------------*/
@ -1604,6 +1606,9 @@ input(void)
/* The MAC puts the 15.4 payload inside the RIME data buffer */
rime_ptr = packetbuf_dataptr();
/* Save the RSSI of the incoming packet in case the upper layer will
want to query us for it later. */
last_rssi = (signed short)packetbuf_attr(PACKETBUF_ATTR_RSSI);
#if SICSLOWPAN_CONF_FRAG
/* if reassembly timed out, cancel it */
if(timer_expired(&reass_timer)) {
@ -1900,6 +1905,12 @@ sicslowpan_init(void)
#endif /* SICSLOWPAN_COMPRESSION == SICSLOWPAN_COMPRESSION_HC06 */
}
/*--------------------------------------------------------------------*/
int
sicslowpan_get_last_rssi(void)
{
return last_rssi;
}
/*--------------------------------------------------------------------*/
const struct network_driver sicslowpan_driver = {
"sicslowpan",
sicslowpan_init,

View file

@ -317,6 +317,7 @@ struct sicslowpan_nh_compressor {
};
int sicslowpan_get_last_rssi(void);
extern const struct network_driver sicslowpan_driver;