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:
Fri Nov 08 09:35:40 2019 -0600
Revision:
22:f062567a28ae
Parent:
21:bc12c888e7dc
xdot-library revision 3.2.5 and mbed-os revision mbed-os-5.13.4

Who changed what in which revision?

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