this is the working code for the xdot to read in serial from the pi and send it over LoRa

Committer:
Jenkins@KEILDM1.dc.multitech.prv
Date:
Thu Aug 23 14:21:20 2018 -0500
Revision:
14:f0c24ce93427
Parent:
10:1e831990a669
Child:
16:4a382fe8f51b
mdot-library revision 3.1.0 and mbed-os revision mbed-os-5.7.7

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1 // TODO: add license header
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 2
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 3 #ifndef MDOT_H
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 4 #define MDOT_H
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 5
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 6 #include "mbed.h"
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 7 #include "rtos.h"
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 8 #include "Mote.h"
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 9 #include <vector>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 10 #include <map>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 11 #include <string>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 12
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 13 class mDotEvent;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 14 class LoRaConfig;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 15
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 16
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 17 class mDot {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 18 friend class mDotEvent;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 19
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 20 private:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 21
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 22 mDot(lora::ChannelPlan* plan);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 23 ~mDot();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 24
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 25 void initLora();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 26
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 27 void setLastError(const std::string& str);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 28
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 29 static bool validateBaudRate(const uint32_t& baud);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 30 static bool validateFrequencySubBand(const uint8_t& band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 31 bool validateDataRate(const uint8_t& dr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 32
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 33 int32_t joinBase(const uint32_t& retries);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 34 int32_t sendBase(const std::vector<uint8_t>& data, const bool& confirmed = false, const bool& blocking = true, const bool& highBw = false);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 35 void waitForPacket();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 36 void waitForLinkCheck();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 37
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 38 void setActivityLedState(const uint8_t& state);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 39 uint8_t getActivityLedState();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 40
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 41 void blinkActivityLed(void) {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 42 if (_activity_led) {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 43 int val = _activity_led->read();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 44 _activity_led->write(!val);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 45 }
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 46 }
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 47
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 48 mDot(const mDot&);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 49 mDot& operator=(const mDot&);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 50
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 51 uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 52 void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 53
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 54 void enterStopMode(const uint32_t& interval, const uint8_t& wakeup_mode = RTC_ALARM);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 55 void enterStandbyMode(const uint32_t& interval, const uint8_t& wakeup_mode = RTC_ALARM);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 56
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 57 static mDot* _instance;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 58
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 59 lora::Mote* _mote;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 60 LoRaConfig* _config;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 61 lora::Settings _settings;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 62 mDotEvent* _events;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 63
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 64 std::string _last_error;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 65 static const uint32_t _baud_rates[];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 66 uint8_t _activity_led_state;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 67 Ticker _tick;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 68 DigitalOut* _activity_led;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 69 bool _activity_led_enable;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 70 PinName _activity_led_pin;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 71 bool _activity_led_external;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 72 uint8_t _linkFailCount;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 73 uint8_t _class;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 74 InterruptIn* _wakeup;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 75 PinName _wakeup_pin;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 76
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 77 typedef enum {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 78 OFF,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 79 ON,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 80 BLINK,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 81 } state;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 82
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 83 public:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 84
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 85 #if defined(TARGET_MTS_MDOT_F411RE)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 86 typedef enum {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 87 FM_APPEND = (1 << 0),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 88 FM_TRUNC = (1 << 1),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 89 FM_CREAT = (1 << 2),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 90 FM_RDONLY = (1 << 3),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 91 FM_WRONLY = (1 << 4),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 92 FM_RDWR = (FM_RDONLY | FM_WRONLY),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 93 FM_DIRECT = (1 << 5)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 94 } FileMode;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 95 #endif /* TARGET_MTS_MDOT_F411RE */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 96
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 97 typedef enum {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 98 MDOT_OK = 0,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 99 MDOT_INVALID_PARAM = -1,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 100 MDOT_TX_ERROR = -2,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 101 MDOT_RX_ERROR = -3,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 102 MDOT_JOIN_ERROR = -4,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 103 MDOT_TIMEOUT = -5,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 104 MDOT_NOT_JOINED = -6,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 105 MDOT_ENCRYPTION_DISABLED = -7,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 106 MDOT_NO_FREE_CHAN = -8,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 107 MDOT_TEST_MODE = -9,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 108 MDOT_NO_ENABLED_CHAN = -10,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 109 MDOT_AGGREGATED_DUTY_CYCLE = -11,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 110 MDOT_MAX_PAYLOAD_EXCEEDED = -12,
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 111 MDOT_LBT_CHANNEL_BUSY = -13,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 112 MDOT_NOT_IDLE = -14,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 113 MDOT_ERROR = -1024,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 114 } mdot_ret_code;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 115
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 116 enum JoinMode {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 117 MANUAL = 0,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 118 OTA,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 119 AUTO_OTA,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 120 PEER_TO_PEER
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 121 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 122
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 123 enum Mode {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 124 COMMAND_MODE,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 125 SERIAL_MODE
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 126 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 127
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 128 enum RX_Output {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 129 HEXADECIMAL,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 130 BINARY
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 131 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 132
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 133 enum DataRates {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 134 DR0,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 135 DR1,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 136 DR2,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 137 DR3,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 138 DR4,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 139 DR5,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 140 DR6,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 141 DR7,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 142 DR8,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 143 DR9,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 144 DR10,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 145 DR11,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 146 DR12,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 147 DR13,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 148 DR14,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 149 DR15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 150 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 151
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 152 enum FrequencySubBands {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 153 FSB_ALL,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 154 FSB_1,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 155 FSB_2,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 156 FSB_3,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 157 FSB_4,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 158 FSB_5,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 159 FSB_6,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 160 FSB_7,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 161 FSB_8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 162 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 163
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 164 enum JoinByteOrder {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 165 LSB,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 166 MSB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 167 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 168
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 169 enum wakeup_mode {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 170 RTC_ALARM,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 171 INTERRUPT,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 172 RTC_ALARM_OR_INTERRUPT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 173 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 174
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 175 enum UserBackupRegs {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 176 UBR0,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 177 UBR1,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 178 UBR2,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 179 UBR3,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 180 UBR4,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 181 UBR5,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 182 UBR6,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 183 UBR7,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 184 UBR8,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 185 UBR9
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 186 #if defined (TARGET_XDOT_L151CC)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 187 ,UBR10,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 188 UBR11,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 189 UBR12,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 190 UBR13,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 191 UBR14,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 192 UBR15,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 193 UBR16,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 194 UBR17,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 195 UBR18,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 196 UBR19,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 197 UBR20,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 198 UBR21
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 199 #endif /* TARGET_XDOT_L151CC */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 200 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 201
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 202 #if defined(TARGET_MTS_MDOT_F411RE)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 203 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 204 int16_t fd;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 205 char name[33];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 206 uint32_t size;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 207 } mdot_file;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 208 #endif /* TARGET_MTS_MDOT_F411RE */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 209
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 210 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 211 uint32_t Up;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 212 uint32_t Down;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 213 uint32_t Joins;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 214 uint32_t JoinFails;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 215 uint32_t MissedAcks;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 216 uint32_t CRCErrors;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 217 } mdot_stats;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 218
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 219 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 220 int16_t last;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 221 int16_t min;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 222 int16_t max;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 223 int16_t avg;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 224 } rssi_stats;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 225
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 226 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 227 int16_t last;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 228 int16_t min;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 229 int16_t max;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 230 int16_t avg;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 231 } snr_stats;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 232
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 233 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 234 bool status;
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 235 uint8_t dBm;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 236 uint32_t gateways;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 237 std::vector<uint8_t> payload;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 238 } link_check;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 239
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 240 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 241 int32_t status;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 242 int16_t rssi;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 243 int16_t snr;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 244 } ping_response;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 245
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 246 static std::string JoinModeStr(uint8_t mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 247 static std::string ModeStr(uint8_t mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 248 static std::string RxOutputStr(uint8_t format);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 249 static std::string DataRateStr(uint8_t rate);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 250 static std::string FrequencyBandStr(uint8_t band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 251 static std::string FrequencySubBandStr(uint8_t band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 252
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 253 #if defined(TARGET_MTS_MDOT_F411RE)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 254 uint32_t UserRegisters[10];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 255 #else
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 256 uint32_t UserRegisters[22];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 257 #endif /* TARGET_MTS_MDOT_F411RE */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 258
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 259 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 260 * Get a handle to the singleton object
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 261 * @param plan the channel plan to use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 262 * @returns pointer to mDot object
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 263 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 264 static mDot* getInstance(lora::ChannelPlan* plan);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 265
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 266 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 267 * Can only be used after a dot has
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 268 * configured with a plan
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 269 * @returns pointer to mDot object
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 270 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 271 static mDot* getInstance();
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 272
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 273 void setEvents(mDotEvent* events);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 274
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 275 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 276 *
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 277 * Get library version information
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 278 * @returns string containing library version information
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 279 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 280 std::string getId();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 281
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 282 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 283 * Get MTS LoRa version information
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 284 * @returns string containing MTS LoRa version information
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 285 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 286 std::string getMtsLoraId();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 287
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 288 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 289 * Perform a soft reset of the system
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 290 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 291 void resetCpu();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 292
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 293 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 294 * Reset config to factory default
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 295 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 296 void resetConfig();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 297
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 298 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 299 * Save config data to non volatile memory
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 300 * @returns true if success, false if failure
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 301 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 302 bool saveConfig();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 303
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 304 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 305 * Set the log level for the library
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 306 * options are:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 307 * NONE_LEVEL - logging is off at this level
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 308 * FATAL_LEVEL - only critical errors will be reported
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 309 * ERROR_LEVEL
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 310 * WARNING_LEVEL
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 311 * INFO_LEVEL
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 312 * DEBUG_LEVEL
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 313 * TRACE_LEVEL - every detail will be reported
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 314 * @param level the level to log at
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 315 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 316 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 317 int32_t setLogLevel(const uint8_t& level);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 318
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 319 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 320 * Get the current log level for the library
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 321 * @returns current log level
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 322 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 323 uint8_t getLogLevel();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 324
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 325 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 326 * Seed pseudo RNG in LoRaMac layer, uses random value from radio RSSI reading by default
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 327 * @param seed for RNG
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 328 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 329 void seedRandom(uint32_t seed);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 330
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 331
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 332 uint8_t setChannelPlan(lora::ChannelPlan* plan);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 333
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 334 lora::Settings* getSettings();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 335
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 336 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 337 * Enable or disable the activity LED.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 338 * @param enable true to enable the LED, false to disable
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 339 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 340 void setActivityLedEnable(const bool& enable);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 341
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 342 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 343 * Find out if the activity LED is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 344 * @returns true if activity LED is enabled, false if disabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 345 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 346 bool getActivityLedEnable();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 347
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 348 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 349 * Use a different pin for the activity LED.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 350 * The default is XBEE_RSSI.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 351 * @param pin the new pin to use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 352 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 353 void setActivityLedPin(const PinName& pin);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 354
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 355 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 356 * Use an external DigitalOut object for the activity LED.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 357 * The pointer must stay valid!
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 358 * @param pin the DigitalOut object to use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 359 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 360 void setActivityLedPin(DigitalOut* pin);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 361
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 362 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 363 * Find out what pin the activity LED is on
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 364 * @returns the pin the activity LED is using
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 365 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 366 PinName getActivityLedPin();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 367
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 368 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 369 * Returns boolean indicative of start-up from standby mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 370 * @returns true if dot woke from standby
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 371 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 372 bool getStandbyFlag();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 373
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 374 std::vector<uint16_t> getChannelMask();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 375
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 376 int32_t setChannelMask(uint8_t offset, uint16_t mask);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 377
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 378 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 379 * Add a channel
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 380 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 381 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 382 int32_t addChannel(uint8_t index, uint32_t frequency, uint8_t datarateRange);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 383
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 384 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 385 * Add a downlink channel
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 386 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 387 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 388 int32_t addDownlinkChannel(uint8_t index, uint32_t frequency);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 389
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 390 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 391 * Get list of channel frequencies currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 392 * @returns vector of channels currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 393 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 394 std::vector<uint32_t> getChannels();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 395
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 396 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 397 * Get list of downlink channel frequencies currently in use
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 398 * @returns vector of channels currently in use
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 399 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 400 std::vector<uint32_t> getDownlinkChannels();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 401
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 402 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 403 * Get list of channel datarate ranges currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 404 * @returns vector of datarate ranges currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 405 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 406 std::vector<uint8_t> getChannelRanges();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 407
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 408 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 409 * Get list of channel frequencies in config file to be used as session defaults
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 410 * @returns vector of channels in config file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 411 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 412 std::vector<uint32_t> getConfigChannels();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 413
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 414 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 415 * Get list of channel datarate ranges in config file to be used as session defaults
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 416 * @returns vector of datarate ranges in config file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 417 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 418 std::vector<uint8_t> getConfigChannelRanges();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 419
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 420 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 421 * Get default frequency band
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 422 * @returns frequency band the device was manufactured for
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 423 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 424 uint8_t getDefaultFrequencyBand();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 425
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 426 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 427 * Set frequency sub band
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 428 * only applicable if frequency band is set for United States (FB_915)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 429 * sub band 0 will allow the radio to use all 64 channels
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 430 * sub band 1 - 8 will allow the radio to use the 8 channels in that sub band
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 431 * for use with Conduit gateway and MTAC_LORA, use sub bands 1 - 8, not sub band 0
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 432 * @param band the sub band to use (0 - 8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 433 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 434 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 435 int32_t setFrequencySubBand(const uint8_t& band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 436
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 437 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 438 * Get frequency sub band
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 439 * @returns frequency sub band currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 440 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 441 uint8_t getFrequencySubBand();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 442
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 443 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 444 * Get frequency band
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 445 * @returns frequency band (channel plan) currently in use
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 446 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 447 uint8_t getFrequencyBand();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 448
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 449 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 450 * Get channel plan name
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 451 * @returns name of channel plan currently in use
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 452 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 453 std::string getChannelPlanName();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 454
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 455 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 456 * Get the datarate currently in use within the MAC layer
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 457 * returns 0-15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 458 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 459 uint8_t getSessionDataRate();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 460
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 461
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 462 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 463 * Get the current max EIRP used in the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 464 * May be changed by the network server
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 465 * returns 0-36
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 466 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 467 uint8_t getSessionMaxEIRP();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 468
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 469 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 470 * Set the current max EIRP used in the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 471 * May be changed by the network server
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 472 * accepts 0-36
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 473 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 474 void setSessionMaxEIRP(uint8_t max);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 475
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 476 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 477 * Get the current downlink dwell time used in the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 478 * May be changed by the network server
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 479 * returns 0-1
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 480 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 481 uint8_t getSessionDownlinkDwelltime();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 482
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 483 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 484 * Set the current downlink dwell time used in the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 485 * May be changed by the network server
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 486 * accepts 0-1
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 487 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 488 void setSessionDownlinkDwelltime(uint8_t dwell);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 489
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 490 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 491 * Get the current uplink dwell time used in the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 492 * May be changed by the network server
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 493 * returns 0-1
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 494 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 495 uint8_t getSessionUplinkDwelltime();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 496
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 497 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 498 * Set the current uplink dwell time used in the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 499 * May be changed by the network server
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 500 * accepts 0-1
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 501 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 502 void setSessionUplinkDwelltime(uint8_t dwell);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 503
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 504 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 505 * Set the current downlink dwell time used in the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 506 * May be changed by the network server
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 507 * accepts 0-1
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 508 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 509 uint32_t getListenBeforeTalkTime(uint8_t ms);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 510
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 511 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 512 * Set the current downlink dwell time used in the channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 513 * May be changed by the network server
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 514 * accepts 0-1
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 515 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 516 void setListenBeforeTalkTime(uint32_t ms);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 517
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 518 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 519 * Set public network mode
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 520 * 0:PRIVATE_MTS, 1:PUBLIC_LORAWAN, 2:PRIVATE_LORAWAN
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 521 * PRIVATE_MTS - Sync Word 0x12, US/AU Downlink frequencies per Frequency Sub Band
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 522 * PUBLIC_LORAWAN - Sync Word 0x34
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 523 * PRIVATE_LORAWAN - Sync Word 0x12
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 524 *
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 525 * The default Join Delay is 5 seconds
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 526 * The default Join Delay for PRIVATE_MTS was 1 second in the previous release
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 527 * The Join Delay must be changed independently of Public Network setting
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 528 *
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 529 * @see lora::NetworkType
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 530 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 531 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 532 int32_t setPublicNetwork(const uint8_t& val);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 533
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 534 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 535 * Get public network mode
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 536 *
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 537 * The default Join Delay is 5 seconds
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 538 * The default Join Delay for PRIVATE_MTS was 1 second in the previous release
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 539 * The Join Delay must be changed independently of Public Network setting
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 540 *
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 541 * @see lora:NetworkType
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 542 * @returns 0:PRIVATE_MTS, 1:PUBLIC_LORAWAN, 2:PRIVATE_LORAWAN
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 543 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 544 uint8_t getPublicNetwork();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 545
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 546 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 547 * Get the device ID
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 548 * @returns vector containing the device ID (size 8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 549 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 550 std::vector<uint8_t> getDeviceId();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 551
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 552 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 553 * Get the device port to be used for lora application data (1-223)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 554 * @returns port
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 555 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 556 uint8_t getAppPort();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 557
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 558 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 559 * Set the device port to be used for lora application data (1-223)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 560 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 561 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 562 int32_t setAppPort(uint8_t port);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 563
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 564 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 565 * Set the device class A, B or C
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 566 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 567 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 568 int32_t setClass(std::string newClass);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 569
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 570 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 571 * Get the device class A, B or C
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 572 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 573 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 574 std::string getClass();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 575
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 576 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 577 * Get the max packet length with current settings
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 578 * @returns max packet length
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 579 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 580 uint8_t getMaxPacketLength();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 581
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 582 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 583 * Set network address
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 584 * for use with MANUAL network join mode, will be assigned in OTA & AUTO_OTA modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 585 * @param addr a vector of 4 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 586 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 587 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 588 int32_t setNetworkAddress(const std::vector<uint8_t>& addr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 589
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 590 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 591 * Get network address
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 592 * @returns vector containing network address (size 4)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 593 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 594 std::vector<uint8_t> getNetworkAddress();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 595
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 596 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 597 * Set network session key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 598 * for use with MANUAL network join mode, will be assigned in OTA & AUTO_OTA modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 599 * @param key a vector of 16 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 600 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 601 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 602 int32_t setNetworkSessionKey(const std::vector<uint8_t>& key);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 603
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 604 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 605 * Get network session key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 606 * @returns vector containing network session key (size 16)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 607 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 608 std::vector<uint8_t> getNetworkSessionKey();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 609
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 610 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 611 * Set data session key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 612 * for use with MANUAL network join mode, will be assigned in OTA & AUTO_OTA modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 613 * @param key a vector of 16 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 614 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 615 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 616 int32_t setDataSessionKey(const std::vector<uint8_t>& key);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 617
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 618 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 619 * Get data session key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 620 * @returns vector containing data session key (size 16)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 621 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 622 std::vector<uint8_t> getDataSessionKey();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 623
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 624 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 625 * Set network name
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 626 * for use with OTA & AUTO_OTA network join modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 627 * generates network ID (crc64 of name) automatically
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 628 * @param name a string of of at least 8 bytes and no more than 128 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 629 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 630 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 631 int32_t setNetworkName(const std::string& name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 632
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 633 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 634 * Get network name
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 635 * @return string containing network name (size 8 to 128)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 636 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 637 std::string getNetworkName();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 638
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 639 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 640 * Set network ID
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 641 * for use with OTA & AUTO_OTA network join modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 642 * setting network ID via this function sets network name to empty
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 643 * @param id a vector of 8 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 644 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 645 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 646 int32_t setNetworkId(const std::vector<uint8_t>& id);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 647
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 648 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 649 * Get network ID
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 650 * @returns vector containing network ID (size 8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 651 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 652 std::vector<uint8_t> getNetworkId();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 653
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 654 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 655 * Set network passphrase
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 656 * for use with OTA & AUTO_OTA network join modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 657 * generates network key (cmac of passphrase) automatically
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 658 * @param name a string of of at least 8 bytes and no more than 128 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 659 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 660 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 661 int32_t setNetworkPassphrase(const std::string& passphrase);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 662
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 663 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 664 * Get network passphrase
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 665 * @return string containing network passphrase (size 8 to 128)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 666 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 667 std::string getNetworkPassphrase();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 668
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 669 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 670 * Set network key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 671 * for use with OTA & AUTO_OTA network join modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 672 * setting network key via this function sets network passphrase to empty
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 673 * @param id a vector of 16 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 674 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 675 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 676 int32_t setNetworkKey(const std::vector<uint8_t>& id);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 677
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 678 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 679 * Get network key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 680 * @returns a vector containing network key (size 16)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 681 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 682 std::vector<uint8_t> getNetworkKey();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 683
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 684 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 685 * Set lorawan application EUI
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 686 * equivalent to setNetworkId
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 687 * @param eui application EUI (size 8)
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 688 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 689 int32_t setAppEUI(const uint8_t* eui);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 690
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 691 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 692 * Get lorawan application EUI
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 693 * equivalent to getNetworkId
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 694 * @returns vector containing application EUI (size 8)
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 695 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 696 const uint8_t* getAppEUI();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 697
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 698 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 699 * Set lorawan application key
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 700 * equivalent to setNetworkKey
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 701 * @param eui application key (size 16)
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 702 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 703 int32_t setAppKey(const uint8_t* key);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 704
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 705 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 706 * Set lorawan application key
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 707 * equivalent to getNetworkKey
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 708 * @returns eui application key (size 16)
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 709 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 710 const uint8_t* getAppKey();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 711
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 712 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 713 * Add a multicast session address and keys
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 714 * Downlink counter is set to 0
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 715 * Up to 3 MULTICAST_SESSIONS can be set
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 716 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 717 int32_t setMulticastSession(uint8_t index, uint32_t addr, const uint8_t* nsk, const uint8_t* dsk);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 718
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 719 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 720 * Set a multicast session counter
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 721 * Up to 3 MULTICAST_SESSIONS can be set
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 722 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 723 int32_t setMulticastDownlinkCounter(uint8_t index, uint32_t count);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 724
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 725 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 726 * Set join byte order
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 727 * @param order 0:LSB 1:MSB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 728 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 729 uint32_t setJoinByteOrder(uint8_t order);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 730
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 731 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 732 * Get join byte order
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 733 * @returns byte order to use in joins 0:LSB 1:MSB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 734 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 735 uint8_t getJoinByteOrder();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 736
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 737 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 738 * Attempt to join network
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 739 * each attempt will be made with a random datarate up to the configured datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 740 * JoinRequest backoff between tries is enforced to 1% for 1st hour, 0.1% for 1-10 hours and 0.01% after 10 hours
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 741 * Check getNextTxMs() for time until next join attempt can be made
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 742 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 743 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 744 int32_t joinNetwork();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 745
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 746 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 747 * Attempts to join network once
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 748 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 749 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 750 int32_t joinNetworkOnce();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 751
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 752 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 753 * Resets current network session, essentially disconnecting from the network
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 754 * has no effect for MANUAL network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 755 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 756 void resetNetworkSession();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 757
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 758 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 759 * Restore saved network session from flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 760 * has no effect for MANUAL network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 761 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 762 void restoreNetworkSession();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 763
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 764 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 765 * Save current network session to flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 766 * has no effect for MANUAL network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 767 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 768 void saveNetworkSession();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 769
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 770 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 771 * Set number of times joining will retry each sub-band before changing
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 772 * to the next subband in US915 and AU915
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 773 * @param retries must be between 0 - 255
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 774 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 775 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 776 int32_t setJoinRetries(const uint8_t& retries);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 777
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 778 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 779 * Get number of times joining will retry each sub-band
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 780 * @returns join retries (0 - 255)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 781 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 782 uint8_t getJoinRetries();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 783
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 784 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 785 * Set network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 786 * MANUAL: set network address and session keys manually
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 787 * OTA: User sets network name and passphrase, then attempts to join
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 788 * AUTO_OTA: same as OTA, but network sessions can be saved and restored
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 789 * @param mode MANUAL, OTA, or AUTO_OTA
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 790 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 791 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 792 int32_t setJoinMode(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 793
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 794 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 795 * Get network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 796 * @returns MANUAL, OTA, or AUTO_OTA
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 797 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 798 uint8_t getJoinMode();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 799
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 800 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 801 * Get network join status
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 802 * @returns true if currently joined to network
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 803 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 804 bool getNetworkJoinStatus();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 805
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 806 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 807 * Do a network link check
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 808 * application data may be returned in response to a network link check command
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 809 * @returns link_check structure containing success, dBm above noise floor, gateways in range, and packet payload
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 810 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 811 link_check networkLinkCheck();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 812
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 813 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 814 * Set network link check count to perform automatic link checks every count packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 815 * only applicable if ACKs are disabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 816 * @param count must be between 0 - 255
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 817 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 818 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 819 int32_t setLinkCheckCount(const uint8_t& count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 820
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 821 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 822 * Get network link check count
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 823 * @returns count (0 - 255)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 824 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 825 uint8_t getLinkCheckCount();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 826
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 827 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 828 * Set network link check threshold, number of link check failures or missed acks to tolerate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 829 * before considering network connection lost
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 830 * @pararm count must be between 0 - 255
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 831 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 832 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 833 int32_t setLinkCheckThreshold(const uint8_t& count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 834
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 835 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 836 * Get network link check threshold
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 837 * @returns threshold (0 - 255)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 838 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 839 uint8_t getLinkCheckThreshold();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 840
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 841 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 842 * Get/set number of failed link checks in the current session
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 843 * @returns count (0 - 255)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 844 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 845 uint8_t getLinkFailCount();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 846 int32_t setLinkFailCount(uint8_t count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 847
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 848 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 849 * Set UpLinkCounter number of packets sent to the gateway during this network session (sequence number)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 850 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 851 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 852 int32_t setUpLinkCounter(uint32_t count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 853
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 854 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 855 * Get UpLinkCounter
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 856 * @returns number of packets sent to the gateway during this network session (sequence number)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 857 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 858 uint32_t getUpLinkCounter();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 859
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 860 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 861 * Set UpLinkCounter number of packets sent by the gateway during this network session (sequence number)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 862 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 863 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 864 int32_t setDownLinkCounter(uint32_t count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 865
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 866 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 867 * Get DownLinkCounter
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 868 * @returns number of packets sent by the gateway during this network session (sequence number)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 869 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 870 uint32_t getDownLinkCounter();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 871
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 872 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 873 * Enable/disable AES encryption
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 874 * AES encryption must be enabled for use with Conduit gateway and MTAC_LORA card
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 875 * @param on true for AES encryption to be enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 876 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 877 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 878 int32_t setAesEncryption(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 879
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 880 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 881 * Get AES encryption
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 882 * @returns true if AES encryption is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 883 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 884 bool getAesEncryption();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 885
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 886 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 887 * Get RSSI stats
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 888 * @returns rssi_stats struct containing last, min, max, and avg RSSI in dB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 889 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 890 rssi_stats getRssiStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 891
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 892 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 893 * Get SNR stats
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 894 * @returns snr_stats struct containing last, min, max, and avg SNR in cB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 895 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 896 snr_stats getSnrStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 897
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 898 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 899 * Get ms until next free channel
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 900 * only applicable for European models, US models return 0
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 901 * @returns time (ms) until a channel is free to use for transmitting
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 902 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 903 uint32_t getNextTxMs();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 904
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 905 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 906 * Get join delay in seconds
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 907 * Defaults to 5 seconds
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 908 * Must match join delay setting of the network server
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 909 *
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 910 * The default Join Delay is 5 seconds
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 911 * The default Join Delay for PRIVATE_MTS was 1 second in the previous release
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 912 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 913 * @returns number of seconds before join accept message is expected
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 914 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 915 uint8_t getJoinDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 916
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 917 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 918 * Set join delay in seconds
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 919 * Defaults to 5 seconds
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 920 * Must match join delay setting of the network server
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 921 *
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 922 * The default Join Delay is 5 seconds
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 923 * The default Join Delay for PRIVATE_MTS was 1 second in the previous release
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 924 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 925 * @param delay number of seconds before join accept message is expected
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 926 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 927 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 928 uint32_t setJoinDelay(uint8_t delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 929
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 930 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 931 * Get join Rx1 datarate offset
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 932 * defaults to 0
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 933 * @returns offset
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 934 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 935 uint8_t getJoinRx1DataRateOffset();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 936
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 937 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 938 * Set join Rx1 datarate offset
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 939 * @param offset for datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 940 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 941 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 942 uint32_t setJoinRx1DataRateOffset(uint8_t offset);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 943
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 944 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 945 * Get join Rx2 datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 946 * defaults to US:DR8, AU:DR8, EU:DR0
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 947 * @returns datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 948 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 949 uint8_t getJoinRx2DataRate();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 950
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 951 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 952 * Set join Rx2 datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 953 * @param datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 954 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 955 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 956 uint32_t setJoinRx2DataRate(uint8_t datarate);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 957
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 958 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 959 * Get join Rx2 frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 960 * defaults US:923.3, AU:923.3, EU:869.525
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 961 * @returns frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 962 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 963 uint32_t getJoinRx2Frequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 964
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 965 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 966 * Set join Rx2 frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 967 * @param frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 968 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 969 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 970 uint32_t setJoinRx2Frequency(uint32_t frequency);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 971
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 972 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 973 * Get rx delay in seconds
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 974 * Defaults to 1 second
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 975 * @returns number of seconds before response message is expected
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 976 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 977 uint8_t getRxDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 978
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 979 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 980 * Set rx delay in seconds
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 981 * Defaults to 1 second
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 982 * @param delay number of seconds before response message is expected
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 983 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 984 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 985 uint32_t setRxDelay(uint8_t delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 986
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 987 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 988 * Get preserve session to save network session info through reset or power down in AUTO_OTA mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 989 * Defaults to off
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 990 * @returns true if enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 991 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 992 bool getPreserveSession();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 993
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 994 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 995 * Set preserve session to save network session info through reset or power down in AUTO_OTA mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 996 * Defaults to off
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 997 * @param enable
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 998 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 999 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1000 uint32_t setPreserveSession(bool enable);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1001
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1002 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1003 * Get data pending
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1004 * only valid after sending data to the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1005 * @returns true if server has available packet(s)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1006 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1007 bool getDataPending();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1008
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1009 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1010 * Get ack requested
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1011 * only valid after sending data to the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1012 * @returns true if server has requested ack
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1013 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1014 bool getAckRequested();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1015
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1016 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1017 * Get is transmitting indicator
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1018 * @returns true if currently transmitting
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1019 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1020 bool getIsTransmitting();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1021
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1022 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1023 * Get is idle indicator
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1024 * @returns true if not currently transmitting, waiting or receiving
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1025 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1026 bool getIsIdle();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1027
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1028 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1029 * Set TX data rate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1030 * data rates affect maximum payload size
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1031 * @param dr DR0-DR7 for Europe, DR0-DR4 for United States
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1032 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1033 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1034 int32_t setTxDataRate(const uint8_t& dr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1035
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1036 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1037 * Get TX data rate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1038 * @returns current TX data rate (DR0-DR15)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1039 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1040 uint8_t getTxDataRate();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1041
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1042 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1043 * Get a random value from the radio based on RSSI
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1044 * @returns randome value
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1045 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1046 uint32_t getRadioRandom();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1047
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1048 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1049 * Get data rate spreading factor and bandwidth
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1050 * EU868 Datarates
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1051 * ---------------
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1052 * DR0 - SF12BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1053 * DR1 - SF11BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1054 * DR2 - SF10BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1055 * DR3 - SF9BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1056 * DR4 - SF8BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1057 * DR5 - SF7BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1058 * DR6 - SF7BW250
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1059 * DR7 - FSK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1060 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1061 * US915 Datarates
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1062 * ---------------
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1063 * DR0 - SF10BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1064 * DR1 - SF9BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1065 * DR2 - SF8BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1066 * DR3 - SF7BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1067 * DR4 - SF8BW500
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1068 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1069 * AU915 Datarates
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1070 * ---------------
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1071 * DR0 - SF10BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1072 * DR1 - SF9BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1073 * DR2 - SF8BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1074 * DR3 - SF7BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1075 * DR4 - SF8BW500
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1076 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1077 * @returns spreading factor and bandwidth
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1078 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1079 std::string getDataRateDetails(uint8_t rate);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1080 std::string getDateRateDetails(uint8_t rate);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1081
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1082
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1083 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1084 * Set TX power output of radio before antenna gain, default: 14 dBm
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1085 * actual output power may be limited by local regulations for the chosen frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1086 * power affects maximum range
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1087 * @param power 2 dBm - 20 dBm
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1088 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1089 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1090 int32_t setTxPower(const uint32_t& power);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1091
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1092 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1093 * Get TX power
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1094 * @returns TX power (2 dBm - 20 dBm)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1095 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1096 uint32_t getTxPower();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1097
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1098 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1099 * Get configured gain of installed antenna, default: +3 dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1100 * @returns gain of antenna in dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1101 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1102 int8_t getAntennaGain();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1103
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1104 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1105 * Set configured gain of installed antenna, default: +3 dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1106 * @param gain -127 dBi - 128 dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1107 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1108 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1109 int32_t setAntennaGain(int8_t gain);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1110
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1111 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1112 * Enable/disable TX waiting for rx windows
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1113 * when enabled, send calls will block until a packet is received or RX timeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1114 * @param enable set to true if expecting responses to transmitted packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1115 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1116 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1117 int32_t setTxWait(const bool& enable);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1118
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1119 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1120 * Get TX wait
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1121 * @returns true if TX wait is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1122 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1123 bool getTxWait();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1124
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1125 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1126 * Cancel pending rx windows
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1127 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1128 void cancelRxWindow();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1129
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1130 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1131 * Get time on air
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1132 * @returns the amount of time (in ms) it would take to send bytes bytes based on current configuration
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1133 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1134 uint32_t getTimeOnAir(uint8_t bytes);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1135
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1136 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1137 * Get min frequency
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1138 * @returns minimum frequency based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1139 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1140 uint32_t getMinFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1141
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1142 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1143 * Get max frequency
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1144 * @returns maximum frequency based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1145 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1146 uint32_t getMaxFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1147
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1148 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1149 * Get min datarate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1150 * @returns minimum datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1151 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1152 uint8_t getMinDatarate();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1153
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1154 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1155 * Get max datarate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1156 * @returns maximum datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1157 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1158 uint8_t getMaxDatarate();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1159
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1160 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1161 * Get min datarate offset
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1162 * @returns minimum datarate offset based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1163 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1164 uint8_t getMinDatarateOffset();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1165
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1166 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1167 * Get max datarate offset
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1168 * @returns maximum datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1169 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1170 uint8_t getMaxDatarateOffset();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1171
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1172 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1173 * Get min datarate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1174 * @returns minimum datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1175 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1176 uint8_t getMinRx2Datarate();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1177
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1178 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1179 * Get max rx2 datarate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1180 * @returns maximum rx2 datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1181 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1182 uint8_t getMaxRx2Datarate();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1183
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1184 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1185 * Get max tx power
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1186 * @returns maximum tx power based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1187 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1188 uint8_t getMaxTxPower();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1189
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1190 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1191 * Get min tx power
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1192 * @returns minimum tx power based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1193 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1194 uint8_t getMinTxPower();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1195
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1196 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1197 *
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1198 * get/set adaptive data rate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1199 * configure data rates and power levels based on signal to noise of packets received at gateway
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1200 * true == adaptive data rate is on
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1201 * set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1202 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1203 int32_t setAdr(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1204 bool getAdr();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1205
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1206 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1207 * Set forward error correction bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1208 * @param bytes 1 - 4 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1209 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1210 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1211 int32_t setFec(const uint8_t& bytes);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1212
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1213 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1214 * Get forward error correction bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1215 * @returns bytes (1 - 4)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1216 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1217 uint8_t getFec();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1218
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1219 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1220 * Enable/disable CRC checking of packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1221 * CRC checking must be enabled for use with Conduit gateway and MTAC_LORA card
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1222 * @param on set to true to enable CRC checking
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1223 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1224 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1225 int32_t setCrc(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1226
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1227 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1228 * Get CRC checking
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1229 * @returns true if CRC checking is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1230 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1231 bool getCrc();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1232
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1233 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1234 * Set ack
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1235 * @param retries 0 to disable acks, otherwise 1 - 8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1236 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1237 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1238 int32_t setAck(const uint8_t& retries);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1239
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1240 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1241 * Get ack
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1242 * @returns 0 if acks are disabled, otherwise retries (1 - 8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1243 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1244 uint8_t getAck();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1245
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1246 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1247 * Set number of packet repeats for unconfirmed frames
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1248 * @param repeat 0 or 1 for no repeats, otherwise 2-15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1249 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1250 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1251 int32_t setRepeat(const uint8_t& repeat);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1252
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1253 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1254 * Get number of packet repeats for unconfirmed frames
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1255 * @returns 0 or 1 if no repeats, otherwise 2-15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1256 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1257 uint8_t getRepeat();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1258
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1259 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1260 * Send data to the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1261 * validates data size (based on spreading factor)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1262 * @param data a vector of up to 242 bytes (may be less based on spreading factor)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1263 * @returns MDOT_OK if packet was sent successfully (ACKs disabled), or if an ACK was received (ACKs enabled)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1264 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1265 int32_t send(const std::vector<uint8_t>& data, const bool& blocking = true, const bool& highBw = false);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1266
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1267 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1268 * Inject mac command
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1269 * @param data a vector containing mac commands
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1270 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1271 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1272 int32_t injectMacCommand(const std::vector<uint8_t>& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1273
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1274 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1275 * Clear MAC command buffer to be sent in next uplink
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1276 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1277 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1278 int32_t clearMacCommands();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1279
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1280 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1281 * Get MAC command buffer to be sent in next uplink
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1282 * @returns command bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1283 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1284 std::vector<uint8_t> getMacCommands();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1285
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1286 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1287 * Fetch data received from the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1288 * this function only checks to see if a packet has been received - it does not open a receive window
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1289 * send() must be called before recv()
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1290 * @param data a vector to put the received data into
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1291 * @returns MDOT_OK if packet was successfully received
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1292 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1293 int32_t recv(std::vector<uint8_t>& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1294
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1295 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1296 * Ping
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1297 * status will be MDOT_OK if ping succeeded
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1298 * @returns ping_response struct containing status, RSSI, and SNR
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1299 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1300 ping_response ping();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1301
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1302 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1303 * Get return code string
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1304 * @returns string containing a description of the given error code
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1305 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1306 static std::string getReturnCodeString(const int32_t& code);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1307
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1308 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1309 * Get last error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1310 * @returns string explaining the last error that occured
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1311 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1312 std::string getLastError();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1313
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1314 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1315 * Go to sleep
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1316 * @param interval the number of seconds to sleep before waking up if wakeup_mode == RTC_ALARM or RTC_ALARM_OR_INTERRUPT, else ignored
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1317 * @param wakeup_mode RTC_ALARM, INTERRUPT, RTC_ALARM_OR_INTERRUPT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1318 * if RTC_ALARM the real time clock is configured to wake the device up after the specified interval
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1319 * if INTERRUPT the device will wake up on the rising edge of the interrupt pin
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1320 * if RTC_ALARM_OR_INTERRUPT the device will wake on the first event to occur
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1321 * @param deepsleep if true go into deep sleep mode (lowest power, all memory and registers are lost, peripherals turned off)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1322 * else go into sleep mode (low power, memory and registers are maintained, peripherals stay on)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1323 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1324 * For the MDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1325 * in sleep mode, the device can be woken up on an XBEE_DI (2-8) pin or by the RTC alarm
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1326 * in deepsleep mode, the device can only be woken up using the WKUP pin (PA0, XBEE_DIO7) or by the RTC alarm
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1327 * For the XDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1328 * in sleep mode, the device can be woken up on GPIO (0-3), UART1_RX, WAKE or by the RTC alarm
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1329 * in deepsleep mode, the device can only be woken up using the WKUP pin (PA0, WAKE) or by the RTC alarm
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1330 * @returns MDOT_OK on success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1331 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1332 int32_t sleep(const uint32_t& interval, const uint8_t& wakeup_mode = RTC_ALARM, const bool& deepsleep = true);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1333
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1334 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1335 * Set auto sleep mode
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1336 * Auto sleep mode will automatically put the MCU to sleep after tx and in between receive windows
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1337 * Note: The MCU will go into a stop mode sleep in between rx windows. This means that
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1338 * peripherals such as timers will not function during the sleep intervals.
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1339 * @param enable - Flag to enable auto sleep mode
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1340 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1341 void setAutoSleep(bool enable);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1342
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1343 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1344 * Get auto sleep mode
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1345 * @returns 0 if sleep mode is disabled, 1 if it is enabled
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1346 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1347 uint8_t getAutoSleep();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1348
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1349 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1350 * Set wake pin
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1351 * @param pin the pin to use to wake the device from sleep mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1352 * For MDOT, XBEE_DI (2-8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1353 * For XDOT, GPIO (0-3), UART1_RX, or WAKE
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1354 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1355 void setWakePin(const PinName& pin);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1356
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1357 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1358 * Get wake pin
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1359 * @returns the pin to use to wake the device from sleep mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1360 * For MDOT, XBEE_DI (2-8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1361 * For XDOT, GPIO (0-3), UART1_RX, or WAKE
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1362 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1363 PinName getWakePin();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1364
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1365 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1366 * Write data in a user backup register
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1367 * @param register one of UBR0 through UBR9 for MDOT, one of UBR0 through UBR21 for XDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1368 * @param data user data to back up
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1369 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1370 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1371 bool writeUserBackupRegister(uint32_t reg, uint32_t data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1372
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1373 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1374 * Read data in a user backup register
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1375 * @param register one of UBR0 through UBR9 for MDOT, one of UBR0 through UBR21 for XDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1376 * @param data gets set to content of register
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1377 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1378 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1379 bool readUserBackupRegister(uint32_t reg, uint32_t& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1380
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1381 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1382 * Set LBT time in us
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1383 * @param ms time in us
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1384 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1385 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1386 bool setLbtTimeUs(uint16_t us);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1387
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1388 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1389 * Get LBT time in us
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1390 * @returns LBT time in us
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1391 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1392 uint16_t getLbtTimeUs();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1393
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1394 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1395 * Set LBT threshold in dBm
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1396 * @param rssi threshold in dBm
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1397 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1398 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1399 bool setLbtThreshold(int8_t rssi);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1400
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1401 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1402 * Get LBT threshold in dBm
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1403 * @returns LBT threshold in dBm
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1404 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1405 int8_t getLbtThreshold();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1406
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1407 #if defined(TARGET_MTS_MDOT_F411RE)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1408 ///////////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1409 // Filesystem (Non Volatile Memory) Operation Functions for mDot //
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1410 ///////////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1411
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1412 // Save user file data to flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1413 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1414 // data - data of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1415 // size - size of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1416 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1417 bool saveUserFile(const char* file, void* data, uint32_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1418
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1419 // Append user file data to flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1420 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1421 // data - data of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1422 // size - size of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1423 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1424 bool appendUserFile(const char* file, void* data, uint32_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1425
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1426 // Read user file data from flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1427 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1428 // data - data of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1429 // size - size of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1430 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1431 bool readUserFile(const char* file, void* data, uint32_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1432
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1433 // Move a user file in flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1434 // file - name of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1435 // new_name - new name of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1436 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1437 bool moveUserFile(const char* file, const char* new_name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1438
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1439 // Delete user file data from flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1440 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1441 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1442 bool deleteUserFile(const char* file);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1443
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1444 // Open user file in flash, max of 4 files open concurrently
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1445 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1446 // mode - combination of FM_APPEND | FM_TRUNC | FM_CREAT |
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1447 // FM_RDONLY | FM_WRONLY | FM_RDWR | FM_DIRECT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1448 // returns - mdot_file struct, fd field will be a negative value if file could not be opened
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1449 mDot::mdot_file openUserFile(const char* file, int mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1450
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1451 // Seek an open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1452 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1453 // offset - offset in bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1454 // whence - where offset is based SEEK_SET, SEEK_CUR, SEEK_END
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1455 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1456 bool seekUserFile(mDot::mdot_file& file, size_t offset, int whence);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1457
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1458 // Read bytes from open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1459 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1460 // data - mem location to store data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1461 // length - number of bytes to read
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1462 // returns - number of bytes read, negative if error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1463 int readUserFile(mDot::mdot_file& file, void* data, size_t length);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1464
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1465 // Write bytes to open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1466 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1467 // data - data to write
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1468 // length - number of bytes to write
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1469 // returns - number of bytes written, negative if error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1470 int writeUserFile(mDot::mdot_file& file, void* data, size_t length);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1471
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1472 // Close open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1473 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1474 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1475 bool closeUserFile(mDot::mdot_file& file);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1476
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1477 // List user files stored in flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1478 std::vector<mDot::mdot_file> listUserFiles();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1479
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1480 // Move file into the firmware upgrade path to be flashed on next boot
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1481 // file - name of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1482 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1483 bool moveUserFileToFirmwareUpgrade(const char* file);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1484 #else
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1485 ///////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1486 // EEPROM (Non Volatile Memory) Operation Functions for xDot //
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1487 ///////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1488
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1489 // Write to EEPROM
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1490 // addr - address to write to (0 - 0x17FF)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1491 // data - data to write
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1492 // size - size of data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1493 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1494 bool nvmWrite(uint16_t addr, void* data, uint16_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1495
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1496 // Read from EEPROM
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1497 // addr - address to read from (0 - 0x17FF)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1498 // data - buffer for data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1499 // size - size of buffer
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1500 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1501 bool nvmRead(uint16_t addr, void* data, uint16_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1502 #endif /* TARGET_MTS_MDOT_F411RE */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1503
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1504 // get current statistics
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1505 // Join Attempts, Join Fails, Up Packets, Down Packets, Missed Acks
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1506 mdot_stats getStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1507
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1508 // reset statistics
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1509 // Join Attempts, Join Fails, Up Packets, Down Packets, Missed Acks
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1510 void resetStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1511
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1512 // Convert pin number 2-8 to pin name DIO2-DI8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1513 static PinName pinNum2Name(uint8_t num);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1514
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1515 // Convert pin name DIO2-DI8 to pin number 2-8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1516 static uint8_t pinName2Num(PinName name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1517
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1518 // Convert pin name DIO2-DI8 to string
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1519 static std::string pinName2Str(PinName name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1520
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1521 uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1522
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1523 /*************************************************************************
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1524 * The following functions are only used by the AT command application and
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1525 * should not be used by standard applications consuming the mDot library
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1526 ************************************************************************/
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1527
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1528 // set/get configured baud rate for command port
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1529 // only for use in conjunction with AT interface
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1530 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1531 int32_t setBaud(const uint32_t& baud);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1532 uint32_t getBaud();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1533
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1534 // set/get baud rate for debug port
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1535 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1536 int32_t setDebugBaud(const uint32_t& baud);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1537 uint32_t getDebugBaud();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1538
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1539 // set/get command terminal echo
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1540 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1541 int32_t setEcho(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1542 bool getEcho();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1543
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1544 // set/get command terminal verbose mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1545 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1546 int32_t setVerbose(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1547 bool getVerbose();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1548
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1549 // set/get startup mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1550 // COMMAND_MODE (default), starts up ready to accept AT commands
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1551 // SERIAL_MODE, read serial data and send it as LoRa packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1552 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1553 int32_t setStartUpMode(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1554 uint8_t getStartUpMode();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1555
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1556 int32_t setRxDataRate(const uint8_t& dr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1557 uint8_t getRxDataRate();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1558
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1559 // get/set TX/RX frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1560 // if frequency band == FB_868 (Europe), must be between 863000000 - 870000000
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1561 // if frequency band == FB_915 (United States), must be between 902000000-928000000
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1562 // if set to 0, device will hop frequencies
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1563 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1564 int32_t setTxFrequency(const uint32_t& freq);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1565 uint32_t getTxFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1566 int32_t setRxFrequency(const uint32_t& freq);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1567 uint32_t getRxFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1568
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1569 // get/set TX/RX inverted
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1570 // true == signal is inverted
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1571 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1572 int32_t setTxInverted(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1573 bool getTxInverted();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1574 int32_t setRxInverted(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1575 bool getRxInverted();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1576
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1577 // get/set RX output mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1578 // valid options are HEXADECIMAL and BINARY
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1579 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1580 int32_t setRxOutput(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1581 uint8_t getRxOutput();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1582
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1583 // get/set serial wake interval
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1584 // valid values are 2 s - INT_MAX (2147483647) s
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1585 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1586 int32_t setWakeInterval(const uint32_t& interval);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1587 uint32_t getWakeInterval();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1588
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1589 // get/set serial wake delay
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1590 // valid values are 2 ms - INT_MAX (2147483647) ms
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1591 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1592 int32_t setWakeDelay(const uint32_t& delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1593 uint32_t getWakeDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1594
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1595 // get/set serial receive timeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1596 // valid values are 0 ms - 65000 ms
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1597 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1598 int32_t setWakeTimeout(const uint16_t& timeout);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1599 uint16_t getWakeTimeout();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1600
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1601 // get/set serial wake mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1602 // valid values are INTERRUPT or RTC_ALARM
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1603 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1604 int32_t setWakeMode(const uint8_t& delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1605 uint8_t getWakeMode();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1606
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1607 // get/set serial flow control enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1608 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1609 int32_t setFlowControl(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1610 bool getFlowControl();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1611
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1612 // get/set serial clear on error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1613 // if enabled the data read from the serial port will be discarded if it cannot be sent or if the send fails
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1614 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1615 int32_t setSerialClearOnError(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1616 bool getSerialClearOnError();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1617
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1618 // MTS_RADIO_DEBUG_COMMANDS
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1619
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1620 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1621 * Disable Duty cycle
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1622 * enables or disables the duty cycle limitations
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1623 * **** ONLY TO BE USED FOR TESTINGS PURPOSES ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1624 * **** ALL DEPLOYABLE CODE MUST ADHERE TO LOCAL REGULATIONS ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1625 * **** THIS SETTING WILL NOT BE SAVED TO CONFIGURATION *****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1626 * @param val true to disable duty-cycle (default:false)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1627 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1628 int32_t setDisableDutyCycle(bool val);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1629
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1630 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1631 * Disable Duty cycle
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1632 * **** ONLY TO BE USED FOR TESTINGS PURPOSES ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1633 * **** ALL DEPLOYABLE CODE MUST ADHERE TO LOCAL REGULATIONS ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1634 * **** THIS SETTING WILL NOT BE SAVED TO CONFIGURATION *****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1635 * @return true if duty-cycle is disabled (default:false)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1636 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1637 uint8_t getDisableDutyCycle();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1638
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1639 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1640 * LBT RSSI
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1641 * @return the current RSSI on the configured frequency (SetTxFrequency) using configured LBT Time
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1642 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1643 int16_t lbtRssi();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1644
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1645 void openRxWindow(uint32_t timeout, uint8_t bandwidth = 0);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1646 void closeRxWindow();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1647 void sendContinuous(bool enable=true);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1648 int32_t setDeviceId(const std::vector<uint8_t>& id);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1649 int32_t setProtectedAppEUI(const std::vector<uint8_t>& appEUI);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1650 int32_t setProtectedAppKey(const std::vector<uint8_t>& appKey);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1651 int32_t setDefaultFrequencyBand(const uint8_t& band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1652 bool saveProtectedConfig();
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1653 // resets the radio/mac/link
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1654 void resetRadio();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1655 int32_t setRadioMode(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1656 std::map<uint8_t, uint8_t> dumpRegisters();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1657 void eraseFlash();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1658
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1659 // deprecated - use setWakeInterval
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1660 int32_t setSerialWakeInterval(const uint32_t& interval);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1661 // deprecated - use getWakeInterval
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1662 uint32_t getSerialWakeInterval();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1663
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1664 // deprecated - use setWakeDelay
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1665 int32_t setSerialWakeDelay(const uint32_t& delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1666 // deprecated - use setWakeDelay
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1667 uint32_t getSerialWakeDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1668
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1669 // deprecated - use setWakeTimeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1670 int32_t setSerialReceiveTimeout(const uint16_t& timeout);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1671 // deprecated - use getWakeTimeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1672 uint16_t getSerialReceiveTimeout();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1673
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1674 void setWakeupCallback(void (*function)(void));
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1675
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1676 template<typename T>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1677 void setWakeupCallback(T *object, void (T::*member)(void)) {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1678 _wakeup_callback.attach(object, member);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1679 }
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1680
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1681 lora::ChannelPlan* getChannelPlan(void);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1682
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1683 uint32_t setRx2DataRate(uint8_t dr);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1684 uint8_t getRx2DataRate();
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1685
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1686 void mcGroupKeys(uint8_t *mcKeyEncrypt, uint32_t addr, uint8_t groupId, uint32_t frame_count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1687 private:
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1688 typedef enum {
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1689 AUTO_SLEEP_EVT_CFG,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1690 AUTO_SLEEP_EVT_TXDONE,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1691 AUTO_SLEEP_EVT_RX1_TIMEOUT,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1692 AUTO_SLEEP_EVT_CLEANUP
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1693 } AutoSleepEvent_t;
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1694
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1695 typedef enum {
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1696 USER_SLEEP,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1697 AUTO_SLEEP
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1698 } SleepClient_t;
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1699
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1700 void sleep_ms(uint32_t interval,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1701 uint8_t wakeup_mode = RTC_ALARM,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1702 bool deepsleep = true,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1703 SleepClient_t sleep_client = USER_SLEEP);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1704
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1705 void auto_sleep(AutoSleepEvent_t evt);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1706
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1707 void wakeup(SleepClient_t sleep_client);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1708
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1709 mdot_stats _stats;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1710
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1711 FunctionPointer _wakeup_callback;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1712
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1713 bool _standbyFlag;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1714 bool _testMode;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1715 uint8_t _savedPort;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1716 void handleTestModePacket();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1717 lora::ChannelPlan* _plan;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1718 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1719
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1720 #endif