-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
574 int16_t
beginOTAA(uint64_t joinEUI, uint64_t devEUI,
const uint8_t* nwkKey,
const uint8_t* appKey);
-
-
586 int16_t
beginABP(uint32_t addr,
const uint8_t* fNwkSIntKey,
const uint8_t* sNwkSIntKey,
const uint8_t* nwkSEncKey,
const uint8_t* appSKey);
-
-
-
-
602 virtual int16_t
activateABP(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED);
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
577 int16_t
beginOTAA(uint64_t joinEUI, uint64_t devEUI,
const uint8_t* nwkKey,
const uint8_t* appKey);
+
+
589 int16_t
beginABP(uint32_t addr,
const uint8_t* fNwkSIntKey,
const uint8_t* sNwkSIntKey,
const uint8_t* nwkSEncKey,
const uint8_t* appSKey);
+
+
+
+
605 virtual int16_t
activateABP(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED);
-
607 #if defined(RADIOLIB_BUILD_ARDUINO)
-
-
-
-
-
-
-
-
-
-
679 virtual int16_t
sendReceive(
const uint8_t* dataUp,
size_t lenUp, uint8_t fPort, uint8_t* dataDown,
size_t* lenDown,
bool isConfirmed =
false,
LoRaWANEvent_t* eventUp = NULL,
LoRaWANEvent_t* eventDown = NULL);
-
-
-
-
-
-
709 int16_t
getMacDeviceTimeAns(uint32_t* gpsEpoch, uint8_t* fraction,
bool returnUnix =
true);
-
-
-
-
-
-
-
-
737 void setADR(
bool enable =
true);
-
-
-
-
-
-
762 void setCSMA(
bool csmaEnabled, uint8_t maxChanges = 4, uint8_t backoffMax = 0, uint8_t difsSlots = 2);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
610 #if defined(RADIOLIB_BUILD_ARDUINO)
+
+
+
+
+
+
+
+
+
+
682 virtual int16_t
sendReceive(
const uint8_t* dataUp,
size_t lenUp, uint8_t fPort, uint8_t* dataDown,
size_t* lenDown,
bool isConfirmed =
false,
LoRaWANEvent_t* eventUp = NULL,
LoRaWANEvent_t* eventDown = NULL);
+
+
+
+
+
+
712 int16_t
getMacDeviceTimeAns(uint32_t* gpsEpoch, uint8_t* fraction,
bool returnUnix =
true);
+
+
+
+
+
+
+
+
740 void setADR(
bool enable =
true);
+
+
+
+
+
+
765 void setCSMA(
bool csmaEnabled, uint8_t maxChanges = 4, uint8_t backoffMax = 0, uint8_t difsSlots = 2);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
862 uint8_t bufferNonces[RADIOLIB_LORAWAN_NONCES_BUF_SIZE] = { 0 };
-
-
-
865 uint8_t bufferSession[RADIOLIB_LORAWAN_SESSION_BUF_SIZE] = { 0 };
-
-
867 uint8_t fOptsUp[RADIOLIB_LORAWAN_FHDR_FOPTS_MAX_LEN] = { 0 };
-
868 uint8_t fOptsDown[RADIOLIB_LORAWAN_FHDR_FOPTS_MAX_LEN] = { 0 };
-
869 uint8_t fOptsUpLen = 0;
-
870 uint8_t fOptsDownLen = 0;
-
-
872 uint16_t lwMode = RADIOLIB_LORAWAN_MODE_NONE;
-
873 uint8_t lwClass = RADIOLIB_LORAWAN_CLASS_A;
-
874 bool isActive =
false;
+
+
+
+
+
+
+
+
+
+
+
-
876 uint64_t joinEUI = 0;
-
-
878 uint8_t nwkKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
879 uint8_t appKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
-
-
-
883 uint32_t devAddr = 0;
-
884 uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
885 uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
886 uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
887 uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
888 uint8_t jSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
-
890 uint16_t keyCheckSum = 0;
-
-
-
893 uint16_t devNonce = 0;
-
894 uint32_t joinNonce = 0;
+
+
877 uint8_t bufferNonces[RADIOLIB_LORAWAN_NONCES_BUF_SIZE] = { 0 };
+
+
+
880 uint8_t bufferSession[RADIOLIB_LORAWAN_SESSION_BUF_SIZE] = { 0 };
+
+
882 uint8_t fOptsUp[RADIOLIB_LORAWAN_FHDR_FOPTS_MAX_LEN] = { 0 };
+
883 uint8_t fOptsDown[RADIOLIB_LORAWAN_FHDR_FOPTS_MAX_LEN] = { 0 };
+
884 uint8_t fOptsUpLen = 0;
+
885 uint8_t fOptsDownLen = 0;
+
+
887 uint16_t lwMode = RADIOLIB_LORAWAN_MODE_NONE;
+
888 uint8_t lwClass = RADIOLIB_LORAWAN_CLASS_A;
+
889 bool isActive =
false;
+
+
891 uint64_t joinEUI = 0;
+
+
893 uint8_t nwkKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
894 uint8_t appKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
-
897 uint32_t homeNetId = 0;
-
898 uint8_t adrLimitExp = RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP;
-
899 uint8_t adrDelayExp = RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP;
-
-
901 uint8_t txPowerSteps = 0;
-
902 uint8_t txPowerMax = 0;
-
-
904 uint32_t aFCntDown = 0;
-
905 uint32_t nFCntDown = 0;
-
906 uint32_t confFCntUp = RADIOLIB_LORAWAN_FCNT_NONE;
-
907 uint32_t confFCntDown = RADIOLIB_LORAWAN_FCNT_NONE;
-
908 uint32_t adrFCnt = 0;
-
-
-
911 bool adrEnabled =
true;
-
-
-
914 bool dutyCycleEnabled =
false;
-
915 uint32_t dutyCycle = 0;
-
-
-
918 uint16_t dwellTimeUp = 0;
-
919 uint16_t dwellTimeDn = 0;
-
-
-
-
-
-
925 bool csmaEnabled =
false;
-
-
-
928 uint8_t maxChanges = RADIOLIB_LORAWAN_MAX_CHANGES_DEFAULT;
-
-
-
-
-
933 uint8_t backoffMax = RADIOLIB_LORAWAN_BACKOFF_MAX_DEFAULT;
-
-
-
936 uint8_t difsSlots = RADIOLIB_LORAWAN_DIFS_DEFAULT;
-
-
-
-
-
-
942 LoRaWANChannel_t channels[3] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE,
-
943 RADIOLIB_LORAWAN_CHANNEL_NONE };
+
+
+
898 uint32_t devAddr = 0;
+
899 uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
900 uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
901 uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
902 uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
903 uint8_t jSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
+
905 uint16_t keyCheckSum = 0;
+
+
+
908 uint16_t devNonce = 0;
+
909 uint32_t joinNonce = 0;
+
+
+
912 uint32_t homeNetId = 0;
+
913 uint8_t adrLimitExp = RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP;
+
914 uint8_t adrDelayExp = RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP;
+
+
916 uint8_t txPowerSteps = 0;
+
917 uint8_t txPowerMax = 0;
+
+
919 uint32_t aFCntDown = 0;
+
920 uint32_t nFCntDown = 0;
+
921 uint32_t confFCntUp = RADIOLIB_LORAWAN_FCNT_NONE;
+
922 uint32_t confFCntDown = RADIOLIB_LORAWAN_FCNT_NONE;
+
923 uint32_t adrFCnt = 0;
+
+
+
926 bool adrEnabled =
true;
+
+
+
929 bool dutyCycleEnabled =
false;
+
930 uint32_t dutyCycle = 0;
+
+
+
933 uint16_t dwellTimeUp = 0;
+
934 uint16_t dwellTimeDn = 0;
+
+
+
+
+
+
940 bool csmaEnabled =
false;
+
+
+
943 uint8_t maxChanges = RADIOLIB_LORAWAN_MAX_CHANGES_DEFAULT;
-
-
-
947 RadioLibTime_t rxDelays[3] = { 0, RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS, RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS };
-
-
-
950 uint8_t rx1DrOffset = 0;
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
948 uint8_t backoffMax = RADIOLIB_LORAWAN_BACKOFF_MAX_DEFAULT;
+
+
+
951 uint8_t difsSlots = RADIOLIB_LORAWAN_DIFS_DEFAULT;
+
+
+
+
+
+
957 LoRaWANChannel_t channels[3] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE,
+
958 RADIOLIB_LORAWAN_CHANNEL_NONE };
+
+
+
+
962 RadioLibTime_t rxDelays[3] = { 0, RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS, RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS };
-
-
965 uint8_t battLevel = 0xFF;
+
+
965 uint8_t rx1DrOffset = 0;
-
-
968 bool isMACPayload =
false;
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
980 void createSession(uint16_t lwMode, uint8_t initialDr);
+
+
980 uint8_t battLevel = 0xFF;
-
-
983 void composeJoinRequest(uint8_t* joinRequestMsg);
+
+
983 bool isMACPayload =
false;
-
-
+
+
-
-
989 void processCFList(
const uint8_t* cfList);
+
+
-
-
992 int16_t isValidUplink(uint8_t* len, uint8_t fPort);
-
-
-
-
-
-
998 void composeUplink(
const uint8_t* in, uint8_t lenIn, uint8_t* out, uint8_t fPort,
bool isConfirmed);
-
-
-
1001 void micUplink(uint8_t* inOut, uint8_t lenInOut);
-
-
-
1004 int16_t transmitUplink(
const LoRaWANChannel_t* chnl, uint8_t* in, uint8_t len,
bool retrans);
-
-
-
-
-
-
1010 int16_t parseDownlink(uint8_t* data,
size_t* len,
LoRaWANEvent_t* event = NULL);
-
-
-
1013 bool execMacCommand(uint8_t cid, uint8_t* optIn, uint8_t lenIn);
-
1014 bool execMacCommand(uint8_t cid, uint8_t* optIn, uint8_t lenIn, uint8_t* optOut);
-
-
-
1017 virtual bool derivedMacHandler(uint8_t cid, uint8_t* optIn, uint8_t lenIn, uint8_t* optOut);
-
-
-
1020 void preprocessMacLinkAdr(uint8_t* mPtr, uint8_t cLen, uint8_t* mAdrOpt);
-
-
-
1023 void postprocessMacLinkAdr(uint8_t* ack, uint8_t cLen);
-
-
-
-
-
-
-
-
-
-
-
1034 virtual int16_t getMacLen(uint8_t cid, uint8_t* len, uint8_t dir,
bool inclusive =
false, uint8_t* payload = NULL);
+
+
+
+
+
+
+
997 void createSession(uint16_t lwMode, uint8_t initialDr);
+
+
+
1000 void composeJoinRequest(uint8_t* joinRequestMsg);
+
+
+
+
+
+
1006 void processCFList(
const uint8_t* cfList);
+
+
+
1009 int16_t isValidUplink(uint8_t* len, uint8_t fPort);
+
+
+
+
+
+
1015 void composeUplink(
const uint8_t* in, uint8_t lenIn, uint8_t* out, uint8_t fPort,
bool isConfirmed);
+
+
+
1018 void micUplink(uint8_t* inOut, uint8_t lenInOut);
+
+
+
1021 int16_t transmitUplink(
const LoRaWANChannel_t* chnl, uint8_t* in, uint8_t len,
bool retrans);
+
+
+
+
+
+
1027 int16_t parseDownlink(uint8_t* data,
size_t* len,
LoRaWANEvent_t* event = NULL);
+
+
+
1030 bool execMacCommand(uint8_t cid, uint8_t* optIn, uint8_t lenIn);
+
1031 bool execMacCommand(uint8_t cid, uint8_t* optIn, uint8_t lenIn, uint8_t* optOut);
+
+
+
1034 virtual bool derivedMacHandler(uint8_t cid, uint8_t* optIn, uint8_t lenIn, uint8_t* optOut);
-
-
-
-
1039 bool isPersistentMacCommand(uint8_t cid, uint8_t dir);
-
-
-
1042 int16_t pushMacCommand(uint8_t cid,
const uint8_t* cOcts, uint8_t* out, uint8_t* lenOut, uint8_t dir);
-
-
-
1045 int16_t getMacPayload(uint8_t cid,
const uint8_t* in, uint8_t lenIn, uint8_t* out, uint8_t dir);
-
-
-
1048 int16_t deleteMacCommand(uint8_t cid, uint8_t* inOut, uint8_t* lenInOut, uint8_t dir);
-
-
-
1051 void clearMacCommands(uint8_t* inOut, uint8_t* lenInOut, uint8_t dir);
+
+
1037 void preprocessMacLinkAdr(uint8_t* mPtr, uint8_t cLen, uint8_t* mAdrOpt);
+
+
+
1040 void postprocessMacLinkAdr(uint8_t* ack, uint8_t cLen);
+
+
+
+
+
+
+
+
+
+
+
1051 virtual int16_t getMacLen(uint8_t cid, uint8_t* len, uint8_t dir,
bool inclusive =
false, uint8_t* payload = NULL);
-
-
1054 int16_t setPhyProperties(
const LoRaWANChannel_t* chnl, uint8_t dir, int8_t pwr,
size_t pre = 0);
-
-
-
1057 bool csmaChannelClear(uint8_t difs, uint8_t numBackoff);
-
-
-
1060 bool cadChannelClear();
-
-
-
1063 void getChannelPlanMask(uint64_t* chMaskGrp0123, uint32_t* chMaskGrp45);
-
-
-
-
-
1068 void selectChannelPlanDyn();
+
+
+
+
1056 bool isPersistentMacCommand(uint8_t cid, uint8_t dir);
+
+
+
1059 int16_t pushMacCommand(uint8_t cid,
const uint8_t* cOcts, uint8_t* out, uint8_t* lenOut, uint8_t dir);
+
+
+
1062 int16_t getMacPayload(uint8_t cid,
const uint8_t* in, uint8_t lenIn, uint8_t* out, uint8_t dir);
+
+
+
1065 int16_t deleteMacCommand(uint8_t cid, uint8_t* inOut, uint8_t* lenInOut, uint8_t dir);
+
+
+
1068 void clearMacCommands(uint8_t* inOut, uint8_t* lenInOut, uint8_t dir);
-
-
-
1072 void selectChannelPlanFix();
-
-
-
-
1076 uint8_t getAvailableChannels(uint16_t* mask);
-
-
-
1079 void setAvailableChannels(uint16_t mask);
-
-
-
1082 int16_t selectChannels();
-
-
-
1085 bool applyChannelMask(uint64_t chMaskGrp0123, uint32_t chMaskGrp45);
+
+
1071 int16_t setPhyProperties(
const LoRaWANChannel_t* chnl, uint8_t dir, int8_t pwr,
size_t pre = 0);
+
+
+
1074 bool csmaChannelClear(uint8_t difs, uint8_t numBackoff);
+
+
+
1077 bool cadChannelClear();
+
+
+
1080 void getChannelPlanMask(uint64_t* chMaskGrp0123, uint32_t* chMaskGrp45);
+
+
+
+
+
1085 void selectChannelPlanDyn();
-
1087#if RADIOLIB_DEBUG_PROTOCOL
-
-
1089 void printChannels();
-
-
-
-
1093 uint32_t generateMIC(
const uint8_t* msg,
size_t len, uint8_t* key);
+
+
+
1089 void selectChannelPlanFix();
+
+
+
+
1093 uint8_t getAvailableChannels(uint16_t* mask);
-
-
-
1097 bool verifyMIC(uint8_t* msg,
size_t len, uint8_t* key);
-
-
-
1100 int16_t findDataRate(uint8_t dr,
DataRate_t* dataRate);
-
-
-
1103 void processAES(
const uint8_t* in,
size_t len, uint8_t* key, uint8_t* out, uint32_t fCnt, uint8_t dir, uint8_t ctrId,
bool counter);
-
-
-
1106 static uint16_t checkSum16(
const uint8_t *key, uint16_t keyLen);
-
-
-
1109 static int16_t checkBufferCommon(
const uint8_t *buffer, uint16_t size);
-
-
-
1112 template<
typename T>
-
1113 static T ntoh(
const uint8_t* buff,
size_t size = 0);
-
-
-
1116 template<
typename T>
-
1117 static void hton(uint8_t* buff, T val,
size_t size = 0);
-
+
+
1096 void setAvailableChannels(uint16_t mask);
+
+
+
1099 int16_t selectChannels();
+
+
+
1102 bool applyChannelMask(uint64_t chMaskGrp0123, uint32_t chMaskGrp45);
+
+
1104#if RADIOLIB_DEBUG_PROTOCOL
+
+
1106 void printChannels();
+
+
+
+
1110 uint32_t generateMIC(
const uint8_t* msg,
size_t len, uint8_t* key);
+
+
+
+
1114 bool verifyMIC(uint8_t* msg,
size_t len, uint8_t* key);
+
+
+
1117 int16_t findDataRate(uint8_t dr,
DataRate_t* dataRate);
+
+
+
1120 void processAES(
const uint8_t* in,
size_t len, uint8_t* key, uint8_t* out, uint32_t fCnt, uint8_t dir, uint8_t ctrId,
bool counter);
+
+
+
+
+
+
1126 static uint16_t checkSum16(
const uint8_t *key, uint16_t keyLen);
+
+
+
1129 static int16_t checkBufferCommon(
const uint8_t *buffer, uint16_t size);
+
+
+
1132 template<
typename T>
+
1133 static T ntoh(
const uint8_t* buff,
size_t size = 0);
+
+
+
1136 template<
typename T>
+
1137 static void hton(uint8_t* buff, T val,
size_t size = 0);
+
-
-
-
1121T LoRaWANNode::ntoh(
const uint8_t* buff,
size_t size) {
-
1122 const uint8_t* buffPtr = buff;
-
1123 size_t targetSize =
sizeof(T);
-
-
-
-
-
1128 for(
size_t i = 0; i < targetSize; i++) {
-
1129 res |= (uint32_t)(*(buffPtr++)) << 8*i;
-
-
-
-
-
-
1135void LoRaWANNode::hton(uint8_t* buff, T val,
size_t size) {
-
1136 uint8_t* buffPtr = buff;
-
1137 size_t targetSize =
sizeof(T);
-
-
-
-
1141 for(
size_t i = 0; i < targetSize; i++) {
-
1142 *(buffPtr++) = val >> 8*i;
-
-
-
-
-
LoRaWAN-compatible node (class A device).
Definition LoRaWAN.h:524
-
void clearSession()
Clear an active session, so that the device will have to rejoin the network.
Definition LoRaWAN.cpp:278
+
+
+
1141T LoRaWANNode::ntoh(
const uint8_t* buff,
size_t size) {
+
1142 const uint8_t* buffPtr = buff;
+
1143 size_t targetSize =
sizeof(T);
+
+
+
+
+
1148 for(
size_t i = 0; i < targetSize; i++) {
+
1149 res |= (uint32_t)(*(buffPtr++)) << 8*i;
+
+
+
+
+
+
1155void LoRaWANNode::hton(uint8_t* buff, T val,
size_t size) {
+
1156 uint8_t* buffPtr = buff;
+
1157 size_t targetSize =
sizeof(T);
+
+
+
+
1161 for(
size_t i = 0; i < targetSize; i++) {
+
1162 *(buffPtr++) = val >> 8*i;
+
+
+
+
+
LoRaWAN-compatible node (class A device).
Definition LoRaWAN.h:527
+
void clearSession()
Clear an active session, so that the device will have to rejoin the network.
Definition LoRaWAN.cpp:277
virtual int16_t sendReceive(const char *strUp, uint8_t fPort, bool isConfirmed=false, LoRaWANEvent_t *eventUp=NULL, LoRaWANEvent_t *eventDown=NULL)
Send a message to the server and wait for a downlink during Rx1 and/or Rx2 window.
Definition LoRaWAN.cpp:43
-
int16_t setDatarate(uint8_t drUp)
Set uplink datarate. This should not be used when ADR is enabled.
Definition LoRaWAN.cpp:2690
-
void scheduleTransmission(RadioLibTime_t tUplink)
Set the exact time a transmission should occur. Note: this is the internal clock time....
Definition LoRaWAN.cpp:2823
-
RadioLibTime_t scanGuard
Rx window padding in milliseconds according to the spec, the Rx window must be at least enough time t...
Definition LoRaWAN.h:853
-
void setCSMA(bool csmaEnabled, uint8_t maxChanges=4, uint8_t backoffMax=0, uint8_t difsSlots=2)
Configures CSMA for LoRaWAN as per TR013, LoRa Alliance.
Definition LoRaWAN.cpp:2805
-
void setDutyCycle(bool enable=true, RadioLibTime_t msPerHour=0)
Toggle adherence to dutyCycle limits to on or off.
Definition LoRaWAN.cpp:2780
-
int16_t beginABP(uint32_t addr, const uint8_t *fNwkSIntKey, const uint8_t *sNwkSIntKey, const uint8_t *nwkSEncKey, const uint8_t *appSKey)
Set the device credentials and activation configuration.
Definition LoRaWAN.cpp:614
-
RadioLibTime_t timeUntilUplink()
Returns time in milliseconds until next uplink is available under dutyCycle limits.
Definition LoRaWAN.cpp:3331
-
void setDeviceStatus(uint8_t battLevel)
Set device status.
Definition LoRaWAN.cpp:2819
-
RadioLibTime_t dutyCycleInterval(RadioLibTime_t msPerHour, RadioLibTime_t airtime)
Calculate the minimum interval to adhere to a certain dutyCycle. This interval is based on the ToA of...
Definition LoRaWAN.cpp:3321
-
void setDwellTime(bool enable, RadioLibTime_t msPerUplink=0)
Set or disable uplink dwell time limitation; enabled by default if mandatory.
Definition LoRaWAN.cpp:2792
-
uint32_t getAFCntDown()
Returns the last application downlink's frame counter; also 0 if no application downlink occured yet.
Definition LoRaWAN.cpp:2839
-
RadioLibTime_t getLastToA()
Get the Time-on-air of the last uplink message (in milliseconds).
Definition LoRaWAN.cpp:2852
-
virtual int16_t activateABP(uint8_t initialDr=RADIOLIB_LORAWAN_DATA_RATE_UNUSED)
Join network by restoring ABP session or performing over-the-air activation. In this procedure,...
Definition LoRaWAN.cpp:985
-
bool TS009
TS009 Protocol Specification Verification switch (allows FPort 224 and cuts off uplink payload instea...
Definition LoRaWAN.h:839
-
uint8_t * getBufferNonces()
Returns the pointer to the internal buffer that holds the LW base parameters.
Definition LoRaWAN.cpp:227
-
uint8_t * getBufferSession()
Returns the pointer to the internal buffer that holds the LW session parameters.
Definition LoRaWAN.cpp:428
-
bool isActivated()
Whether there is an ongoing session active.
Definition LoRaWAN.cpp:1075
-
int16_t setTxPower(int8_t txPower)
Configure TX power of the radio module.
Definition LoRaWAN.cpp:2723
-
int16_t getMacDeviceTimeAns(uint32_t *gpsEpoch, uint8_t *fraction, bool returnUnix=true)
Returns the network time after requesting a DeviceTime MAC command. Returns 'true' if a network respo...
Definition LoRaWAN.cpp:2536
-
uint32_t getNFCntDown()
Returns the last network downlink's frame counter; also 0 if no network downlink occured yet.
Definition LoRaWAN.cpp:2835
-
int16_t beginOTAA(uint64_t joinEUI, uint64_t devEUI, const uint8_t *nwkKey, const uint8_t *appKey)
Set the device credentials and activation configuration.
Definition LoRaWAN.cpp:585
-
uint8_t getMaxPayloadLen()
Returns the maximum allowed uplink payload size given the current MAC state. Most importantly,...
Definition LoRaWAN.cpp:3340
-
virtual int16_t activateOTAA(uint8_t initialDr=RADIOLIB_LORAWAN_DATA_RATE_UNUSED, LoRaWANJoinEvent_t *joinEvent=NULL)
Join network by restoring OTAA session or performing over-the-air activation. By this procedure,...
Definition LoRaWAN.cpp:869
-
uint32_t getFCntUp()
Returns the last uplink's frame counter; also 0 if no uplink occured yet.
Definition LoRaWAN.cpp:2828
-
int16_t setBufferNonces(const uint8_t *persistentBuffer)
Fill the internal buffer that holds the LW base parameters with a supplied buffer.
Definition LoRaWAN.cpp:242
-
int16_t setRx2Dr(uint8_t dr)
Configure the Rx2 datarate for ABP mode. This should not be needed for LoRaWAN 1.1 as it is configure...
Definition LoRaWAN.cpp:2749
-
int16_t sendMacCommandReq(uint8_t cid)
Add a MAC command to the uplink queue. Only LinkCheck and DeviceTime are available to the user....
Definition LoRaWAN.cpp:2501
-
int16_t getMacLinkCheckAns(uint8_t *margin, uint8_t *gwCnt)
Returns the quality of connectivity after requesting a LinkCheck MAC command. Returns 'true' if a net...
Definition LoRaWAN.cpp:2525
-
void setADR(bool enable=true)
Toggle ADR to on or off.
Definition LoRaWAN.cpp:2776
-
int16_t setBufferSession(const uint8_t *persistentBuffer)
Fill the internal buffer that holds the LW session parameters with a supplied buffer.
Definition LoRaWAN.cpp:460
-
uint32_t getDevAddr()
Returns the DevAddr of the device, regardless of OTAA or ABP mode.
Definition LoRaWAN.cpp:2848
-
void resetFCntDown()
Reset the downlink frame counters (application and network) This is unsafe and can possibly allow rep...
Definition LoRaWAN.cpp:2843
+
void setSleepFunction(SleepCb_t cb)
Set custom delay/sleep function callback. If set, LoRaWAN node will call this function to wait for pe...
Definition LoRaWAN.cpp:3378
+
int16_t setDatarate(uint8_t drUp)
Set uplink datarate. This should not be used when ADR is enabled.
Definition LoRaWAN.cpp:2689
+
void scheduleTransmission(RadioLibTime_t tUplink)
Set the exact time a transmission should occur. Note: this is the internal clock time....
Definition LoRaWAN.cpp:2822
+
RadioLibTime_t scanGuard
Rx window padding in milliseconds according to the spec, the Rx window must be at least enough time t...
Definition LoRaWAN.h:868
+
void setCSMA(bool csmaEnabled, uint8_t maxChanges=4, uint8_t backoffMax=0, uint8_t difsSlots=2)
Configures CSMA for LoRaWAN as per TR013, LoRa Alliance.
Definition LoRaWAN.cpp:2804
+
void(* SleepCb_t)(RadioLibTime_t ms)
Callback to a user-provided sleep function.
Definition LoRaWAN.h:839
+
void setDutyCycle(bool enable=true, RadioLibTime_t msPerHour=0)
Toggle adherence to dutyCycle limits to on or off.
Definition LoRaWAN.cpp:2779
+
int16_t beginABP(uint32_t addr, const uint8_t *fNwkSIntKey, const uint8_t *sNwkSIntKey, const uint8_t *nwkSEncKey, const uint8_t *appSKey)
Set the device credentials and activation configuration.
Definition LoRaWAN.cpp:613
+
RadioLibTime_t timeUntilUplink()
Returns time in milliseconds until next uplink is available under dutyCycle limits.
Definition LoRaWAN.cpp:3330
+
void setDeviceStatus(uint8_t battLevel)
Set device status.
Definition LoRaWAN.cpp:2818
+
RadioLibTime_t dutyCycleInterval(RadioLibTime_t msPerHour, RadioLibTime_t airtime)
Calculate the minimum interval to adhere to a certain dutyCycle. This interval is based on the ToA of...
Definition LoRaWAN.cpp:3320
+
void setDwellTime(bool enable, RadioLibTime_t msPerUplink=0)
Set or disable uplink dwell time limitation; enabled by default if mandatory.
Definition LoRaWAN.cpp:2791
+
uint32_t getAFCntDown()
Returns the last application downlink's frame counter; also 0 if no application downlink occured yet.
Definition LoRaWAN.cpp:2838
+
RadioLibTime_t getLastToA()
Get the Time-on-air of the last uplink message (in milliseconds).
Definition LoRaWAN.cpp:2851
+
virtual int16_t activateABP(uint8_t initialDr=RADIOLIB_LORAWAN_DATA_RATE_UNUSED)
Join network by restoring ABP session or performing over-the-air activation. In this procedure,...
Definition LoRaWAN.cpp:984
+
bool TS009
TS009 Protocol Specification Verification switch (allows FPort 224 and cuts off uplink payload instea...
Definition LoRaWAN.h:854
+
uint8_t * getBufferNonces()
Returns the pointer to the internal buffer that holds the LW base parameters.
Definition LoRaWAN.cpp:226
+
uint8_t * getBufferSession()
Returns the pointer to the internal buffer that holds the LW session parameters.
Definition LoRaWAN.cpp:427
+
bool isActivated()
Whether there is an ongoing session active.
Definition LoRaWAN.cpp:1074
+
int16_t setTxPower(int8_t txPower)
Configure TX power of the radio module.
Definition LoRaWAN.cpp:2722
+
int16_t getMacDeviceTimeAns(uint32_t *gpsEpoch, uint8_t *fraction, bool returnUnix=true)
Returns the network time after requesting a DeviceTime MAC command. Returns 'true' if a network respo...
Definition LoRaWAN.cpp:2535
+
uint32_t getNFCntDown()
Returns the last network downlink's frame counter; also 0 if no network downlink occured yet.
Definition LoRaWAN.cpp:2834
+
int16_t beginOTAA(uint64_t joinEUI, uint64_t devEUI, const uint8_t *nwkKey, const uint8_t *appKey)
Set the device credentials and activation configuration.
Definition LoRaWAN.cpp:584
+
uint8_t getMaxPayloadLen()
Returns the maximum allowed uplink payload size given the current MAC state. Most importantly,...
Definition LoRaWAN.cpp:3339
+
virtual int16_t activateOTAA(uint8_t initialDr=RADIOLIB_LORAWAN_DATA_RATE_UNUSED, LoRaWANJoinEvent_t *joinEvent=NULL)
Join network by restoring OTAA session or performing over-the-air activation. By this procedure,...
Definition LoRaWAN.cpp:868
+
uint32_t getFCntUp()
Returns the last uplink's frame counter; also 0 if no uplink occured yet.
Definition LoRaWAN.cpp:2827
+
int16_t setBufferNonces(const uint8_t *persistentBuffer)
Fill the internal buffer that holds the LW base parameters with a supplied buffer.
Definition LoRaWAN.cpp:241
+
int16_t setRx2Dr(uint8_t dr)
Configure the Rx2 datarate for ABP mode. This should not be needed for LoRaWAN 1.1 as it is configure...
Definition LoRaWAN.cpp:2748
+
int16_t sendMacCommandReq(uint8_t cid)
Add a MAC command to the uplink queue. Only LinkCheck and DeviceTime are available to the user....
Definition LoRaWAN.cpp:2500
+
int16_t getMacLinkCheckAns(uint8_t *margin, uint8_t *gwCnt)
Returns the quality of connectivity after requesting a LinkCheck MAC command. Returns 'true' if a net...
Definition LoRaWAN.cpp:2524
+
void setADR(bool enable=true)
Toggle ADR to on or off.
Definition LoRaWAN.cpp:2775
+
int16_t setBufferSession(const uint8_t *persistentBuffer)
Fill the internal buffer that holds the LW session parameters with a supplied buffer.
Definition LoRaWAN.cpp:459
+
uint32_t getDevAddr()
Returns the DevAddr of the device, regardless of OTAA or ABP mode.
Definition LoRaWAN.cpp:2847
+
void resetFCntDown()
Reset the downlink frame counters (application and network) This is unsafe and can possibly allow rep...
Definition LoRaWAN.cpp:2842
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition PhysicalLayer.h:216
unsigned long RadioLibTime_t
Type used for durations in RadioLib.
Definition TypeDef.h:642
-
Structure to save information about LoRaWAN band.
Definition LoRaWAN.h:369
-
int8_t powerMax
Maximum allowed output power in this band in dBm.
Definition LoRaWAN.h:386
-
bool txParamSupported
Whether this band implements the MAC command TxParamSetupReq.
Definition LoRaWAN.h:401
-
LoRaWANChannel_t txAck[2]
Relay channels for ACK downlink.
Definition LoRaWAN.h:424
-
RadioLibTime_t dutyCycle
Number of milliseconds per hour of allowed Time-on-Air.
Definition LoRaWAN.h:392
-
uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
The corresponding datarates, bandwidths and coding rates for DR index.
Definition LoRaWAN.h:427
-
RadioLibTime_t dwellTimeUp
Maximum dwell time per uplink message in milliseconds.
Definition LoRaWAN.h:395
-
LoRaWANChannel_t txWoR[2]
Relay channels for WoR uplink.
Definition LoRaWAN.h:421
-
uint32_t freqMin
Minimum allowed frequency (coded in 100 Hz steps)
Definition LoRaWAN.h:377
-
uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
Array of allowed maximum application payload lengths for each data rate (N-value)
Definition LoRaWAN.h:383
-
LoRaWANChannel_t txFreqs[3]
A set of default uplink (TX) channels for dynamic bands.
Definition LoRaWAN.h:404
-
int8_t powerNumSteps
Number of power steps in this band.
Definition LoRaWAN.h:389
-
LoRaWANChannelSpan_t txSpans[2]
Default uplink (TX) channel spans for fixed bands, including Join-Request parameters.
Definition LoRaWAN.h:410
-
uint8_t bandNum
Identier for this band.
Definition LoRaWAN.h:371
-
uint32_t freqMax
Maximum allowed frequency (coded in 100 Hz steps)
Definition LoRaWAN.h:380
-
uint8_t bandType
Whether the channels are fixed per specification, or dynamically allocated through the network (plus ...
Definition LoRaWAN.h:374
-
LoRaWANChannel_t rx2
Backup channel for downlink (RX2) window.
Definition LoRaWAN.h:418
-
uint8_t numTxSpans
The number of TX channel spans for fixed bands.
Definition LoRaWAN.h:407
-
RadioLibTime_t dwellTimeDn
Maximum dwell time per downlink message in milliseconds.
Definition LoRaWAN.h:398
-
LoRaWANChannelSpan_t rx1Span
Default downlink (RX1) channel span for fixed bands.
Definition LoRaWAN.h:413
+
Structure to save information about LoRaWAN band.
Definition LoRaWAN.h:372
+
int8_t powerMax
Maximum allowed output power in this band in dBm.
Definition LoRaWAN.h:389
+
bool txParamSupported
Whether this band implements the MAC command TxParamSetupReq.
Definition LoRaWAN.h:404
+
LoRaWANChannel_t txAck[2]
Relay channels for ACK downlink.
Definition LoRaWAN.h:427
+
RadioLibTime_t dutyCycle
Number of milliseconds per hour of allowed Time-on-Air.
Definition LoRaWAN.h:395
+
uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
The corresponding datarates, bandwidths and coding rates for DR index.
Definition LoRaWAN.h:430
+
RadioLibTime_t dwellTimeUp
Maximum dwell time per uplink message in milliseconds.
Definition LoRaWAN.h:398
+
LoRaWANChannel_t txWoR[2]
Relay channels for WoR uplink.
Definition LoRaWAN.h:424
+
uint32_t freqMin
Minimum allowed frequency (coded in 100 Hz steps)
Definition LoRaWAN.h:380
+
uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
Array of allowed maximum application payload lengths for each data rate (N-value)
Definition LoRaWAN.h:386
+
LoRaWANChannel_t txFreqs[3]
A set of default uplink (TX) channels for dynamic bands.
Definition LoRaWAN.h:407
+
int8_t powerNumSteps
Number of power steps in this band.
Definition LoRaWAN.h:392
+
LoRaWANChannelSpan_t txSpans[2]
Default uplink (TX) channel spans for fixed bands, including Join-Request parameters.
Definition LoRaWAN.h:413
+
uint8_t bandNum
Identier for this band.
Definition LoRaWAN.h:374
+
uint32_t freqMax
Maximum allowed frequency (coded in 100 Hz steps)
Definition LoRaWAN.h:383
+
uint8_t bandType
Whether the channels are fixed per specification, or dynamically allocated through the network (plus ...
Definition LoRaWAN.h:377
+
LoRaWANChannel_t rx2
Backup channel for downlink (RX2) window.
Definition LoRaWAN.h:421
+
uint8_t numTxSpans
The number of TX channel spans for fixed bands.
Definition LoRaWAN.h:410
+
RadioLibTime_t dwellTimeDn
Maximum dwell time per downlink message in milliseconds.
Definition LoRaWAN.h:401
+
LoRaWANChannelSpan_t rx1Span
Default downlink (RX1) channel span for fixed bands.
Definition LoRaWAN.h:416
IDs of all currently supported bands.
-
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition LoRaWAN.h:310
-
bool available
Whether this channel is available for channel selection.
Definition LoRaWAN.h:330
-
uint8_t dr
Datarate currently in use on this channel.
Definition LoRaWAN.h:327
-
uint32_t freq
The channel frequency (coded in 100 Hz steps)
Definition LoRaWAN.h:318
-
uint8_t idx
The channel number, as specified by defaults or the network.
Definition LoRaWAN.h:315
-
uint8_t drMin
Minimum allowed datarate for this channel.
Definition LoRaWAN.h:321
-
bool enabled
Whether this channel is enabled (can be used) or is disabled.
Definition LoRaWAN.h:312
-
uint8_t drMax
Maximum allowed datarate for this channel (inclusive)
Definition LoRaWAN.h:324
-
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition LoRaWAN.h:342
-
uint8_t drJoinRequest
Allowed data rates for a join request message.
Definition LoRaWAN.h:359
-
uint32_t freqStart
Center frequency of the first channel in span (coded in 100 Hz steps)
Definition LoRaWAN.h:347
-
uint8_t numChannels
Total number of channels in the span.
Definition LoRaWAN.h:344
-
uint8_t drMax
Maximum allowed datarate for all channels in this span (inclusive)
Definition LoRaWAN.h:356
-
uint32_t freqStep
Frequency step between adjacent channels (coded in 100 Hz steps)
Definition LoRaWAN.h:350
-
uint8_t drMin
Minimum allowed datarate for all channels in this span.
Definition LoRaWAN.h:353
-
Structure to save extra information about uplink/downlink event.
Definition LoRaWAN.h:487
-
float freq
Frequency in MHz.
Definition LoRaWAN.h:505
-
bool confirmed
Whether the event is confirmed or not (e.g., confirmed uplink sent by user application)
Definition LoRaWAN.h:492
-
uint8_t fPort
Port number.
Definition LoRaWAN.h:514
-
int16_t power
Transmit power in dBm for uplink, or RSSI for downlink.
Definition LoRaWAN.h:508
-
bool confirming
Whether the event is confirming a previous request (e.g., server downlink reply to confirmed uplink s...
Definition LoRaWAN.h:496
-
uint8_t datarate
Datarate.
Definition LoRaWAN.h:502
-
uint8_t dir
Event direction, one of RADIOLIB_LORAWAN_CHANNEL_DIR_*.
Definition LoRaWAN.h:489
-
uint8_t nbTrans
Number of times this uplink was transmitted (ADR)
Definition LoRaWAN.h:517
-
uint32_t fCnt
The appropriate frame counter - for different events, different frame counters will be reported!
Definition LoRaWAN.h:511
-
bool frmPending
Whether further downlink messages are pending on the server side.
Definition LoRaWAN.h:499
-
Structure to save extra information about activation event.
Definition LoRaWAN.h:472
-
bool newSession
Whether a new session was started.
Definition LoRaWAN.h:474
-
uint32_t joinNonce
The received Join-Request JoinNonce value.
Definition LoRaWAN.h:480
-
uint16_t devNonce
The transmitted Join-Request DevNonce value.
Definition LoRaWAN.h:477
-
MAC command specification structure.
Definition LoRaWAN.h:217
-
const uint8_t lenDn
Uplink message length.
Definition LoRaWAN.h:222
-
const bool user
Whether this MAC command can be issued by the user or not.
Definition LoRaWAN.h:231
-
const uint8_t cid
Command ID.
Definition LoRaWAN.h:219
-
const uint8_t lenUp
Downlink message length.
Definition LoRaWAN.h:225
-
const bool persist
Some commands must be resent until Class A downlink received.
Definition LoRaWAN.h:228
+
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition LoRaWAN.h:313
+
bool available
Whether this channel is available for channel selection.
Definition LoRaWAN.h:333
+
uint8_t dr
Datarate currently in use on this channel.
Definition LoRaWAN.h:330
+
uint32_t freq
The channel frequency (coded in 100 Hz steps)
Definition LoRaWAN.h:321
+
uint8_t idx
The channel number, as specified by defaults or the network.
Definition LoRaWAN.h:318
+
uint8_t drMin
Minimum allowed datarate for this channel.
Definition LoRaWAN.h:324
+
bool enabled
Whether this channel is enabled (can be used) or is disabled.
Definition LoRaWAN.h:315
+
uint8_t drMax
Maximum allowed datarate for this channel (inclusive)
Definition LoRaWAN.h:327
+
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition LoRaWAN.h:345
+
uint8_t drJoinRequest
Allowed data rates for a join request message.
Definition LoRaWAN.h:362
+
uint32_t freqStart
Center frequency of the first channel in span (coded in 100 Hz steps)
Definition LoRaWAN.h:350
+
uint8_t numChannels
Total number of channels in the span.
Definition LoRaWAN.h:347
+
uint8_t drMax
Maximum allowed datarate for all channels in this span (inclusive)
Definition LoRaWAN.h:359
+
uint32_t freqStep
Frequency step between adjacent channels (coded in 100 Hz steps)
Definition LoRaWAN.h:353
+
uint8_t drMin
Minimum allowed datarate for all channels in this span.
Definition LoRaWAN.h:356
+
Structure to save extra information about uplink/downlink event.
Definition LoRaWAN.h:490
+
float freq
Frequency in MHz.
Definition LoRaWAN.h:508
+
bool confirmed
Whether the event is confirmed or not (e.g., confirmed uplink sent by user application)
Definition LoRaWAN.h:495
+
uint8_t fPort
Port number.
Definition LoRaWAN.h:517
+
int16_t power
Transmit power in dBm for uplink, or RSSI for downlink.
Definition LoRaWAN.h:511
+
bool confirming
Whether the event is confirming a previous request (e.g., server downlink reply to confirmed uplink s...
Definition LoRaWAN.h:499
+
uint8_t datarate
Datarate.
Definition LoRaWAN.h:505
+
uint8_t dir
Event direction, one of RADIOLIB_LORAWAN_CHANNEL_DIR_*.
Definition LoRaWAN.h:492
+
uint8_t nbTrans
Number of times this uplink was transmitted (ADR)
Definition LoRaWAN.h:520
+
uint32_t fCnt
The appropriate frame counter - for different events, different frame counters will be reported!
Definition LoRaWAN.h:514
+
bool frmPending
Whether further downlink messages are pending on the server side.
Definition LoRaWAN.h:502
+
Structure to save extra information about activation event.
Definition LoRaWAN.h:475
+
bool newSession
Whether a new session was started.
Definition LoRaWAN.h:477
+
uint32_t joinNonce
The received Join-Request JoinNonce value.
Definition LoRaWAN.h:483
+
uint16_t devNonce
The transmitted Join-Request DevNonce value.
Definition LoRaWAN.h:480
+
MAC command specification structure.
Definition LoRaWAN.h:220
+
const uint8_t lenDn
Uplink message length.
Definition LoRaWAN.h:225
+
const bool user
Whether this MAC command can be issued by the user or not.
Definition LoRaWAN.h:234
+
const uint8_t cid
Command ID.
Definition LoRaWAN.h:222
+
const uint8_t lenUp
Downlink message length.
Definition LoRaWAN.h:228
+
const bool persist
Some commands must be resent until Class A downlink received.
Definition LoRaWAN.h:231
Common data rate structure.
Definition PhysicalLayer.h:74