Skip to content

Give application access to RSSI and SNR values of downlink packets. #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/STM32LoRaWAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,8 @@ void STM32LoRaWAN::MacMcpsIndication(McpsIndication_t* i, LoRaMacRxStatus_t* sta
if ((i->McpsIndication == MCPS_CONFIRMED || i->McpsIndication == MCPS_UNCONFIRMED) && i->Status == LORAMAC_EVENT_INFO_STATUS_OK) {
instance->add_rx(i->Buffer, i->BufferSize);
instance->rx_port = i->Port;
instance->rx_rssi = status->Rssi;
instance->rx_snr = status->Snr;
}
}

Expand Down
16 changes: 16 additions & 0 deletions src/STM32LoRaWAN.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,16 @@ class STM32LoRaWAN : public Stream {
* Returns the port number of the most recently received packet.
*/
uint8_t getDownlinkPort() { return rx_port; }

/**
* Returns the RSSI of the most recently received packet.
*/
int16_t getDownlinkRssi() { return rx_rssi; }

/**
* Returns the SNR of the most recently received packet.
*/
int8_t getDownlinkSnr() { return rx_snr; }
/// @}


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

/** RSSI for most recently received packet */
int16_t rx_rssi = 0;

/** SNR for most recently received packet */
int8_t rx_snr = 0;

bool nwk_key_set = false;

// Buffer sizes match LORAMAC_PHY_MAXPAYLOAD (but that is not
Expand Down