Skip to content
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

[LoRaWAN] Change session activation #1093

Merged
merged 9 commits into from
May 21, 2024
2 changes: 1 addition & 1 deletion examples/LoRaWAN/LoRaWAN_ABP/LoRaWAN_ABP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void setup() {

Serial.println(F("Initialise LoRaWAN Network credentials"));
state = node.beginABP(devAddr, fNwkSIntKey, sNwkSIntKey, nwkSEncKey, appSKey, true);
debug(state < RADIOLIB_ERR_NONE, F("Session setup failed"), state, true);
debug(state != RADIOLIB_LORAWAN_NEW_SESSION, F("Session setup failed"), state, true);

Serial.println(F("Ready!\n"));
}
Expand Down
6 changes: 3 additions & 3 deletions examples/LoRaWAN/LoRaWAN_Reference/LoRaWAN_Reference.ino
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ void setup() {
debug(state != RADIOLIB_ERR_NONE, F("Initialise radio failed"), state, true);

// Override the default join rate
// uint8_t joinDR = 3;
uint8_t joinDR = 4;

Serial.println(F("Join ('login') to the LoRaWAN Network"));
state = node.beginOTAA(joinEUI, devEUI, nwkKey, appKey, true);
debug(state < RADIOLIB_ERR_NONE, F("Join failed"), state, true);
state = node.beginOTAA(joinEUI, devEUI, nwkKey, appKey, true, joinDR);
debug(state != RADIOLIB_LORAWAN_NEW_SESSION, F("Join failed"), state, true);

// Print the DevAddr
Serial.print("[LoRaWAN] DevAddr: ");
Expand Down
4 changes: 2 additions & 2 deletions examples/LoRaWAN/LoRaWAN_Starter/LoRaWAN_Starter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ void setup() {
debug(state != RADIOLIB_ERR_NONE, F("Initialise radio failed"), state, true);

Serial.println(F("Join ('login') to the LoRaWAN Network"));
state = node.beginOTAA(joinEUI, devEUI, nwkKey, appKey, true);
debug(state < RADIOLIB_ERR_NONE, F("Join failed"), state, true);
state = node.beginOTAA(joinEUI, devEUI, nwkKey, appKey);
debug(state != RADIOLIB_LORAWAN_NEW_SESSION, F("Join failed"), state, true);

Serial.println(F("Ready!\n"));
}
Expand Down
8 changes: 4 additions & 4 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,16 @@ checkDataRate KEYWORD2
setModem KEYWORD2

# LoRaWAN
wipe KEYWORD2
clearSession KEYWORD2
getBufferNonces KEYWORD2
setBufferNonces KEYWORD2
getBufferSession KEYWORD2
setBufferSession KEYWORD2
restore KEYWORD2
beginOTAA KEYWORD2
activateOTAA KEYWORD2
beginABP KEYWORD2
isJoined KEYWORD2
saveSession KEYWORD2
activateABP KEYWORD2
isActivated KEYWORD2
sendMacCommandReq KEYWORD2
uplink KEYWORD2
downlink KEYWORD2
Expand Down
20 changes: 20 additions & 0 deletions src/TypeDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,26 @@
*/
#define RADIOLIB_LORAWAN_NO_DOWNLINK (-1116)

/*!
\brief The LoRaWAN session was successfully re-activated.
*/
#define RADIOLIB_LORAWAN_SESSION_RESTORED (-1117)

/*!
\brief A new LoRaWAN session is started.
*/
#define RADIOLIB_LORAWAN_NEW_SESSION (-1118)

/*!
\brief The supplied Nonces buffer is discarded as its activation information is invalid.
*/
#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

/*!
Expand Down
Loading
Loading