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; 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