Stable version of the mDot library for mbed 5. This version of the library is suitable for deployment scenarios. See lastest commit message for version of mbed-os library that has been tested against.

Dependents:   mdot_two_way unh-hackathon-example unh-hackathon-example-raw TelitSensorToCloud ... more

Fork of libmDot-dev-mbed5-deprecated by MultiTech

The Dot library provides a LoRaWan certified stack for LoRa communication using MultiTech mDot and xDot devices. The stack is compatible with mbed 5.

The name of the repository can be used to determine which device the stack was compiled for and if it's a development or production-ready build:

A changelog for the Dot library can be found here.

The Dot library version and the version of mbed-os it was compiled against can both be found in the commit message for that revision of the Dot library. Building your application with the same version of mbed-os as what was used to build the Dot library is highly recommended!

The Dot-Examples repository demonstrates how to use the Dot library in a custom application.

The mDot and xDot platform pages have lots of platform specific information and document potential issues, gotchas, etc, and provide instructions for getting started with development. Please take a look at the platform page before starting development as they should answer many questions you will have.

FOTA

Full FOTA support is only available with mDot, xDot does not have the required external flash. xDot can use the FOTA example to dynamically join a multicast session only. After joining the multicast session the received Fragmentation packets could be handed to a host MCU for processing and at completion the firmware can be loaded into the xDot using the bootloader and y-modem. See xDot Developer Guide.

  • Add the following code to allow Fota to use the Dot instance

main.cpp

    // Initialize FOTA singleton
    Fota::getInstance(dot);
  • Add fragmentation handling the the PacketRx event

RadioEvent.h

    virtual void PacketRx(uint8_t port, uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr, lora::DownlinkControl ctrl, uint8_t slot, uint8_t retries, uint32_t address, bool dupRx) {
        mDotEvent::PacketRx(port, payload, size, rssi, snr, ctrl, slot, retries, address, dupRx);

#if ACTIVE_EXAMPLE == FOTA_EXAMPLE
        if(port == 200 || port == 201 || port == 202) {
            Fota::getInstance()->processCmd(payload, port, size);
        }
#endif
    }

A definition is needed to enable Fragmentation support on mDot and save fragments to flash. This should not be defined for xDot and will result in a compiler error.

mbed_app.json

{
    "macros": [
        "FOTA=1"
    ]
}

The FOTA implementation has a few differences from the LoRaWAN Protocol

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