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 Sep 22 16:29:07 2016 -0500
Revision:
2:4569491293d7
Parent:
0:d8b7d49a734c
Child:
10:1e831990a669
update from git revision 2.0.12

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 2:4569491293d7 16 class mDot {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 17 friend class mDotEvent;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 18
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 19 private:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 20
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 21 mDot();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 22 ~mDot();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 23
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 24 void initLora();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 25
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 26 void setLastError(const std::string& str);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 27
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 28 static bool validateBaudRate(const uint32_t& baud);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 29 static bool validateFrequencySubBand(const uint8_t& band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 30 bool validateDataRate(const uint8_t& dr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 31
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 32 int32_t joinBase(const uint32_t& retries);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 33 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 34 void waitForPacket();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 35 void waitForLinkCheck();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 36
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 37 void setActivityLedState(const uint8_t& state);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 38 uint8_t getActivityLedState();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 39
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 40 void blinkActivityLed(void) {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 41 if (_activity_led) {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 42 int val = _activity_led->read();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 43 _activity_led->write(!val);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 44 }
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 45 }
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 46
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 47 mDot(const mDot&);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 48 mDot& operator=(const mDot&);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 49
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 50 uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 51 void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 52
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 53 void wakeup();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 54
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 55 void enterStopMode(const uint32_t& interval, const uint8_t& wakeup_mode = RTC_ALARM);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 56 void enterStandbyMode(const uint32_t& interval, const uint8_t& wakeup_mode = RTC_ALARM);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 57
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 58 static mDot* _instance;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 59
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 60 lora::Mote _mote;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 61 LoRaConfig* _config;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 62 lora::Settings _settings;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 63 mDotEvent* _events;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 64
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 65 std::string _last_error;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 66 static const uint32_t _baud_rates[];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 67 uint8_t _activity_led_state;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 68 Ticker _tick;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 69 DigitalOut* _activity_led;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 70 bool _activity_led_enable;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 71 PinName _activity_led_pin;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 72 bool _activity_led_external;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 73 uint8_t _linkFailCount;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 74 uint8_t _class;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 75 InterruptIn* _wakeup;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 76 PinName _wakeup_pin;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 77
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 78 typedef enum {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 79 OFF,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 80 ON,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 81 BLINK,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 82 } state;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 83
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 84 public:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 85
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 86 #if defined(TARGET_MTS_MDOT_F411RE)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 87 typedef enum {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 88 FM_APPEND = (1 << 0),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 89 FM_TRUNC = (1 << 1),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 90 FM_CREAT = (1 << 2),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 91 FM_RDONLY = (1 << 3),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 92 FM_WRONLY = (1 << 4),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 93 FM_RDWR = (FM_RDONLY | FM_WRONLY),
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 94 FM_DIRECT = (1 << 5)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 95 } FileMode;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 96 #endif /* TARGET_MTS_MDOT_F411RE */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 97
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 98 typedef enum {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 99 MDOT_OK = 0,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 100 MDOT_INVALID_PARAM = -1,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 101 MDOT_TX_ERROR = -2,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 102 MDOT_RX_ERROR = -3,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 103 MDOT_JOIN_ERROR = -4,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 104 MDOT_TIMEOUT = -5,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 105 MDOT_NOT_JOINED = -6,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 106 MDOT_ENCRYPTION_DISABLED = -7,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 107 MDOT_NO_FREE_CHAN = -8,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 108 MDOT_TEST_MODE = -9,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 109 MDOT_NO_ENABLED_CHAN = -10,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 110 MDOT_AGGREGATED_DUTY_CYCLE = -11,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 111 MDOT_MAX_PAYLOAD_EXCEEDED = -12,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 112 MDOT_ERROR = -1024,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 113 } mdot_ret_code;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 114
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 115 enum JoinMode {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 116 MANUAL = 0,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 117 OTA,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 118 AUTO_OTA,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 119 PEER_TO_PEER
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 120 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 121
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 122 enum Mode {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 123 COMMAND_MODE,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 124 SERIAL_MODE
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 125 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 126
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 127 enum RX_Output {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 128 HEXADECIMAL,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 129 BINARY
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 130 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 131
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 132 enum DataRates {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 133 DR0,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 134 DR1,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 135 DR2,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 136 DR3,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 137 DR4,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 138 DR5,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 139 DR6,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 140 DR7,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 141 DR8,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 142 DR9,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 143 DR10,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 144 DR11,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 145 DR12,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 146 DR13,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 147 DR14,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 148 DR15,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 149 SF_12 = 16,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 150 SF_11,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 151 SF_10,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 152 SF_9,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 153 SF_8,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 154 SF_7,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 155 SF_7H,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 156 SF_FSK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 157 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 158
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 159 enum FrequencyBands {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 160 FB_868 = 0,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 161 FB_915 = 1,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 162 FB_EU868 = 0, // EU868
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 163 FB_US915 = 1, // US915
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 164 FB_AU915 = 2
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 165 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 166
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 167 enum FrequencySubBands {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 168 FSB_ALL,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 169 FSB_1,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 170 FSB_2,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 171 FSB_3,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 172 FSB_4,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 173 FSB_5,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 174 FSB_6,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 175 FSB_7,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 176 FSB_8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 177 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 178
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 179 enum JoinByteOrder {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 180 LSB,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 181 MSB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 182 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 183
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 184 enum wakeup_mode {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 185 RTC_ALARM,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 186 INTERRUPT,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 187 RTC_ALARM_OR_INTERRUPT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 188 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 189
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 190 enum UserBackupRegs {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 191 UBR0,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 192 UBR1,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 193 UBR2,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 194 UBR3,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 195 UBR4,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 196 UBR5,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 197 UBR6,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 198 UBR7,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 199 UBR8,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 200 UBR9
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 201 #if defined (TARGET_XDOT_L151CC)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 202 ,UBR10,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 203 UBR11,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 204 UBR12,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 205 UBR13,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 206 UBR14,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 207 UBR15,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 208 UBR16,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 209 UBR17,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 210 UBR18,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 211 UBR19,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 212 UBR20,
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 213 UBR21
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 214 #endif /* TARGET_XDOT_L151CC */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 215 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 216
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 217 #if defined(TARGET_MTS_MDOT_F411RE)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 218 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 219 int16_t fd;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 220 char name[33];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 221 uint32_t size;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 222 } mdot_file;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 223 #endif /* TARGET_MTS_MDOT_F411RE */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 224
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 225 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 226 uint32_t Up;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 227 uint32_t Down;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 228 uint32_t Joins;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 229 uint32_t JoinFails;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 230 uint32_t MissedAcks;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 231 uint32_t CRCErrors;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 232 } mdot_stats;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 233
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 234 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 235 int16_t last;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 236 int16_t min;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 237 int16_t max;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 238 int16_t avg;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 239 } rssi_stats;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 240
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 241 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 242 int16_t last;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 243 int16_t min;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 244 int16_t max;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 245 int16_t avg;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 246 } snr_stats;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 247
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 248 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 249 bool status;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 250 int32_t dBm;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 251 uint32_t gateways;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 252 std::vector<uint8_t> payload;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 253 } link_check;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 254
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 255 typedef struct {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 256 int32_t status;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 257 int16_t rssi;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 258 int16_t snr;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 259 } ping_response;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 260
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 261 static const uint8_t MaxLengths_915[];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 262 static const uint8_t MaxLengths_868[];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 263
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 264 static std::string JoinModeStr(uint8_t mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 265 static std::string ModeStr(uint8_t mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 266 static std::string RxOutputStr(uint8_t format);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 267 static std::string DataRateStr(uint8_t rate);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 268 static std::string FrequencyBandStr(uint8_t band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 269 static std::string FrequencySubBandStr(uint8_t band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 270
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 271 #if defined(TARGET_MTS_MDOT_F411RE)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 272 uint32_t UserRegisters[10];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 273 #else
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 274 uint32_t UserRegisters[22];
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 275 #endif /* TARGET_MTS_MDOT_F411RE */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 276
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 277 /** Get a handle to the singleton object
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 278 * @returns pointer to mDot object
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 279 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 280 static mDot* getInstance();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 281
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 282 void setEvents(mDotEvent* events);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 283
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 284 /** Get library version information
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 285 * @returns string containing library version information
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 286 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 287 std::string getId();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 288
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 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 2:4569491293d7 293 /** Reset config to factory default
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 294 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 295 void resetConfig();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 296
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 297 /** Save config data to non volatile memory
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 298 * @returns true if success, false if failure
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 299 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 300 bool saveConfig();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 301
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 302 /** Set the log level for the library
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 303 * options are:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 304 * NONE_LEVEL - logging is off at this level
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 305 * FATAL_LEVEL - only critical errors will be reported
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 306 * ERROR_LEVEL
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 307 * WARNING_LEVEL
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 308 * INFO_LEVEL
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 309 * DEBUG_LEVEL
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 310 * TRACE_LEVEL - every detail will be reported
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 311 * @param level the level to log at
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 312 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 313 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 314 int32_t setLogLevel(const uint8_t& level);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 315
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 316 /** Get the current log level for the library
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 317 * @returns current log level
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 318 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 319 uint8_t getLogLevel();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 320
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 321 /** Seed pseudo RNG in LoRaMac layer, uses random value from radio RSSI reading by default
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 322 * @param seed for RNG
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 323 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 324 void seedRandom(uint32_t seed);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 325
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 326 /** Enable or disable the activity LED.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 327 * @param enable true to enable the LED, false to disable
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 328 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 329 void setActivityLedEnable(const bool& enable);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 330
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 331 /** Find out if the activity LED is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 332 * @returns true if activity LED is enabled, false if disabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 333 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 334 bool getActivityLedEnable();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 335
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 336 /** Use a different pin for the activity LED.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 337 * The default is XBEE_RSSI.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 338 * @param pin the new pin to use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 339 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 340 void setActivityLedPin(const PinName& pin);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 341
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 342 /** Use an external DigitalOut object for the activity LED.
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 343 * The pointer must stay valid!
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 344 * @param pin the DigitalOut object to use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 345 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 346 void setActivityLedPin(DigitalOut* pin);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 347
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 348 /** Find out what pin the activity LED is on
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 349 * @returns the pin the activity LED is using
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 350 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 351 PinName getActivityLedPin();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 352
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 353 /** Returns boolean indicative of start-up from standby mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 354 * @returns true if dot woke from standby
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 355 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 356 bool getStandbyFlag();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 357
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 358 std::vector<uint16_t> getChannelMask();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 359
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 360 int32_t setChannelMask(uint8_t offset, uint16_t mask);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 361
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 362 /** Add a channel frequencies currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 363 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 364 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 365 int32_t addChannel(uint8_t index, uint32_t frequency, uint8_t datarateRange);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 366
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 367 /** Get list of channel frequencies currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 368 * @returns vector of channels currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 369 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 370 std::vector<uint32_t> getChannels();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 371
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 372 /** Get list of channel datarate ranges currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 373 * @returns vector of datarate ranges currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 374 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 375 std::vector<uint8_t> getChannelRanges();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 376
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 377 /** Get list of channel frequencies in config file to be used as session defaults
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 378 * @returns vector of channels in config file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 379 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 380 std::vector<uint32_t> getConfigChannels();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 381
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 382 /** Get list of channel datarate ranges in config file to be used as session defaults
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 383 * @returns vector of datarate ranges in config file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 384 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 385 std::vector<uint8_t> getConfigChannelRanges();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 386
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 387 /** Get frequency band
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 388 * @returns FB_915 if configured for United States, FB_868 if configured for Europe
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 389 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 390 uint8_t getFrequencyBand();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 391
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 392 /** Set frequency sub band
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 393 * only applicable if frequency band is set for United States (FB_915)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 394 * sub band 0 will allow the radio to use all 64 channels
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 395 * sub band 1 - 8 will allow the radio to use the 8 channels in that sub band
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 396 * for use with Conduit gateway and MTAC_LORA, use sub bands 1 - 8, not sub band 0
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 397 * @param band the sub band to use (0 - 8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 398 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 399 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 400 int32_t setFrequencySubBand(const uint8_t& band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 401
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 402 /** Get frequency sub band
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 403 * @returns frequency sub band currently in use
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 404 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 405 uint8_t getFrequencySubBand();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 406
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 407 /** Get the datarate currently in use within the MAC layer
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 408 * returns 0-15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 409 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 410 uint8_t getSessionDataRate();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 411
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 412 /** Enable/disable public network mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 413 * JoinDelay will be set to (public: 5s, private: 1s) and
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 414 * RxDelay will be set to 1s both can be adjusted afterwards
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 415 * @param on should be true to enable public network mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 416 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 417 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 418 int32_t setPublicNetwork(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 419
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 420 /** Get public network mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 421 * @returns true if public network mode is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 422 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 423 bool getPublicNetwork();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 424
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 425 /** Get the device ID
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 426 * @returns vector containing the device ID (size 8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 427 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 428 std::vector<uint8_t> getDeviceId();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 429
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 430 /** Get the device port to be used for lora application data (1-223)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 431 * @returns port
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 432 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 433 uint8_t getAppPort();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 434
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 435 /** Set the device port to be used for lora application data (1-223)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 436 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 437 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 438 int32_t setAppPort(uint8_t port);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 439
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 440 /** Set the device class A, B or C
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 441 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 442 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 443 int32_t setClass(std::string newClass);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 444
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 445 /** Get the device class A, B or C
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 446 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 447 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 448 std::string getClass();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 449
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 450 /** Get the max packet length with current settings
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 451 * @returns max packet length
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 452 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 453 uint8_t getMaxPacketLength();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 454
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 455 /** Set network address
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 456 * for use with MANUAL network join mode, will be assigned in OTA & AUTO_OTA modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 457 * @param addr a vector of 4 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 458 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 459 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 460 int32_t setNetworkAddress(const std::vector<uint8_t>& addr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 461
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 462 /** Get network address
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 463 * @returns vector containing network address (size 4)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 464 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 465 std::vector<uint8_t> getNetworkAddress();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 466
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 467 /** Set network session key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 468 * for use with MANUAL network join mode, will be assigned in OTA & AUTO_OTA modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 469 * @param key a vector of 16 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 470 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 471 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 472 int32_t setNetworkSessionKey(const std::vector<uint8_t>& key);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 473
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 474 /** Get network session key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 475 * @returns vector containing network session key (size 16)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 476 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 477 std::vector<uint8_t> getNetworkSessionKey();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 478
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 479 /** Set data session key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 480 * for use with MANUAL network join mode, will be assigned in OTA & AUTO_OTA modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 481 * @param key a vector of 16 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 482 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 483 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 484 int32_t setDataSessionKey(const std::vector<uint8_t>& key);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 485
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 486 /** Get data session key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 487 * @returns vector containing data session key (size 16)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 488 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 489 std::vector<uint8_t> getDataSessionKey();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 490
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 491 /** Set network name
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 492 * for use with OTA & AUTO_OTA network join modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 493 * generates network ID (crc64 of name) automatically
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 494 * @param name a string of of at least 8 bytes and no more than 128 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 495 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 496 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 497 int32_t setNetworkName(const std::string& name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 498
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 499 /** Get network name
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 500 * @return string containing network name (size 8 to 128)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 501 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 502 std::string getNetworkName();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 503
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 504 /** Set network ID
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 505 * for use with OTA & AUTO_OTA network join modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 506 * setting network ID via this function sets network name to empty
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 507 * @param id a vector of 8 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 508 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 509 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 510 int32_t setNetworkId(const std::vector<uint8_t>& id);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 511
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 512 /** Get network ID
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 513 * @returns vector containing network ID (size 8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 514 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 515 std::vector<uint8_t> getNetworkId();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 516
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 517 /** Set network passphrase
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 518 * for use with OTA & AUTO_OTA network join modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 519 * generates network key (cmac of passphrase) automatically
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 520 * @param name a string of of at least 8 bytes and no more than 128 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 521 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 522 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 523 int32_t setNetworkPassphrase(const std::string& passphrase);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 524
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 525 /** Get network passphrase
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 526 * @return string containing network passphrase (size 8 to 128)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 527 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 528 std::string getNetworkPassphrase();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 529
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 530 /** Set network key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 531 * for use with OTA & AUTO_OTA network join modes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 532 * setting network key via this function sets network passphrase to empty
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 533 * @param id a vector of 16 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 534 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 535 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 536 int32_t setNetworkKey(const std::vector<uint8_t>& id);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 537
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 538 /** Get network key
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 539 * @returns a vector containing network key (size 16)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 540 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 541 std::vector<uint8_t> getNetworkKey();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 542
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 543 /** Set join byte order
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 544 * @param order 0:LSB 1:MSB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 545 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 546 uint32_t setJoinByteOrder(uint8_t order);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 547
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 548 /** Get join byte order
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 549 * @returns byte order to use in joins 0:LSB 1:MSB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 550 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 551 uint8_t getJoinByteOrder();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 552
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 553 /** Attempt to join network
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 554 * each attempt will be made with a random datarate up to the configured datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 555 * 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 556 * Check getNextTxMs() for time until next join attempt can be made
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 557 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 558 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 559 int32_t joinNetwork();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 560
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 561 /** Attempts to join network once
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 562 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 563 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 564 int32_t joinNetworkOnce();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 565
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 566 /** Resets current network session, essentially disconnecting from the network
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 567 * has no effect for MANUAL network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 568 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 569 void resetNetworkSession();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 570
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 571 /** Restore saved network session from flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 572 * has no effect for MANUAL network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 573 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 574 void restoreNetworkSession();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 575
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 576 /** Save current network session to flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 577 * has no effect for MANUAL network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 578 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 579 void saveNetworkSession();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 580
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 581 /** Set number of times joining will retry each sub-band before changing
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 582 * to the next subband in US915 and AU915
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 583 * @param retries must be between 0 - 255
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 584 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 585 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 586 int32_t setJoinRetries(const uint8_t& retries);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 587
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 588 /** Get number of times joining will retry each sub-band
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 589 * @returns join retries (0 - 255)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 590 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 591 uint8_t getJoinRetries();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 592
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 593 /** Set network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 594 * MANUAL: set network address and session keys manually
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 595 * OTA: User sets network name and passphrase, then attempts to join
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 596 * AUTO_OTA: same as OTA, but network sessions can be saved and restored
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 597 * @param mode MANUAL, OTA, or AUTO_OTA
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 598 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 599 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 600 int32_t setJoinMode(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 601
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 602 /** Get network join mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 603 * @returns MANUAL, OTA, or AUTO_OTA
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 604 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 605 uint8_t getJoinMode();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 606
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 607 /** Get network join status
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 608 * @returns true if currently joined to network
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 609 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 610 bool getNetworkJoinStatus();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 611
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 612 /** Do a network link check
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 613 * application data may be returned in response to a network link check command
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 614 * @returns link_check structure containing success, dBm above noise floor, gateways in range, and packet payload
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 615 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 616 link_check networkLinkCheck();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 617
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 618 /** Set network link check count to perform automatic link checks every count packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 619 * only applicable if ACKs are disabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 620 * @param count must be between 0 - 255
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 621 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 622 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 623 int32_t setLinkCheckCount(const uint8_t& count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 624
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 625 /** Get network link check count
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 626 * @returns count (0 - 255)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 627 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 628 uint8_t getLinkCheckCount();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 629
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 630 /** Set network link check threshold, number of link check failures or missed acks to tolerate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 631 * before considering network connection lost
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 632 * @pararm count must be between 0 - 255
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 633 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 634 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 635 int32_t setLinkCheckThreshold(const uint8_t& count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 636
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 637 /** Get network link check threshold
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 638 * @returns threshold (0 - 255)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 639 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 640 uint8_t getLinkCheckThreshold();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 641
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 642 /** Get/set number of failed link checks in the current session
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 643 * @returns count (0 - 255)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 644 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 645 uint8_t getLinkFailCount();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 646 int32_t setLinkFailCount(uint8_t count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 647
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 648 /** Set UpLinkCounter number of packets sent to the gateway during this network session (sequence number)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 649 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 650 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 651 int32_t setUpLinkCounter(uint32_t count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 652
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 653 /** Get UpLinkCounter
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 654 * @returns number of packets sent to the gateway during this network session (sequence number)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 655 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 656 uint32_t getUpLinkCounter();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 657
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 658 /** Set UpLinkCounter number of packets sent by the gateway during this network session (sequence number)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 659 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 660 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 661 int32_t setDownLinkCounter(uint32_t count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 662
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 663 /** Get DownLinkCounter
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 664 * @returns number of packets sent by the gateway during this network session (sequence number)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 665 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 666 uint32_t getDownLinkCounter();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 667
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 668 /** Enable/disable AES encryption
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 669 * AES encryption must be enabled for use with Conduit gateway and MTAC_LORA card
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 670 * @param on true for AES encryption to be enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 671 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 672 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 673 int32_t setAesEncryption(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 674
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 675 /** Get AES encryption
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 676 * @returns true if AES encryption is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 677 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 678 bool getAesEncryption();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 679
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 680 /** Get RSSI stats
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 681 * @returns rssi_stats struct containing last, min, max, and avg RSSI in dB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 682 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 683 rssi_stats getRssiStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 684
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 685 /** Get SNR stats
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 686 * @returns snr_stats struct containing last, min, max, and avg SNR in cB
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 687 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 688 snr_stats getSnrStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 689
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 690 /** Get ms until next free channel
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 691 * only applicable for European models, US models return 0
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 692 * @returns time (ms) until a channel is free to use for transmitting
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 693 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 694 uint32_t getNextTxMs();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 695
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 696 /** Get join delay in seconds
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 697 * Public network defaults to 5 seconds
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 698 * Private network defaults to 1 second
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 699 * @returns number of seconds before join accept message is expected
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 700 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 701 uint8_t getJoinDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 702
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 703 /** Set join delay in seconds
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 704 * Public network defaults to 5 seconds
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 705 * Private network defaults to 1 second
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 706 * @param delay number of seconds before join accept message is expected
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 707 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 708 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 709 uint32_t setJoinDelay(uint8_t delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 710
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 711 /** Get join Rx1 datarate offset
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 712 * defaults to 0
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 713 * @returns offset
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 714 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 715 uint8_t getJoinRx1DataRateOffset();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 716
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 717 /** Set join Rx1 datarate offset
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 718 * @param offset for datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 719 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 720 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 721 uint32_t setJoinRx1DataRateOffset(uint8_t offset);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 722
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 723 /** Get join Rx2 datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 724 * defaults to US:DR8, AU:DR8, EU:DR0
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 725 * @returns datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 726 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 727 uint8_t getJoinRx2DataRate();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 728
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 729 /** Set join Rx2 datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 730 * @param datarate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 731 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 732 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 733 uint32_t setJoinRx2DataRate(uint8_t datarate);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 734
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 735 /** Get join Rx2 frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 736 * defaults US:923.3, AU:923.3, EU:869.525
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 737 * @returns frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 738 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 739 uint32_t getJoinRx2Frequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 740
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 741 /** Set join Rx2 frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 742 * @param frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 743 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 744 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 745 uint32_t setJoinRx2Frequency(uint32_t frequency);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 746
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 747 /** Get rx delay in seconds
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 748 * Defaults to 1 second
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 749 * @returns number of seconds before response message is expected
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 750 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 751 uint8_t getRxDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 752
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 753 /** Set rx delay in seconds
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 754 * Defaults to 1 second
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 755 * @param delay number of seconds before response message is expected
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 756 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 757 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 758 uint32_t setRxDelay(uint8_t delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 759
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 760 /** Get preserve session to save network session info through reset or power down in AUTO_OTA mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 761 * Defaults to off
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 762 * @returns true if enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 763 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 764 bool getPreserveSession();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 765
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 766 /** Set preserve session to save network session info through reset or power down in AUTO_OTA mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 767 * Defaults to off
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 768 * @param enable
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 769 * @return MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 770 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 771 uint32_t setPreserveSession(bool enable);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 772
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 773 /** Get data pending
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 774 * only valid after sending data to the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 775 * @returns true if server has available packet(s)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 776 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 777 bool getDataPending();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 778
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 779 /** Get ack requested
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 780 * only valid after sending data to the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 781 * @returns true if server has requested ack
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 782 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 783 bool getAckRequested();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 784
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 785 /** Get is transmitting indicator
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 786 * @returns true if currently transmitting
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 787 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 788 bool getIsTransmitting();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 789
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 790 /** Get is idle indicator
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 791 * @returns true if not currently transmitting, waiting or receiving
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 792 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 793 bool getIsIdle();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 794
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 795 /** Set TX data rate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 796 * data rates affect maximum payload size
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 797 * @param dr SF_7 - SF_12|DR0-DR7 for Europe, SF_7 - SF_10 | DR0-DR4 for United States
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 798 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 799 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 800 int32_t setTxDataRate(const uint8_t& dr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 801
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 802 /** Get TX data rate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 803 * @returns current TX data rate (DR0-DR15)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 804 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 805 uint8_t getTxDataRate();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 806
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 807 /** Get a random value from the radio based on RSSI
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 808 * @returns randome value
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 809 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 810 uint32_t getRadioRandom();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 811
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 812 /** Get data rate spreading factor and bandwidth
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 813 * EU868 Datarates
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 814 * ---------------
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 815 * DR0 - SF12BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 816 * DR1 - SF11BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 817 * DR2 - SF10BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 818 * DR3 - SF9BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 819 * DR4 - SF8BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 820 * DR5 - SF7BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 821 * DR6 - SF7BW250
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 822 * DR7 - FSK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 823 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 824 * US915 Datarates
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 825 * ---------------
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 826 * DR0 - SF10BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 827 * DR1 - SF9BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 828 * DR2 - SF8BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 829 * DR3 - SF7BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 830 * DR4 - SF8BW500
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 831 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 832 * AU915 Datarates
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 833 * ---------------
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 834 * DR0 - SF10BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 835 * DR1 - SF9BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 836 * DR2 - SF8BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 837 * DR3 - SF7BW125
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 838 * DR4 - SF8BW500
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 839 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 840 * @returns spreading factor and bandwidth
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 841 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 842 std::string getDateRateDetails(uint8_t rate);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 843
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 844 /** Set TX power output of radio before antenna gain, default: 14 dBm
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 845 * actual output power may be limited by local regulations for the chosen frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 846 * power affects maximum range
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 847 * @param power 2 dBm - 20 dBm
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 848 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 849 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 850 int32_t setTxPower(const uint32_t& power);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 851
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 852 /** Get TX power
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 853 * @returns TX power (2 dBm - 20 dBm)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 854 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 855 uint32_t getTxPower();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 856
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 857 /** Get configured gain of installed antenna, default: +3 dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 858 * @returns gain of antenna in dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 859 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 860 int8_t getAntennaGain();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 861
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 862 /** Set configured gain of installed antenna, default: +3 dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 863 * @param gain -127 dBi - 128 dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 864 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 865 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 866 int32_t setAntennaGain(int8_t gain);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 867
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 868 /** Enable/disable TX waiting for rx windows
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 869 * when enabled, send calls will block until a packet is received or RX timeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 870 * @param enable set to true if expecting responses to transmitted packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 871 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 872 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 873 int32_t setTxWait(const bool& enable);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 874
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 875 /** Get TX wait
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 876 * @returns true if TX wait is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 877 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 878 bool getTxWait();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 879
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 880 /** Cancel pending rx windows
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 881 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 882 void cancelRxWindow();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 883
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 884 /** Get time on air
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 885 * @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 886 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 887 uint32_t getTimeOnAir(uint8_t bytes);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 888
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 889 /** Get min frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 890 * @returns minimum frequency based on current configuration
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 891 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 892 uint32_t getMinFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 893
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 894 /** Get max frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 895 * @returns maximum frequency based on current configuration
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 896 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 897 uint32_t getMaxFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 898
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 899 // get/set adaptive data rate
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 900 // configure data rates and power levels based on signal to noise of packets received at gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 901 // true == adaptive data rate is on
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 902 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 903 int32_t setAdr(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 904 bool getAdr();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 905
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 906 /** Set forward error correction bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 907 * @param bytes 1 - 4 bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 908 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 909 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 910 int32_t setFec(const uint8_t& bytes);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 911
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 912 /** Get forward error correction bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 913 * @returns bytes (1 - 4)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 914 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 915 uint8_t getFec();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 916
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 917 /** Enable/disable CRC checking of packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 918 * CRC checking must be enabled for use with Conduit gateway and MTAC_LORA card
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 919 * @param on set to true to enable CRC checking
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 920 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 921 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 922 int32_t setCrc(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 923
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 924 /** Get CRC checking
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 925 * @returns true if CRC checking is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 926 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 927 bool getCrc();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 928
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 929 /** Set ack
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 930 * @param retries 0 to disable acks, otherwise 1 - 8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 931 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 932 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 933 int32_t setAck(const uint8_t& retries);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 934
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 935 /** Get ack
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 936 * @returns 0 if acks are disabled, otherwise retries (1 - 8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 937 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 938 uint8_t getAck();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 939
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 940 /** Set number of packet repeats for unconfirmed frames
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 941 * @param repeat 0 or 1 for no repeats, otherwise 2-15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 942 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 943 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 944 int32_t setRepeat(const uint8_t& repeat);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 945
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 946 /** Get number of packet repeats for unconfirmed frames
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 947 * @returns 0 or 1 if no repeats, otherwise 2-15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 948 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 949 uint8_t getRepeat();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 950
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 951 /** Send data to the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 952 * validates data size (based on spreading factor)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 953 * @param data a vector of up to 242 bytes (may be less based on spreading factor)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 954 * @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 955 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 956 int32_t send(const std::vector<uint8_t>& data, const bool& blocking = true, const bool& highBw = false);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 957
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 958 /** Inject mac command
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 959 * @param data a vector containing mac commands
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 960 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 961 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 962 int32_t injectMacCommand(const std::vector<uint8_t>& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 963
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 964 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 965 * Clear MAC command buffer to be sent in next uplink
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 966 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 967 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 968 int32_t clearMacCommands();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 969
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 970 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 971 * Get MAC command buffer to be sent in next uplink
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 972 * @returns command bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 973 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 974 std::vector<uint8_t> getMacCommands();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 975
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 976 /** Fetch data received from the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 977 * 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 978 * send() must be called before recv()
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 979 * @param data a vector to put the received data into
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 980 * @returns MDOT_OK if packet was successfully received
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 981 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 982 int32_t recv(std::vector<uint8_t>& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 983
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 984 /** Ping
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 985 * status will be MDOT_OK if ping succeeded
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 986 * @returns ping_response struct containing status, RSSI, and SNR
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 987 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 988 ping_response ping();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 989
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 990 /** Get return code string
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 991 * @returns string containing a description of the given error code
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 992 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 993 static std::string getReturnCodeString(const int32_t& code);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 994
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 995 /** Get last error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 996 * @returns string explaining the last error that occured
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 997 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 998 std::string getLastError();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 999
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1000 /** Go to sleep
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1001 * @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 1002 * @param wakeup_mode RTC_ALARM, INTERRUPT, RTC_ALARM_OR_INTERRUPT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1003 * 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 1004 * if INTERRUPT the device will wake up on the rising edge of the interrupt pin
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1005 * if RTC_ALARM_OR_INTERRUPT the device will wake on the first event to occur
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1006 * @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 1007 * else go into sleep mode (low power, memory and registers are maintained, peripherals stay on)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1008 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1009 * For the MDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1010 * 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 1011 * 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 1012 * For the XDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1013 * 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 1014 * 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 2:4569491293d7 1015 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1016 void sleep(const uint32_t& interval, const uint8_t& wakeup_mode = RTC_ALARM, const bool& deepsleep = true);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1017
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1018 /** Set wake pin
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1019 * @param pin the pin to use to wake the device from sleep mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1020 * For MDOT, XBEE_DI (2-8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1021 * For XDOT, GPIO (0-3), UART1_RX, or WAKE
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1022 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1023 void setWakePin(const PinName& pin);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1024
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1025 /** Get wake pin
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1026 * @returns the pin to use to wake the device from sleep mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1027 * For MDOT, XBEE_DI (2-8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1028 * For XDOT, GPIO (0-3), UART1_RX, or WAKE
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1029 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1030 PinName getWakePin();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1031
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1032 /** Write data in a user backup register
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1033 * @param register one of UBR0 through UBR9 for MDOT, one of UBR0 through UBR21 for XDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1034 * @param data user data to back up
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1035 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1036 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1037 bool writeUserBackupRegister(uint32_t reg, uint32_t data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1038
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1039 /** Read data in a user backup register
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1040 * @param register one of UBR0 through UBR9 for MDOT, one of UBR0 through UBR21 for XDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1041 * @param data gets set to content of register
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1042 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1043 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1044 bool readUserBackupRegister(uint32_t reg, uint32_t& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1045
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1046 #if defined(TARGET_MTS_MDOT_F411RE)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1047 ///////////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1048 // Filesystem (Non Volatile Memory) Operation Functions for mDot //
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1049 ///////////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1050
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1051 // Save user file data to flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1052 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1053 // data - data of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1054 // size - size of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1055 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1056 bool saveUserFile(const char* file, void* data, uint32_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1057
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1058 // Append user file data to flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1059 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1060 // data - data of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1061 // size - size of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1062 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1063 bool appendUserFile(const char* file, void* data, uint32_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1064
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1065 // Read user file data from flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1066 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1067 // data - data of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1068 // size - size of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1069 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1070 bool readUserFile(const char* file, void* data, uint32_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1071
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1072 // Move a user file in flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1073 // file - name of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1074 // new_name - new name of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1075 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1076 bool moveUserFile(const char* file, const char* new_name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1077
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1078 // Delete user file data from flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1079 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1080 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1081 bool deleteUserFile(const char* file);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1082
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1083 // Open user file in flash, max of 4 files open concurrently
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1084 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1085 // mode - combination of FM_APPEND | FM_TRUNC | FM_CREAT |
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1086 // FM_RDONLY | FM_WRONLY | FM_RDWR | FM_DIRECT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1087 // returns - mdot_file struct, fd field will be a negative value if file could not be opened
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1088 mDot::mdot_file openUserFile(const char* file, int mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1089
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1090 // Seek an open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1091 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1092 // offset - offset in bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1093 // whence - where offset is based SEEK_SET, SEEK_CUR, SEEK_END
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1094 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1095 bool seekUserFile(mDot::mdot_file& file, size_t offset, int whence);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1096
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1097 // Read bytes from open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1098 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1099 // data - mem location to store data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1100 // length - number of bytes to read
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1101 // returns - number of bytes read, negative if error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1102 int readUserFile(mDot::mdot_file& file, void* data, size_t length);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1103
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1104 // Write bytes to open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1105 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1106 // data - data to write
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1107 // length - number of bytes to write
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1108 // returns - number of bytes written, negative if error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1109 int writeUserFile(mDot::mdot_file& file, void* data, size_t length);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1110
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1111 // Close open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1112 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1113 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1114 bool closeUserFile(mDot::mdot_file& file);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1115
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1116 // List user files stored in flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1117 std::vector<mDot::mdot_file> listUserFiles();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1118
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1119 // Move file into the firmware upgrade path to be flashed on next boot
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1120 // file - name of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1121 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1122 bool moveUserFileToFirmwareUpgrade(const char* file);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1123 #else
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1124 ///////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1125 // EEPROM (Non Volatile Memory) Operation Functions for xDot //
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1126 ///////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1127
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1128 // Write to EEPROM
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1129 // addr - address to write to (0 - 0x17FF)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1130 // data - data to write
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1131 // size - size of data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1132 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1133 bool nvmWrite(uint16_t addr, void* data, uint16_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1134
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1135 // Read from EEPROM
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1136 // addr - address to read from (0 - 0x17FF)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1137 // data - buffer for data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1138 // size - size of buffer
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1139 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1140 bool nvmRead(uint16_t addr, void* data, uint16_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1141 #endif /* TARGET_MTS_MDOT_F411RE */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1142
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1143 // get current statistics
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1144 // Join Attempts, Join Fails, Up Packets, Down Packets, Missed Acks
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1145 mdot_stats getStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1146
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1147 // reset statistics
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1148 // Join Attempts, Join Fails, Up Packets, Down Packets, Missed Acks
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1149 void resetStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1150
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1151 // Convert pin number 2-8 to pin name DIO2-DI8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1152 static PinName pinNum2Name(uint8_t num);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1153
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1154 // Convert pin name DIO2-DI8 to pin number 2-8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1155 static uint8_t pinName2Num(PinName name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1156
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1157 // Convert pin name DIO2-DI8 to string
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1158 static std::string pinName2Str(PinName name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1159
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1160 uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1161
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1162 /*************************************************************************
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1163 * The following functions are only used by the AT command application and
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1164 * should not be used by standard applications consuming the mDot library
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1165 ************************************************************************/
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1166
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1167 // set/get configured baud rate for command port
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1168 // only for use in conjunction with AT interface
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1169 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1170 int32_t setBaud(const uint32_t& baud);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1171 uint32_t getBaud();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1172
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1173 // set/get baud rate for debug port
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1174 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1175 int32_t setDebugBaud(const uint32_t& baud);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1176 uint32_t getDebugBaud();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1177
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1178 // set/get command terminal echo
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1179 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1180 int32_t setEcho(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1181 bool getEcho();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1182
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1183 // set/get command terminal verbose mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1184 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1185 int32_t setVerbose(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1186 bool getVerbose();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1187
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1188 // set/get startup mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1189 // COMMAND_MODE (default), starts up ready to accept AT commands
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1190 // SERIAL_MODE, read serial data and send it as LoRa packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1191 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1192 int32_t setStartUpMode(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1193 uint8_t getStartUpMode();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1194
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1195 int32_t setRxDataRate(const uint8_t& dr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1196 uint8_t getRxDataRate();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1197
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1198 // get/set TX/RX frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1199 // if frequency band == FB_868 (Europe), must be between 863000000 - 870000000
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1200 // if frequency band == FB_915 (United States), must be between 902000000-928000000
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1201 // if set to 0, device will hop frequencies
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1202 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1203 int32_t setTxFrequency(const uint32_t& freq);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1204 uint32_t getTxFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1205 int32_t setRxFrequency(const uint32_t& freq);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1206 uint32_t getRxFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1207
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1208 // get/set TX/RX inverted
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1209 // true == signal is inverted
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1210 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1211 int32_t setTxInverted(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1212 bool getTxInverted();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1213 int32_t setRxInverted(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1214 bool getRxInverted();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1215
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1216 // get/set RX output mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1217 // valid options are HEXADECIMAL and BINARY
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1218 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1219 int32_t setRxOutput(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1220 uint8_t getRxOutput();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1221
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1222 // get/set serial wake interval
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1223 // valid values are 2 s - INT_MAX (2147483647) s
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1224 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1225 int32_t setWakeInterval(const uint32_t& interval);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1226 uint32_t getWakeInterval();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1227
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1228 // get/set serial wake delay
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1229 // valid values are 2 ms - INT_MAX (2147483647) ms
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1230 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1231 int32_t setWakeDelay(const uint32_t& delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1232 uint32_t getWakeDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1233
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1234 // get/set serial receive timeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1235 // valid values are 0 ms - 65000 ms
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1236 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1237 int32_t setWakeTimeout(const uint16_t& timeout);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1238 uint16_t getWakeTimeout();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1239
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1240 // get/set serial wake mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1241 // valid values are INTERRUPT or RTC_ALARM
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1242 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1243 int32_t setWakeMode(const uint8_t& delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1244 uint8_t getWakeMode();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1245
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1246 // get/set serial flow control enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1247 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1248 int32_t setFlowControl(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1249 bool getFlowControl();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1250
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1251 // get/set serial clear on error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1252 // 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 1253 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1254 int32_t setSerialClearOnError(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1255 bool getSerialClearOnError();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1256
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1257 // MTS_RADIO_DEBUG_COMMANDS
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1258
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1259 /** Disable Duty cycle
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1260 * enables or disables the duty cycle limitations
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1261 * **** ONLY TO BE USED FOR TESTINGS PURPOSES ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1262 * **** ALL DEPLOYABLE CODE MUST ADHERE TO LOCAL REGULATIONS ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1263 * **** THIS SETTING WILL NOT BE SAVED TO CONFIGURATION *****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1264 * @param val true to disable duty-cycle (default:false)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1265 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1266 int32_t setDisableDutyCycle(bool val);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1267
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1268 /** Disable Duty cycle
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1269 * **** ONLY TO BE USED FOR TESTINGS PURPOSES ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1270 * **** ALL DEPLOYABLE CODE MUST ADHERE TO LOCAL REGULATIONS ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1271 * **** THIS SETTING WILL NOT BE SAVED TO CONFIGURATION *****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1272 * @return true if duty-cycle is disabled (default:false)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1273 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1274 uint8_t getDisableDutyCycle();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1275
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1276 void openRxWindow(uint32_t timeout, uint8_t bandwidth = 0);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1277 void closeRxWindow();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1278 void sendContinuous(bool enable=true);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1279 int32_t setDeviceId(const std::vector<uint8_t>& id);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1280 int32_t setFrequencyBand(const uint8_t& band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1281 bool saveProtectedConfig();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1282 void resetRadio();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1283 int32_t setRadioMode(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1284 std::map<uint8_t, uint8_t> dumpRegisters();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1285 void eraseFlash();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1286
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1287 // deprecated - use setWakeInterval
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1288 int32_t setSerialWakeInterval(const uint32_t& interval);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1289 // deprecated - use getWakeInterval
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1290 uint32_t getSerialWakeInterval();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1291
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1292 // deprecated - use setWakeDelay
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1293 int32_t setSerialWakeDelay(const uint32_t& delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1294 // deprecated - use setWakeDelay
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1295 uint32_t getSerialWakeDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1296
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1297 // deprecated - use setWakeTimeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1298 int32_t setSerialReceiveTimeout(const uint16_t& timeout);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1299 // deprecated - use getWakeTimeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1300 uint16_t getSerialReceiveTimeout();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1301
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1302 void setWakeupCallback(void (*function)(void));
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1303
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1304 template<typename T>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1305 void setWakeupCallback(T *object, void (T::*member)(void)) {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1306 _wakeup_callback.attach(object, member);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1307 }
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1308
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1309 private:
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1310 mdot_stats _stats;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1311
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1312 FunctionPointer _wakeup_callback;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1313
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1314 bool _standbyFlag;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1315 bool _testMode;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1316 uint8_t _savedPort;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1317 void handleTestModePacket();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1318
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1319 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1320
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1321 #endif