diff --git a/_lo_ra_w_a_n_8h_source.html b/_lo_ra_w_a_n_8h_source.html index 067c4263..8897aa68 100644 --- a/_lo_ra_w_a_n_8h_source.html +++ b/_lo_ra_w_a_n_8h_source.html @@ -279,489 +279,494 @@ $(document).ready(function(){initNavTree('_lo_ra_w_a_n_8h_source.html',''); init
191 // maximum allowed dwell time on bands that implement dwell time limitations
192 #define RADIOLIB_LORAWAN_DWELL_TIME (400)
193 
-
194 struct LoRaWANMacSpec_t {
-
195  const uint8_t cid;
-
196  const uint8_t lenDn;
-
197  const uint8_t lenUp;
-
198  const bool user; // whether this MAC command can be issued by a user or not
-
199 };
-
200 
-
201 const LoRaWANMacSpec_t MacTable[RADIOLIB_LORAWAN_NUM_MAC_COMMANDS + 1] = {
-
202  { 0x00, 0, 0, false }, // not an actual MAC command, exists for index offsetting
-
203  { RADIOLIB_LORAWAN_MAC_RESET, 1, 1, false },
-
204  { RADIOLIB_LORAWAN_MAC_LINK_CHECK, 2, 0, true },
-
205  { RADIOLIB_LORAWAN_MAC_LINK_ADR, 4, 1, false },
-
206  { RADIOLIB_LORAWAN_MAC_DUTY_CYCLE, 1, 0, false },
-
207  { RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP, 4, 1, false },
-
208  { RADIOLIB_LORAWAN_MAC_DEV_STATUS, 0, 2, false },
-
209  { RADIOLIB_LORAWAN_MAC_NEW_CHANNEL, 5, 1, false },
-
210  { RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP, 1, 0, false },
-
211  { RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP, 1, 0, false },
-
212  { RADIOLIB_LORAWAN_MAC_DL_CHANNEL, 4, 1, false },
-
213  { RADIOLIB_LORAWAN_MAC_REKEY, 1, 1, false },
-
214  { RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP, 1, 0, false },
-
215  { RADIOLIB_LORAWAN_MAC_DEVICE_TIME, 5, 0, true },
-
216  { RADIOLIB_LORAWAN_MAC_FORCE_REJOIN, 2, 0, false },
-
217  { RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP, 1, 1, false },
-
218  { RADIOLIB_LORAWAN_MAC_PROPRIETARY, 5, 0, true }
-
219 };
-
220 
-
226 struct LoRaWANChannel_t {
-
228  bool enabled;
-
229 
-
231  uint8_t idx;
-
232 
-
234  float freq;
-
235 
-
237  uint8_t drMin;
-
238 
-
240  uint8_t drMax;
-
241 };
-
242 
-
243 // alias for unused channel
-
244 #define RADIOLIB_LORAWAN_CHANNEL_NONE { .enabled = false, .idx = RADIOLIB_LORAWAN_CHANNEL_INDEX_NONE, .freq = 0, .drMin = 0, .drMax = 0 }
-
245 
-
251 struct LoRaWANChannelSpan_t {
-
253  uint8_t numChannels;
-
254 
-
256  float freqStart;
-
257 
-
259  float freqStep;
-
260 
-
262  uint8_t drMin;
-
263 
-
265  uint8_t drMax;
-
266 
-
268  uint8_t joinRequestDataRate;
-
269 };
-
270 
-
271 // alias for unused channel span
-
272 #define RADIOLIB_LORAWAN_CHANNEL_SPAN_NONE { .numChannels = 0, .freqStart = 0, .freqStep = 0, .drMin = 0, .drMax = 0, .joinRequestDataRate = RADIOLIB_LORAWAN_DATA_RATE_UNUSED }
-
273 
-
278 struct LoRaWANBand_t {
-
280  uint8_t bandType;
-
281 
-
283  uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];
-
284 
-
286  int8_t powerMax;
-
287 
-
289  int8_t powerNumSteps;
-
290 
-
292  uint32_t dutyCycle;
-
293 
-
295  uint32_t dwellTimeUp;
-
296  uint32_t dwellTimeDn;
-
297 
-
299  LoRaWANChannel_t txFreqs[3];
-
300 
-
302  LoRaWANChannel_t txJoinReq[3];
-
303 
-
305  uint8_t numTxSpans;
-
306 
-
308  LoRaWANChannelSpan_t txSpans[2];
-
309 
-
311  LoRaWANChannelSpan_t rx1Span;
-
312 
-
314  uint8_t rx1DataRateBase;
-
315 
-
317  LoRaWANChannel_t rx2;
-
318 
-
320  uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];
-
321 };
-
322 
-
323 // supported bands
-
324 extern const LoRaWANBand_t EU868;
-
325 extern const LoRaWANBand_t US915;
-
326 extern const LoRaWANBand_t CN780;
-
327 extern const LoRaWANBand_t EU433;
-
328 extern const LoRaWANBand_t AU915;
-
329 extern const LoRaWANBand_t CN500;
-
330 extern const LoRaWANBand_t AS923;
-
331 extern const LoRaWANBand_t KR920;
-
332 extern const LoRaWANBand_t IN865;
-
333 
-
338 struct LoRaWANMacCommand_t {
-
340  uint8_t cid;
-
341 
-
343  uint8_t payload[5];
-
344 
-
346  uint8_t len;
-
347 
-
349  uint8_t repeat;
-
350 };
-
351 
-
352 struct LoRaWANMacCommandQueue_t {
-
353  uint8_t numCommands;
-
354  uint8_t len;
-
355  LoRaWANMacCommand_t commands[RADIOLIB_LORAWAN_MAC_COMMAND_QUEUE_SIZE];
-
356 };
-
357 
-
362 struct LoRaWANEvent_t {
-
364  uint8_t dir;
-
365 
-
367  bool confirmed;
-
368 
-
371  bool confirming;
-
372 
-
374  uint8_t datarate;
-
375 
-
377  float freq;
-
378 
-
380  int16_t power;
-
381 
-
383  uint32_t fcnt;
-
384 
-
386  uint8_t port;
-
387 };
-
388 
-
393 class LoRaWANNode {
-
394  public:
-
395 
-
396  // Offset between TX and RX1 (such that RX1 has equal or lower DR)
-
397  uint8_t rx1DrOffset = 0;
-
398 
-
399  // RX2 channel properties - may be changed by MAC command
-
400  LoRaWANChannel_t rx2;
-
401 
-
408  LoRaWANNode(PhysicalLayer* phy, const LoRaWANBand_t* band, uint8_t subBand = 0);
-
409 
-
410 #if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
-
415  void wipe();
-
416 
-
422  int16_t restore();
-
423 #endif
-
424 
-
437  int16_t beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t* nwkKey, uint8_t* appKey, uint8_t joinDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED, bool force = false);
-
438 
-
450  int16_t beginABP(uint32_t addr, uint8_t* nwkSKey, uint8_t* appSKey, uint8_t* fNwkSIntKey = NULL, uint8_t* sNwkSIntKey = NULL, bool force = false);
-
451 
-
453  bool isJoined();
-
454 
-
460  int16_t saveSession();
-
461 
-
469  bool sendMacCommandReq(uint8_t cid);
-
470 
-
471  #if defined(RADIOLIB_BUILD_ARDUINO)
-
481  int16_t uplink(String& str, uint8_t port, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
-
482  #endif
-
483 
-
493  int16_t uplink(const char* str, uint8_t port, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
-
494 
-
505  int16_t uplink(uint8_t* data, size_t len, uint8_t port, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
-
506 
-
507  #if defined(RADIOLIB_BUILD_ARDUINO)
-
515  int16_t downlink(String& str, LoRaWANEvent_t* event = NULL);
-
516  #endif
-
517 
-
526  int16_t downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event = NULL);
-
527 
-
528  #if defined(RADIOLIB_BUILD_ARDUINO)
-
541  int16_t sendReceive(String& strUp, uint8_t port, String& strDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
-
542  #endif
-
543 
-
557  int16_t sendReceive(const char* strUp, uint8_t port, uint8_t* dataDown, size_t* lenDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
-
558 
-
573  int16_t sendReceive(uint8_t* dataUp, size_t lenUp, uint8_t port, uint8_t* dataDown, size_t* lenDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
-
574 
-
580  void setDeviceStatus(uint8_t battLevel);
-
581 
-
583  uint32_t getFcntUp();
-
584 
-
586  uint32_t getNFcntDown();
-
587 
-
589  uint32_t getAFcntDown();
-
590 
-
595  void resetFcntDown();
-
596 
-
603  int16_t setDatarate(uint8_t drUp, bool saveToEeprom = false);
-
604 
-
609  void setADR(bool enable = true);
-
610 
-
617  void setDutyCycle(bool enable = true, uint32_t msPerHour = 0);
-
618 
-
626  uint32_t dutyCycleInterval(uint32_t msPerHour, uint32_t airtime);
-
627 
-
629  uint32_t timeUntilUplink();
-
630 
-
637  void setDwellTime(bool enable, uint32_t msPerUplink = 0);
-
638 
-
644  uint8_t maxPayloadDwellTime();
-
645 
-
652  int16_t setTxPower(int8_t txPower, bool saveToEeprom = false);
-
653 
-
660  void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA = false);
-
661 
-
670  int16_t getMacLinkCheckAns(uint8_t* margin, uint8_t* gwCnt);
-
671 
-
681  int16_t getMacDeviceTimeAns(uint32_t* gpsEpoch, uint8_t* fraction, bool returnUnix = true);
-
682 
-
683 #if !RADIOLIB_GODMODE
-
684  private:
-
685 #endif
-
686  PhysicalLayer* phyLayer = NULL;
-
687  const LoRaWANBand_t* band = NULL;
-
688 
-
689  void beginCommon(uint8_t joinDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED);
-
690 
-
691  LoRaWANMacCommandQueue_t commandsUp = {
-
692  .numCommands = 0,
-
693  .len = 0,
-
694  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
-
695  };
-
696  LoRaWANMacCommandQueue_t commandsDown = {
+
194 // Maximum MAC command sizes
+
195 #define RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_DOWN (5)
+
196 #define RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_UP (2)
+
197 #define RADIOLIB_LORAWAN_MAX_NUM_ADR_COMMANDS (8)
+
198 
+
199 struct LoRaWANMacSpec_t {
+
200  const uint8_t cid;
+
201  const uint8_t lenDn;
+
202  const uint8_t lenUp;
+
203  const bool user; // whether this MAC command can be issued by a user or not
+
204 };
+
205 
+
206 const LoRaWANMacSpec_t MacTable[RADIOLIB_LORAWAN_NUM_MAC_COMMANDS + 1] = {
+
207  { 0x00, 0, 0, false }, // not an actual MAC command, exists for index offsetting
+
208  { RADIOLIB_LORAWAN_MAC_RESET, 1, 1, false },
+
209  { RADIOLIB_LORAWAN_MAC_LINK_CHECK, 2, 0, true },
+
210  { RADIOLIB_LORAWAN_MAC_LINK_ADR, 4, 1, false },
+
211  { RADIOLIB_LORAWAN_MAC_DUTY_CYCLE, 1, 0, false },
+
212  { RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP, 4, 1, false },
+
213  { RADIOLIB_LORAWAN_MAC_DEV_STATUS, 0, 2, false },
+
214  { RADIOLIB_LORAWAN_MAC_NEW_CHANNEL, 5, 1, false },
+
215  { RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP, 1, 0, false },
+
216  { RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP, 1, 0, false },
+
217  { RADIOLIB_LORAWAN_MAC_DL_CHANNEL, 4, 1, false },
+
218  { RADIOLIB_LORAWAN_MAC_REKEY, 1, 1, false },
+
219  { RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP, 1, 0, false },
+
220  { RADIOLIB_LORAWAN_MAC_DEVICE_TIME, 5, 0, true },
+
221  { RADIOLIB_LORAWAN_MAC_FORCE_REJOIN, 2, 0, false },
+
222  { RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP, 1, 1, false },
+
223  { RADIOLIB_LORAWAN_MAC_PROPRIETARY, 5, 0, true }
+
224 };
+
225 
+
231 struct LoRaWANChannel_t {
+
233  bool enabled;
+
234 
+
236  uint8_t idx;
+
237 
+
239  float freq;
+
240 
+
242  uint8_t drMin;
+
243 
+
245  uint8_t drMax;
+
246 };
+
247 
+
248 // alias for unused channel
+
249 #define RADIOLIB_LORAWAN_CHANNEL_NONE { .enabled = false, .idx = RADIOLIB_LORAWAN_CHANNEL_INDEX_NONE, .freq = 0, .drMin = 0, .drMax = 0 }
+
250 
+
256 struct LoRaWANChannelSpan_t {
+
258  uint8_t numChannels;
+
259 
+
261  float freqStart;
+
262 
+
264  float freqStep;
+
265 
+
267  uint8_t drMin;
+
268 
+
270  uint8_t drMax;
+
271 
+
273  uint8_t joinRequestDataRate;
+
274 };
+
275 
+
276 // alias for unused channel span
+
277 #define RADIOLIB_LORAWAN_CHANNEL_SPAN_NONE { .numChannels = 0, .freqStart = 0, .freqStep = 0, .drMin = 0, .drMax = 0, .joinRequestDataRate = RADIOLIB_LORAWAN_DATA_RATE_UNUSED }
+
278 
+
283 struct LoRaWANBand_t {
+
285  uint8_t bandType;
+
286 
+
288  uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];
+
289 
+
291  int8_t powerMax;
+
292 
+
294  int8_t powerNumSteps;
+
295 
+
297  uint32_t dutyCycle;
+
298 
+
300  uint32_t dwellTimeUp;
+
301  uint32_t dwellTimeDn;
+
302 
+
304  LoRaWANChannel_t txFreqs[3];
+
305 
+
307  LoRaWANChannel_t txJoinReq[3];
+
308 
+
310  uint8_t numTxSpans;
+
311 
+
313  LoRaWANChannelSpan_t txSpans[2];
+
314 
+
316  LoRaWANChannelSpan_t rx1Span;
+
317 
+
319  uint8_t rx1DataRateBase;
+
320 
+
322  LoRaWANChannel_t rx2;
+
323 
+
325  uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];
+
326 };
+
327 
+
328 // supported bands
+
329 extern const LoRaWANBand_t EU868;
+
330 extern const LoRaWANBand_t US915;
+
331 extern const LoRaWANBand_t CN780;
+
332 extern const LoRaWANBand_t EU433;
+
333 extern const LoRaWANBand_t AU915;
+
334 extern const LoRaWANBand_t CN500;
+
335 extern const LoRaWANBand_t AS923;
+
336 extern const LoRaWANBand_t KR920;
+
337 extern const LoRaWANBand_t IN865;
+
338 
+
343 struct LoRaWANMacCommand_t {
+
345  uint8_t cid;
+
346 
+
348  uint8_t payload[5];
+
349 
+
351  uint8_t len;
+
352 
+
354  uint8_t repeat;
+
355 };
+
356 
+
357 struct LoRaWANMacCommandQueue_t {
+
358  uint8_t numCommands;
+
359  uint8_t len;
+
360  LoRaWANMacCommand_t commands[RADIOLIB_LORAWAN_MAC_COMMAND_QUEUE_SIZE];
+
361 };
+
362 
+
367 struct LoRaWANEvent_t {
+
369  uint8_t dir;
+
370 
+
372  bool confirmed;
+
373 
+
376  bool confirming;
+
377 
+
379  uint8_t datarate;
+
380 
+
382  float freq;
+
383 
+
385  int16_t power;
+
386 
+
388  uint32_t fcnt;
+
389 
+
391  uint8_t port;
+
392 };
+
393 
+
398 class LoRaWANNode {
+
399  public:
+
400 
+
401  // Offset between TX and RX1 (such that RX1 has equal or lower DR)
+
402  uint8_t rx1DrOffset = 0;
+
403 
+
404  // RX2 channel properties - may be changed by MAC command
+
405  LoRaWANChannel_t rx2;
+
406 
+
413  LoRaWANNode(PhysicalLayer* phy, const LoRaWANBand_t* band, uint8_t subBand = 0);
+
414 
+
415 #if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
+
420  void wipe();
+
421 
+
427  int16_t restore();
+
428 #endif
+
429 
+
442  int16_t beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t* nwkKey, uint8_t* appKey, uint8_t joinDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED, bool force = false);
+
443 
+
455  int16_t beginABP(uint32_t addr, uint8_t* nwkSKey, uint8_t* appSKey, uint8_t* fNwkSIntKey = NULL, uint8_t* sNwkSIntKey = NULL, bool force = false);
+
456 
+
458  bool isJoined();
+
459 
+
465  int16_t saveSession();
+
466 
+
474  bool sendMacCommandReq(uint8_t cid);
+
475 
+
476  #if defined(RADIOLIB_BUILD_ARDUINO)
+
486  int16_t uplink(String& str, uint8_t port, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
+
487  #endif
+
488 
+
498  int16_t uplink(const char* str, uint8_t port, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
+
499 
+
510  int16_t uplink(uint8_t* data, size_t len, uint8_t port, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
+
511 
+
512  #if defined(RADIOLIB_BUILD_ARDUINO)
+
520  int16_t downlink(String& str, LoRaWANEvent_t* event = NULL);
+
521  #endif
+
522 
+
531  int16_t downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event = NULL);
+
532 
+
533  #if defined(RADIOLIB_BUILD_ARDUINO)
+
546  int16_t sendReceive(String& strUp, uint8_t port, String& strDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
+
547  #endif
+
548 
+
562  int16_t sendReceive(const char* strUp, uint8_t port, uint8_t* dataDown, size_t* lenDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
+
563 
+
578  int16_t sendReceive(uint8_t* dataUp, size_t lenUp, uint8_t port, uint8_t* dataDown, size_t* lenDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
+
579 
+
585  void setDeviceStatus(uint8_t battLevel);
+
586 
+
588  uint32_t getFcntUp();
+
589 
+
591  uint32_t getNFcntDown();
+
592 
+
594  uint32_t getAFcntDown();
+
595 
+
600  void resetFcntDown();
+
601 
+
608  int16_t setDatarate(uint8_t drUp, bool saveToEeprom = false);
+
609 
+
614  void setADR(bool enable = true);
+
615 
+
622  void setDutyCycle(bool enable = true, uint32_t msPerHour = 0);
+
623 
+
631  uint32_t dutyCycleInterval(uint32_t msPerHour, uint32_t airtime);
+
632 
+
634  uint32_t timeUntilUplink();
+
635 
+
642  void setDwellTime(bool enable, uint32_t msPerUplink = 0);
+
643 
+
649  uint8_t maxPayloadDwellTime();
+
650 
+
657  int16_t setTxPower(int8_t txPower, bool saveToEeprom = false);
+
658 
+
665  void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA = false);
+
666 
+
675  int16_t getMacLinkCheckAns(uint8_t* margin, uint8_t* gwCnt);
+
676 
+
686  int16_t getMacDeviceTimeAns(uint32_t* gpsEpoch, uint8_t* fraction, bool returnUnix = true);
+
687 
+
688 #if !RADIOLIB_GODMODE
+
689  private:
+
690 #endif
+
691  PhysicalLayer* phyLayer = NULL;
+
692  const LoRaWANBand_t* band = NULL;
+
693 
+
694  void beginCommon(uint8_t joinDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED);
+
695 
+
696  LoRaWANMacCommandQueue_t commandsUp = {
697  .numCommands = 0,
698  .len = 0,
699  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
700  };
-
701 
-
702  // the following is either provided by the network server (OTAA)
-
703  // or directly entered by the user (ABP)
-
704  uint32_t devAddr = 0;
-
705  uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
706  uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
707  uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
708  uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
709  uint8_t jSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
710 
-
711  // device-specific parameters, persistent through sessions
-
712  uint16_t devNonce = 0;
-
713  uint32_t joinNonce = 0;
-
714 
-
715  // session-specific parameters
-
716  uint32_t homeNetId = 0;
-
717  uint8_t adrLimitExp = RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP;
-
718  uint8_t adrDelayExp = RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP;
-
719  uint8_t nbTrans = 1; // Number of allowed frame retransmissions
-
720  uint8_t txPowerCur = 0;
-
721  uint8_t txPowerMax = 0;
-
722  uint32_t fcntUp = 0;
-
723  uint32_t aFcntDown = 0;
-
724  uint32_t nFcntDown = 0;
-
725  uint32_t confFcntUp = RADIOLIB_LORAWAN_FCNT_NONE;
-
726  uint32_t confFcntDown = RADIOLIB_LORAWAN_FCNT_NONE;
-
727  uint32_t adrFcnt = 0;
-
728 
-
729  // whether the current configured channel is in FSK mode
-
730  bool FSK = false;
-
731 
-
732  // flag that shows whether the device is joined and there is an ongoing session (none, ABP or OTAA)
-
733  uint16_t activeMode = 0;
-
734 
-
735  // ADR is enabled by default
-
736  bool adrEnabled = true;
-
737 
-
738  // duty cycle is set upon initialization and activated in regions that impose this
-
739  bool dutyCycleEnabled = false;
-
740  uint32_t dutyCycle = 0;
-
741 
-
742  // dwell time is set upon initialization and activated in regions that impose this
-
743  bool dwellTimeEnabledUp = false;
-
744  uint16_t dwellTimeUp = 0;
-
745  bool dwellTimeEnabledDn = false;
-
746  uint16_t dwellTimeDn = 0;
-
747 
-
748  // enable/disable CSMA for LoRaWAN
-
749  bool enableCSMA;
-
750 
-
751  // number of backoff slots to be decremented after DIFS phase. 0 to disable BO.
-
752  // A random BO avoids collisions in the case where two or more nodes start the CSMA
-
753  // process at the same time.
-
754  uint8_t backoffMax;
-
755 
-
756  // number of CADs to estimate a clear CH
-
757  uint8_t difsSlots;
-
758 
-
759  // available channel frequencies from list passed during OTA activation
-
760  LoRaWANChannel_t availableChannels[2][RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS];
-
761 
-
762  // currently configured channels for TX and RX1
-
763  LoRaWANChannel_t currentChannels[2] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE };
-
764 
-
765  // currently configured datarates for TX and RX1
-
766  uint8_t dataRates[2] = { RADIOLIB_LORAWAN_DATA_RATE_UNUSED, RADIOLIB_LORAWAN_DATA_RATE_UNUSED };
-
767 
-
768  // LoRaWAN revision (1.0 vs 1.1)
-
769  uint8_t rev = 0;
-
770 
-
771  // Time on Air of last uplink
-
772  uint32_t lastToA = 0;
-
773 
-
774  // timestamp to measure the RX1/2 delay (from uplink end)
-
775  uint32_t rxDelayStart = 0;
-
776 
-
777  // timestamp when the Rx1/2 windows were closed (timeout or uplink received)
-
778  uint32_t rxDelayEnd = 0;
-
779 
-
780  // delays between the uplink and RX1/2 windows
-
781  uint32_t rxDelays[2] = { RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS, RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS };
-
782 
-
783  // device status - battery level
-
784  uint8_t battLevel = 0xFF;
-
785 
-
786  // indicates whether an uplink has MAC commands as payload
-
787  bool isMACPayload = false;
-
788 
-
789  // save the selected subband in case this must be restored in ADR control
-
790  int8_t subBand = -1;
-
791 
-
792 #if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
-
798  int16_t saveFcntUp();
-
799 
-
805  int16_t restoreFcntUp();
-
806 #endif
-
807 
-
808  // wait for, open and listen during Rx1 and Rx2 windows; only performs listening
-
809  int16_t downlinkCommon();
-
810 
-
811  // method to generate message integrity code
-
812  uint32_t generateMIC(uint8_t* msg, size_t len, uint8_t* key);
-
813 
-
814  // method to verify message integrity code
-
815  // it assumes that the MIC is the last 4 bytes of the message
-
816  bool verifyMIC(uint8_t* msg, size_t len, uint8_t* key);
-
817 
-
818  // configure the common physical layer properties (preamble, sync word etc.)
-
819  // channels must be configured separately by setupChannelsDyn()!
-
820  int16_t setPhyProperties();
-
821 
-
822  // setup uplink/downlink channel data rates and frequencies
-
823  // for dynamic channels, there is a small set of predefined channels
-
824  // in case of JoinRequest, add some optional extra frequencies
-
825  int16_t setupChannelsDyn(bool joinRequest = false);
+
701  LoRaWANMacCommandQueue_t commandsDown = {
+
702  .numCommands = 0,
+
703  .len = 0,
+
704  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
+
705  };
+
706 
+
707  // the following is either provided by the network server (OTAA)
+
708  // or directly entered by the user (ABP)
+
709  uint32_t devAddr = 0;
+
710  uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
711  uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
712  uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
713  uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
714  uint8_t jSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
715 
+
716  // device-specific parameters, persistent through sessions
+
717  uint16_t devNonce = 0;
+
718  uint32_t joinNonce = 0;
+
719 
+
720  // session-specific parameters
+
721  uint32_t homeNetId = 0;
+
722  uint8_t adrLimitExp = RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP;
+
723  uint8_t adrDelayExp = RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP;
+
724  uint8_t nbTrans = 1; // Number of allowed frame retransmissions
+
725  uint8_t txPowerCur = 0;
+
726  uint8_t txPowerMax = 0;
+
727  uint32_t fcntUp = 0;
+
728  uint32_t aFcntDown = 0;
+
729  uint32_t nFcntDown = 0;
+
730  uint32_t confFcntUp = RADIOLIB_LORAWAN_FCNT_NONE;
+
731  uint32_t confFcntDown = RADIOLIB_LORAWAN_FCNT_NONE;
+
732  uint32_t adrFcnt = 0;
+
733 
+
734  // whether the current configured channel is in FSK mode
+
735  bool FSK = false;
+
736 
+
737  // flag that shows whether the device is joined and there is an ongoing session (none, ABP or OTAA)
+
738  uint16_t activeMode = 0;
+
739 
+
740  // ADR is enabled by default
+
741  bool adrEnabled = true;
+
742 
+
743  // duty cycle is set upon initialization and activated in regions that impose this
+
744  bool dutyCycleEnabled = false;
+
745  uint32_t dutyCycle = 0;
+
746 
+
747  // dwell time is set upon initialization and activated in regions that impose this
+
748  bool dwellTimeEnabledUp = false;
+
749  uint16_t dwellTimeUp = 0;
+
750  bool dwellTimeEnabledDn = false;
+
751  uint16_t dwellTimeDn = 0;
+
752 
+
753  // enable/disable CSMA for LoRaWAN
+
754  bool enableCSMA;
+
755 
+
756  // number of backoff slots to be decremented after DIFS phase. 0 to disable BO.
+
757  // A random BO avoids collisions in the case where two or more nodes start the CSMA
+
758  // process at the same time.
+
759  uint8_t backoffMax;
+
760 
+
761  // number of CADs to estimate a clear CH
+
762  uint8_t difsSlots;
+
763 
+
764  // available channel frequencies from list passed during OTA activation
+
765  LoRaWANChannel_t availableChannels[2][RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS];
+
766 
+
767  // currently configured channels for TX and RX1
+
768  LoRaWANChannel_t currentChannels[2] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE };
+
769 
+
770  // currently configured datarates for TX and RX1
+
771  uint8_t dataRates[2] = { RADIOLIB_LORAWAN_DATA_RATE_UNUSED, RADIOLIB_LORAWAN_DATA_RATE_UNUSED };
+
772 
+
773  // LoRaWAN revision (1.0 vs 1.1)
+
774  uint8_t rev = 0;
+
775 
+
776  // Time on Air of last uplink
+
777  uint32_t lastToA = 0;
+
778 
+
779  // timestamp to measure the RX1/2 delay (from uplink end)
+
780  uint32_t rxDelayStart = 0;
+
781 
+
782  // timestamp when the Rx1/2 windows were closed (timeout or uplink received)
+
783  uint32_t rxDelayEnd = 0;
+
784 
+
785  // delays between the uplink and RX1/2 windows
+
786  uint32_t rxDelays[2] = { RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS, RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS };
+
787 
+
788  // device status - battery level
+
789  uint8_t battLevel = 0xFF;
+
790 
+
791  // indicates whether an uplink has MAC commands as payload
+
792  bool isMACPayload = false;
+
793 
+
794  // save the selected subband in case this must be restored in ADR control
+
795  int8_t subBand = -1;
+
796 
+
797 #if !defined(RADIOLIB_EEPROM_UNSUPPORTED)
+
803  int16_t saveFcntUp();
+
804 
+
810  int16_t restoreFcntUp();
+
811 #endif
+
812 
+
813  // wait for, open and listen during Rx1 and Rx2 windows; only performs listening
+
814  int16_t downlinkCommon();
+
815 
+
816  // method to generate message integrity code
+
817  uint32_t generateMIC(uint8_t* msg, size_t len, uint8_t* key);
+
818 
+
819  // method to verify message integrity code
+
820  // it assumes that the MIC is the last 4 bytes of the message
+
821  bool verifyMIC(uint8_t* msg, size_t len, uint8_t* key);
+
822 
+
823  // configure the common physical layer properties (preamble, sync word etc.)
+
824  // channels must be configured separately by setupChannelsDyn()!
+
825  int16_t setPhyProperties();
826 
827  // setup uplink/downlink channel data rates and frequencies
-
828  // for fixed bands, we only allow one subband at a time to be selected
-
829  int16_t setupChannelsFix(uint8_t subBand);
-
830 
-
831  // a join-accept can piggy-back a set of channels or channel masks
-
832  int16_t processCFList(uint8_t* cfList);
-
833 
-
834  // select a set of random TX/RX channels for up- and downlink
-
835  int16_t selectChannels();
-
836 
-
837  // find the first usable data rate for the given band
-
838  int16_t findDataRate(uint8_t dr, DataRate_t* dataRate);
-
839 
-
840  // configure channel based on cached data rate ID and frequency
-
841  int16_t configureChannel(uint8_t dir);
-
842 
-
843  // restore all available channels from persistent storage
-
844  int16_t restoreChannels();
-
845 
-
846  // push MAC command to queue, done by copy
-
847  int16_t pushMacCommand(LoRaWANMacCommand_t* cmd, LoRaWANMacCommandQueue_t* queue);
-
848 
-
849  // delete a specific MAC command from queue, indicated by the command ID
-
850  // if a payload pointer is supplied, this returns the payload of the MAC command
-
851  int16_t deleteMacCommand(uint8_t cid, LoRaWANMacCommandQueue_t* queue, uint8_t payload[5] = NULL);
-
852 
-
853  // execute mac command, return the number of processed bytes for sequential processing
-
854  bool execMacCommand(LoRaWANMacCommand_t* cmd, bool saveToEeprom = true);
-
855 
-
856  // apply a channel mask to a set of readily defined channels (dynamic bands only)
-
857  bool applyChannelMaskDyn(uint8_t chMaskCntl, uint16_t chMask);
-
858 
-
859  // define or delete channels from a fixed set of channels (fixed bands only)
-
860  bool applyChannelMaskFix(uint8_t chMaskCntl, uint16_t chMask, bool clear);
-
861 
-
862  // get the payload length for a specific MAC command
-
863  uint8_t getMacPayloadLength(uint8_t cid);
-
864 
-
865  // Performs CSMA as per LoRa Alliance Technical Reccomendation 13 (TR-013).
-
866  void performCSMA();
-
867 
-
868  // perform a single CAD operation for the under SF/CH combination. Returns either busy or otherwise.
-
869  bool performCAD();
-
870 
-
871  // function to encrypt and decrypt payloads
-
872  void processAES(uint8_t* in, size_t len, uint8_t* key, uint8_t* out, uint32_t fcnt, uint8_t dir, uint8_t ctrId, bool counter);
-
873 
-
874  // 16-bit checksum method that takes a uint8_t array of even length and calculates the checksum
-
875  static uint16_t checkSum16(uint8_t *key, uint8_t keyLen);
-
876 
-
877  // network-to-host conversion method - takes data from network packet and converts it to the host endians
-
878  template<typename T>
-
879  static T ntoh(uint8_t* buff, size_t size = 0);
-
880 
-
881  // host-to-network conversion method - takes data from host variable and and converts it to network packet endians
-
882  template<typename T>
-
883  static void hton(uint8_t* buff, T val, size_t size = 0);
-
884 };
+
828  // for dynamic channels, there is a small set of predefined channels
+
829  // in case of JoinRequest, add some optional extra frequencies
+
830  int16_t setupChannelsDyn(bool joinRequest = false);
+
831 
+
832  // setup uplink/downlink channel data rates and frequencies
+
833  // for fixed bands, we only allow one subband at a time to be selected
+
834  int16_t setupChannelsFix(uint8_t subBand);
+
835 
+
836  // a join-accept can piggy-back a set of channels or channel masks
+
837  int16_t processCFList(uint8_t* cfList);
+
838 
+
839  // select a set of random TX/RX channels for up- and downlink
+
840  int16_t selectChannels();
+
841 
+
842  // find the first usable data rate for the given band
+
843  int16_t findDataRate(uint8_t dr, DataRate_t* dataRate);
+
844 
+
845  // configure channel based on cached data rate ID and frequency
+
846  int16_t configureChannel(uint8_t dir);
+
847 
+
848  // restore all available channels from persistent storage
+
849  int16_t restoreChannels();
+
850 
+
851  // push MAC command to queue, done by copy
+
852  int16_t pushMacCommand(LoRaWANMacCommand_t* cmd, LoRaWANMacCommandQueue_t* queue);
+
853 
+
854  // delete a specific MAC command from queue, indicated by the command ID
+
855  // if a payload pointer is supplied, this returns the payload of the MAC command
+
856  int16_t deleteMacCommand(uint8_t cid, LoRaWANMacCommandQueue_t* queue, uint8_t payload[5] = NULL);
+
857 
+
858  // execute mac command, return the number of processed bytes for sequential processing
+
859  bool execMacCommand(LoRaWANMacCommand_t* cmd, bool saveToEeprom = true);
+
860 
+
861  // apply a channel mask to a set of readily defined channels (dynamic bands only)
+
862  bool applyChannelMaskDyn(uint8_t chMaskCntl, uint16_t chMask);
+
863 
+
864  // define or delete channels from a fixed set of channels (fixed bands only)
+
865  bool applyChannelMaskFix(uint8_t chMaskCntl, uint16_t chMask, bool clear);
+
866 
+
867  // get the payload length for a specific MAC command
+
868  uint8_t getMacPayloadLength(uint8_t cid);
+
869 
+
870  // Performs CSMA as per LoRa Alliance Technical Reccomendation 13 (TR-013).
+
871  void performCSMA();
+
872 
+
873  // perform a single CAD operation for the under SF/CH combination. Returns either busy or otherwise.
+
874  bool performCAD();
+
875 
+
876  // function to encrypt and decrypt payloads
+
877  void processAES(uint8_t* in, size_t len, uint8_t* key, uint8_t* out, uint32_t fcnt, uint8_t dir, uint8_t ctrId, bool counter);
+
878 
+
879  // 16-bit checksum method that takes a uint8_t array of even length and calculates the checksum
+
880  static uint16_t checkSum16(uint8_t *key, uint8_t keyLen);
+
881 
+
882  // network-to-host conversion method - takes data from network packet and converts it to the host endians
+
883  template<typename T>
+
884  static T ntoh(uint8_t* buff, size_t size = 0);
885 
-
886 #endif
-
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:393
-
LoRaWANNode::uplink
int16_t uplink(const char *str, uint8_t port, bool isConfirmed=false, LoRaWANEvent_t *event=NULL)
Send a message to the server.
Definition: LoRaWAN.cpp:852
-
LoRaWANNode::sendReceive
int16_t sendReceive(const char *strUp, uint8_t port, uint8_t *dataDown, size_t *lenDown, 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:1568
-
LoRaWANNode::setTxPower
int16_t setTxPower(int8_t txPower, bool saveToEeprom=false)
Configure TX power of the radio module.
Definition: LoRaWAN.cpp:1945
-
LoRaWANNode::maxPayloadDwellTime
uint8_t maxPayloadDwellTime()
Returns the maximum payload given the currently present dwelltime limits. WARNING: the addition of MA...
Definition: LoRaWAN.cpp:1925
-
LoRaWANNode::setDwellTime
void setDwellTime(bool enable, uint32_t msPerUplink=0)
Toggle adherence to dwellTime limits to on or off.
Definition: LoRaWAN.cpp:1916
-
LoRaWANNode::getFcntUp
uint32_t getFcntUp()
Returns the last uplink's frame counter.
Definition: LoRaWAN.cpp:1592
-
LoRaWANNode::setDeviceStatus
void setDeviceStatus(uint8_t battLevel)
Set device status.
Definition: LoRaWAN.cpp:1588
-
LoRaWANNode::dutyCycleInterval
uint32_t dutyCycleInterval(uint32_t msPerHour, uint32_t airtime)
Calculate the minimum interval to adhere to a certain dutyCycle. This interval is based on the ToA of...
Definition: LoRaWAN.cpp:1897
-
LoRaWANNode::resetFcntDown
void resetFcntDown()
Reset the downlink frame counters (application and network) This is unsafe and can possibly allow rep...
Definition: LoRaWAN.cpp:1604
-
LoRaWANNode::sendMacCommandReq
bool sendMacCommandReq(uint8_t cid)
Add a MAC command to the uplink queue. Only LinkCheck and DeviceTime are available to the user....
Definition: LoRaWAN.cpp:2032
-
LoRaWANNode::saveSession
int16_t saveSession()
Save the current state of the session. All variables are compared to what is saved and only the diffe...
Definition: LoRaWAN.cpp:744
-
LoRaWANNode::setDatarate
int16_t setDatarate(uint8_t drUp, bool saveToEeprom=false)
Set uplink datarate. This should not be used when ADR is enabled.
Definition: LoRaWAN.cpp:1848
-
LoRaWANNode::getNFcntDown
uint32_t getNFcntDown()
Returns the last network downlink's frame counter.
Definition: LoRaWAN.cpp:1596
-
LoRaWANNode::getAFcntDown
uint32_t getAFcntDown()
Returns the last application downlink's frame counter.
Definition: LoRaWAN.cpp:1600
+
886  // host-to-network conversion method - takes data from host variable and and converts it to network packet endians
+
887  template<typename T>
+
888  static void hton(uint8_t* buff, T val, size_t size = 0);
+
889 };
+
890 
+
891 #endif
+
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:398
+
LoRaWANNode::uplink
int16_t uplink(const char *str, uint8_t port, bool isConfirmed=false, LoRaWANEvent_t *event=NULL)
Send a message to the server.
Definition: LoRaWAN.cpp:863
+
LoRaWANNode::sendReceive
int16_t sendReceive(const char *strUp, uint8_t port, uint8_t *dataDown, size_t *lenDown, 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:1579
+
LoRaWANNode::setTxPower
int16_t setTxPower(int8_t txPower, bool saveToEeprom=false)
Configure TX power of the radio module.
Definition: LoRaWAN.cpp:1970
+
LoRaWANNode::maxPayloadDwellTime
uint8_t maxPayloadDwellTime()
Returns the maximum payload given the currently present dwelltime limits. WARNING: the addition of MA...
Definition: LoRaWAN.cpp:1950
+
LoRaWANNode::setDwellTime
void setDwellTime(bool enable, uint32_t msPerUplink=0)
Toggle adherence to dwellTime limits to on or off.
Definition: LoRaWAN.cpp:1941
+
LoRaWANNode::getFcntUp
uint32_t getFcntUp()
Returns the last uplink's frame counter.
Definition: LoRaWAN.cpp:1603
+
LoRaWANNode::setDeviceStatus
void setDeviceStatus(uint8_t battLevel)
Set device status.
Definition: LoRaWAN.cpp:1599
+
LoRaWANNode::dutyCycleInterval
uint32_t dutyCycleInterval(uint32_t msPerHour, uint32_t airtime)
Calculate the minimum interval to adhere to a certain dutyCycle. This interval is based on the ToA of...
Definition: LoRaWAN.cpp:1922
+
LoRaWANNode::resetFcntDown
void resetFcntDown()
Reset the downlink frame counters (application and network) This is unsafe and can possibly allow rep...
Definition: LoRaWAN.cpp:1615
+
LoRaWANNode::sendMacCommandReq
bool sendMacCommandReq(uint8_t cid)
Add a MAC command to the uplink queue. Only LinkCheck and DeviceTime are available to the user....
Definition: LoRaWAN.cpp:2060
+
LoRaWANNode::saveSession
int16_t saveSession()
Save the current state of the session. All variables are compared to what is saved and only the diffe...
Definition: LoRaWAN.cpp:755
+
LoRaWANNode::setDatarate
int16_t setDatarate(uint8_t drUp, bool saveToEeprom=false)
Set uplink datarate. This should not be used when ADR is enabled.
Definition: LoRaWAN.cpp:1870
+
LoRaWANNode::getNFcntDown
uint32_t getNFcntDown()
Returns the last network downlink's frame counter.
Definition: LoRaWAN.cpp:1607
+
LoRaWANNode::getAFcntDown
uint32_t getAFcntDown()
Returns the last application downlink's frame counter.
Definition: LoRaWAN.cpp:1611
LoRaWANNode::wipe
void wipe()
Wipe internal persistent parameters. This will reset all counters and saved variables,...
Definition: LoRaWAN.cpp:49
-
LoRaWANNode::beginABP
int16_t beginABP(uint32_t addr, uint8_t *nwkSKey, uint8_t *appSKey, uint8_t *fNwkSIntKey=NULL, uint8_t *sNwkSIntKey=NULL, bool force=false)
Join network by performing activation by personalization. In this procedure, all necessary configurat...
Definition: LoRaWAN.cpp:652
-
LoRaWANNode::getMacDeviceTimeAns
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:2749
-
LoRaWANNode::downlink
int16_t downlink(uint8_t *data, size_t *len, LoRaWANEvent_t *event=NULL)
Wait for downlink from the server in either RX1 or RX2 window.
Definition: LoRaWAN.cpp:1259
+
LoRaWANNode::beginABP
int16_t beginABP(uint32_t addr, uint8_t *nwkSKey, uint8_t *appSKey, uint8_t *fNwkSIntKey=NULL, uint8_t *sNwkSIntKey=NULL, bool force=false)
Join network by performing activation by personalization. In this procedure, all necessary configurat...
Definition: LoRaWAN.cpp:663
+
LoRaWANNode::getMacDeviceTimeAns
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:2782
+
LoRaWANNode::downlink
int16_t downlink(uint8_t *data, size_t *len, LoRaWANEvent_t *event=NULL)
Wait for downlink from the server in either RX1 or RX2 window.
Definition: LoRaWAN.cpp:1270
LoRaWANNode::LoRaWANNode
LoRaWANNode(PhysicalLayer *phy, const LoRaWANBand_t *band, uint8_t subBand=0)
Default constructor.
Definition: LoRaWAN.cpp:31
-
LoRaWANNode::setDutyCycle
void setDutyCycle(bool enable=true, uint32_t msPerHour=0)
Toggle adherence to dutyCycle limits to on or off.
Definition: LoRaWAN.cpp:1886
-
LoRaWANNode::timeUntilUplink
uint32_t timeUntilUplink()
Returns time in milliseconds until next uplink is available under dutyCycle limits.
Definition: LoRaWAN.cpp:1907
-
LoRaWANNode::getMacLinkCheckAns
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:2738
+
LoRaWANNode::setDutyCycle
void setDutyCycle(bool enable=true, uint32_t msPerHour=0)
Toggle adherence to dutyCycle limits to on or off.
Definition: LoRaWAN.cpp:1911
+
LoRaWANNode::timeUntilUplink
uint32_t timeUntilUplink()
Returns time in milliseconds until next uplink is available under dutyCycle limits.
Definition: LoRaWAN.cpp:1932
+
LoRaWANNode::getMacLinkCheckAns
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:2771
LoRaWANNode::setCSMA
void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA=false)
Configures CSMA for LoRaWAN as per TR-13, LoRa Alliance.
Definition: LoRaWAN.cpp:42
-
LoRaWANNode::setADR
void setADR(bool enable=true)
Toggle ADR to on or off.
Definition: LoRaWAN.cpp:1882
+
LoRaWANNode::setADR
void setADR(bool enable=true)
Toggle ADR to on or off.
Definition: LoRaWAN.cpp:1907
LoRaWANNode::restore
int16_t restore()
Restore session by loading information from persistent storage.
Definition: LoRaWAN.cpp:54
-
LoRaWANNode::beginOTAA
int16_t beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t *nwkKey, uint8_t *appKey, uint8_t joinDr=RADIOLIB_LORAWAN_DATA_RATE_UNUSED, bool force=false)
Join network by performing over-the-air activation. By this procedure, the device will perform an exc...
Definition: LoRaWAN.cpp:370
-
LoRaWANNode::isJoined
bool isJoined()
Whether there is an ongoing session active.
Definition: LoRaWAN.cpp:739
+
LoRaWANNode::beginOTAA
int16_t beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t *nwkKey, uint8_t *appKey, uint8_t joinDr=RADIOLIB_LORAWAN_DATA_RATE_UNUSED, bool force=false)
Join network by performing over-the-air activation. By this procedure, the device will perform an exc...
Definition: LoRaWAN.cpp:378
+
LoRaWANNode::isJoined
bool isJoined()
Whether there is an ongoing session active.
Definition: LoRaWAN.cpp:750
PhysicalLayer
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:34
-
LoRaWANBand_t
Structure to save information about LoRaWAN band.
Definition: LoRaWAN.h:278
-
LoRaWANBand_t::dwellTimeUp
uint32_t dwellTimeUp
Maximum dwell time per message in milliseconds.
Definition: LoRaWAN.h:295
-
LoRaWANBand_t::powerMax
int8_t powerMax
Maximum allowed output power in this band in dBm.
Definition: LoRaWAN.h:286
-
LoRaWANBand_t::dataRates
uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
The corresponding datarates, bandwidths and coding rates for DR index.
Definition: LoRaWAN.h:320
-
LoRaWANBand_t::payloadLenMax
uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
Array of allowed maximum payload lengths for each data rate.
Definition: LoRaWAN.h:283
-
LoRaWANBand_t::txFreqs
LoRaWANChannel_t txFreqs[3]
A set of default uplink (TX) channels for frequency-type bands.
Definition: LoRaWAN.h:299
-
LoRaWANBand_t::txJoinReq
LoRaWANChannel_t txJoinReq[3]
A set of possible extra channels for the Join-Request message for frequency-type bands.
Definition: LoRaWAN.h:302
-
LoRaWANBand_t::powerNumSteps
int8_t powerNumSteps
Number of power steps in this band.
Definition: LoRaWAN.h:289
-
LoRaWANBand_t::txSpans
LoRaWANChannelSpan_t txSpans[2]
Default uplink (TX) channel spans for mask-type bands, including Join-Request parameters.
Definition: LoRaWAN.h:308
-
LoRaWANBand_t::rx1DataRateBase
uint8_t rx1DataRateBase
The base downlink data rate. Used to calculate data rate changes for adaptive data rate.
Definition: LoRaWAN.h:314
-
LoRaWANBand_t::bandType
uint8_t bandType
Whether the channels are fixed per specification, or dynamically allocated through the network (plus ...
Definition: LoRaWAN.h:280
-
LoRaWANBand_t::rx2
LoRaWANChannel_t rx2
Backup channel for downlink (RX2) window.
Definition: LoRaWAN.h:317
-
LoRaWANBand_t::numTxSpans
uint8_t numTxSpans
The number of TX channel spans for mask-type bands.
Definition: LoRaWAN.h:305
-
LoRaWANBand_t::rx1Span
LoRaWANChannelSpan_t rx1Span
Default downlink (RX1) channel span for mask-type bands.
Definition: LoRaWAN.h:311
-
LoRaWANBand_t::dutyCycle
uint32_t dutyCycle
Number of milliseconds per hour of allowed Time-on-Air.
Definition: LoRaWAN.h:292
-
LoRaWANChannel_t
Definition: LoRaWAN.h:226
-
LoRaWANChannel_t::freq
float freq
The channel frequency.
Definition: LoRaWAN.h:234
-
LoRaWANChannel_t::idx
uint8_t idx
The channel number, as specified by defaults or the network.
Definition: LoRaWAN.h:231
-
LoRaWANChannel_t::drMin
uint8_t drMin
Minimum allowed datarate for this channel.
Definition: LoRaWAN.h:237
-
LoRaWANChannel_t::enabled
bool enabled
Whether this channel is enabled (can be used) or is disabled.
Definition: LoRaWAN.h:228
-
LoRaWANChannel_t::drMax
uint8_t drMax
Maximum allowed datarate for this channel (inclusive)
Definition: LoRaWAN.h:240
-
LoRaWANChannelSpan_t
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition: LoRaWAN.h:251
-
LoRaWANChannelSpan_t::joinRequestDataRate
uint8_t joinRequestDataRate
Allowed data rates for a join request message.
Definition: LoRaWAN.h:268
-
LoRaWANChannelSpan_t::freqStart
float freqStart
Center frequency of the first channel in span.
Definition: LoRaWAN.h:256
-
LoRaWANChannelSpan_t::numChannels
uint8_t numChannels
Total number of channels in the span.
Definition: LoRaWAN.h:253
-
LoRaWANChannelSpan_t::drMax
uint8_t drMax
Maximum allowed datarate for all channels in this span (inclusive)
Definition: LoRaWAN.h:265
-
LoRaWANChannelSpan_t::freqStep
float freqStep
Frequency step between adjacent channels.
Definition: LoRaWAN.h:259
-
LoRaWANChannelSpan_t::drMin
uint8_t drMin
Minimum allowed datarate for all channels in this span.
Definition: LoRaWAN.h:262
-
LoRaWANEvent_t
Structure to save extra information about uplink/downlink event.
Definition: LoRaWAN.h:362
-
LoRaWANEvent_t::freq
float freq
Frequency in MHz.
Definition: LoRaWAN.h:377
-
LoRaWANEvent_t::confirmed
bool confirmed
Whether the event is confirmed or not (e.g., confirmed uplink sent by user application)
Definition: LoRaWAN.h:367
-
LoRaWANEvent_t::power
int16_t power
Transmit power in dBm for uplink, or RSSI for downlink.
Definition: LoRaWAN.h:380
-
LoRaWANEvent_t::confirming
bool confirming
Whether the event is confirming a previous request (e.g., server downlink reply to confirmed uplink s...
Definition: LoRaWAN.h:371
-
LoRaWANEvent_t::datarate
uint8_t datarate
Datarate.
Definition: LoRaWAN.h:374
-
LoRaWANEvent_t::dir
uint8_t dir
Event direction, one of RADIOLIB_LORAWAN_CHANNEL_DIR_*.
Definition: LoRaWAN.h:364
-
LoRaWANEvent_t::fcnt
uint32_t fcnt
The appropriate frame counter - for different events, different frame counters will be reported!
Definition: LoRaWAN.h:383
-
LoRaWANEvent_t::port
uint8_t port
Port number.
Definition: LoRaWAN.h:386
-
LoRaWANMacCommand_t
Structure to save information about MAC command.
Definition: LoRaWAN.h:338
-
LoRaWANMacCommand_t::len
uint8_t len
Length of the payload.
Definition: LoRaWAN.h:346
-
LoRaWANMacCommand_t::cid
uint8_t cid
The command ID.
Definition: LoRaWAN.h:340
-
LoRaWANMacCommand_t::repeat
uint8_t repeat
Repetition counter (the command will be uplinked repeat + 1 times)
Definition: LoRaWAN.h:349
-
LoRaWANMacCommand_t::payload
uint8_t payload[5]
Payload buffer (5 bytes is the longest possible)
Definition: LoRaWAN.h:343
-
LoRaWANMacCommandQueue_t
Definition: LoRaWAN.h:352
-
LoRaWANMacSpec_t
Definition: LoRaWAN.h:194
+
LoRaWANBand_t
Structure to save information about LoRaWAN band.
Definition: LoRaWAN.h:283
+
LoRaWANBand_t::dwellTimeUp
uint32_t dwellTimeUp
Maximum dwell time per message in milliseconds.
Definition: LoRaWAN.h:300
+
LoRaWANBand_t::powerMax
int8_t powerMax
Maximum allowed output power in this band in dBm.
Definition: LoRaWAN.h:291
+
LoRaWANBand_t::dataRates
uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
The corresponding datarates, bandwidths and coding rates for DR index.
Definition: LoRaWAN.h:325
+
LoRaWANBand_t::payloadLenMax
uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
Array of allowed maximum payload lengths for each data rate.
Definition: LoRaWAN.h:288
+
LoRaWANBand_t::txFreqs
LoRaWANChannel_t txFreqs[3]
A set of default uplink (TX) channels for frequency-type bands.
Definition: LoRaWAN.h:304
+
LoRaWANBand_t::txJoinReq
LoRaWANChannel_t txJoinReq[3]
A set of possible extra channels for the Join-Request message for frequency-type bands.
Definition: LoRaWAN.h:307
+
LoRaWANBand_t::powerNumSteps
int8_t powerNumSteps
Number of power steps in this band.
Definition: LoRaWAN.h:294
+
LoRaWANBand_t::txSpans
LoRaWANChannelSpan_t txSpans[2]
Default uplink (TX) channel spans for mask-type bands, including Join-Request parameters.
Definition: LoRaWAN.h:313
+
LoRaWANBand_t::rx1DataRateBase
uint8_t rx1DataRateBase
The base downlink data rate. Used to calculate data rate changes for adaptive data rate.
Definition: LoRaWAN.h:319
+
LoRaWANBand_t::bandType
uint8_t bandType
Whether the channels are fixed per specification, or dynamically allocated through the network (plus ...
Definition: LoRaWAN.h:285
+
LoRaWANBand_t::rx2
LoRaWANChannel_t rx2
Backup channel for downlink (RX2) window.
Definition: LoRaWAN.h:322
+
LoRaWANBand_t::numTxSpans
uint8_t numTxSpans
The number of TX channel spans for mask-type bands.
Definition: LoRaWAN.h:310
+
LoRaWANBand_t::rx1Span
LoRaWANChannelSpan_t rx1Span
Default downlink (RX1) channel span for mask-type bands.
Definition: LoRaWAN.h:316
+
LoRaWANBand_t::dutyCycle
uint32_t dutyCycle
Number of milliseconds per hour of allowed Time-on-Air.
Definition: LoRaWAN.h:297
+
LoRaWANChannel_t
Definition: LoRaWAN.h:231
+
LoRaWANChannel_t::freq
float freq
The channel frequency.
Definition: LoRaWAN.h:239
+
LoRaWANChannel_t::idx
uint8_t idx
The channel number, as specified by defaults or the network.
Definition: LoRaWAN.h:236
+
LoRaWANChannel_t::drMin
uint8_t drMin
Minimum allowed datarate for this channel.
Definition: LoRaWAN.h:242
+
LoRaWANChannel_t::enabled
bool enabled
Whether this channel is enabled (can be used) or is disabled.
Definition: LoRaWAN.h:233
+
LoRaWANChannel_t::drMax
uint8_t drMax
Maximum allowed datarate for this channel (inclusive)
Definition: LoRaWAN.h:245
+
LoRaWANChannelSpan_t
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition: LoRaWAN.h:256
+
LoRaWANChannelSpan_t::joinRequestDataRate
uint8_t joinRequestDataRate
Allowed data rates for a join request message.
Definition: LoRaWAN.h:273
+
LoRaWANChannelSpan_t::freqStart
float freqStart
Center frequency of the first channel in span.
Definition: LoRaWAN.h:261
+
LoRaWANChannelSpan_t::numChannels
uint8_t numChannels
Total number of channels in the span.
Definition: LoRaWAN.h:258
+
LoRaWANChannelSpan_t::drMax
uint8_t drMax
Maximum allowed datarate for all channels in this span (inclusive)
Definition: LoRaWAN.h:270
+
LoRaWANChannelSpan_t::freqStep
float freqStep
Frequency step between adjacent channels.
Definition: LoRaWAN.h:264
+
LoRaWANChannelSpan_t::drMin
uint8_t drMin
Minimum allowed datarate for all channels in this span.
Definition: LoRaWAN.h:267
+
LoRaWANEvent_t
Structure to save extra information about uplink/downlink event.
Definition: LoRaWAN.h:367
+
LoRaWANEvent_t::freq
float freq
Frequency in MHz.
Definition: LoRaWAN.h:382
+
LoRaWANEvent_t::confirmed
bool confirmed
Whether the event is confirmed or not (e.g., confirmed uplink sent by user application)
Definition: LoRaWAN.h:372
+
LoRaWANEvent_t::power
int16_t power
Transmit power in dBm for uplink, or RSSI for downlink.
Definition: LoRaWAN.h:385
+
LoRaWANEvent_t::confirming
bool confirming
Whether the event is confirming a previous request (e.g., server downlink reply to confirmed uplink s...
Definition: LoRaWAN.h:376
+
LoRaWANEvent_t::datarate
uint8_t datarate
Datarate.
Definition: LoRaWAN.h:379
+
LoRaWANEvent_t::dir
uint8_t dir
Event direction, one of RADIOLIB_LORAWAN_CHANNEL_DIR_*.
Definition: LoRaWAN.h:369
+
LoRaWANEvent_t::fcnt
uint32_t fcnt
The appropriate frame counter - for different events, different frame counters will be reported!
Definition: LoRaWAN.h:388
+
LoRaWANEvent_t::port
uint8_t port
Port number.
Definition: LoRaWAN.h:391
+
LoRaWANMacCommand_t
Structure to save information about MAC command.
Definition: LoRaWAN.h:343
+
LoRaWANMacCommand_t::len
uint8_t len
Length of the payload.
Definition: LoRaWAN.h:351
+
LoRaWANMacCommand_t::cid
uint8_t cid
The command ID.
Definition: LoRaWAN.h:345
+
LoRaWANMacCommand_t::repeat
uint8_t repeat
Repetition counter (the command will be uplinked repeat + 1 times)
Definition: LoRaWAN.h:354
+
LoRaWANMacCommand_t::payload
uint8_t payload[5]
Payload buffer (5 bytes is the longest possible)
Definition: LoRaWAN.h:348
+
LoRaWANMacCommandQueue_t
Definition: LoRaWAN.h:357
+
LoRaWANMacSpec_t
Definition: LoRaWAN.h:199
DataRate_t
Definition: PhysicalLayer.h:21
diff --git a/_physical_layer_8h_source.html b/_physical_layer_8h_source.html index 682c0c0c..eda54331 100644 --- a/_physical_layer_8h_source.html +++ b/_physical_layer_8h_source.html @@ -299,7 +299,7 @@ $(document).ready(function(){initNavTree('_physical_layer_8h_source.html',''); i
BellClient
Client for Bell modem communication. The public interface is the same as Arduino Serial.
Definition: BellModem.h:57
FSK4Client
Client for FSK-4 communication. The public interface is the same as Arduino Serial.
Definition: FSK4.h:15
HellClient
Client for Hellschreiber transmissions.
Definition: Hellschreiber.h:90
-
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:393
+
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:398
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:31
MorseClient
Client for Morse Code communication. The public interface is the same as Arduino Serial.
Definition: Morse.h:93
PagerClient
Client for Pager communication.
Definition: Pager.h:62