From 1f292b865dc01e5be9494600a0c593fbeddb5a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Amann?= <30447739+Bjoerns-TB@users.noreply.github.com> Date: Fri, 10 Apr 2020 15:04:04 +0200 Subject: [PATCH 1/2] Update LoRaWan.h --- src/LoRaWan.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/LoRaWan.h b/src/LoRaWan.h index fa492ab4..ded323f0 100644 --- a/src/LoRaWan.h +++ b/src/LoRaWan.h @@ -278,10 +278,12 @@ class LoRaWanClass * \param [in] *buffer The receive data cache * \param [in] length The length of data cache * \param [in] *rssi The RSSI cache + * \param [in] *snr The SNR cache + * \param [in] *gwcnt The Gateway count cache * * \return Return Receive data number */ - short receivePacket(char *buffer, short length, short *rssi); + short receivePacket(char *buffer, int length, short *rssi, float *snr, short *gwcnt); /** * \brief Transfer the proprietary data @@ -498,4 +500,4 @@ class LoRaWanClass extern LoRaWanClass lora; -#endif \ No newline at end of file +#endif From 1e46033f36fe2a33dc65f3fa7b0a716a9423b919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Amann?= <30447739+Bjoerns-TB@users.noreply.github.com> Date: Fri, 10 Apr 2020 15:08:19 +0200 Subject: [PATCH 2/2] Update LoRaWan.cpp --- src/LoRaWan.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/LoRaWan.cpp b/src/LoRaWan.cpp index e5940721..04f395d4 100644 --- a/src/LoRaWan.cpp +++ b/src/LoRaWan.cpp @@ -416,7 +416,7 @@ bool LoRaWanClass::transferPacketWithConfirmed(unsigned char *buffer, unsigned c return false; } -short LoRaWanClass::receivePacket(char *buffer, short length, short *rssi) +short LoRaWanClass::receivePacket(char *buffer, int length, short *rssi, float *snr, short *gwcnt) { char *ptr; short number = 0; @@ -424,6 +424,14 @@ short LoRaWanClass::receivePacket(char *buffer, short length, short *rssi) ptr = strstr(_buffer, "RSSI "); if(ptr)*rssi = atoi(ptr + 5); else *rssi = -255; + + ptr = strstr(_buffer, "SNR "); + if(ptr)*snr = atof(ptr + 4); + else *snr = -20.00; + + ptr = strstr(_buffer, "Link"); + if(ptr)*gwcnt = atoi(ptr + 9); + else *gwcnt = 0; ptr = strstr(_buffer, "RX: \""); if(ptr) @@ -1042,4 +1050,4 @@ short LoRaWanClass::sendCommandAndWaitForResponse(char* command, char *response, } -LoRaWanClass lora; \ No newline at end of file +LoRaWanClass lora;