Skip to content

Commit e270fbc

Browse files
mrschusterfpistm
authored andcommitted
Give application access to RSSI and SNR values of downlink packets.
1 parent 32439c1 commit e270fbc

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/STM32LoRaWAN.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,8 @@ void STM32LoRaWAN::MacMcpsIndication(McpsIndication_t* i, LoRaMacRxStatus_t* sta
13041304
if ((i->McpsIndication == MCPS_CONFIRMED || i->McpsIndication == MCPS_UNCONFIRMED) && i->Status == LORAMAC_EVENT_INFO_STATUS_OK) {
13051305
instance->add_rx(i->Buffer, i->BufferSize);
13061306
instance->rx_port = i->Port;
1307+
instance->rx_rssi = status->Rssi;
1308+
instance->rx_snr = status->Snr;
13071309
}
13081310
}
13091311

src/STM32LoRaWAN.h

+16
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,16 @@ class STM32LoRaWAN : public Stream {
299299
* Returns the port number of the most recently received packet.
300300
*/
301301
uint8_t getDownlinkPort() { return rx_port; }
302+
303+
/**
304+
* Returns the RSSI of the most recently received packet.
305+
*/
306+
int16_t getDownlinkRssi() { return rx_rssi; }
307+
308+
/**
309+
* Returns the SNR of the most recently received packet.
310+
*/
311+
int8_t getDownlinkSnr() { return rx_snr; }
302312
/// @}
303313

304314

@@ -1045,6 +1055,12 @@ class STM32LoRaWAN : public Stream {
10451055
/** Port for most recently received packet */
10461056
uint8_t rx_port = 0;
10471057

1058+
/** RSSI for most recently received packet */
1059+
int16_t rx_rssi = 0;
1060+
1061+
/** SNR for most recently received packet */
1062+
int8_t rx_snr = 0;
1063+
10481064
bool nwk_key_set = false;
10491065

10501066
// Buffer sizes match LORAMAC_PHY_MAXPAYLOAD (but that is not

0 commit comments

Comments
 (0)