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