Bleeding edge development version of the mDot library for mbed 5. This version of the library is not guaranteed to be stable or well tested and should not be used in production or deployment scenarios.

Dependents:   mDot-IKS01A1 mDot-IKS01A1 mDot-Examples mDot-IKS01A1-Explora ... more

Fork of libmDot-dev-mbed2-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.

Dot Library Version 3 Updates

Dot Library versions 3.x.x require a channel plan to be injected into the stack. Channel plans are included with the 3.x.x Dot Library releases. The following code snippet demonstrates how to create a channel plan and inject it into the stack.

#include "mDot.h"
#include "channel_plans.h"

int main() {
    ChannelPlan* plan = new lora::ChannelPlan_US915();
    assert(plan);
    mDot* dot = mDot::getInstance(plan);
    assert(dot);

    // ...
}

Dot devices must not be deployed with software using a different channel plan than the Dot's default plan! This functionality is for development and testing only!

Multicast Sessions

Multicast sessions and packet rx events in library. When in Class C mode Multicast downlinks can be received. Recieved packets should be filtered on address, counter value will be maintained in the session or can be set explicitly depending on Application support to share Multicast Address, Keys and Counters.

mDot.h

        /**
         * Add a multicast session address and keys
         * Downlink counter is set to 0
         * Up to 3 MULTICAST_SESSIONS can be set
         */
        int32_t setMulticastSession(uint8_t index, uint32_t addr, const uint8_t* nsk, const uint8_t* dsk);
 
        /**
         * Set a multicast session counter
         * Up to 3 MULTICAST_SESSIONS can be set
         */
        int32_t setMulticastDownlinkCounter(uint8_t index, uint32_t count);

mDotEvent.h

The address field was added to PacketRx event.

        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);

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.

Committer:
Jenkins@KEILDM1.dc.multitech.prv
Date:
Mon Nov 13 09:34:56 2017 -0600
Revision:
109:41d16d4ab0f0
Parent:
103:06bafd42c324
Child:
111:4bebf247fa58
mdot-library revision 3.0.1-1-gada985f and mbed-os revision mbed-os-5.5.7

Who changed what in which revision?

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