From 491241c12dc4f89e9e2ef04224b4696de1c47155 Mon Sep 17 00:00:00 2001 From: StevenCellist Date: Sat, 18 May 2024 11:27:33 +0200 Subject: [PATCH] [LoRaWAN] Additional error-code --- src/TypeDef.h | 5 +++++ src/protocols/LoRaWAN/LoRaWAN.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/TypeDef.h b/src/TypeDef.h index 234fac8d..30c78bd8 100644 --- a/src/TypeDef.h +++ b/src/TypeDef.h @@ -578,6 +578,11 @@ */ #define RADIOLIB_LORAWAN_NONCES_DISCARDED (-1119) +/*! + \brief The supplied Session buffer is discarded as it doesn't match the Nonces. +*/ +#define RADIOLIB_LORAWAN_SESSION_DISCARDED (-1120) + // LR11x0-specific status codes /*! diff --git a/src/protocols/LoRaWAN/LoRaWAN.cpp b/src/protocols/LoRaWAN/LoRaWAN.cpp index 63271919..0aa3aba1 100644 --- a/src/protocols/LoRaWAN/LoRaWAN.cpp +++ b/src/protocols/LoRaWAN/LoRaWAN.cpp @@ -130,7 +130,7 @@ int16_t LoRaWANNode::setBufferSession(uint8_t* persistentBuffer) { uint16_t signatureInSession = LoRaWANNode::ntoh(&persistentBuffer[RADIOLIB_LW_SESSION_NONCES_SIGNATURE]); if(signatureNonces != signatureInSession) { RADIOLIB_DEBUG_PROTOCOL_PRINTLN("The supplied session buffer does not match the Nonces buffer"); - return(RADIOLIB_ERR_CHECKSUM_MISMATCH); + return(RADIOLIB_LORAWAN_SESSION_DISCARDED); } // copy the whole buffer over @@ -833,7 +833,7 @@ int16_t LoRaWANNode::activateABP(bool force, uint8_t initialDr) { LoRaWANNode::hton(&this->bufferSession[RADIOLIB_LW_SESSION_VERSION], this->rev); this->isActive = true; - + return(RADIOLIB_LORAWAN_NEW_SESSION); }