diff --git a/_lo_ra_w_a_n_8h_source.html b/_lo_ra_w_a_n_8h_source.html index f338b8e3..e4e9019e 100644 --- a/_lo_ra_w_a_n_8h_source.html +++ b/_lo_ra_w_a_n_8h_source.html @@ -465,358 +465,364 @@ $(document).ready(function(){initNavTree('_lo_ra_w_a_n_8h_source.html',''); init
441 extern const LoRaWANBand_t AU915;
442 extern const LoRaWANBand_t CN500;
443 extern const LoRaWANBand_t AS923;
-
444 extern const LoRaWANBand_t KR920;
-
445 extern const LoRaWANBand_t IN865;
-
446 
-
451 enum LoRaWANBandNum_t {
-
452  BandEU868,
-
453  BandUS915,
-
454  BandCN780,
-
455  BandEU433,
-
456  BandAU915,
-
457  BandCN500,
-
458  BandAS923,
-
459  BandKR920,
-
460  BandIN865,
-
461  BandLast
-
462 };
-
463 
-
464 // provide easy access to the number of currently supported bands
-
465 #define RADIOLIB_LORAWAN_NUM_SUPPORTED_BANDS (BandLast - BandEU868)
-
466 
-
467 // array of currently supported bands
-
468 extern const LoRaWANBand_t* LoRaWANBands[];
+
444 extern const LoRaWANBand_t AS923_2;
+
445 extern const LoRaWANBand_t AS923_3;
+
446 extern const LoRaWANBand_t AS923_4;
+
447 extern const LoRaWANBand_t KR920;
+
448 extern const LoRaWANBand_t IN865;
+
449 
+
454 enum LoRaWANBandNum_t {
+
455  BandEU868,
+
456  BandUS915,
+
457  BandCN780,
+
458  BandEU433,
+
459  BandAU915,
+
460  BandCN500,
+
461  BandAS923,
+
462  BandAS923_2,
+
463  BandAS923_3,
+
464  BandAS923_4,
+
465  BandKR920,
+
466  BandIN865,
+
467  BandLast
+
468 };
469 
-
474 struct LoRaWANJoinEvent_t {
-
476  bool newSession = false;
-
477 
-
479  uint16_t devNonce = 0;
-
480 
-
482  uint32_t joinNonce = 0;
-
483 };
-
484 
-
489 struct LoRaWANEvent_t {
-
491  uint8_t dir;
-
492 
-
494  bool confirmed;
-
495 
-
498  bool confirming;
-
499 
-
501  uint8_t datarate;
-
502 
-
504  float freq;
-
505 
-
507  int16_t power;
+
470 // provide easy access to the number of currently supported bands
+
471 #define RADIOLIB_LORAWAN_NUM_SUPPORTED_BANDS (BandLast - BandEU868)
+
472 
+
473 // array of currently supported bands
+
474 extern const LoRaWANBand_t* LoRaWANBands[];
+
475 
+
480 struct LoRaWANJoinEvent_t {
+
482  bool newSession = false;
+
483 
+
485  uint16_t devNonce = 0;
+
486 
+
488  uint32_t joinNonce = 0;
+
489 };
+
490 
+
495 struct LoRaWANEvent_t {
+
497  uint8_t dir;
+
498 
+
500  bool confirmed;
+
501 
+
504  bool confirming;
+
505 
+
507  uint8_t datarate;
508 
-
510  uint32_t fCnt;
+
510  float freq;
511 
-
513  uint8_t fPort;
-
514 };
-
515 
-
520 class LoRaWANNode {
-
521  public:
-
522 
-
529  LoRaWANNode(PhysicalLayer* phy, const LoRaWANBand_t* band, uint8_t subBand = 0);
-
530 
-
534  void clearSession();
-
535 
-
540  uint8_t* getBufferNonces();
+
513  int16_t power;
+
514 
+
516  uint32_t fCnt;
+
517 
+
519  uint8_t fPort;
+
520 };
+
521 
+
526 class LoRaWANNode {
+
527  public:
+
528 
+
535  LoRaWANNode(PhysicalLayer* phy, const LoRaWANBand_t* band, uint8_t subBand = 0);
+
536 
+
540  void clearSession();
541 
-
547  int16_t setBufferNonces(uint8_t* persistentBuffer);
-
548 
-
553  uint8_t* getBufferSession();
+
546  uint8_t* getBufferNonces();
+
547 
+
553  int16_t setBufferNonces(uint8_t* persistentBuffer);
554 
-
560  int16_t setBufferSession(uint8_t* persistentBuffer);
-
561 
-
569  void beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t* nwkKey, uint8_t* appKey);
-
570 
-
577  int16_t activateOTAA(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED, LoRaWANJoinEvent_t *joinEvent = NULL);
-
578 
-
588  void beginABP(uint32_t addr, uint8_t* fNwkSIntKey, uint8_t* sNwkSIntKey, uint8_t* nwkSEncKey, uint8_t* appSKey);
-
589 
-
596  int16_t activateABP(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED);
-
597 
-
599  bool isActivated();
-
600 
-
607  int16_t setRx2Dr(uint8_t dr);
-
608 
-
616  int16_t sendMacCommandReq(uint8_t cid);
-
617 
-
618  #if defined(RADIOLIB_BUILD_ARDUINO)
-
628  int16_t uplink(String& str, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
-
629  #endif
-
630 
-
640  int16_t uplink(const char* str, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
-
641 
-
652  int16_t uplink(uint8_t* data, size_t len, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
-
653 
-
654  #if defined(RADIOLIB_BUILD_ARDUINO)
-
662  int16_t downlink(String& str, LoRaWANEvent_t* event = NULL);
-
663  #endif
-
664 
-
673  int16_t downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event = NULL);
-
674 
-
681  int16_t downlink(LoRaWANEvent_t* event = NULL);
-
682 
-
683  #if defined(RADIOLIB_BUILD_ARDUINO)
-
696  int16_t sendReceive(String& strUp, uint8_t fPort, String& strDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
-
697  #endif
-
698 
-
712  int16_t sendReceive(const char* strUp, uint8_t fPort, uint8_t* dataDown, size_t* lenDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
-
713 
-
728  int16_t sendReceive(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);
-
729 
-
742  int16_t sendReceive(uint8_t* dataUp, size_t lenUp, uint8_t fPort = 1, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
-
743 
-
749  void setDeviceStatus(uint8_t battLevel);
-
750 
-
755  uint32_t getFCntUp();
+
559  uint8_t* getBufferSession();
+
560 
+
566  int16_t setBufferSession(uint8_t* persistentBuffer);
+
567 
+
575  void beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t* nwkKey, uint8_t* appKey);
+
576 
+
583  int16_t activateOTAA(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED, LoRaWANJoinEvent_t *joinEvent = NULL);
+
584 
+
594  void beginABP(uint32_t addr, uint8_t* fNwkSIntKey, uint8_t* sNwkSIntKey, uint8_t* nwkSEncKey, uint8_t* appSKey);
+
595 
+
602  int16_t activateABP(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED);
+
603 
+
605  bool isActivated();
+
606 
+
613  int16_t setRx2Dr(uint8_t dr);
+
614 
+
622  int16_t sendMacCommandReq(uint8_t cid);
+
623 
+
624  #if defined(RADIOLIB_BUILD_ARDUINO)
+
634  int16_t uplink(String& str, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
+
635  #endif
+
636 
+
646  int16_t uplink(const char* str, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
+
647 
+
658  int16_t uplink(uint8_t* data, size_t len, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
+
659 
+
660  #if defined(RADIOLIB_BUILD_ARDUINO)
+
668  int16_t downlink(String& str, LoRaWANEvent_t* event = NULL);
+
669  #endif
+
670 
+
679  int16_t downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event = NULL);
+
680 
+
687  int16_t downlink(LoRaWANEvent_t* event = NULL);
+
688 
+
689  #if defined(RADIOLIB_BUILD_ARDUINO)
+
702  int16_t sendReceive(String& strUp, uint8_t fPort, String& strDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
+
703  #endif
+
704 
+
718  int16_t sendReceive(const char* strUp, uint8_t fPort, uint8_t* dataDown, size_t* lenDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
+
719 
+
734  int16_t sendReceive(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);
+
735 
+
748  int16_t sendReceive(uint8_t* dataUp, size_t lenUp, uint8_t fPort = 1, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
+
749 
+
755  void setDeviceStatus(uint8_t battLevel);
756 
-
761  uint32_t getNFCntDown();
+
761  uint32_t getFCntUp();
762 
-
767  uint32_t getAFCntDown();
+
767  uint32_t getNFCntDown();
768 
-
774  void resetFCntDown();
-
775 
-
781  int16_t setDatarate(uint8_t drUp);
-
782 
-
787  void setADR(bool enable = true);
+
773  uint32_t getAFCntDown();
+
774 
+
780  void resetFCntDown();
+
781 
+
787  int16_t setDatarate(uint8_t drUp);
788 
-
795  void setDutyCycle(bool enable = true, RadioLibTime_t msPerHour = 0);
-
796 
-
804  RadioLibTime_t dutyCycleInterval(RadioLibTime_t msPerHour, RadioLibTime_t airtime);
-
805 
-
807  RadioLibTime_t timeUntilUplink();
-
808 
-
815  void setDwellTime(bool enable, RadioLibTime_t msPerUplink = 0);
-
816 
-
822  uint8_t maxPayloadDwellTime();
-
823 
-
829  int16_t setTxPower(int8_t txPower);
-
830 
-
839  int16_t getMacLinkCheckAns(uint8_t* margin, uint8_t* gwCnt);
-
840 
-
850  int16_t getMacDeviceTimeAns(uint32_t* gpsEpoch, uint8_t* fraction, bool returnUnix = true);
-
851 
-
856  uint64_t getDevAddr();
+
793  void setADR(bool enable = true);
+
794 
+
801  void setDutyCycle(bool enable = true, RadioLibTime_t msPerHour = 0);
+
802 
+
810  RadioLibTime_t dutyCycleInterval(RadioLibTime_t msPerHour, RadioLibTime_t airtime);
+
811 
+
813  RadioLibTime_t timeUntilUplink();
+
814 
+
821  void setDwellTime(bool enable, RadioLibTime_t msPerUplink = 0);
+
822 
+
828  uint8_t maxPayloadDwellTime();
+
829 
+
835  int16_t setTxPower(int8_t txPower);
+
836 
+
845  int16_t getMacLinkCheckAns(uint8_t* margin, uint8_t* gwCnt);
+
846 
+
856  int16_t getMacDeviceTimeAns(uint32_t* gpsEpoch, uint8_t* fraction, bool returnUnix = true);
857 
-
862  RadioLibTime_t getLastToA();
+
862  uint64_t getDevAddr();
863 
-
868  bool TS009 = false;
+
868  RadioLibTime_t getLastToA();
869 
-
870 #if !RADIOLIB_GODMODE
-
871  private:
-
872 #endif
-
873  PhysicalLayer* phyLayer = NULL;
-
874  const LoRaWANBand_t* band = NULL;
+
874  bool TS009 = false;
875 
-
876  static int16_t checkBufferCommon(uint8_t *buffer, uint16_t size);
-
877 
-
878  void activateCommon(uint8_t initialDr);
-
879 
-
880  // a buffer that holds all LW base parameters that should persist at all times!
-
881  uint8_t bufferNonces[RADIOLIB_LORAWAN_NONCES_BUF_SIZE] = { 0 };
-
882 
-
883  // a buffer that holds all LW session parameters that preferably persist, but can be afforded to get lost
-
884  uint8_t bufferSession[RADIOLIB_LORAWAN_SESSION_BUF_SIZE] = { 0 };
+
876 #if !RADIOLIB_GODMODE
+
877  private:
+
878 #endif
+
879  PhysicalLayer* phyLayer = NULL;
+
880  const LoRaWANBand_t* band = NULL;
+
881 
+
882  static int16_t checkBufferCommon(uint8_t *buffer, uint16_t size);
+
883 
+
884  void activateCommon(uint8_t initialDr);
885 
-
886  LoRaWANMacCommandQueue_t commandsUp = {
-
887  .numCommands = 0,
-
888  .len = 0,
-
889  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
-
890  };
-
891  LoRaWANMacCommandQueue_t commandsDown = {
-
892  .numCommands = 0,
-
893  .len = 0,
-
894  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
-
895  };
-
896 
-
897  uint16_t lwMode = RADIOLIB_LORAWAN_MODE_NONE;
-
898  uint8_t lwClass = RADIOLIB_LORAWAN_CLASS_A;
-
899  bool isActive = false;
-
900 
-
901  uint64_t joinEUI = 0;
-
902  uint64_t devEUI = 0;
-
903  uint8_t nwkKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
904  uint8_t appKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
905 
-
906  // the following is either provided by the network server (OTAA)
-
907  // or directly entered by the user (ABP)
-
908  uint32_t devAddr = 0;
-
909  uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
910  uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
911  uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
912  uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
913  uint8_t jSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
914 
-
915  uint16_t keyCheckSum = 0;
-
916 
-
917  // device-specific parameters, persistent through sessions
-
918  uint16_t devNonce = 0;
-
919  uint32_t joinNonce = 0;
+
886  // a buffer that holds all LW base parameters that should persist at all times!
+
887  uint8_t bufferNonces[RADIOLIB_LORAWAN_NONCES_BUF_SIZE] = { 0 };
+
888 
+
889  // a buffer that holds all LW session parameters that preferably persist, but can be afforded to get lost
+
890  uint8_t bufferSession[RADIOLIB_LORAWAN_SESSION_BUF_SIZE] = { 0 };
+
891 
+
892  LoRaWANMacCommandQueue_t commandsUp = {
+
893  .numCommands = 0,
+
894  .len = 0,
+
895  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
+
896  };
+
897  LoRaWANMacCommandQueue_t commandsDown = {
+
898  .numCommands = 0,
+
899  .len = 0,
+
900  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
+
901  };
+
902 
+
903  uint16_t lwMode = RADIOLIB_LORAWAN_MODE_NONE;
+
904  uint8_t lwClass = RADIOLIB_LORAWAN_CLASS_A;
+
905  bool isActive = false;
+
906 
+
907  uint64_t joinEUI = 0;
+
908  uint64_t devEUI = 0;
+
909  uint8_t nwkKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
910  uint8_t appKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
911 
+
912  // the following is either provided by the network server (OTAA)
+
913  // or directly entered by the user (ABP)
+
914  uint32_t devAddr = 0;
+
915  uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
916  uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
917  uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
918  uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
919  uint8_t jSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
920 
-
921  // session-specific parameters
-
922  uint32_t homeNetId = 0;
-
923  uint8_t adrLimitExp = RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP;
-
924  uint8_t adrDelayExp = RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP;
-
925  uint8_t nbTrans = 1; // Number of allowed frame retransmissions
-
926  uint8_t txPowerSteps = 0;
-
927  uint8_t txPowerMax = 0;
-
928  uint32_t fCntUp = 0;
-
929  uint32_t aFCntDown = 0;
-
930  uint32_t nFCntDown = 0;
-
931  uint32_t confFCntUp = RADIOLIB_LORAWAN_FCNT_NONE;
-
932  uint32_t confFCntDown = RADIOLIB_LORAWAN_FCNT_NONE;
-
933  uint32_t adrFCnt = 0;
-
934 
-
935  // modulation of the currently configured channel
-
936  uint8_t modulation = RADIOLIB_LORAWAN_MODULATION_LORA;
-
937 
-
938  // ADR is enabled by default
-
939  bool adrEnabled = true;
+
921  uint16_t keyCheckSum = 0;
+
922 
+
923  // device-specific parameters, persistent through sessions
+
924  uint16_t devNonce = 0;
+
925  uint32_t joinNonce = 0;
+
926 
+
927  // session-specific parameters
+
928  uint32_t homeNetId = 0;
+
929  uint8_t adrLimitExp = RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP;
+
930  uint8_t adrDelayExp = RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP;
+
931  uint8_t nbTrans = 1; // Number of allowed frame retransmissions
+
932  uint8_t txPowerSteps = 0;
+
933  uint8_t txPowerMax = 0;
+
934  uint32_t fCntUp = 0;
+
935  uint32_t aFCntDown = 0;
+
936  uint32_t nFCntDown = 0;
+
937  uint32_t confFCntUp = RADIOLIB_LORAWAN_FCNT_NONE;
+
938  uint32_t confFCntDown = RADIOLIB_LORAWAN_FCNT_NONE;
+
939  uint32_t adrFCnt = 0;
940 
-
941  // duty cycle is set upon initialization and activated in regions that impose this
-
942  bool dutyCycleEnabled = false;
-
943  uint32_t dutyCycle = 0;
-
944 
-
945  // dwell time is set upon initialization and activated in regions that impose this
-
946  bool dwellTimeEnabledUp = false;
-
947  uint16_t dwellTimeUp = 0;
-
948  bool dwellTimeEnabledDn = false;
-
949  uint16_t dwellTimeDn = 0;
-
950 
-
951  // enable/disable CSMA for LoRaWAN
-
952  bool enableCSMA;
-
953 
-
954  // number of backoff slots to be decremented after DIFS phase. 0 to disable BO.
-
955  // A random BO avoids collisions in the case where two or more nodes start the CSMA
-
956  // process at the same time.
-
957  uint8_t backoffMax;
-
958 
-
959  // number of CADs to estimate a clear CH
-
960  uint8_t difsSlots;
-
961 
-
962  // available channel frequencies from list passed during OTA activation
-
963  LoRaWANChannel_t availableChannels[2][RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS];
-
964 
-
965  // currently configured channels for TX and RX1
-
966  LoRaWANChannel_t currentChannels[2] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE };
+
941  // modulation of the currently configured channel
+
942  uint8_t modulation = RADIOLIB_LORAWAN_MODULATION_LORA;
+
943 
+
944  // ADR is enabled by default
+
945  bool adrEnabled = true;
+
946 
+
947  // duty cycle is set upon initialization and activated in regions that impose this
+
948  bool dutyCycleEnabled = false;
+
949  uint32_t dutyCycle = 0;
+
950 
+
951  // dwell time is set upon initialization and activated in regions that impose this
+
952  bool dwellTimeEnabledUp = false;
+
953  uint16_t dwellTimeUp = 0;
+
954  bool dwellTimeEnabledDn = false;
+
955  uint16_t dwellTimeDn = 0;
+
956 
+
957  // enable/disable CSMA for LoRaWAN
+
958  bool enableCSMA;
+
959 
+
960  // number of backoff slots to be decremented after DIFS phase. 0 to disable BO.
+
961  // A random BO avoids collisions in the case where two or more nodes start the CSMA
+
962  // process at the same time.
+
963  uint8_t backoffMax;
+
964 
+
965  // number of CADs to estimate a clear CH
+
966  uint8_t difsSlots;
967 
-
968  // currently configured datarates for TX and RX1
-
969  uint8_t dataRates[2] = { RADIOLIB_LORAWAN_DATA_RATE_UNUSED, RADIOLIB_LORAWAN_DATA_RATE_UNUSED };
+
968  // available channel frequencies from list passed during OTA activation
+
969  LoRaWANChannel_t availableChannels[2][RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS];
970 
-
971  // Rx2 channel properties - may be changed by MAC command
-
972  LoRaWANChannel_t rx2 = RADIOLIB_LORAWAN_CHANNEL_NONE;
+
971  // currently configured channels for TX and RX1
+
972  LoRaWANChannel_t currentChannels[2] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE };
973 
-
974  // offset between TX and RX1 (such that RX1 has equal or lower DR)
-
975  uint8_t rx1DrOffset = 0;
+
974  // currently configured datarates for TX and RX1
+
975  uint8_t dataRates[2] = { RADIOLIB_LORAWAN_DATA_RATE_UNUSED, RADIOLIB_LORAWAN_DATA_RATE_UNUSED };
976 
-
977  // LoRaWAN revision (1.0 vs 1.1)
-
978  uint8_t rev = 0;
+
977  // Rx2 channel properties - may be changed by MAC command
+
978  LoRaWANChannel_t rx2 = RADIOLIB_LORAWAN_CHANNEL_NONE;
979 
-
980  // Time on Air of last uplink
-
981  RadioLibTime_t lastToA = 0;
+
980  // offset between TX and RX1 (such that RX1 has equal or lower DR)
+
981  uint8_t rx1DrOffset = 0;
982 
-
983  // timestamp to measure the RX1/2 delay (from uplink end)
-
984  RadioLibTime_t rxDelayStart = 0;
+
983  // LoRaWAN revision (1.0 vs 1.1)
+
984  uint8_t rev = 0;
985 
-
986  // timestamp when the Rx1/2 windows were closed (timeout or uplink received)
-
987  RadioLibTime_t rxDelayEnd = 0;
+
986  // Time on Air of last uplink
+
987  RadioLibTime_t lastToA = 0;
988 
-
989  // delays between the uplink and RX1/2 windows
-
990  RadioLibTime_t rxDelays[2] = { RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS, RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS };
+
989  // timestamp to measure the RX1/2 delay (from uplink end)
+
990  RadioLibTime_t rxDelayStart = 0;
991 
-
992  // device status - battery level
-
993  uint8_t battLevel = 0xFF;
+
992  // timestamp when the Rx1/2 windows were closed (timeout or uplink received)
+
993  RadioLibTime_t rxDelayEnd = 0;
994 
-
995  // indicates whether an uplink has MAC commands as payload
-
996  bool isMACPayload = false;
+
995  // delays between the uplink and RX1/2 windows
+
996  RadioLibTime_t rxDelays[2] = { RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS, RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS };
997 
-
998  // save the selected sub-band in case this must be restored in ADR control
-
999  uint8_t subBand = 0;
+
998  // device status - battery level
+
999  uint8_t battLevel = 0xFF;
1000 
-
1001  // this will reset the device credentials, so the device starts completely new
-
1002  void clearNonces();
+
1001  // indicates whether an uplink has MAC commands as payload
+
1002  bool isMACPayload = false;
1003 
-
1004  // wait for, open and listen during Rx1 and Rx2 windows; only performs listening
-
1005  int16_t downlinkCommon();
+
1004  // save the selected sub-band in case this must be restored in ADR control
+
1005  uint8_t subBand = 0;
1006 
-
1007  // method to generate message integrity code
-
1008  uint32_t generateMIC(uint8_t* msg, size_t len, uint8_t* key);
+
1007  // this will reset the device credentials, so the device starts completely new
+
1008  void clearNonces();
1009 
-
1010  // method to verify message integrity code
-
1011  // it assumes that the MIC is the last 4 bytes of the message
-
1012  bool verifyMIC(uint8_t* msg, size_t len, uint8_t* key);
-
1013 
-
1014  // configure the common physical layer properties (preamble, sync word etc.)
-
1015  // channels must be configured separately by setupChannelsDyn()!
-
1016  int16_t setPhyProperties(uint8_t dir);
-
1017 
-
1018  // setup uplink/downlink channel data rates and frequencies
-
1019  // for dynamic channels, there is a small set of predefined channels
-
1020  // in case of JoinRequest, add some optional extra frequencies
-
1021  int16_t setupChannelsDyn(bool joinRequest = false);
-
1022 
-
1023  // setup uplink/downlink channel data rates and frequencies
-
1024  // for fixed bands, we only allow one sub-band at a time to be selected
-
1025  int16_t setupChannelsFix(uint8_t subBand);
-
1026 
-
1027  // a join-accept can piggy-back a set of channels or channel masks
-
1028  int16_t processCFList(uint8_t* cfList);
-
1029 
-
1030  // select a set of random TX/RX channels for up- and downlink
-
1031  int16_t selectChannels();
+
1010  // wait for, open and listen during Rx1 and Rx2 windows; only performs listening
+
1011  int16_t downlinkCommon();
+
1012 
+
1013  // method to generate message integrity code
+
1014  uint32_t generateMIC(uint8_t* msg, size_t len, uint8_t* key);
+
1015 
+
1016  // method to verify message integrity code
+
1017  // it assumes that the MIC is the last 4 bytes of the message
+
1018  bool verifyMIC(uint8_t* msg, size_t len, uint8_t* key);
+
1019 
+
1020  // configure the common physical layer properties (preamble, sync word etc.)
+
1021  // channels must be configured separately by setupChannelsDyn()!
+
1022  int16_t setPhyProperties(uint8_t dir);
+
1023 
+
1024  // setup uplink/downlink channel data rates and frequencies
+
1025  // for dynamic channels, there is a small set of predefined channels
+
1026  // in case of JoinRequest, add some optional extra frequencies
+
1027  int16_t setupChannelsDyn(bool joinRequest = false);
+
1028 
+
1029  // setup uplink/downlink channel data rates and frequencies
+
1030  // for fixed bands, we only allow one sub-band at a time to be selected
+
1031  int16_t setupChannelsFix(uint8_t subBand);
1032 
-
1033  // find the first usable data rate for the given band
-
1034  int16_t findDataRate(uint8_t dr, DataRate_t* dataRate);
+
1033  // a join-accept can piggy-back a set of channels or channel masks
+
1034  int16_t processCFList(uint8_t* cfList);
1035 
-
1036  // restore all available channels from persistent storage
-
1037  int16_t restoreChannels();
+
1036  // select a set of random TX/RX channels for up- and downlink
+
1037  int16_t selectChannels();
1038 
-
1039  // push MAC command to queue, done by copy
-
1040  int16_t pushMacCommand(LoRaWANMacCommand_t* cmd, LoRaWANMacCommandQueue_t* queue);
+
1039  // find the first usable data rate for the given band
+
1040  int16_t findDataRate(uint8_t dr, DataRate_t* dataRate);
1041 
-
1042  // delete a specific MAC command from queue, indicated by the command ID
-
1043  // if a payload pointer is supplied, this returns the payload of the MAC command
-
1044  int16_t deleteMacCommand(uint8_t cid, LoRaWANMacCommandQueue_t* queue, uint8_t* payload = NULL);
-
1045 
-
1046  // execute mac command, return the number of processed bytes for sequential processing
-
1047  bool execMacCommand(LoRaWANMacCommand_t* cmd);
-
1048 
-
1049  // apply a channel mask to a set of readily defined channels (dynamic bands only)
-
1050  bool applyChannelMaskDyn(uint8_t chMaskCntl, uint16_t chMask);
+
1042  // restore all available channels from persistent storage
+
1043  int16_t restoreChannels();
+
1044 
+
1045  // push MAC command to queue, done by copy
+
1046  int16_t pushMacCommand(LoRaWANMacCommand_t* cmd, LoRaWANMacCommandQueue_t* queue);
+
1047 
+
1048  // delete a specific MAC command from queue, indicated by the command ID
+
1049  // if a payload pointer is supplied, this returns the payload of the MAC command
+
1050  int16_t deleteMacCommand(uint8_t cid, LoRaWANMacCommandQueue_t* queue, uint8_t* payload = NULL);
1051 
-
1052  // define or delete channels from a fixed set of channels (fixed bands only)
-
1053  bool applyChannelMaskFix(uint8_t chMaskCntl, uint16_t chMask);
+
1052  // execute mac command, return the number of processed bytes for sequential processing
+
1053  bool execMacCommand(LoRaWANMacCommand_t* cmd);
1054 
-
1055  // get the payload length for a specific MAC command
-
1056  uint8_t getMacPayloadLength(uint8_t cid);
-
1057 
-
1064  void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA = false);
-
1065 
-
1066  // Performs CSMA as per LoRa Alliance Technical Recommendation 13 (TR-013).
-
1067  void performCSMA();
-
1068 
-
1069  // perform a single CAD operation for the under SF/CH combination. Returns either busy or otherwise.
-
1070  bool performCAD();
+
1055  // apply a channel mask to a set of readily defined channels (dynamic bands only)
+
1056  bool applyChannelMaskDyn(uint8_t chMaskCntl, uint16_t chMask);
+
1057 
+
1058  // define or delete channels from a fixed set of channels (fixed bands only)
+
1059  bool applyChannelMaskFix(uint8_t chMaskCntl, uint16_t chMask);
+
1060 
+
1061  // get the payload length for a specific MAC command
+
1062  uint8_t getMacPayloadLength(uint8_t cid);
+
1063 
+
1070  void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA = false);
1071 
-
1072  // function to encrypt and decrypt payloads
-
1073  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);
+
1072  // Performs CSMA as per LoRa Alliance Technical Recommendation 13 (TR-013).
+
1073  void performCSMA();
1074 
-
1075  // 16-bit checksum method that takes a uint8_t array of even length and calculates the checksum
-
1076  static uint16_t checkSum16(uint8_t *key, uint16_t keyLen);
+
1075  // perform a single CAD operation for the under SF/CH combination. Returns either busy or otherwise.
+
1076  bool performCAD();
1077 
-
1078  // network-to-host conversion method - takes data from network packet and converts it to the host endians
-
1079  template<typename T>
-
1080  static T ntoh(uint8_t* buff, size_t size = 0);
-
1081 
-
1082  // host-to-network conversion method - takes data from host variable and and converts it to network packet endians
-
1083  template<typename T>
-
1084  static void hton(uint8_t* buff, T val, size_t size = 0);
-
1085 };
-
1086 
-
1087 #endif
-
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:520
+
1078  // function to encrypt and decrypt payloads
+
1079  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);
+
1080 
+
1081  // 16-bit checksum method that takes a uint8_t array of even length and calculates the checksum
+
1082  static uint16_t checkSum16(uint8_t *key, uint16_t keyLen);
+
1083 
+
1084  // network-to-host conversion method - takes data from network packet and converts it to the host endians
+
1085  template<typename T>
+
1086  static T ntoh(uint8_t* buff, size_t size = 0);
+
1087 
+
1088  // host-to-network conversion method - takes data from host variable and and converts it to network packet endians
+
1089  template<typename T>
+
1090  static void hton(uint8_t* buff, T val, size_t size = 0);
+
1091 };
+
1092 
+
1093 #endif
+
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:526
LoRaWANNode::clearSession
void clearSession()
Clear an active session, so that the device will have to rejoin the network.
Definition: LoRaWAN.cpp:59
LoRaWANNode::setBufferNonces
int16_t setBufferNonces(uint8_t *persistentBuffer)
Fill the internal buffer that holds the LW base parameters with a supplied buffer.
Definition: LoRaWAN.cpp:75
LoRaWANNode::setDatarate
int16_t setDatarate(uint8_t drUp)
Set uplink datarate. This should not be used when ADR is enabled.
Definition: LoRaWAN.cpp:1999
@@ -831,7 +837,7 @@ $(document).ready(function(){initNavTree('_lo_ra_w_a_n_8h_source.html',''); init
LoRaWANNode::getAFCntDown
uint32_t getAFCntDown()
Returns the last application downlink's frame counter; also 0 if no application downlink occured yet.
Definition: LoRaWAN.cpp:1696
LoRaWANNode::getLastToA
RadioLibTime_t getLastToA()
Get the Time-on-air of the last uplink message.
Definition: LoRaWAN.cpp:2918
LoRaWANNode::activateABP
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:791
-
LoRaWANNode::TS009
bool TS009
TS009 Protocol Specification Verification switch (allows FPort 224 and cuts off uplink payload instea...
Definition: LoRaWAN.h:868
+
LoRaWANNode::TS009
bool TS009
TS009 Protocol Specification Verification switch (allows FPort 224 and cuts off uplink payload instea...
Definition: LoRaWAN.h:874
LoRaWANNode::getBufferNonces
uint8_t * getBufferNonces()
Returns the pointer to the internal buffer that holds the LW base parameters.
Definition: LoRaWAN.cpp:67
LoRaWANNode::sendReceive
int16_t sendReceive(const char *strUp, uint8_t fPort, 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:1660
LoRaWANNode::getBufferSession
uint8_t * getBufferSession()
Returns the pointer to the internal buffer that holds the LW session parameters.
Definition: LoRaWAN.cpp:111
@@ -884,19 +890,19 @@ $(document).ready(function(){initNavTree('_lo_ra_w_a_n_8h_source.html',''); init
LoRaWANChannelSpan_t::drMax
uint8_t drMax
Maximum allowed datarate for all channels in this span (inclusive)
Definition: LoRaWAN.h:373
LoRaWANChannelSpan_t::freqStep
float freqStep
Frequency step between adjacent channels.
Definition: LoRaWAN.h:367
LoRaWANChannelSpan_t::drMin
uint8_t drMin
Minimum allowed datarate for all channels in this span.
Definition: LoRaWAN.h:370
-
LoRaWANEvent_t
Structure to save extra information about uplink/downlink event.
Definition: LoRaWAN.h:489
-
LoRaWANEvent_t::freq
float freq
Frequency in MHz.
Definition: LoRaWAN.h:504
-
LoRaWANEvent_t::confirmed
bool confirmed
Whether the event is confirmed or not (e.g., confirmed uplink sent by user application)
Definition: LoRaWAN.h:494
-
LoRaWANEvent_t::fPort
uint8_t fPort
Port number.
Definition: LoRaWAN.h:513
-
LoRaWANEvent_t::power
int16_t power
Transmit power in dBm for uplink, or RSSI for downlink.
Definition: LoRaWAN.h:507
-
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:498
-
LoRaWANEvent_t::datarate
uint8_t datarate
Datarate.
Definition: LoRaWAN.h:501
-
LoRaWANEvent_t::dir
uint8_t dir
Event direction, one of RADIOLIB_LORAWAN_CHANNEL_DIR_*.
Definition: LoRaWAN.h:491
-
LoRaWANEvent_t::fCnt
uint32_t fCnt
The appropriate frame counter - for different events, different frame counters will be reported!
Definition: LoRaWAN.h:510
-
LoRaWANJoinEvent_t
Structure to save extra information about activation event.
Definition: LoRaWAN.h:474
-
LoRaWANJoinEvent_t::newSession
bool newSession
Whether a new session was started.
Definition: LoRaWAN.h:476
-
LoRaWANJoinEvent_t::joinNonce
uint32_t joinNonce
The received Join-Request JoinNonce value.
Definition: LoRaWAN.h:482
-
LoRaWANJoinEvent_t::devNonce
uint16_t devNonce
The transmitted Join-Request DevNonce value.
Definition: LoRaWAN.h:479
+
LoRaWANEvent_t
Structure to save extra information about uplink/downlink event.
Definition: LoRaWAN.h:495
+
LoRaWANEvent_t::freq
float freq
Frequency in MHz.
Definition: LoRaWAN.h:510
+
LoRaWANEvent_t::confirmed
bool confirmed
Whether the event is confirmed or not (e.g., confirmed uplink sent by user application)
Definition: LoRaWAN.h:500
+
LoRaWANEvent_t::fPort
uint8_t fPort
Port number.
Definition: LoRaWAN.h:519
+
LoRaWANEvent_t::power
int16_t power
Transmit power in dBm for uplink, or RSSI for downlink.
Definition: LoRaWAN.h:513
+
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:504
+
LoRaWANEvent_t::datarate
uint8_t datarate
Datarate.
Definition: LoRaWAN.h:507
+
LoRaWANEvent_t::dir
uint8_t dir
Event direction, one of RADIOLIB_LORAWAN_CHANNEL_DIR_*.
Definition: LoRaWAN.h:497
+
LoRaWANEvent_t::fCnt
uint32_t fCnt
The appropriate frame counter - for different events, different frame counters will be reported!
Definition: LoRaWAN.h:516
+
LoRaWANJoinEvent_t
Structure to save extra information about activation event.
Definition: LoRaWAN.h:480
+
LoRaWANJoinEvent_t::newSession
bool newSession
Whether a new session was started.
Definition: LoRaWAN.h:482
+
LoRaWANJoinEvent_t::joinNonce
uint32_t joinNonce
The received Join-Request JoinNonce value.
Definition: LoRaWAN.h:488
+
LoRaWANJoinEvent_t::devNonce
uint16_t devNonce
The transmitted Join-Request DevNonce value.
Definition: LoRaWAN.h:485
LoRaWANMacCommand_t
Structure to save information about MAC command.
Definition: LoRaWAN.h:248
LoRaWANMacCommand_t::payload
uint8_t payload[RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_DOWN]
Payload buffer (5 bytes is the longest possible)
Definition: LoRaWAN.h:253
LoRaWANMacCommand_t::len
uint8_t len
Length of the payload.
Definition: LoRaWAN.h:256
diff --git a/_physical_layer_8h_source.html b/_physical_layer_8h_source.html index 8d7ec85b..05463a6d 100644 --- a/_physical_layer_8h_source.html +++ b/_physical_layer_8h_source.html @@ -306,7 +306,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:520
+
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:526
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:65
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