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

Committer:
Jenkins@KEILDM1.dc.multitech.prv
Date:
Thu Aug 29 12:21:40 2019 -0500
Revision:
19:aa5b1fcd05be
Parent:
18:d7332302f5f1
Child:
20:c296b26ea8e7
Child:
21:bc12c888e7dc
xdot-library revision 3.2.1 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 19:aa5b1fcd05be 1083 * DR0 - SF10BW125
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1084 * DR1 - SF9BW125
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1085 * DR2 - SF8BW125
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1086 * DR3 - SF7BW125
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1087 * DR4 - SF8BW500
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1088 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1089 * @returns spreading factor and bandwidth
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1090 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1091 std::string getDataRateDetails(uint8_t rate);
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1092 MBED_DEPRECATED("Will be removed in 3.3.0")
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1093 std::string getDateRateDetails(uint8_t rate);
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1094
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1095
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1096 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1097 * Set TX power output of radio before antenna gain, default: 14 dBm
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1098 * actual output power may be limited by local regulations for the chosen frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1099 * power affects maximum range
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1100 * @param power 2 dBm - 20 dBm
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1101 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1102 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1103 int32_t setTxPower(const uint32_t& power);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1104
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1105 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1106 * Get TX power
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1107 * @returns TX power (2 dBm - 20 dBm)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1108 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1109 uint32_t getTxPower();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1110
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1111 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1112 * Get configured gain of installed antenna, default: +3 dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1113 * @returns gain of antenna in dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1114 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1115 int8_t getAntennaGain();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1116
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1117 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1118 * Set configured gain of installed antenna, default: +3 dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1119 * @param gain -127 dBi - 128 dBi
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1120 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1121 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1122 int32_t setAntennaGain(int8_t gain);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1123
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1124 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1125 * Enable/disable TX waiting for rx windows
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1126 * when enabled, send calls will block until a packet is received or RX timeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1127 * @param enable set to true if expecting responses to transmitted packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1128 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1129 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1130 int32_t setTxWait(const bool& enable);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1131
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1132 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1133 * Get TX wait
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1134 * @returns true if TX wait is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1135 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1136 bool getTxWait();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1137
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1138 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1139 * Cancel pending rx windows
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1140 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1141 void cancelRxWindow();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1142
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1143 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1144 * Get time on air
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1145 * @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 1146 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1147 uint32_t getTimeOnAir(uint8_t bytes);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1148
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1149 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1150 * Get min frequency
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1151 * @returns minimum frequency based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1152 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1153 uint32_t getMinFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1154
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1155 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1156 * Get max frequency
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1157 * @returns maximum frequency based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1158 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1159 uint32_t getMaxFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1160
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1161 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1162 * Get min datarate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1163 * @returns minimum datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1164 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1165 uint8_t getMinDatarate();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1166
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1167 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1168 * Get max datarate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1169 * @returns maximum datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1170 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1171 uint8_t getMaxDatarate();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1172
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1173 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1174 * Get min datarate offset
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1175 * @returns minimum datarate offset based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1176 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1177 uint8_t getMinDatarateOffset();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1178
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1179 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1180 * Get max datarate offset
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1181 * @returns maximum datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1182 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1183 uint8_t getMaxDatarateOffset();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1184
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1185 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1186 * Get min datarate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1187 * @returns minimum datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1188 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1189 uint8_t getMinRx2Datarate();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1190
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1191 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1192 * Get max rx2 datarate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1193 * @returns maximum rx2 datarate based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1194 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1195 uint8_t getMaxRx2Datarate();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1196
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1197 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1198 * Get max tx power
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1199 * @returns maximum tx power based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1200 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1201 uint8_t getMaxTxPower();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1202
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1203 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1204 * Get min tx power
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1205 * @returns minimum tx power based on current channel plan
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1206 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1207 uint8_t getMinTxPower();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1208
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1209 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1210 * Set ping slot periodicity
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1211 * Specify the the number of ping slots in a given beacon interval
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1212 * Note: Must switch back to class A for the change to take effect
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1213 * @param exp - number_of_pings = 2^(7 - exp) where 0 <= exp <= 7
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1214 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1215 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1216 uint32_t setPingPeriodicity(uint8_t exp);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1217
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1218 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1219 * Get ping slot periodicity
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1220 * @returns exp = 7 - log2(number_of_pings)
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1221 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1222 uint8_t getPingPeriodicity();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1223
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1224 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1225 *
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1226 * get/set adaptive data rate
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1227 * configure data rates and power levels based on signal to noise of packets received at gateway
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1228 * true == adaptive data rate is on
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1229 * set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1230 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1231 int32_t setAdr(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1232 bool getAdr();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1233
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1234 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1235 * Set the ADR ACK Limit
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1236 * @param limit - ADR ACK limit
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1237 */
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1238 void setAdrAckLimit(uint16_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 19:aa5b1fcd05be 1244 uint16_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 16:4a382fe8f51b 1249 */
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1250 void setAdrAckDelay(uint16_t delay);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1251
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1252 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1253 * Get the ADR ACK Delay
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1254 * @returns ADR ACK delay
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1255 */
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1256 uint16_t getAdrAckDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1257
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1258 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1259 * Enable/disable CRC checking of packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1260 * CRC checking must be enabled for use with Conduit gateway and MTAC_LORA card
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1261 * @param on set to true to enable CRC checking
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1262 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1263 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1264 int32_t setCrc(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1265
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1266 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1267 * Get CRC checking
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1268 * @returns true if CRC checking is enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1269 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1270 bool getCrc();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1271
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1272 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1273 * Set ack
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1274 * @param retries 0 to disable acks, otherwise 1 - 8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1275 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1276 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1277 int32_t setAck(const uint8_t& retries);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1278
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1279 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1280 * Get ack
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1281 * @returns 0 if acks are disabled, otherwise retries (1 - 8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1282 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1283 uint8_t getAck();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1284
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1285 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1286 * Set number of packet repeats for unconfirmed frames
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1287 * @param repeat 0 or 1 for no repeats, otherwise 2-15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1288 * @returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1289 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1290 int32_t setRepeat(const uint8_t& repeat);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1291
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1292 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1293 * Get number of packet repeats for unconfirmed frames
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1294 * @returns 0 or 1 if no repeats, otherwise 2-15
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1295 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1296 uint8_t getRepeat();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1297
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1298 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1299 * Send data to the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1300 * validates data size (based on spreading factor)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1301 * @param data a vector of up to 242 bytes (may be less based on spreading factor)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1302 * @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 1303 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1304 int32_t send(const std::vector<uint8_t>& data, const bool& blocking = true, const bool& highBw = false);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1305
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1306 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1307 * Inject mac command
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1308 * @param data a vector containing mac commands
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1309 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1310 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1311 int32_t injectMacCommand(const std::vector<uint8_t>& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1312
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1313 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1314 * Clear MAC command buffer to be sent in next uplink
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1315 * @returns MDOT_OK
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1316 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1317 int32_t clearMacCommands();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1318
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1319 /**
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1320 * Get MAC command buffer to be sent in next uplink
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1321 * @returns command bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1322 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1323 std::vector<uint8_t> getMacCommands();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1324
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1325 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1326 * Fetch data received from the gateway
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1327 * 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 1328 * send() must be called before recv()
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1329 * @param data a vector to put the received data into
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1330 * @returns MDOT_OK if packet was successfully received
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1331 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1332 int32_t recv(std::vector<uint8_t>& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1333
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1334 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1335 * Ping
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1336 * status will be MDOT_OK if ping succeeded
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1337 * @returns ping_response struct containing status, RSSI, and SNR
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1338 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1339 ping_response ping();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1340
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1341 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1342 * Get return code string
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1343 * @returns string containing a description of the given error code
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1344 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1345 static std::string getReturnCodeString(const int32_t& code);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1346
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1347 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1348 * Get last error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1349 * @returns string explaining the last error that occured
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1350 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1351 std::string getLastError();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1352
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1353 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1354 * Go to sleep
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1355 * @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 1356 * @param wakeup_mode RTC_ALARM, INTERRUPT, RTC_ALARM_OR_INTERRUPT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1357 * 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 1358 * if INTERRUPT the device will wake up on the rising edge of the interrupt pin
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1359 * if RTC_ALARM_OR_INTERRUPT the device will wake on the first event to occur
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1360 * @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 1361 * else go into sleep mode (low power, memory and registers are maintained, peripherals stay on)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1362 *
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1363 * For the MDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1364 * 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 1365 * 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 1366 * For the XDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1367 * 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 1368 * 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 1369 * @returns MDOT_OK on success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1370 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1371 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 1372
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1373 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1374 * Set auto sleep mode
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1375 * Auto sleep mode will automatically put the MCU to sleep after tx and in between receive windows
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1376 * Note: The MCU will go into a stop mode sleep in between rx windows. This means that
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1377 * peripherals such as timers will not function during the sleep intervals.
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1378 * @param enable - Flag to enable auto sleep mode
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1379 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1380 void setAutoSleep(bool enable);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1381
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1382 /**
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1383 * Get auto sleep mode
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1384 * @returns 0 if sleep mode is disabled, 1 if it is enabled
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1385 */
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1386 uint8_t getAutoSleep();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1387
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1388 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1389 * Set wake pin
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1390 * @param pin the pin to use to wake the device from sleep mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1391 * For MDOT, XBEE_DI (2-8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1392 * For XDOT, GPIO (0-3), UART1_RX, or WAKE
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1393 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1394 void setWakePin(const PinName& pin);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1395
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1396 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1397 * Get wake pin
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1398 * @returns the pin to use to wake the device from sleep mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1399 * For MDOT, XBEE_DI (2-8)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1400 * For XDOT, GPIO (0-3), UART1_RX, or WAKE
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1401 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1402 PinName getWakePin();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1403
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1404 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1405 * Write data in a user backup register
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1406 * @param register one of UBR0 through UBR9 for MDOT, one of UBR0 through UBR21 for XDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1407 * @param data user data to back up
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1408 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1409 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1410 bool writeUserBackupRegister(uint32_t reg, uint32_t data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1411
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1412 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1413 * Read data in a user backup register
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1414 * @param register one of UBR0 through UBR9 for MDOT, one of UBR0 through UBR21 for XDOT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1415 * @param data gets set to content of register
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1416 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1417 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1418 bool readUserBackupRegister(uint32_t reg, uint32_t& data);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1419
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1420 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1421 * Set LBT time in us
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1422 * @param ms time in us
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1423 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1424 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1425 bool setLbtTimeUs(uint16_t us);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1426
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1427 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1428 * Get LBT time in us
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1429 * @returns LBT time in us
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1430 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1431 uint16_t getLbtTimeUs();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1432
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1433 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1434 * Set LBT threshold in dBm
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1435 * @param rssi threshold in dBm
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1436 * @returns true if success
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1437 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1438 bool setLbtThreshold(int8_t rssi);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1439
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1440 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1441 * Get LBT threshold in dBm
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1442 * @returns LBT threshold in dBm
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1443 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1444 int8_t getLbtThreshold();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1445
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1446 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1447 * Get Radio Frequency Offset
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1448 * Used for fine calibration of radio frequencies
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1449 * @returns frequency offset in MHz
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1450 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1451 int32_t getFrequencyOffset();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1452 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1453 * Get Radio Frequency Offset
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1454 * Used for fine calibration of radio frequencies
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1455 * @param offset frequency offset in MHz
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1456 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1457 void setFrequencyOffset(int32_t offset);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1458
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1459 /**
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1460 * Get GPS time from network server
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1461 * Sends a DeviceTimeReq command to the network server
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1462 * @returns time since GPS epoch, 0 on failure
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1463 */
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1464 uint64_t getGPSTime();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1465
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1466 #if defined(TARGET_MTS_MDOT_F411RE)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1467 ///////////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1468 // Filesystem (Non Volatile Memory) Operation Functions for mDot //
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1469 ///////////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1470
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1471 // Save user file data to flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1472 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1473 // data - data of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1474 // size - size of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1475 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1476 bool saveUserFile(const char* file, void* data, uint32_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1477
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1478 // Append user file data to flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1479 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1480 // data - data of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1481 // size - size of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1482 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1483 bool appendUserFile(const char* file, void* data, uint32_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1484
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1485 // Read user file data from flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1486 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1487 // data - data of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1488 // size - size of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1489 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1490 bool readUserFile(const char* file, void* data, uint32_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1491
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1492 // Move a user file in flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1493 // file - name of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1494 // new_name - new name of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1495 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1496 bool moveUserFile(const char* file, const char* new_name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1497
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1498 // Delete user file data from flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1499 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1500 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1501 bool deleteUserFile(const char* file);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1502
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1503 // Open user file in flash, max of 4 files open concurrently
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1504 // file - name of file max 30 chars
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1505 // mode - combination of FM_APPEND | FM_TRUNC | FM_CREAT |
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1506 // FM_RDONLY | FM_WRONLY | FM_RDWR | FM_DIRECT
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1507 // returns - mdot_file struct, fd field will be a negative value if file could not be opened
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1508 mDot::mdot_file openUserFile(const char* file, int mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1509
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1510 // Seek an open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1511 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1512 // offset - offset in bytes
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1513 // whence - where offset is based SEEK_SET, SEEK_CUR, SEEK_END
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1514 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1515 bool seekUserFile(mDot::mdot_file& file, size_t offset, int whence);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1516
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1517 // Read bytes from open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1518 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1519 // data - mem location to store data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1520 // length - number of bytes to read
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1521 // returns - number of bytes read, negative if error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1522 int readUserFile(mDot::mdot_file& file, void* data, size_t length);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1523
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1524 // Write bytes to open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1525 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1526 // data - data to write
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1527 // length - number of bytes to write
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1528 // returns - number of bytes written, negative if error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1529 int writeUserFile(mDot::mdot_file& file, void* data, size_t length);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1530
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1531 // Close open file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1532 // file - mdot file struct
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1533 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1534 bool closeUserFile(mDot::mdot_file& file);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1535
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1536 // List user files stored in flash
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1537 std::vector<mDot::mdot_file> listUserFiles();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1538
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1539 // Move file into the firmware upgrade path to be flashed on next boot
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1540 // file - name of file
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1541 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1542 bool moveUserFileToFirmwareUpgrade(const char* file);
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1543
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1544 // Return total size of all files saved in FLASH
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1545 // Does not include SPIFFS overhead
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1546 uint32_t getUsedSpace();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1547 #else
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1548 ///////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1549 // EEPROM (Non Volatile Memory) Operation Functions for xDot //
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1550 ///////////////////////////////////////////////////////////////
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1551
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1552 // Write to EEPROM
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1553 // addr - address to write to (0 - 0x17FF)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1554 // data - data to write
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1555 // size - size of data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1556 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1557 bool nvmWrite(uint16_t addr, void* data, uint16_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1558
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1559 // Read from EEPROM
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1560 // addr - address to read from (0 - 0x17FF)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1561 // data - buffer for data
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1562 // size - size of buffer
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1563 // returns true if successful
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1564 bool nvmRead(uint16_t addr, void* data, uint16_t size);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1565 #endif /* TARGET_MTS_MDOT_F411RE */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1566
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1567 // get current statistics
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1568 // Join Attempts, Join Fails, Up Packets, Down Packets, Missed Acks
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1569 mdot_stats getStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1570
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1571 // reset statistics
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1572 // Join Attempts, Join Fails, Up Packets, Down Packets, Missed Acks
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1573 void resetStats();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1574
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1575 // Convert pin number 2-8 to pin name DIO2-DI8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1576 static PinName pinNum2Name(uint8_t num);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1577
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1578 // Convert pin name DIO2-DI8 to pin number 2-8
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1579 static uint8_t pinName2Num(PinName name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1580
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1581 // Convert pin name DIO2-DI8 to string
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1582 static std::string pinName2Str(PinName name);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1583
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1584 uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1585
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1586 /*************************************************************************
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1587 * The following functions are only used by the AT command application and
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1588 * should not be used by standard applications consuming the mDot library
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1589 ************************************************************************/
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1590
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1591 // set/get configured baud rate for command port
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1592 // only for use in conjunction with AT interface
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1593 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1594 int32_t setBaud(const uint32_t& baud);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1595 uint32_t getBaud();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1596
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1597 // set/get baud rate for debug port
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1598 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1599 int32_t setDebugBaud(const uint32_t& baud);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1600 uint32_t getDebugBaud();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1601
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1602 // set/get command terminal echo
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1603 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1604 int32_t setEcho(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1605 bool getEcho();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1606
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1607 // set/get command terminal verbose mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1608 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1609 int32_t setVerbose(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1610 bool getVerbose();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1611
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1612 // set/get startup mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1613 // COMMAND_MODE (default), starts up ready to accept AT commands
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1614 // SERIAL_MODE, read serial data and send it as LoRa packets
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1615 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1616 int32_t setStartUpMode(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1617 uint8_t getStartUpMode();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1618
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1619 int32_t setRxDataRate(const uint8_t& dr);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1620 uint8_t getRxDataRate();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1621
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1622 // get/set TX/RX frequency
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1623 // if set to 0, device will hop frequencies
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1624 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1625 int32_t setTxFrequency(const uint32_t& freq);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1626 uint32_t getTxFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1627 int32_t setRxFrequency(const uint32_t& freq);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1628 uint32_t getRxFrequency();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1629
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1630 // get/set RX output mode
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1631 // valid options are HEXADECIMAL, BINARY, and EXTENDED
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1632 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1633 int32_t setRxOutput(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1634 uint8_t getRxOutput();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1635
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1636 // get/set serial wake interval
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1637 // valid values are 2 s - INT_MAX (2147483647) s
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1638 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1639 int32_t setWakeInterval(const uint32_t& interval);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1640 uint32_t getWakeInterval();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1641
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1642 // get/set serial wake delay
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1643 // valid values are 2 ms - INT_MAX (2147483647) ms
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1644 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1645 int32_t setWakeDelay(const uint32_t& delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1646 uint32_t getWakeDelay();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1647
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1648 // get/set serial receive timeout
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1649 // valid values are 0 ms - 65000 ms
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1650 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1651 int32_t setWakeTimeout(const uint16_t& timeout);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1652 uint16_t getWakeTimeout();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1653
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1654 // get/set serial wake mode
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1655 // valid values are INTERRUPT or RTC_ALARM
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1656 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1657 int32_t setWakeMode(const uint8_t& delay);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1658 uint8_t getWakeMode();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1659
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1660 // get/set serial flow control enabled
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1661 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1662 int32_t setFlowControl(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1663 bool getFlowControl();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1664
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1665 // get/set serial clear on error
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1666 // 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 1667 // set function returns MDOT_OK if success
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1668 int32_t setSerialClearOnError(const bool& on);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1669 bool getSerialClearOnError();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1670
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1671 // MTS_RADIO_DEBUG_COMMANDS
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1672
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1673 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1674 * Disable Duty cycle
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1675 * enables or disables the duty cycle limitations
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1676 * **** ONLY TO BE USED FOR TESTINGS PURPOSES ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1677 * **** ALL DEPLOYABLE CODE MUST ADHERE TO LOCAL REGULATIONS ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1678 * **** THIS SETTING WILL NOT BE SAVED TO CONFIGURATION *****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1679 * @param val true to disable duty-cycle (default:false)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1680 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1681 int32_t setDisableDutyCycle(bool val);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1682
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1683 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1684 * Disable Duty cycle
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1685 * **** ONLY TO BE USED FOR TESTINGS PURPOSES ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1686 * **** ALL DEPLOYABLE CODE MUST ADHERE TO LOCAL REGULATIONS ****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1687 * **** THIS SETTING WILL NOT BE SAVED TO CONFIGURATION *****
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1688 * @return true if duty-cycle is disabled (default:false)
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1689 */
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1690 uint8_t getDisableDutyCycle();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1691
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1692 /**
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1693 * LBT RSSI
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1694 * @return the current RSSI on the configured frequency (SetTxFrequency) using configured LBT Time
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1695 */
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1696 int16_t lbtRssi();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1697
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1698 void openRxWindow(uint32_t timeout, uint8_t bandwidth = 0);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1699 void closeRxWindow();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1700 void sendContinuous(bool enable=true, uint32_t timeout=0, uint32_t frequency=0, int8_t txpower=-1);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1701 int32_t setDeviceId(const std::vector<uint8_t>& id);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1702 int32_t setProtectedAppEUI(const std::vector<uint8_t>& appEUI);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1703 int32_t setProtectedAppKey(const std::vector<uint8_t>& appKey);
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1704 int32_t setDefaultFrequencyBand(const uint8_t& band);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1705 bool saveProtectedConfig();
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1706 // resets the radio/mac/link
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1707 void resetRadio();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1708 int32_t setRadioMode(const uint8_t& mode);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1709 std::map<uint8_t, uint8_t> dumpRegisters();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1710 void eraseFlash();
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1711
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1712 void setWakeupCallback(void (*function)(void));
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1713
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1714 template<typename T>
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1715 void setWakeupCallback(T *object, void (T::*member)(void)) {
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1716 _wakeup_callback.attach(object, member);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1717 }
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1718
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1719 lora::ChannelPlan* getChannelPlan(void);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1720
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1721 uint32_t setRx2DataRate(uint8_t dr);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1722 uint8_t getRx2DataRate();
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1723
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1724 void mcGroupKeys(uint8_t *mcKeyEncrypt, uint32_t addr, uint8_t groupId, uint32_t frame_count);
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1725 private:
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1726
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1727 void sleep_ms(uint32_t interval,
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1728 uint8_t wakeup_mode = RTC_ALARM,
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1729 bool deepsleep = true);
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1730
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1731
Jenkins@KEILDM1.dc.multitech.prv 16:4a382fe8f51b 1732 void wakeup();
Jenkins@KEILDM1.dc.multitech.prv 14:f0c24ce93427 1733
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1734 mdot_stats _stats;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1735
Jenkins@KEILDM1.dc.multitech.prv 19:aa5b1fcd05be 1736 FunctionPointer _wakeup_callback;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1737
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1738 bool _standbyFlag;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1739 bool _testMode;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1740 uint8_t _savedPort;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1741 void handleTestModePacket();
Jenkins@KEILDM1.dc.multitech.prv 10:1e831990a669 1742 lora::ChannelPlan* _plan;
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1743 };
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1744
Jenkins@KEILDM1.dc.multitech.prv 2:4569491293d7 1745 #endif