diff --git a/core/net/sicslowpan.c b/core/net/sicslowpan.c index 9fbc9baaa..7e0200418 100644 --- a/core/net/sicslowpan.c +++ b/core/net/sicslowpan.c @@ -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, diff --git a/core/net/sicslowpan.h b/core/net/sicslowpan.h index f4a3bc562..4f12e9fe4 100644 --- a/core/net/sicslowpan.h +++ b/core/net/sicslowpan.h @@ -317,6 +317,7 @@ struct sicslowpan_nh_compressor { }; +int sicslowpan_get_last_rssi(void); extern const struct network_driver sicslowpan_driver;