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@12:54f9cac9d690, 2016-03-10 (annotated)
- Committer:
- Mike Fiore
- Date:
- Thu Mar 10 14:25:17 2016 -0600
- Revision:
- 12:54f9cac9d690
- Parent:
- 11:d8464345e1f1
- Child:
- 16:b630e18103e5
update to version 1.0.3-1 of mDot library
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" |
mfiore | 0:c62615f15125 | 8 | #include <vector> |
mfiore | 0:c62615f15125 | 9 | #include <map> |
mfiore | 0:c62615f15125 | 10 | #include <string> |
mfiore | 0:c62615f15125 | 11 | |
Mike Fiore |
12:54f9cac9d690 | 12 | class mDotEvent; |
mfiore | 0:c62615f15125 | 13 | class LoRaMacEvent; |
mfiore | 0:c62615f15125 | 14 | class LoRaConfig; |
mfiore | 0:c62615f15125 | 15 | class LoRaMac; |
mfiore | 0:c62615f15125 | 16 | class MdotRadio; |
mfiore | 0:c62615f15125 | 17 | |
mfiore | 0:c62615f15125 | 18 | class mDot { |
mfiore | 0:c62615f15125 | 19 | |
mfiore | 0:c62615f15125 | 20 | private: |
mfiore | 0:c62615f15125 | 21 | |
mfiore | 0:c62615f15125 | 22 | mDot(); |
mfiore | 0:c62615f15125 | 23 | ~mDot(); |
mfiore | 0:c62615f15125 | 24 | |
mfiore | 0:c62615f15125 | 25 | static void idle(void const* args) { |
mfiore | 0:c62615f15125 | 26 | while (1) |
mfiore | 0:c62615f15125 | 27 | __WFI(); |
mfiore | 0:c62615f15125 | 28 | } |
mfiore | 0:c62615f15125 | 29 | |
mfiore | 0:c62615f15125 | 30 | void setLastError(const std::string& str); |
mfiore | 0:c62615f15125 | 31 | |
mfiore | 0:c62615f15125 | 32 | static bool validateBaudRate(const uint32_t& baud); |
mfiore | 0:c62615f15125 | 33 | static bool validateFrequencySubBand(const uint8_t& band); |
mfiore | 0:c62615f15125 | 34 | bool validateDataRate(const uint8_t& dr); |
mfiore | 0:c62615f15125 | 35 | |
mfiore | 0:c62615f15125 | 36 | int32_t joinBase(const uint32_t& retries); |
mfiore | 0:c62615f15125 | 37 | int32_t sendBase(const std::vector<uint8_t>& data, const bool& confirmed = false, const bool& blocking = true, const bool& highBw = false); |
mfiore | 0:c62615f15125 | 38 | void waitForPacket(); |
mfiore | 0:c62615f15125 | 39 | void waitForLinkCheck(); |
mfiore | 0:c62615f15125 | 40 | |
mfiore | 0:c62615f15125 | 41 | void setActivityLedState(const uint8_t& state); |
mfiore | 0:c62615f15125 | 42 | uint8_t getActivityLedState(); |
mfiore | 0:c62615f15125 | 43 | |
mfiore | 0:c62615f15125 | 44 | void blinkActivityLed(void) { |
Mike Fiore |
6:390fc83d588d | 45 | if (_activity_led) { |
Mike Fiore |
6:390fc83d588d | 46 | int val = _activity_led->read(); |
Mike Fiore |
6:390fc83d588d | 47 | _activity_led->write(!val); |
Mike Fiore |
6:390fc83d588d | 48 | } |
mfiore | 0:c62615f15125 | 49 | } |
mfiore | 0:c62615f15125 | 50 | |
mfiore | 0:c62615f15125 | 51 | mDot(const mDot&); |
mfiore | 0:c62615f15125 | 52 | mDot& operator=(const mDot&); |
mfiore | 0:c62615f15125 | 53 | |
Mike Fiore |
7:683dba5d576f | 54 | uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR); |
Mike Fiore |
7:683dba5d576f | 55 | void RTC_WriteBackupRegister(uint32_t RTC_BKP_DR, uint32_t Data); |
Mike Fiore |
7:683dba5d576f | 56 | |
Mike Fiore |
7:683dba5d576f | 57 | void wakeup(); |
Mike Fiore |
7:683dba5d576f | 58 | |
Mike Fiore |
12:54f9cac9d690 | 59 | void enterStopMode(const uint32_t& interval, const uint8_t& wakeup_mode = RTC_ALARM); |
Mike Fiore |
12:54f9cac9d690 | 60 | void enterStandbyMode(const uint32_t& interval, const uint8_t& wakeup_mode = RTC_ALARM); |
Mike Fiore |
12:54f9cac9d690 | 61 | |
mfiore | 0:c62615f15125 | 62 | static mDot* _instance; |
mfiore | 0:c62615f15125 | 63 | |
mfiore | 0:c62615f15125 | 64 | LoRaMac* _mac; |
mfiore | 0:c62615f15125 | 65 | MdotRadio* _radio; |
mfiore | 0:c62615f15125 | 66 | LoRaMacEvent* _events; |
mfiore | 0:c62615f15125 | 67 | LoRaConfig* _config; |
mfiore | 0:c62615f15125 | 68 | Thread _idle_thread; |
mfiore | 0:c62615f15125 | 69 | std::string _last_error; |
mfiore | 0:c62615f15125 | 70 | static const uint32_t _baud_rates[]; |
mfiore | 0:c62615f15125 | 71 | uint8_t _activity_led_state; |
mfiore | 0:c62615f15125 | 72 | Ticker _tick; |
Mike Fiore |
6:390fc83d588d | 73 | DigitalOut* _activity_led; |
Mike Fiore |
6:390fc83d588d | 74 | bool _activity_led_enable; |
Mike Fiore |
6:390fc83d588d | 75 | PinName _activity_led_pin; |
Mike Fiore |
5:0bfe6a650513 | 76 | bool _activity_led_external; |
jreiss | 9:ec2fffe31793 | 77 | uint8_t _linkFailCount; |
Mike Fiore |
7:683dba5d576f | 78 | uint8_t _class; |
Mike Fiore |
7:683dba5d576f | 79 | InterruptIn* _wakeup; |
Mike Fiore |
7:683dba5d576f | 80 | PinName _wakeup_pin; |
mfiore | 0:c62615f15125 | 81 | |
mfiore | 0:c62615f15125 | 82 | typedef enum { |
Jason Reiss |
10:27dafba9fe19 | 83 | OFF, |
Jason Reiss |
10:27dafba9fe19 | 84 | ON, |
Jason Reiss |
10:27dafba9fe19 | 85 | BLINK, |
mfiore | 0:c62615f15125 | 86 | } state; |
mfiore | 0:c62615f15125 | 87 | |
mfiore | 0:c62615f15125 | 88 | public: |
mfiore | 0:c62615f15125 | 89 | |
mfiore | 0:c62615f15125 | 90 | typedef enum { |
Mike Fiore |
7:683dba5d576f | 91 | FM_APPEND = (1 << 0), |
Mike Fiore |
7:683dba5d576f | 92 | FM_TRUNC = (1 << 1), |
Mike Fiore |
7:683dba5d576f | 93 | FM_CREAT = (1 << 2), |
Mike Fiore |
7:683dba5d576f | 94 | FM_RDONLY = (1 << 3), |
Mike Fiore |
7:683dba5d576f | 95 | FM_WRONLY = (1 << 4), |
Mike Fiore |
7:683dba5d576f | 96 | FM_RDWR = (FM_RDONLY | FM_WRONLY), |
Mike Fiore |
7:683dba5d576f | 97 | FM_DIRECT = (1 << 5) |
Mike Fiore |
7:683dba5d576f | 98 | } FileMode; |
Mike Fiore |
7:683dba5d576f | 99 | |
Mike Fiore |
7:683dba5d576f | 100 | typedef enum { |
mfiore | 0:c62615f15125 | 101 | MDOT_OK = 0, |
mfiore | 0:c62615f15125 | 102 | MDOT_INVALID_PARAM = -1, |
mfiore | 0:c62615f15125 | 103 | MDOT_TX_ERROR = -2, |
mfiore | 0:c62615f15125 | 104 | MDOT_RX_ERROR = -3, |
mfiore | 0:c62615f15125 | 105 | MDOT_JOIN_ERROR = -4, |
mfiore | 0:c62615f15125 | 106 | MDOT_TIMEOUT = -5, |
mfiore | 0:c62615f15125 | 107 | MDOT_NOT_JOINED = -6, |
mfiore | 0:c62615f15125 | 108 | MDOT_ENCRYPTION_DISABLED = -7, |
mfiore | 0:c62615f15125 | 109 | MDOT_NO_FREE_CHAN = -8, |
Mike Fiore |
12:54f9cac9d690 | 110 | MDOT_TEST_MODE = -9, |
Mike Fiore |
12:54f9cac9d690 | 111 | MDOT_NO_ENABLED_CHAN = -10, |
Mike Fiore |
12:54f9cac9d690 | 112 | MDOT_AGGREGATED_DUTY_CYCLE = -11, |
mfiore | 0:c62615f15125 | 113 | MDOT_ERROR = -1024, |
mfiore | 0:c62615f15125 | 114 | } mdot_ret_code; |
mfiore | 0:c62615f15125 | 115 | |
mfiore | 0:c62615f15125 | 116 | enum JoinMode { |
Jason Reiss |
10:27dafba9fe19 | 117 | MANUAL, |
Jason Reiss |
10:27dafba9fe19 | 118 | OTA, |
Mike Fiore |
12:54f9cac9d690 | 119 | AUTO_OTA, |
Mike Fiore |
12:54f9cac9d690 | 120 | PEER_TO_PEER |
mfiore | 0:c62615f15125 | 121 | }; |
mfiore | 0:c62615f15125 | 122 | |
mfiore | 0:c62615f15125 | 123 | enum Mode { |
Jason Reiss |
10:27dafba9fe19 | 124 | COMMAND_MODE, |
Jason Reiss |
10:27dafba9fe19 | 125 | SERIAL_MODE |
mfiore | 0:c62615f15125 | 126 | }; |
mfiore | 0:c62615f15125 | 127 | |
mfiore | 0:c62615f15125 | 128 | enum RX_Output { |
Jason Reiss |
10:27dafba9fe19 | 129 | HEXADECIMAL, |
Jason Reiss |
10:27dafba9fe19 | 130 | BINARY |
mfiore | 0:c62615f15125 | 131 | }; |
mfiore | 0:c62615f15125 | 132 | |
mfiore | 0:c62615f15125 | 133 | enum DataRates { |
Mike Fiore |
12:54f9cac9d690 | 134 | DR0, |
Mike Fiore |
12:54f9cac9d690 | 135 | DR1, |
Mike Fiore |
12:54f9cac9d690 | 136 | DR2, |
Mike Fiore |
12:54f9cac9d690 | 137 | DR3, |
Mike Fiore |
12:54f9cac9d690 | 138 | DR4, |
Mike Fiore |
12:54f9cac9d690 | 139 | DR5, |
Mike Fiore |
12:54f9cac9d690 | 140 | DR6, |
Mike Fiore |
12:54f9cac9d690 | 141 | DR7, |
Mike Fiore |
12:54f9cac9d690 | 142 | DR8, |
Mike Fiore |
12:54f9cac9d690 | 143 | DR9, |
Mike Fiore |
12:54f9cac9d690 | 144 | DR10, |
Mike Fiore |
12:54f9cac9d690 | 145 | DR11, |
Mike Fiore |
12:54f9cac9d690 | 146 | DR12, |
Mike Fiore |
12:54f9cac9d690 | 147 | DR13, |
Mike Fiore |
12:54f9cac9d690 | 148 | DR14, |
Mike Fiore |
12:54f9cac9d690 | 149 | DR15, |
Mike Fiore |
12:54f9cac9d690 | 150 | SF_12 = 16, |
Jason Reiss |
10:27dafba9fe19 | 151 | SF_11, |
Jason Reiss |
10:27dafba9fe19 | 152 | SF_10, |
Jason Reiss |
10:27dafba9fe19 | 153 | SF_9, |
Jason Reiss |
10:27dafba9fe19 | 154 | SF_8, |
Jason Reiss |
10:27dafba9fe19 | 155 | SF_7, |
Jason Reiss |
10:27dafba9fe19 | 156 | SF_7H, |
Mike Fiore |
12:54f9cac9d690 | 157 | SF_FSK |
mfiore | 0:c62615f15125 | 158 | }; |
mfiore | 0:c62615f15125 | 159 | |
mfiore | 0:c62615f15125 | 160 | enum FrequencyBands { |
Mike Fiore |
11:d8464345e1f1 | 161 | FB_868, // EU868 |
Mike Fiore |
11:d8464345e1f1 | 162 | FB_915 // US915 |
mfiore | 0:c62615f15125 | 163 | }; |
mfiore | 0:c62615f15125 | 164 | |
mfiore | 0:c62615f15125 | 165 | enum FrequencySubBands { |
Jason Reiss |
10:27dafba9fe19 | 166 | FSB_ALL, |
Jason Reiss |
10:27dafba9fe19 | 167 | FSB_1, |
Jason Reiss |
10:27dafba9fe19 | 168 | FSB_2, |
Jason Reiss |
10:27dafba9fe19 | 169 | FSB_3, |
Jason Reiss |
10:27dafba9fe19 | 170 | FSB_4, |
Jason Reiss |
10:27dafba9fe19 | 171 | FSB_5, |
Jason Reiss |
10:27dafba9fe19 | 172 | FSB_6, |
Jason Reiss |
10:27dafba9fe19 | 173 | FSB_7, |
Jason Reiss |
10:27dafba9fe19 | 174 | FSB_8 |
mfiore | 0:c62615f15125 | 175 | }; |
mfiore | 0:c62615f15125 | 176 | |
Mike Fiore |
6:390fc83d588d | 177 | enum JoinByteOrder { |
Jason Reiss |
10:27dafba9fe19 | 178 | LSB, |
Jason Reiss |
10:27dafba9fe19 | 179 | MSB |
Mike Fiore |
6:390fc83d588d | 180 | }; |
Mike Fiore |
6:390fc83d588d | 181 | |
Mike Fiore |
7:683dba5d576f | 182 | enum wakeup_mode { |
Jason Reiss |
10:27dafba9fe19 | 183 | RTC_ALARM, |
Jason Reiss |
10:27dafba9fe19 | 184 | INTERRUPT, |
Jason Reiss |
10:27dafba9fe19 | 185 | RTC_ALARM_OR_INTERRUPT |
Mike Fiore |
7:683dba5d576f | 186 | }; |
Mike Fiore |
7:683dba5d576f | 187 | |
jreiss | 9:ec2fffe31793 | 188 | enum UserBackupRegs { |
Jason Reiss |
10:27dafba9fe19 | 189 | UBR0, |
Jason Reiss |
10:27dafba9fe19 | 190 | UBR1, |
Jason Reiss |
10:27dafba9fe19 | 191 | UBR2, |
Jason Reiss |
10:27dafba9fe19 | 192 | UBR3, |
Jason Reiss |
10:27dafba9fe19 | 193 | UBR4, |
Jason Reiss |
10:27dafba9fe19 | 194 | UBR5, |
Jason Reiss |
10:27dafba9fe19 | 195 | UBR6, |
Jason Reiss |
10:27dafba9fe19 | 196 | UBR7, |
Jason Reiss |
10:27dafba9fe19 | 197 | UBR8, |
Jason Reiss |
10:27dafba9fe19 | 198 | UBR9 |
jreiss | 9:ec2fffe31793 | 199 | }; |
jreiss | 9:ec2fffe31793 | 200 | |
Mike Fiore |
7:683dba5d576f | 201 | typedef struct { |
Mike Fiore |
7:683dba5d576f | 202 | int16_t fd; |
Mike Fiore |
7:683dba5d576f | 203 | char name[30]; |
Mike Fiore |
7:683dba5d576f | 204 | uint32_t size; |
Mike Fiore |
7:683dba5d576f | 205 | } mdot_file; |
Mike Fiore |
7:683dba5d576f | 206 | |
mfiore | 0:c62615f15125 | 207 | typedef struct { |
mfiore | 0:c62615f15125 | 208 | uint32_t Up; |
mfiore | 0:c62615f15125 | 209 | uint32_t Down; |
mfiore | 0:c62615f15125 | 210 | uint32_t Joins; |
mfiore | 0:c62615f15125 | 211 | uint32_t JoinFails; |
mfiore | 0:c62615f15125 | 212 | uint32_t MissedAcks; |
mfiore | 0:c62615f15125 | 213 | } mdot_stats; |
mfiore | 0:c62615f15125 | 214 | |
mfiore | 0:c62615f15125 | 215 | typedef struct { |
mfiore | 0:c62615f15125 | 216 | int16_t last; |
mfiore | 0:c62615f15125 | 217 | int16_t min; |
mfiore | 0:c62615f15125 | 218 | int16_t max; |
mfiore | 0:c62615f15125 | 219 | int16_t avg; |
mfiore | 0:c62615f15125 | 220 | } rssi_stats; |
mfiore | 0:c62615f15125 | 221 | |
mfiore | 0:c62615f15125 | 222 | typedef struct { |
Mike Fiore |
11:d8464345e1f1 | 223 | int16_t last; |
Mike Fiore |
11:d8464345e1f1 | 224 | int16_t min; |
Mike Fiore |
11:d8464345e1f1 | 225 | int16_t max; |
Mike Fiore |
11:d8464345e1f1 | 226 | int16_t avg; |
mfiore | 0:c62615f15125 | 227 | } snr_stats; |
mfiore | 0:c62615f15125 | 228 | |
mfiore | 0:c62615f15125 | 229 | typedef struct { |
mfiore | 0:c62615f15125 | 230 | bool status; |
mfiore | 0:c62615f15125 | 231 | int32_t dBm; |
mfiore | 0:c62615f15125 | 232 | uint32_t gateways; |
mfiore | 0:c62615f15125 | 233 | std::vector<uint8_t> payload; |
mfiore | 0:c62615f15125 | 234 | } link_check; |
mfiore | 0:c62615f15125 | 235 | |
mfiore | 0:c62615f15125 | 236 | typedef struct { |
mfiore | 0:c62615f15125 | 237 | int32_t status; |
mfiore | 0:c62615f15125 | 238 | int16_t rssi; |
mfiore | 0:c62615f15125 | 239 | int16_t snr; |
mfiore | 0:c62615f15125 | 240 | } ping_response; |
mfiore | 0:c62615f15125 | 241 | |
mfiore | 0:c62615f15125 | 242 | static const uint8_t MaxLengths_915[]; |
mfiore | 0:c62615f15125 | 243 | static const uint8_t MaxLengths_868[]; |
mfiore | 0:c62615f15125 | 244 | |
mfiore | 0:c62615f15125 | 245 | static std::string JoinModeStr(uint8_t mode); |
mfiore | 0:c62615f15125 | 246 | static std::string ModeStr(uint8_t mode); |
mfiore | 0:c62615f15125 | 247 | static std::string RxOutputStr(uint8_t format); |
mfiore | 0:c62615f15125 | 248 | static std::string DataRateStr(uint8_t rate); |
mfiore | 0:c62615f15125 | 249 | static std::string FrequencyBandStr(uint8_t band); |
mfiore | 0:c62615f15125 | 250 | static std::string FrequencySubBandStr(uint8_t band); |
mfiore | 0:c62615f15125 | 251 | |
jreiss | 9:ec2fffe31793 | 252 | uint32_t UserRegisters[10]; |
jreiss | 9:ec2fffe31793 | 253 | |
mfiore | 0:c62615f15125 | 254 | /** Get a handle to the singleton object |
mfiore | 0:c62615f15125 | 255 | * @returns pointer to mDot object |
mfiore | 0:c62615f15125 | 256 | */ |
mfiore | 0:c62615f15125 | 257 | static mDot* getInstance(); |
mfiore | 0:c62615f15125 | 258 | |
Mike Fiore |
12:54f9cac9d690 | 259 | void setEvents(mDotEvent* events); |
Mike Fiore |
12:54f9cac9d690 | 260 | |
mfiore | 0:c62615f15125 | 261 | /** Get library version information |
mfiore | 0:c62615f15125 | 262 | * @returns string containing library version information |
mfiore | 0:c62615f15125 | 263 | */ |
mfiore | 0:c62615f15125 | 264 | std::string getId(); |
mfiore | 0:c62615f15125 | 265 | |
mfiore | 0:c62615f15125 | 266 | /** Perform a soft reset of the system |
mfiore | 0:c62615f15125 | 267 | */ |
mfiore | 0:c62615f15125 | 268 | void resetCpu(); |
mfiore | 0:c62615f15125 | 269 | |
mfiore | 0:c62615f15125 | 270 | /** Reset config to factory default |
mfiore | 0:c62615f15125 | 271 | */ |
mfiore | 0:c62615f15125 | 272 | void resetConfig(); |
mfiore | 0:c62615f15125 | 273 | |
mfiore | 0:c62615f15125 | 274 | /** Save config data to non volatile memory |
mfiore | 0:c62615f15125 | 275 | * @returns true if success, false if failure |
mfiore | 0:c62615f15125 | 276 | */ |
mfiore | 0:c62615f15125 | 277 | bool saveConfig(); |
mfiore | 0:c62615f15125 | 278 | |
mfiore | 0:c62615f15125 | 279 | /** Set the log level for the library |
mfiore | 0:c62615f15125 | 280 | * options are: |
mfiore | 0:c62615f15125 | 281 | * NONE_LEVEL - logging is off at this level |
mfiore | 0:c62615f15125 | 282 | * FATAL_LEVEL - only critical errors will be reported |
mfiore | 0:c62615f15125 | 283 | * ERROR_LEVEL |
mfiore | 0:c62615f15125 | 284 | * WARNING_LEVEL |
mfiore | 0:c62615f15125 | 285 | * INFO_LEVEL |
mfiore | 0:c62615f15125 | 286 | * DEBUG_LEVEL |
mfiore | 0:c62615f15125 | 287 | * TRACE_LEVEL - every detail will be reported |
mfiore | 0:c62615f15125 | 288 | * @param level the level to log at |
mfiore | 0:c62615f15125 | 289 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 290 | */ |
mfiore | 0:c62615f15125 | 291 | int32_t setLogLevel(const uint8_t& level); |
mfiore | 0:c62615f15125 | 292 | |
mfiore | 0:c62615f15125 | 293 | /** Get the current log level for the library |
mfiore | 0:c62615f15125 | 294 | * @returns current log level |
mfiore | 0:c62615f15125 | 295 | */ |
Mike Fiore |
6:390fc83d588d | 296 | uint8_t getLogLevel(); |
Mike Fiore |
6:390fc83d588d | 297 | |
Mike Fiore |
12:54f9cac9d690 | 298 | /** Seed pseudo RNG in LoRaMac layer, uses random value from radio RSSI reading by default |
Mike Fiore |
12:54f9cac9d690 | 299 | * @param seed for RNG |
Mike Fiore |
12:54f9cac9d690 | 300 | */ |
Mike Fiore |
12:54f9cac9d690 | 301 | void seedRandom(uint32_t seed); |
Mike Fiore |
12:54f9cac9d690 | 302 | |
Mike Fiore |
6:390fc83d588d | 303 | /** Enable or disable the activity LED. |
Mike Fiore |
6:390fc83d588d | 304 | * @param enable true to enable the LED, false to disable |
Mike Fiore |
6:390fc83d588d | 305 | */ |
Mike Fiore |
6:390fc83d588d | 306 | void setActivityLedEnable(const bool& enable); |
Mike Fiore |
4:94969e981dcc | 307 | |
Mike Fiore |
6:390fc83d588d | 308 | /** Find out if the activity LED is enabled |
Mike Fiore |
6:390fc83d588d | 309 | * @returns true if activity LED is enabled, false if disabled |
Mike Fiore |
6:390fc83d588d | 310 | */ |
Mike Fiore |
6:390fc83d588d | 311 | bool getActivityLedEnable(); |
Mike Fiore |
6:390fc83d588d | 312 | |
Mike Fiore |
6:390fc83d588d | 313 | /** Use a different pin for the activity LED. |
Mike Fiore |
6:390fc83d588d | 314 | * The default is XBEE_RSSI. |
Mike Fiore |
6:390fc83d588d | 315 | * @param pin the new pin to use |
Mike Fiore |
6:390fc83d588d | 316 | */ |
Mike Fiore |
6:390fc83d588d | 317 | void setActivityLedPin(const PinName& pin); |
Mike Fiore |
6:390fc83d588d | 318 | |
Mike Fiore |
5:0bfe6a650513 | 319 | /** Use an external DigitalOut object for the activity LED. |
Mike Fiore |
5:0bfe6a650513 | 320 | * The pointer must stay valid! |
Mike Fiore |
5:0bfe6a650513 | 321 | * @param pin the DigitalOut object to use |
Mike Fiore |
5:0bfe6a650513 | 322 | */ |
Mike Fiore |
5:0bfe6a650513 | 323 | void setActivityLedPin(DigitalOut* pin); |
Mike Fiore |
6:390fc83d588d | 324 | |
Mike Fiore |
6:390fc83d588d | 325 | /** Find out what pin the activity LED is on |
Mike Fiore |
6:390fc83d588d | 326 | * @returns the pin the activity LED is using |
Mike Fiore |
6:390fc83d588d | 327 | */ |
Mike Fiore |
6:390fc83d588d | 328 | PinName getActivityLedPin(); |
mfiore | 0:c62615f15125 | 329 | |
Mike Fiore |
12:54f9cac9d690 | 330 | /** Returns boolean indicative of start-up from standby mode |
Mike Fiore |
12:54f9cac9d690 | 331 | * @returns true if dot woke from standby |
Mike Fiore |
12:54f9cac9d690 | 332 | */ |
Mike Fiore |
12:54f9cac9d690 | 333 | bool getStandbyFlag(); |
Mike Fiore |
12:54f9cac9d690 | 334 | |
Mike Fiore |
12:54f9cac9d690 | 335 | /** Add a channel frequencies currently in use |
Mike Fiore |
12:54f9cac9d690 | 336 | * @returns MDOT_OK |
Mike Fiore |
12:54f9cac9d690 | 337 | */ |
Mike Fiore |
12:54f9cac9d690 | 338 | int32_t addChannel(uint8_t index, uint32_t frequency, uint8_t datarateRange); |
Mike Fiore |
12:54f9cac9d690 | 339 | |
mfiore | 0:c62615f15125 | 340 | /** Get list of channel frequencies currently in use |
mfiore | 0:c62615f15125 | 341 | * @returns vector of channels currently in use |
mfiore | 0:c62615f15125 | 342 | */ |
mfiore | 0:c62615f15125 | 343 | std::vector<uint32_t> getChannels(); |
mfiore | 0:c62615f15125 | 344 | |
Mike Fiore |
12:54f9cac9d690 | 345 | /** Get list of channel datarate ranges currently in use |
Mike Fiore |
12:54f9cac9d690 | 346 | * @returns vector of datarate ranges currently in use |
Mike Fiore |
12:54f9cac9d690 | 347 | */ |
Mike Fiore |
12:54f9cac9d690 | 348 | std::vector<uint8_t> getChannelRanges(); |
Mike Fiore |
12:54f9cac9d690 | 349 | |
Mike Fiore |
12:54f9cac9d690 | 350 | /** Get list of channel frequencies in config file to be used as session defaults |
Mike Fiore |
12:54f9cac9d690 | 351 | * @returns vector of channels in config file |
Mike Fiore |
12:54f9cac9d690 | 352 | */ |
Mike Fiore |
12:54f9cac9d690 | 353 | std::vector<uint32_t> getConfigChannels(); |
Mike Fiore |
12:54f9cac9d690 | 354 | |
Mike Fiore |
12:54f9cac9d690 | 355 | /** Get list of channel datarate ranges in config file to be used as session defaults |
Mike Fiore |
12:54f9cac9d690 | 356 | * @returns vector of datarate ranges in config file |
Mike Fiore |
12:54f9cac9d690 | 357 | */ |
Mike Fiore |
12:54f9cac9d690 | 358 | std::vector<uint8_t> getConfigChannelRanges(); |
Mike Fiore |
12:54f9cac9d690 | 359 | |
mfiore | 0:c62615f15125 | 360 | /** Get frequency band |
mfiore | 0:c62615f15125 | 361 | * @returns FB_915 if configured for United States, FB_868 if configured for Europe |
mfiore | 0:c62615f15125 | 362 | */ |
mfiore | 0:c62615f15125 | 363 | uint8_t getFrequencyBand(); |
mfiore | 0:c62615f15125 | 364 | |
mfiore | 0:c62615f15125 | 365 | /** Set frequency sub band |
mfiore | 0:c62615f15125 | 366 | * only applicable if frequency band is set for United States (FB_915) |
Jason Reiss |
10:27dafba9fe19 | 367 | * sub band 0 will allow the radio to use all 64 channels |
mfiore | 0:c62615f15125 | 368 | * sub band 1 - 8 will allow the radio to use the 8 channels in that sub band |
mfiore | 0:c62615f15125 | 369 | * for use with Conduit gateway and MTAC_LORA, use sub bands 1 - 8, not sub band 0 |
mfiore | 0:c62615f15125 | 370 | * @param band the sub band to use (0 - 8) |
mfiore | 0:c62615f15125 | 371 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 372 | */ |
mfiore | 0:c62615f15125 | 373 | int32_t setFrequencySubBand(const uint8_t& band); |
mfiore | 0:c62615f15125 | 374 | |
mfiore | 0:c62615f15125 | 375 | /** Get frequency sub band |
mfiore | 0:c62615f15125 | 376 | * @returns frequency sub band currently in use |
mfiore | 0:c62615f15125 | 377 | */ |
mfiore | 0:c62615f15125 | 378 | uint8_t getFrequencySubBand(); |
mfiore | 0:c62615f15125 | 379 | |
Mike Fiore |
12:54f9cac9d690 | 380 | /** Get the datarate currently in use within the MAC layer |
Mike Fiore |
12:54f9cac9d690 | 381 | * returns 0-15 |
Mike Fiore |
12:54f9cac9d690 | 382 | */ |
Mike Fiore |
12:54f9cac9d690 | 383 | uint8_t getSessionDataRate(); |
Mike Fiore |
12:54f9cac9d690 | 384 | |
mfiore | 0:c62615f15125 | 385 | /** Enable/disable public network mode |
Jason Reiss |
10:27dafba9fe19 | 386 | * JoinDelay will be set to (public: 5s, private: 1s) and |
Jason Reiss |
10:27dafba9fe19 | 387 | * RxDelay will be set to 1s both can be adjusted afterwards |
mfiore | 0:c62615f15125 | 388 | * @param on should be true to enable public network mode |
mfiore | 0:c62615f15125 | 389 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 390 | */ |
mfiore | 0:c62615f15125 | 391 | int32_t setPublicNetwork(const bool& on); |
mfiore | 0:c62615f15125 | 392 | |
mfiore | 0:c62615f15125 | 393 | /** Get public network mode |
mfiore | 0:c62615f15125 | 394 | * @returns true if public network mode is enabled |
mfiore | 0:c62615f15125 | 395 | */ |
mfiore | 0:c62615f15125 | 396 | bool getPublicNetwork(); |
mfiore | 0:c62615f15125 | 397 | |
mfiore | 0:c62615f15125 | 398 | /** Get the device ID |
mfiore | 0:c62615f15125 | 399 | * @returns vector containing the device ID (size 8) |
mfiore | 0:c62615f15125 | 400 | */ |
mfiore | 0:c62615f15125 | 401 | std::vector<uint8_t> getDeviceId(); |
mfiore | 0:c62615f15125 | 402 | |
Jason Reiss |
10:27dafba9fe19 | 403 | /** Get the device port to be used for lora application data (1-223) |
Jason Reiss |
10:27dafba9fe19 | 404 | * @returns port |
Jason Reiss |
10:27dafba9fe19 | 405 | */ |
Jason Reiss |
10:27dafba9fe19 | 406 | uint8_t getAppPort(); |
Jason Reiss |
10:27dafba9fe19 | 407 | |
Jason Reiss |
10:27dafba9fe19 | 408 | /** Set the device port to be used for lora application data (1-223) |
Jason Reiss |
10:27dafba9fe19 | 409 | * @returns MDOT_OK if success |
Jason Reiss |
10:27dafba9fe19 | 410 | */ |
Jason Reiss |
10:27dafba9fe19 | 411 | int32_t setAppPort(uint8_t port); |
Jason Reiss |
10:27dafba9fe19 | 412 | |
Jason Reiss |
10:27dafba9fe19 | 413 | /** Set the device class A, B or C |
Jason Reiss |
10:27dafba9fe19 | 414 | * @returns MDOT_OK if success |
Jason Reiss |
10:27dafba9fe19 | 415 | */ |
Jason Reiss |
10:27dafba9fe19 | 416 | int32_t setClass(std::string newClass); |
Jason Reiss |
10:27dafba9fe19 | 417 | |
Jason Reiss |
10:27dafba9fe19 | 418 | /** Get the device class A, B or C |
Jason Reiss |
10:27dafba9fe19 | 419 | * @returns MDOT_OK if success |
Jason Reiss |
10:27dafba9fe19 | 420 | */ |
Jason Reiss |
10:27dafba9fe19 | 421 | std::string getClass(); |
Jason Reiss |
10:27dafba9fe19 | 422 | |
Jason Reiss |
10:27dafba9fe19 | 423 | /** Get the max packet length with current settings |
Jason Reiss |
10:27dafba9fe19 | 424 | * @returns max packet length |
Jason Reiss |
10:27dafba9fe19 | 425 | */ |
Jason Reiss |
10:27dafba9fe19 | 426 | uint8_t getMaxPacketLength(); |
Jason Reiss |
10:27dafba9fe19 | 427 | |
mfiore | 0:c62615f15125 | 428 | /** Set network address |
mfiore | 0:c62615f15125 | 429 | * for use with MANUAL network join mode, will be assigned in OTA & AUTO_OTA modes |
mfiore | 0:c62615f15125 | 430 | * @param addr a vector of 4 bytes |
mfiore | 0:c62615f15125 | 431 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 432 | */ |
mfiore | 0:c62615f15125 | 433 | int32_t setNetworkAddress(const std::vector<uint8_t>& addr); |
mfiore | 0:c62615f15125 | 434 | |
mfiore | 0:c62615f15125 | 435 | /** Get network address |
mfiore | 0:c62615f15125 | 436 | * @returns vector containing network address (size 4) |
mfiore | 0:c62615f15125 | 437 | */ |
mfiore | 0:c62615f15125 | 438 | std::vector<uint8_t> getNetworkAddress(); |
mfiore | 0:c62615f15125 | 439 | |
mfiore | 0:c62615f15125 | 440 | /** Set network session key |
mfiore | 0:c62615f15125 | 441 | * for use with MANUAL network join mode, will be assigned in OTA & AUTO_OTA modes |
mfiore | 0:c62615f15125 | 442 | * @param key a vector of 16 bytes |
mfiore | 0:c62615f15125 | 443 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 444 | */ |
mfiore | 0:c62615f15125 | 445 | int32_t setNetworkSessionKey(const std::vector<uint8_t>& key); |
mfiore | 0:c62615f15125 | 446 | |
mfiore | 0:c62615f15125 | 447 | /** Get network session key |
mfiore | 0:c62615f15125 | 448 | * @returns vector containing network session key (size 16) |
mfiore | 0:c62615f15125 | 449 | */ |
mfiore | 0:c62615f15125 | 450 | std::vector<uint8_t> getNetworkSessionKey(); |
mfiore | 0:c62615f15125 | 451 | |
mfiore | 0:c62615f15125 | 452 | /** Set data session key |
mfiore | 0:c62615f15125 | 453 | * for use with MANUAL network join mode, will be assigned in OTA & AUTO_OTA modes |
mfiore | 0:c62615f15125 | 454 | * @param key a vector of 16 bytes |
mfiore | 0:c62615f15125 | 455 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 456 | */ |
mfiore | 0:c62615f15125 | 457 | int32_t setDataSessionKey(const std::vector<uint8_t>& key); |
mfiore | 0:c62615f15125 | 458 | |
mfiore | 0:c62615f15125 | 459 | /** Get data session key |
mfiore | 0:c62615f15125 | 460 | * @returns vector containing data session key (size 16) |
mfiore | 0:c62615f15125 | 461 | */ |
mfiore | 0:c62615f15125 | 462 | std::vector<uint8_t> getDataSessionKey(); |
mfiore | 0:c62615f15125 | 463 | |
mfiore | 0:c62615f15125 | 464 | /** Set network name |
mfiore | 0:c62615f15125 | 465 | * for use with OTA & AUTO_OTA network join modes |
mfiore | 0:c62615f15125 | 466 | * generates network ID (crc64 of name) automatically |
mfiore | 0:c62615f15125 | 467 | * @param name a string of of at least 8 bytes and no more than 128 bytes |
mfiore | 0:c62615f15125 | 468 | * @return MDOT_OK if success |
mfiore | 0:c62615f15125 | 469 | */ |
mfiore | 0:c62615f15125 | 470 | int32_t setNetworkName(const std::string& name); |
mfiore | 0:c62615f15125 | 471 | |
mfiore | 0:c62615f15125 | 472 | /** Get network name |
mfiore | 0:c62615f15125 | 473 | * @return string containing network name (size 8 to 128) |
mfiore | 0:c62615f15125 | 474 | */ |
mfiore | 0:c62615f15125 | 475 | std::string getNetworkName(); |
mfiore | 0:c62615f15125 | 476 | |
mfiore | 0:c62615f15125 | 477 | /** Set network ID |
mfiore | 0:c62615f15125 | 478 | * for use with OTA & AUTO_OTA network join modes |
mfiore | 0:c62615f15125 | 479 | * setting network ID via this function sets network name to empty |
mfiore | 0:c62615f15125 | 480 | * @param id a vector of 8 bytes |
mfiore | 0:c62615f15125 | 481 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 482 | */ |
mfiore | 0:c62615f15125 | 483 | int32_t setNetworkId(const std::vector<uint8_t>& id); |
mfiore | 0:c62615f15125 | 484 | |
mfiore | 0:c62615f15125 | 485 | /** Get network ID |
mfiore | 0:c62615f15125 | 486 | * @returns vector containing network ID (size 8) |
mfiore | 0:c62615f15125 | 487 | */ |
mfiore | 0:c62615f15125 | 488 | std::vector<uint8_t> getNetworkId(); |
mfiore | 0:c62615f15125 | 489 | |
mfiore | 0:c62615f15125 | 490 | /** Set network passphrase |
mfiore | 0:c62615f15125 | 491 | * for use with OTA & AUTO_OTA network join modes |
mfiore | 0:c62615f15125 | 492 | * generates network key (cmac of passphrase) automatically |
mfiore | 0:c62615f15125 | 493 | * @param name a string of of at least 8 bytes and no more than 128 bytes |
mfiore | 0:c62615f15125 | 494 | * @return MDOT_OK if success |
mfiore | 0:c62615f15125 | 495 | */ |
mfiore | 0:c62615f15125 | 496 | int32_t setNetworkPassphrase(const std::string& passphrase); |
mfiore | 0:c62615f15125 | 497 | |
mfiore | 0:c62615f15125 | 498 | /** Get network passphrase |
mfiore | 0:c62615f15125 | 499 | * @return string containing network passphrase (size 8 to 128) |
mfiore | 0:c62615f15125 | 500 | */ |
mfiore | 0:c62615f15125 | 501 | std::string getNetworkPassphrase(); |
mfiore | 0:c62615f15125 | 502 | |
mfiore | 0:c62615f15125 | 503 | /** Set network key |
mfiore | 0:c62615f15125 | 504 | * for use with OTA & AUTO_OTA network join modes |
mfiore | 0:c62615f15125 | 505 | * setting network key via this function sets network passphrase to empty |
mfiore | 0:c62615f15125 | 506 | * @param id a vector of 16 bytes |
mfiore | 0:c62615f15125 | 507 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 508 | */ |
mfiore | 0:c62615f15125 | 509 | int32_t setNetworkKey(const std::vector<uint8_t>& id); |
mfiore | 0:c62615f15125 | 510 | |
mfiore | 0:c62615f15125 | 511 | /** Get network key |
mfiore | 0:c62615f15125 | 512 | * @returns a vector containing network key (size 16) |
mfiore | 0:c62615f15125 | 513 | */ |
mfiore | 0:c62615f15125 | 514 | std::vector<uint8_t> getNetworkKey(); |
mfiore | 0:c62615f15125 | 515 | |
Mike Fiore |
6:390fc83d588d | 516 | /** Set join byte order |
Mike Fiore |
6:390fc83d588d | 517 | * @param order 0:LSB 1:MSB |
Mike Fiore |
6:390fc83d588d | 518 | */ |
Mike Fiore |
6:390fc83d588d | 519 | uint32_t setJoinByteOrder(uint8_t order); |
Mike Fiore |
6:390fc83d588d | 520 | |
Mike Fiore |
6:390fc83d588d | 521 | /** Get join byte order |
Mike Fiore |
6:390fc83d588d | 522 | * @returns byte order to use in joins 0:LSB 1:MSB |
Mike Fiore |
6:390fc83d588d | 523 | */ |
Mike Fiore |
6:390fc83d588d | 524 | uint8_t getJoinByteOrder(); |
Mike Fiore |
6:390fc83d588d | 525 | |
mfiore | 0:c62615f15125 | 526 | /** Attempt to join network |
Mike Fiore |
12:54f9cac9d690 | 527 | * each attempt will be made with a random datarate up to the configured datarate |
Mike Fiore |
12:54f9cac9d690 | 528 | * 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 | 529 | * Check getNextTxMs() for time until next join attempt can be made |
mfiore | 0:c62615f15125 | 530 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 531 | */ |
mfiore | 0:c62615f15125 | 532 | int32_t joinNetwork(); |
mfiore | 0:c62615f15125 | 533 | |
mfiore | 0:c62615f15125 | 534 | /** Attempts to join network once |
mfiore | 0:c62615f15125 | 535 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 536 | */ |
mfiore | 0:c62615f15125 | 537 | int32_t joinNetworkOnce(); |
mfiore | 0:c62615f15125 | 538 | |
mfiore | 0:c62615f15125 | 539 | /** Resets current network session, essentially disconnecting from the network |
mfiore | 0:c62615f15125 | 540 | * has no effect for MANUAL network join mode |
mfiore | 0:c62615f15125 | 541 | */ |
mfiore | 0:c62615f15125 | 542 | void resetNetworkSession(); |
mfiore | 0:c62615f15125 | 543 | |
Mike Fiore |
12:54f9cac9d690 | 544 | /** Restore saved network session from flash |
Mike Fiore |
12:54f9cac9d690 | 545 | * has no effect for MANUAL network join mode |
Mike Fiore |
12:54f9cac9d690 | 546 | */ |
Mike Fiore |
12:54f9cac9d690 | 547 | void restoreNetworkSession(); |
Mike Fiore |
12:54f9cac9d690 | 548 | |
Mike Fiore |
12:54f9cac9d690 | 549 | /** Save current network session to flash |
Mike Fiore |
12:54f9cac9d690 | 550 | * has no effect for MANUAL network join mode |
Mike Fiore |
12:54f9cac9d690 | 551 | */ |
Mike Fiore |
12:54f9cac9d690 | 552 | void saveNetworkSession(); |
Mike Fiore |
12:54f9cac9d690 | 553 | |
mfiore | 0:c62615f15125 | 554 | /** Set number of times joining will retry before giving up |
mfiore | 0:c62615f15125 | 555 | * @param retries must be between 0 - 255 |
mfiore | 0:c62615f15125 | 556 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 557 | */ |
mfiore | 0:c62615f15125 | 558 | int32_t setJoinRetries(const uint8_t& retries); |
mfiore | 0:c62615f15125 | 559 | |
mfiore | 0:c62615f15125 | 560 | /** Set number of times joining will retry before giving up |
mfiore | 0:c62615f15125 | 561 | * @returns join retries (0 - 255) |
mfiore | 0:c62615f15125 | 562 | */ |
mfiore | 0:c62615f15125 | 563 | uint8_t getJoinRetries(); |
mfiore | 0:c62615f15125 | 564 | |
mfiore | 0:c62615f15125 | 565 | /** Set network join mode |
mfiore | 0:c62615f15125 | 566 | * MANUAL: set network address and session keys manually |
mfiore | 0:c62615f15125 | 567 | * OTA: User sets network name and passphrase, then attempts to join |
mfiore | 0:c62615f15125 | 568 | * AUTO_OTA: same as OTA, but network sessions can be saved and restored |
mfiore | 0:c62615f15125 | 569 | * @param mode MANUAL, OTA, or AUTO_OTA |
mfiore | 0:c62615f15125 | 570 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 571 | */ |
mfiore | 0:c62615f15125 | 572 | int32_t setJoinMode(const uint8_t& mode); |
mfiore | 0:c62615f15125 | 573 | |
mfiore | 0:c62615f15125 | 574 | /** Get network join mode |
mfiore | 0:c62615f15125 | 575 | * @returns MANUAL, OTA, or AUTO_OTA |
mfiore | 0:c62615f15125 | 576 | */ |
mfiore | 0:c62615f15125 | 577 | uint8_t getJoinMode(); |
mfiore | 0:c62615f15125 | 578 | |
mfiore | 0:c62615f15125 | 579 | /** Get network join status |
mfiore | 0:c62615f15125 | 580 | * @returns true if currently joined to network |
mfiore | 0:c62615f15125 | 581 | */ |
mfiore | 0:c62615f15125 | 582 | bool getNetworkJoinStatus(); |
mfiore | 0:c62615f15125 | 583 | |
mfiore | 0:c62615f15125 | 584 | /** Do a network link check |
mfiore | 0:c62615f15125 | 585 | * application data may be returned in response to a network link check command |
mfiore | 0:c62615f15125 | 586 | * @returns link_check structure containing success, dBm above noise floor, gateways in range, and packet payload |
mfiore | 0:c62615f15125 | 587 | */ |
mfiore | 0:c62615f15125 | 588 | link_check networkLinkCheck(); |
mfiore | 0:c62615f15125 | 589 | |
mfiore | 0:c62615f15125 | 590 | /** Set network link check count to perform automatic link checks every count packets |
mfiore | 0:c62615f15125 | 591 | * only applicable if ACKs are disabled |
mfiore | 0:c62615f15125 | 592 | * @param count must be between 0 - 255 |
mfiore | 0:c62615f15125 | 593 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 594 | */ |
mfiore | 0:c62615f15125 | 595 | int32_t setLinkCheckCount(const uint8_t& count); |
mfiore | 0:c62615f15125 | 596 | |
mfiore | 0:c62615f15125 | 597 | /** Get network link check count |
mfiore | 0:c62615f15125 | 598 | * @returns count (0 - 255) |
mfiore | 0:c62615f15125 | 599 | */ |
mfiore | 0:c62615f15125 | 600 | uint8_t getLinkCheckCount(); |
mfiore | 0:c62615f15125 | 601 | |
mfiore | 0:c62615f15125 | 602 | /** Set network link check threshold, number of link check failures or missed acks to tolerate |
mfiore | 0:c62615f15125 | 603 | * before considering network connection lost |
mfiore | 0:c62615f15125 | 604 | * @pararm count must be between 0 - 255 |
mfiore | 0:c62615f15125 | 605 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 606 | */ |
mfiore | 0:c62615f15125 | 607 | int32_t setLinkCheckThreshold(const uint8_t& count); |
mfiore | 0:c62615f15125 | 608 | |
mfiore | 0:c62615f15125 | 609 | /** Get network link check threshold |
mfiore | 0:c62615f15125 | 610 | * @returns threshold (0 - 255) |
mfiore | 0:c62615f15125 | 611 | */ |
mfiore | 0:c62615f15125 | 612 | uint8_t getLinkCheckThreshold(); |
mfiore | 0:c62615f15125 | 613 | |
Mike Fiore |
12:54f9cac9d690 | 614 | /** Get/set number of failed link checks in the current session |
Mike Fiore |
12:54f9cac9d690 | 615 | * @returns count (0 - 255) |
Mike Fiore |
12:54f9cac9d690 | 616 | */ |
Mike Fiore |
12:54f9cac9d690 | 617 | uint8_t getLinkFailCount(); |
Mike Fiore |
12:54f9cac9d690 | 618 | int32_t setLinkFailCount(uint8_t count); |
Mike Fiore |
12:54f9cac9d690 | 619 | |
Mike Fiore |
12:54f9cac9d690 | 620 | /** Set UpLinkCounter number of packets sent to the gateway during this network session (sequence number) |
Mike Fiore |
12:54f9cac9d690 | 621 | * @returns MDOT_OK |
Mike Fiore |
12:54f9cac9d690 | 622 | */ |
Mike Fiore |
12:54f9cac9d690 | 623 | int32_t setUpLinkCounter(uint32_t count); |
Mike Fiore |
12:54f9cac9d690 | 624 | |
mfiore | 0:c62615f15125 | 625 | /** Get UpLinkCounter |
mfiore | 0:c62615f15125 | 626 | * @returns number of packets sent to the gateway during this network session (sequence number) |
mfiore | 0:c62615f15125 | 627 | */ |
mfiore | 0:c62615f15125 | 628 | uint32_t getUpLinkCounter(); |
mfiore | 0:c62615f15125 | 629 | |
Mike Fiore |
12:54f9cac9d690 | 630 | /** Set UpLinkCounter number of packets sent by the gateway during this network session (sequence number) |
Mike Fiore |
12:54f9cac9d690 | 631 | * @returns MDOT_OK |
Mike Fiore |
12:54f9cac9d690 | 632 | */ |
Mike Fiore |
12:54f9cac9d690 | 633 | int32_t setDownLinkCounter(uint32_t count); |
Mike Fiore |
12:54f9cac9d690 | 634 | |
Mike Fiore |
12:54f9cac9d690 | 635 | /** Get DownLinkCounter |
Mike Fiore |
12:54f9cac9d690 | 636 | * @returns number of packets sent by the gateway during this network session (sequence number) |
Mike Fiore |
12:54f9cac9d690 | 637 | */ |
Mike Fiore |
12:54f9cac9d690 | 638 | uint32_t getDownLinkCounter(); |
Mike Fiore |
12:54f9cac9d690 | 639 | |
mfiore | 0:c62615f15125 | 640 | /** Enable/disable AES encryption |
mfiore | 0:c62615f15125 | 641 | * AES encryption must be enabled for use with Conduit gateway and MTAC_LORA card |
mfiore | 0:c62615f15125 | 642 | * @param on true for AES encryption to be enabled |
mfiore | 0:c62615f15125 | 643 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 644 | */ |
mfiore | 0:c62615f15125 | 645 | int32_t setAesEncryption(const bool& on); |
mfiore | 0:c62615f15125 | 646 | |
mfiore | 0:c62615f15125 | 647 | /** Get AES encryption |
mfiore | 0:c62615f15125 | 648 | * @returns true if AES encryption is enabled |
mfiore | 0:c62615f15125 | 649 | */ |
mfiore | 0:c62615f15125 | 650 | bool getAesEncryption(); |
mfiore | 0:c62615f15125 | 651 | |
mfiore | 0:c62615f15125 | 652 | /** Get RSSI stats |
Mike Fiore |
11:d8464345e1f1 | 653 | * @returns rssi_stats struct containing last, min, max, and avg RSSI in dB |
mfiore | 0:c62615f15125 | 654 | */ |
mfiore | 0:c62615f15125 | 655 | rssi_stats getRssiStats(); |
mfiore | 0:c62615f15125 | 656 | |
mfiore | 0:c62615f15125 | 657 | /** Get SNR stats |
Mike Fiore |
11:d8464345e1f1 | 658 | * @returns snr_stats struct containing last, min, max, and avg SNR in cB |
mfiore | 0:c62615f15125 | 659 | */ |
mfiore | 0:c62615f15125 | 660 | snr_stats getSnrStats(); |
mfiore | 0:c62615f15125 | 661 | |
mfiore | 0:c62615f15125 | 662 | /** Get ms until next free channel |
mfiore | 0:c62615f15125 | 663 | * only applicable for European models, US models return 0 |
mfiore | 0:c62615f15125 | 664 | * @returns time (ms) until a channel is free to use for transmitting |
mfiore | 0:c62615f15125 | 665 | */ |
mfiore | 0:c62615f15125 | 666 | uint32_t getNextTxMs(); |
mfiore | 0:c62615f15125 | 667 | |
Jason Reiss |
10:27dafba9fe19 | 668 | /** Get join delay in seconds |
Jason Reiss |
10:27dafba9fe19 | 669 | * Public network defaults to 5 seconds |
Jason Reiss |
10:27dafba9fe19 | 670 | * Private network defaults to 1 second |
Jason Reiss |
10:27dafba9fe19 | 671 | * @returns number of seconds before join accept message is expected |
Jason Reiss |
10:27dafba9fe19 | 672 | */ |
Jason Reiss |
10:27dafba9fe19 | 673 | uint8_t getJoinDelay(); |
Jason Reiss |
10:27dafba9fe19 | 674 | |
Jason Reiss |
10:27dafba9fe19 | 675 | /** Set join delay in seconds |
Jason Reiss |
10:27dafba9fe19 | 676 | * Public network defaults to 5 seconds |
Jason Reiss |
10:27dafba9fe19 | 677 | * Private network defaults to 1 second |
Jason Reiss |
10:27dafba9fe19 | 678 | * @param delay number of seconds before join accept message is expected |
Jason Reiss |
10:27dafba9fe19 | 679 | * @return MDOT_OK if success |
Jason Reiss |
10:27dafba9fe19 | 680 | */ |
Jason Reiss |
10:27dafba9fe19 | 681 | uint32_t setJoinDelay(uint8_t delay); |
Jason Reiss |
10:27dafba9fe19 | 682 | |
Jason Reiss |
10:27dafba9fe19 | 683 | /** Get rx delay in seconds |
Jason Reiss |
10:27dafba9fe19 | 684 | * Defaults to 1 second |
Jason Reiss |
10:27dafba9fe19 | 685 | * @returns number of seconds before response message is expected |
Jason Reiss |
10:27dafba9fe19 | 686 | */ |
Jason Reiss |
10:27dafba9fe19 | 687 | uint8_t getRxDelay(); |
Jason Reiss |
10:27dafba9fe19 | 688 | |
Jason Reiss |
10:27dafba9fe19 | 689 | /** Set rx delay in seconds |
Jason Reiss |
10:27dafba9fe19 | 690 | * Defaults to 1 second |
Jason Reiss |
10:27dafba9fe19 | 691 | * @param delay number of seconds before response message is expected |
Jason Reiss |
10:27dafba9fe19 | 692 | * @return MDOT_OK if success |
Jason Reiss |
10:27dafba9fe19 | 693 | */ |
Jason Reiss |
10:27dafba9fe19 | 694 | uint32_t setRxDelay(uint8_t delay); |
Jason Reiss |
10:27dafba9fe19 | 695 | |
Jason Reiss |
10:27dafba9fe19 | 696 | /** Get preserve session to save network session info through reset or power down in AUTO_OTA mode |
Jason Reiss |
10:27dafba9fe19 | 697 | * Defaults to off |
Jason Reiss |
10:27dafba9fe19 | 698 | * @returns true if enabled |
Jason Reiss |
10:27dafba9fe19 | 699 | */ |
Jason Reiss |
10:27dafba9fe19 | 700 | bool getPreserveSession(); |
Jason Reiss |
10:27dafba9fe19 | 701 | |
Jason Reiss |
10:27dafba9fe19 | 702 | /** Set preserve session to save network session info through reset or power down in AUTO_OTA mode |
Jason Reiss |
10:27dafba9fe19 | 703 | * Defaults to off |
Jason Reiss |
10:27dafba9fe19 | 704 | * @param enable |
Jason Reiss |
10:27dafba9fe19 | 705 | * @return MDOT_OK if success |
Jason Reiss |
10:27dafba9fe19 | 706 | */ |
Jason Reiss |
10:27dafba9fe19 | 707 | uint32_t setPreserveSession(bool enable); |
Jason Reiss |
10:27dafba9fe19 | 708 | |
mfiore | 0:c62615f15125 | 709 | /** Get data pending |
mfiore | 0:c62615f15125 | 710 | * only valid after sending data to the gateway |
mfiore | 0:c62615f15125 | 711 | * @returns true if server has available packet(s) |
mfiore | 0:c62615f15125 | 712 | */ |
mfiore | 0:c62615f15125 | 713 | bool getDataPending(); |
mfiore | 0:c62615f15125 | 714 | |
Jason Reiss |
10:27dafba9fe19 | 715 | /** Get transmitting |
mfiore | 0:c62615f15125 | 716 | * @returns true if currently transmitting |
mfiore | 0:c62615f15125 | 717 | */ |
mfiore | 0:c62615f15125 | 718 | bool getIsTransmitting(); |
mfiore | 0:c62615f15125 | 719 | |
mfiore | 0:c62615f15125 | 720 | /** Set TX data rate |
mfiore | 0:c62615f15125 | 721 | * data rates affect maximum payload size |
Mike Fiore |
11:d8464345e1f1 | 722 | * @param dr SF_7 - SF_12|DR0-DR7 for Europe, SF_7 - SF_10 | DR0-DR4 for United States |
mfiore | 0:c62615f15125 | 723 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 724 | */ |
mfiore | 0:c62615f15125 | 725 | int32_t setTxDataRate(const uint8_t& dr); |
mfiore | 0:c62615f15125 | 726 | |
mfiore | 0:c62615f15125 | 727 | /** Get TX data rate |
Mike Fiore |
11:d8464345e1f1 | 728 | * @returns current TX data rate (DR0-DR15) |
mfiore | 0:c62615f15125 | 729 | */ |
mfiore | 0:c62615f15125 | 730 | uint8_t getTxDataRate(); |
mfiore | 0:c62615f15125 | 731 | |
Mike Fiore |
12:54f9cac9d690 | 732 | /** Get a random value from the radio based on RSSI |
Mike Fiore |
12:54f9cac9d690 | 733 | * @returns randome value |
Mike Fiore |
12:54f9cac9d690 | 734 | */ |
Mike Fiore |
12:54f9cac9d690 | 735 | uint32_t getRadioRandom(); |
Mike Fiore |
12:54f9cac9d690 | 736 | |
Mike Fiore |
11:d8464345e1f1 | 737 | |
Mike Fiore |
11:d8464345e1f1 | 738 | /** Get data rate spreading factor and bandwidth |
Mike Fiore |
11:d8464345e1f1 | 739 | * EU868 Datarates |
Mike Fiore |
11:d8464345e1f1 | 740 | * --------------- |
Mike Fiore |
11:d8464345e1f1 | 741 | * DR0 - SF12BW125 |
Mike Fiore |
11:d8464345e1f1 | 742 | * DR1 - SF11BW125 |
Mike Fiore |
11:d8464345e1f1 | 743 | * DR2 - SF10BW125 |
Mike Fiore |
11:d8464345e1f1 | 744 | * DR3 - SF9BW125 |
Mike Fiore |
11:d8464345e1f1 | 745 | * DR4 - SF8BW125 |
Mike Fiore |
11:d8464345e1f1 | 746 | * DR5 - SF7BW125 |
Mike Fiore |
11:d8464345e1f1 | 747 | * DR6 - SF7BW250 |
Mike Fiore |
11:d8464345e1f1 | 748 | * DR7 - FSK |
Mike Fiore |
11:d8464345e1f1 | 749 | * |
Mike Fiore |
11:d8464345e1f1 | 750 | * US915 Datarates |
Mike Fiore |
11:d8464345e1f1 | 751 | * --------------- |
Mike Fiore |
11:d8464345e1f1 | 752 | * DR0 - SF10BW125 |
Mike Fiore |
11:d8464345e1f1 | 753 | * DR1 - SF9BW125 |
Mike Fiore |
11:d8464345e1f1 | 754 | * DR2 - SF8BW125 |
Mike Fiore |
11:d8464345e1f1 | 755 | * DR3 - SF7BW125 |
Mike Fiore |
11:d8464345e1f1 | 756 | * DR4 - SF8BW500 |
Mike Fiore |
11:d8464345e1f1 | 757 | * |
Mike Fiore |
11:d8464345e1f1 | 758 | * @returns spreading factor and bandwidth |
Mike Fiore |
11:d8464345e1f1 | 759 | */ |
Mike Fiore |
11:d8464345e1f1 | 760 | std::string getDateRateDetails(uint8_t rate); |
Mike Fiore |
11:d8464345e1f1 | 761 | |
Mike Fiore |
12:54f9cac9d690 | 762 | /** Set TX power output of radio before antenna gain, default: 14 dBm |
Mike Fiore |
12:54f9cac9d690 | 763 | * actual output power may be limited by local regulations for the chosen frequency |
mfiore | 0:c62615f15125 | 764 | * power affects maximum range |
mfiore | 0:c62615f15125 | 765 | * @param power 2 dBm - 20 dBm |
mfiore | 0:c62615f15125 | 766 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 767 | */ |
mfiore | 0:c62615f15125 | 768 | int32_t setTxPower(const uint32_t& power); |
mfiore | 0:c62615f15125 | 769 | |
mfiore | 0:c62615f15125 | 770 | /** Get TX power |
mfiore | 0:c62615f15125 | 771 | * @returns TX power (2 dBm - 20 dBm) |
mfiore | 0:c62615f15125 | 772 | */ |
mfiore | 0:c62615f15125 | 773 | uint32_t getTxPower(); |
mfiore | 0:c62615f15125 | 774 | |
Mike Fiore |
12:54f9cac9d690 | 775 | /** Get configured gain of installed antenna, default: +3 dBi |
Mike Fiore |
11:d8464345e1f1 | 776 | * @returns gain of antenna in dBi |
Mike Fiore |
11:d8464345e1f1 | 777 | */ |
Mike Fiore |
11:d8464345e1f1 | 778 | int8_t getAntennaGain(); |
Mike Fiore |
11:d8464345e1f1 | 779 | |
Mike Fiore |
12:54f9cac9d690 | 780 | /** Set configured gain of installed antenna, default: +3 dBi |
Mike Fiore |
11:d8464345e1f1 | 781 | * @param gain -127 dBi - 128 dBi |
Mike Fiore |
11:d8464345e1f1 | 782 | * @returns MDOT_OK if success |
Mike Fiore |
11:d8464345e1f1 | 783 | */ |
Mike Fiore |
11:d8464345e1f1 | 784 | int32_t setAntennaGain(int8_t gain); |
Mike Fiore |
11:d8464345e1f1 | 785 | |
mfiore | 0:c62615f15125 | 786 | /** Enable/disable TX waiting for rx windows |
mfiore | 0:c62615f15125 | 787 | * when enabled, send calls will block until a packet is received or RX timeout |
mfiore | 0:c62615f15125 | 788 | * @param enable set to true if expecting responses to transmitted packets |
mfiore | 0:c62615f15125 | 789 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 790 | */ |
mfiore | 0:c62615f15125 | 791 | int32_t setTxWait(const bool& enable); |
mfiore | 0:c62615f15125 | 792 | |
mfiore | 0:c62615f15125 | 793 | /** Get TX wait |
mfiore | 0:c62615f15125 | 794 | * @returns true if TX wait is enabled |
mfiore | 0:c62615f15125 | 795 | */ |
mfiore | 0:c62615f15125 | 796 | bool getTxWait(); |
mfiore | 0:c62615f15125 | 797 | |
mfiore | 0:c62615f15125 | 798 | /** Get time on air |
mfiore | 0:c62615f15125 | 799 | * @returns the amount of time (in ms) it would take to send bytes bytes based on current configuration |
mfiore | 0:c62615f15125 | 800 | */ |
mfiore | 0:c62615f15125 | 801 | uint32_t getTimeOnAir(uint8_t bytes); |
mfiore | 0:c62615f15125 | 802 | |
mfiore | 0:c62615f15125 | 803 | /** Get min frequency |
mfiore | 0:c62615f15125 | 804 | * @returns minimum frequency based on current configuration |
mfiore | 0:c62615f15125 | 805 | */ |
mfiore | 0:c62615f15125 | 806 | uint32_t getMinFrequency(); |
mfiore | 0:c62615f15125 | 807 | |
mfiore | 0:c62615f15125 | 808 | /** Get max frequency |
mfiore | 0:c62615f15125 | 809 | * @returns maximum frequency based on current configuration |
mfiore | 0:c62615f15125 | 810 | */ |
mfiore | 0:c62615f15125 | 811 | uint32_t getMaxFrequency(); |
mfiore | 0:c62615f15125 | 812 | |
Mike Fiore |
12:54f9cac9d690 | 813 | // get/set adaptive data rate |
Mike Fiore |
12:54f9cac9d690 | 814 | // configure data rates and power levels based on signal to noise of packets received at gateway |
Mike Fiore |
12:54f9cac9d690 | 815 | // true == adaptive data rate is on |
Mike Fiore |
12:54f9cac9d690 | 816 | // set function returns MDOT_OK if success |
Mike Fiore |
12:54f9cac9d690 | 817 | int32_t setAdr(const bool& on); |
Mike Fiore |
12:54f9cac9d690 | 818 | bool getAdr(); |
Mike Fiore |
12:54f9cac9d690 | 819 | |
mfiore | 0:c62615f15125 | 820 | /** Set forward error correction bytes |
mfiore | 0:c62615f15125 | 821 | * @param bytes 1 - 4 bytes |
mfiore | 0:c62615f15125 | 822 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 823 | */ |
mfiore | 0:c62615f15125 | 824 | int32_t setFec(const uint8_t& bytes); |
mfiore | 0:c62615f15125 | 825 | |
mfiore | 0:c62615f15125 | 826 | /** Get forward error correction bytes |
mfiore | 0:c62615f15125 | 827 | * @returns bytes (1 - 4) |
mfiore | 0:c62615f15125 | 828 | */ |
mfiore | 0:c62615f15125 | 829 | uint8_t getFec(); |
mfiore | 0:c62615f15125 | 830 | |
mfiore | 0:c62615f15125 | 831 | /** Enable/disable CRC checking of packets |
mfiore | 0:c62615f15125 | 832 | * CRC checking must be enabled for use with Conduit gateway and MTAC_LORA card |
mfiore | 0:c62615f15125 | 833 | * @param on set to true to enable CRC checking |
mfiore | 0:c62615f15125 | 834 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 835 | */ |
mfiore | 0:c62615f15125 | 836 | int32_t setCrc(const bool& on); |
mfiore | 0:c62615f15125 | 837 | |
mfiore | 0:c62615f15125 | 838 | /** Get CRC checking |
mfiore | 0:c62615f15125 | 839 | * @returns true if CRC checking is enabled |
mfiore | 0:c62615f15125 | 840 | */ |
mfiore | 0:c62615f15125 | 841 | bool getCrc(); |
mfiore | 0:c62615f15125 | 842 | |
mfiore | 0:c62615f15125 | 843 | /** Set ack |
mfiore | 0:c62615f15125 | 844 | * @param retries 0 to disable acks, otherwise 1 - 8 |
mfiore | 0:c62615f15125 | 845 | * @returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 846 | */ |
mfiore | 0:c62615f15125 | 847 | int32_t setAck(const uint8_t& retries); |
mfiore | 0:c62615f15125 | 848 | |
mfiore | 0:c62615f15125 | 849 | /** Get ack |
mfiore | 0:c62615f15125 | 850 | * @returns 0 if acks are disabled, otherwise retries (1 - 8) |
mfiore | 0:c62615f15125 | 851 | */ |
mfiore | 0:c62615f15125 | 852 | uint8_t getAck(); |
mfiore | 0:c62615f15125 | 853 | |
Mike Fiore |
12:54f9cac9d690 | 854 | /** Set number of packet repeats for unconfirmed frames |
Mike Fiore |
12:54f9cac9d690 | 855 | * @param repeat 0 or 1 for no repeats, otherwise 2-15 |
Mike Fiore |
12:54f9cac9d690 | 856 | * @returns MDOT_OK if success |
Mike Fiore |
12:54f9cac9d690 | 857 | */ |
Mike Fiore |
12:54f9cac9d690 | 858 | int32_t setRepeat(const uint8_t& repeat); |
Mike Fiore |
12:54f9cac9d690 | 859 | |
Mike Fiore |
12:54f9cac9d690 | 860 | /** Get number of packet repeats for unconfirmed frames |
Mike Fiore |
12:54f9cac9d690 | 861 | * @returns 0 or 1 if no repeats, otherwise 2-15 |
Mike Fiore |
12:54f9cac9d690 | 862 | */ |
Mike Fiore |
12:54f9cac9d690 | 863 | uint8_t getRepeat(); |
Mike Fiore |
12:54f9cac9d690 | 864 | |
mfiore | 0:c62615f15125 | 865 | /** Send data to the gateway |
mfiore | 0:c62615f15125 | 866 | * validates data size (based on spreading factor) |
mfiore | 0:c62615f15125 | 867 | * @param data a vector of up to 242 bytes (may be less based on spreading factor) |
mfiore | 0:c62615f15125 | 868 | * @returns MDOT_OK if packet was sent successfully (ACKs disabled), or if an ACK was received (ACKs enabled) |
mfiore | 0:c62615f15125 | 869 | */ |
mfiore | 0:c62615f15125 | 870 | int32_t send(const std::vector<uint8_t>& data, const bool& blocking = true, const bool& highBw = false); |
mfiore | 0:c62615f15125 | 871 | |
mfiore | 0:c62615f15125 | 872 | /** Fetch data received from the gateway |
mfiore | 0:c62615f15125 | 873 | * this function only checks to see if a packet has been received - it does not open a receive window |
mfiore | 0:c62615f15125 | 874 | * send() must be called before recv() |
mfiore | 0:c62615f15125 | 875 | * @param data a vector to put the received data into |
mfiore | 0:c62615f15125 | 876 | * @returns MDOT_OK if packet was successfully received |
mfiore | 0:c62615f15125 | 877 | */ |
mfiore | 0:c62615f15125 | 878 | int32_t recv(std::vector<uint8_t>& data); |
mfiore | 0:c62615f15125 | 879 | |
mfiore | 0:c62615f15125 | 880 | /** Ping |
mfiore | 0:c62615f15125 | 881 | * status will be MDOT_OK if ping succeeded |
mfiore | 0:c62615f15125 | 882 | * @returns ping_response struct containing status, RSSI, and SNR |
mfiore | 0:c62615f15125 | 883 | */ |
mfiore | 0:c62615f15125 | 884 | ping_response ping(); |
mfiore | 0:c62615f15125 | 885 | |
mfiore | 0:c62615f15125 | 886 | /** Get return code string |
mfiore | 0:c62615f15125 | 887 | * @returns string containing a description of the given error code |
mfiore | 0:c62615f15125 | 888 | */ |
mfiore | 0:c62615f15125 | 889 | static std::string getReturnCodeString(const int32_t& code); |
mfiore | 0:c62615f15125 | 890 | |
mfiore | 0:c62615f15125 | 891 | /** Get last error |
mfiore | 0:c62615f15125 | 892 | * @returns string explaining the last error that occured |
mfiore | 0:c62615f15125 | 893 | */ |
mfiore | 0:c62615f15125 | 894 | std::string getLastError(); |
mfiore | 0:c62615f15125 | 895 | |
Mike Fiore |
7:683dba5d576f | 896 | /** Go to sleep |
Jason Reiss |
10:27dafba9fe19 | 897 | * @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 | 898 | * @param wakeup_mode RTC_ALARM, INTERRUPT, RTC_ALARM_OR_INTERRUPT |
Mike Fiore |
7:683dba5d576f | 899 | * if RTC_ALARM the real time clock is configured to wake the device up after the specified interval |
Mike Fiore |
7:683dba5d576f | 900 | * if INTERRUPT the device will wake up on the rising edge of the interrupt pin |
Jason Reiss |
10:27dafba9fe19 | 901 | * if RTC_ALARM_OR_INTERRUPT the device will wake on the first event to occur |
Mike Fiore |
7:683dba5d576f | 902 | * @param deepsleep if true go into deep sleep mode (lowest power, all memory and registers are lost, peripherals turned off) |
Mike Fiore |
7:683dba5d576f | 903 | * else go into sleep mode (low power, memory and registers are maintained, peripherals stay on) |
Mike Fiore |
7:683dba5d576f | 904 | * |
Mike Fiore |
11:d8464345e1f1 | 905 | * in sleep mode, the device can be woken up on an XBEE_DI (2-8) pin or by the RTC alarm |
Mike Fiore |
7:683dba5d576f | 906 | * in deepsleep mode, the device can only be woken up using the WKUP pin (PA0, XBEE_DIO7) or by the RTC alarm |
Mike Fiore |
7:683dba5d576f | 907 | */ |
Mike Fiore |
7:683dba5d576f | 908 | void sleep(const uint32_t& interval, const uint8_t& wakeup_mode = RTC_ALARM, const bool& deepsleep = true); |
Mike Fiore |
7:683dba5d576f | 909 | |
Mike Fiore |
7:683dba5d576f | 910 | /** Set wake pin |
Mike Fiore |
11:d8464345e1f1 | 911 | * @param pin the pin to use to wake the device from sleep mode XBEE_DI (2-8) |
Mike Fiore |
7:683dba5d576f | 912 | */ |
Mike Fiore |
7:683dba5d576f | 913 | void setWakePin(const PinName& pin); |
Mike Fiore |
7:683dba5d576f | 914 | |
Mike Fiore |
7:683dba5d576f | 915 | /** Get wake pin |
Mike Fiore |
11:d8464345e1f1 | 916 | * @returns the pin to use to wake the device from sleep mode XBEE_DI (2-8) |
Mike Fiore |
7:683dba5d576f | 917 | */ |
Mike Fiore |
7:683dba5d576f | 918 | PinName getWakePin(); |
Mike Fiore |
7:683dba5d576f | 919 | |
jreiss | 9:ec2fffe31793 | 920 | /** Write data in a user backup register |
jreiss | 9:ec2fffe31793 | 921 | * @param register one of UBR0 through UBR9 |
jreiss | 9:ec2fffe31793 | 922 | * @param data user data to back up |
jreiss | 9:ec2fffe31793 | 923 | * @returns true if success |
jreiss | 9:ec2fffe31793 | 924 | */ |
jreiss | 9:ec2fffe31793 | 925 | bool writeUserBackupRegister(uint32_t reg, uint32_t data); |
jreiss | 9:ec2fffe31793 | 926 | |
jreiss | 9:ec2fffe31793 | 927 | /** Read data in a user backup register |
jreiss | 9:ec2fffe31793 | 928 | * @param register one of UBR0 through UBR9 |
jreiss | 9:ec2fffe31793 | 929 | * @param data gets set to content of register |
jreiss | 9:ec2fffe31793 | 930 | * @returns true if success |
jreiss | 9:ec2fffe31793 | 931 | */ |
jreiss | 9:ec2fffe31793 | 932 | bool readUserBackupRegister(uint32_t reg, uint32_t& data); |
jreiss | 9:ec2fffe31793 | 933 | |
Mike Fiore |
11:d8464345e1f1 | 934 | // Save user file data to flash |
Mike Fiore |
11:d8464345e1f1 | 935 | // file - name of file max 30 chars |
Mike Fiore |
11:d8464345e1f1 | 936 | // data - data of file |
Mike Fiore |
11:d8464345e1f1 | 937 | // size - size of file |
Mike Fiore |
11:d8464345e1f1 | 938 | bool saveUserFile(const char* file, void* data, uint32_t size); |
Mike Fiore |
11:d8464345e1f1 | 939 | |
Mike Fiore |
11:d8464345e1f1 | 940 | // Append user file data to flash |
Mike Fiore |
11:d8464345e1f1 | 941 | // file - name of file max 30 chars |
Mike Fiore |
11:d8464345e1f1 | 942 | // data - data of file |
Mike Fiore |
11:d8464345e1f1 | 943 | // size - size of file |
Mike Fiore |
11:d8464345e1f1 | 944 | bool appendUserFile(const char* file, void* data, uint32_t size); |
Mike Fiore |
11:d8464345e1f1 | 945 | |
Mike Fiore |
11:d8464345e1f1 | 946 | // Read user file data from flash |
Mike Fiore |
11:d8464345e1f1 | 947 | // file - name of file max 30 chars |
Mike Fiore |
11:d8464345e1f1 | 948 | // data - data of file |
Mike Fiore |
11:d8464345e1f1 | 949 | // size - size of file |
Mike Fiore |
11:d8464345e1f1 | 950 | bool readUserFile(const char* file, void* data, uint32_t size); |
Mike Fiore |
11:d8464345e1f1 | 951 | |
Mike Fiore |
11:d8464345e1f1 | 952 | // Move a user file in flash |
Mike Fiore |
11:d8464345e1f1 | 953 | // file - name of file |
Mike Fiore |
11:d8464345e1f1 | 954 | // new_name - new name of file |
Mike Fiore |
11:d8464345e1f1 | 955 | bool moveUserFile(const char* file, const char* new_name); |
Mike Fiore |
11:d8464345e1f1 | 956 | |
Mike Fiore |
11:d8464345e1f1 | 957 | // Delete user file data from flash |
Mike Fiore |
11:d8464345e1f1 | 958 | // file - name of file max 30 chars |
Mike Fiore |
11:d8464345e1f1 | 959 | bool deleteUserFile(const char* file); |
Mike Fiore |
11:d8464345e1f1 | 960 | |
Mike Fiore |
11:d8464345e1f1 | 961 | // Open user file in flash, max of 4 files open concurrently |
Mike Fiore |
11:d8464345e1f1 | 962 | // file - name of file max 30 chars |
Mike Fiore |
11:d8464345e1f1 | 963 | // mode - combination of FM_APPEND | FM_TRUNC | FM_CREAT | |
Mike Fiore |
11:d8464345e1f1 | 964 | // FM_RDONLY | FM_WRONLY | FM_RDWR | FM_DIRECT |
Mike Fiore |
11:d8464345e1f1 | 965 | // returns - mdot_file struct, fd field will be a negative value if file could not be opened |
Mike Fiore |
11:d8464345e1f1 | 966 | mDot::mdot_file openUserFile(const char* file, int mode); |
Mike Fiore |
11:d8464345e1f1 | 967 | |
Mike Fiore |
11:d8464345e1f1 | 968 | // Seek an open file |
Mike Fiore |
11:d8464345e1f1 | 969 | // file - mdot file struct |
Mike Fiore |
11:d8464345e1f1 | 970 | // offset - offset in bytes |
Mike Fiore |
11:d8464345e1f1 | 971 | // whence - where offset is based SEEK_SET, SEEK_CUR, SEEK_END |
Mike Fiore |
11:d8464345e1f1 | 972 | bool seekUserFile(mDot::mdot_file& file, size_t offset, int whence); |
Mike Fiore |
11:d8464345e1f1 | 973 | |
Mike Fiore |
11:d8464345e1f1 | 974 | // Read bytes from open file |
Mike Fiore |
11:d8464345e1f1 | 975 | // file - mdot file struct |
Mike Fiore |
11:d8464345e1f1 | 976 | // data - mem location to store data |
Mike Fiore |
11:d8464345e1f1 | 977 | // length - number of bytes to read |
Mike Fiore |
11:d8464345e1f1 | 978 | // returns - number of bytes written |
Mike Fiore |
11:d8464345e1f1 | 979 | int readUserFile(mDot::mdot_file& file, void* data, size_t length); |
Mike Fiore |
11:d8464345e1f1 | 980 | |
Mike Fiore |
11:d8464345e1f1 | 981 | // Write bytes to open file |
Mike Fiore |
11:d8464345e1f1 | 982 | // file - mdot file struct |
Mike Fiore |
11:d8464345e1f1 | 983 | // data - data to write |
Mike Fiore |
11:d8464345e1f1 | 984 | // length - number of bytes to write |
Mike Fiore |
11:d8464345e1f1 | 985 | // returns - number of bytes written |
Mike Fiore |
11:d8464345e1f1 | 986 | int writeUserFile(mDot::mdot_file& file, void* data, size_t length); |
Mike Fiore |
11:d8464345e1f1 | 987 | |
Mike Fiore |
11:d8464345e1f1 | 988 | // Close open file |
Mike Fiore |
11:d8464345e1f1 | 989 | // file - mdot file struct |
Mike Fiore |
11:d8464345e1f1 | 990 | bool closeUserFile(mDot::mdot_file& file); |
Mike Fiore |
11:d8464345e1f1 | 991 | |
Mike Fiore |
11:d8464345e1f1 | 992 | // List user files stored in flash |
Mike Fiore |
11:d8464345e1f1 | 993 | std::vector<mDot::mdot_file> listUserFiles(); |
Mike Fiore |
11:d8464345e1f1 | 994 | |
Mike Fiore |
11:d8464345e1f1 | 995 | // Move file into the firmware upgrade path to be flashed on next boot |
Mike Fiore |
11:d8464345e1f1 | 996 | // file - name of file |
Mike Fiore |
11:d8464345e1f1 | 997 | bool moveUserFileToFirmwareUpgrade(const char* file); |
Mike Fiore |
11:d8464345e1f1 | 998 | |
Mike Fiore |
11:d8464345e1f1 | 999 | // get current statistics |
Mike Fiore |
11:d8464345e1f1 | 1000 | // Join Attempts, Join Fails, Up Packets, Down Packets, Missed Acks |
Mike Fiore |
11:d8464345e1f1 | 1001 | mdot_stats getStats(); |
Mike Fiore |
11:d8464345e1f1 | 1002 | |
Mike Fiore |
11:d8464345e1f1 | 1003 | // reset statistics |
Mike Fiore |
11:d8464345e1f1 | 1004 | // Join Attempts, Join Fails, Up Packets, Down Packets, Missed Acks |
Mike Fiore |
11:d8464345e1f1 | 1005 | void resetStats(); |
Mike Fiore |
11:d8464345e1f1 | 1006 | |
Mike Fiore |
11:d8464345e1f1 | 1007 | // Convert pin number 2-8 to pin name DIO2-DI8 |
Mike Fiore |
11:d8464345e1f1 | 1008 | static PinName pinNum2Name(uint8_t num); |
Mike Fiore |
11:d8464345e1f1 | 1009 | |
Mike Fiore |
11:d8464345e1f1 | 1010 | // Convert pin name DIO2-DI8 to pin number 2-8 |
Mike Fiore |
11:d8464345e1f1 | 1011 | static uint8_t pinName2Num(PinName name); |
Mike Fiore |
11:d8464345e1f1 | 1012 | |
Mike Fiore |
11:d8464345e1f1 | 1013 | // Convert pin name DIO2-DI8 to string |
Mike Fiore |
11:d8464345e1f1 | 1014 | static std::string pinName2Str(PinName name); |
Mike Fiore |
11:d8464345e1f1 | 1015 | |
Mike Fiore |
11:d8464345e1f1 | 1016 | uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l); |
mfiore | 0:c62615f15125 | 1017 | |
mfiore | 0:c62615f15125 | 1018 | /************************************************************************* |
mfiore | 0:c62615f15125 | 1019 | * The following functions are only used by the AT command application and |
mfiore | 0:c62615f15125 | 1020 | * should not be used by standard applications consuming the mDot library |
mfiore | 0:c62615f15125 | 1021 | ************************************************************************/ |
Mike Fiore |
7:683dba5d576f | 1022 | |
mfiore | 0:c62615f15125 | 1023 | // set/get configured baud rate for command port |
mfiore | 0:c62615f15125 | 1024 | // only for use in conjunction with AT interface |
mfiore | 0:c62615f15125 | 1025 | // set function returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 1026 | int32_t setBaud(const uint32_t& baud); |
mfiore | 0:c62615f15125 | 1027 | uint32_t getBaud(); |
mfiore | 0:c62615f15125 | 1028 | |
mfiore | 0:c62615f15125 | 1029 | // set/get baud rate for debug port |
mfiore | 0:c62615f15125 | 1030 | // set function returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 1031 | int32_t setDebugBaud(const uint32_t& baud); |
mfiore | 0:c62615f15125 | 1032 | uint32_t getDebugBaud(); |
mfiore | 0:c62615f15125 | 1033 | |
mfiore | 0:c62615f15125 | 1034 | // set/get command terminal echo |
mfiore | 0:c62615f15125 | 1035 | // set function returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 1036 | int32_t setEcho(const bool& on); |
mfiore | 0:c62615f15125 | 1037 | bool getEcho(); |
mfiore | 0:c62615f15125 | 1038 | |
mfiore | 0:c62615f15125 | 1039 | // set/get command terminal verbose mode |
mfiore | 0:c62615f15125 | 1040 | // set function returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 1041 | int32_t setVerbose(const bool& on); |
mfiore | 0:c62615f15125 | 1042 | bool getVerbose(); |
mfiore | 0:c62615f15125 | 1043 | |
mfiore | 0:c62615f15125 | 1044 | // set/get startup mode |
mfiore | 0:c62615f15125 | 1045 | // COMMAND_MODE (default), starts up ready to accept AT commands |
mfiore | 0:c62615f15125 | 1046 | // SERIAL_MODE, read serial data and send it as LoRa packets |
mfiore | 0:c62615f15125 | 1047 | // set function returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 1048 | int32_t setStartUpMode(const uint8_t& mode); |
mfiore | 0:c62615f15125 | 1049 | uint8_t getStartUpMode(); |
mfiore | 0:c62615f15125 | 1050 | |
mfiore | 0:c62615f15125 | 1051 | int32_t setRxDataRate(const uint8_t& dr); |
mfiore | 0:c62615f15125 | 1052 | uint8_t getRxDataRate(); |
mfiore | 0:c62615f15125 | 1053 | |
mfiore | 0:c62615f15125 | 1054 | // get/set TX/RX frequency |
mfiore | 0:c62615f15125 | 1055 | // if frequency band == FB_868 (Europe), must be between 863000000 - 870000000 |
mfiore | 0:c62615f15125 | 1056 | // if frequency band == FB_915 (United States), must be between 902000000-928000000 |
mfiore | 0:c62615f15125 | 1057 | // if set to 0, device will hop frequencies |
mfiore | 0:c62615f15125 | 1058 | // set function returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 1059 | int32_t setTxFrequency(const uint32_t& freq); |
mfiore | 0:c62615f15125 | 1060 | uint32_t getTxFrequency(); |
mfiore | 0:c62615f15125 | 1061 | int32_t setRxFrequency(const uint32_t& freq); |
mfiore | 0:c62615f15125 | 1062 | uint32_t getRxFrequency(); |
mfiore | 0:c62615f15125 | 1063 | |
mfiore | 0:c62615f15125 | 1064 | // get/set TX/RX inverted |
mfiore | 0:c62615f15125 | 1065 | // true == signal is inverted |
mfiore | 0:c62615f15125 | 1066 | // set function returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 1067 | int32_t setTxInverted(const bool& on); |
mfiore | 0:c62615f15125 | 1068 | bool getTxInverted(); |
mfiore | 0:c62615f15125 | 1069 | int32_t setRxInverted(const bool& on); |
mfiore | 0:c62615f15125 | 1070 | bool getRxInverted(); |
mfiore | 0:c62615f15125 | 1071 | |
mfiore | 0:c62615f15125 | 1072 | // get/set RX output mode |
mfiore | 0:c62615f15125 | 1073 | // valid options are HEXADECIMAL and BINARY |
mfiore | 0:c62615f15125 | 1074 | // set function returns MDOT_OK if success |
mfiore | 0:c62615f15125 | 1075 | int32_t setRxOutput(const uint8_t& mode); |
mfiore | 0:c62615f15125 | 1076 | uint8_t getRxOutput(); |
mfiore | 0:c62615f15125 | 1077 | |
mfiore | 0:c62615f15125 | 1078 | // get/set serial wake interval |
mfiore | 0:c62615f15125 | 1079 | // valid values are 2 s - INT_MAX (2147483647) s |
mfiore | 0:c62615f15125 | 1080 | // set function returns MDOT_OK if success |
Mike Fiore |
7:683dba5d576f | 1081 | int32_t setWakeInterval(const uint32_t& interval); |
Mike Fiore |
7:683dba5d576f | 1082 | uint32_t getWakeInterval(); |
mfiore | 0:c62615f15125 | 1083 | |
mfiore | 0:c62615f15125 | 1084 | // get/set serial wake delay |
mfiore | 0:c62615f15125 | 1085 | // valid values are 2 ms - INT_MAX (2147483647) ms |
mfiore | 0:c62615f15125 | 1086 | // set function returns MDOT_OK if success |
Mike Fiore |
7:683dba5d576f | 1087 | int32_t setWakeDelay(const uint32_t& delay); |
Mike Fiore |
7:683dba5d576f | 1088 | uint32_t getWakeDelay(); |
mfiore | 0:c62615f15125 | 1089 | |
mfiore | 0:c62615f15125 | 1090 | // get/set serial receive timeout |
mfiore | 0:c62615f15125 | 1091 | // valid values are 0 ms - 65000 ms |
mfiore | 0:c62615f15125 | 1092 | // set function returns MDOT_OK if success |
Mike Fiore |
7:683dba5d576f | 1093 | int32_t setWakeTimeout(const uint16_t& timeout); |
Mike Fiore |
7:683dba5d576f | 1094 | uint16_t getWakeTimeout(); |
Mike Fiore |
7:683dba5d576f | 1095 | |
Mike Fiore |
7:683dba5d576f | 1096 | // get/set serial wake mode |
Mike Fiore |
7:683dba5d576f | 1097 | // valid values are INTERRUPT or RTC_ALARM |
Mike Fiore |
7:683dba5d576f | 1098 | // set function returns MDOT_OK if success |
Mike Fiore |
7:683dba5d576f | 1099 | int32_t setWakeMode(const uint8_t& delay); |
Mike Fiore |
7:683dba5d576f | 1100 | uint8_t getWakeMode(); |
Mike Fiore |
7:683dba5d576f | 1101 | |
Mike Fiore |
12:54f9cac9d690 | 1102 | // get/set serial flow control enabled |
Mike Fiore |
12:54f9cac9d690 | 1103 | // set function returns MDOT_OK if success |
Mike Fiore |
12:54f9cac9d690 | 1104 | int32_t setFlowControl(const bool& on); |
Mike Fiore |
12:54f9cac9d690 | 1105 | bool getFlowControl(); |
Mike Fiore |
12:54f9cac9d690 | 1106 | |
Mike Fiore |
7:683dba5d576f | 1107 | |
Mike Fiore |
12:54f9cac9d690 | 1108 | // get/set serial clear on error |
Mike Fiore |
12:54f9cac9d690 | 1109 | // 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 | 1110 | // set function returns MDOT_OK if success |
Mike Fiore |
12:54f9cac9d690 | 1111 | int32_t setSerialClearOnError(const bool& on); |
Mike Fiore |
12:54f9cac9d690 | 1112 | bool getSerialClearOnError(); |
mfiore | 0:c62615f15125 | 1113 | |
mfiore | 0:c62615f15125 | 1114 | // MTS_RADIO_DEBUG_COMMANDS |
Mike Fiore |
7:683dba5d576f | 1115 | |
Mike Fiore |
7:683dba5d576f | 1116 | void openRxWindow(uint32_t timeout, uint8_t bandwidth = 0); |
Mike Fiore |
6:390fc83d588d | 1117 | void sendContinuous(); |
mfiore | 0:c62615f15125 | 1118 | int32_t setDeviceId(const std::vector<uint8_t>& id); |
mfiore | 0:c62615f15125 | 1119 | int32_t setFrequencyBand(const uint8_t& band); |
mfiore | 0:c62615f15125 | 1120 | bool saveProtectedConfig(); |
mfiore | 0:c62615f15125 | 1121 | void resetRadio(); |
mfiore | 0:c62615f15125 | 1122 | int32_t setRadioMode(const uint8_t& mode); |
mfiore | 0:c62615f15125 | 1123 | std::map<uint8_t, uint8_t> dumpRegisters(); |
mfiore | 0:c62615f15125 | 1124 | void eraseFlash(); |
mfiore | 0:c62615f15125 | 1125 | |
Mike Fiore |
7:683dba5d576f | 1126 | // deprecated - use setWakeInterval |
Mike Fiore |
7:683dba5d576f | 1127 | int32_t setSerialWakeInterval(const uint32_t& interval); |
Mike Fiore |
7:683dba5d576f | 1128 | // deprecated - use getWakeInterval |
Mike Fiore |
7:683dba5d576f | 1129 | uint32_t getSerialWakeInterval(); |
Mike Fiore |
6:390fc83d588d | 1130 | |
Mike Fiore |
7:683dba5d576f | 1131 | // deprecated - use setWakeDelay |
Mike Fiore |
7:683dba5d576f | 1132 | int32_t setSerialWakeDelay(const uint32_t& delay); |
Mike Fiore |
7:683dba5d576f | 1133 | // deprecated - use setWakeDelay |
Mike Fiore |
7:683dba5d576f | 1134 | uint32_t getSerialWakeDelay(); |
Mike Fiore |
7:683dba5d576f | 1135 | |
Mike Fiore |
7:683dba5d576f | 1136 | // deprecated - use setWakeTimeout |
Mike Fiore |
7:683dba5d576f | 1137 | int32_t setSerialReceiveTimeout(const uint16_t& timeout); |
Mike Fiore |
7:683dba5d576f | 1138 | // deprecated - use getWakeTimeout |
Mike Fiore |
7:683dba5d576f | 1139 | uint16_t getSerialReceiveTimeout(); |
mfiore | 0:c62615f15125 | 1140 | |
Mike Fiore |
11:d8464345e1f1 | 1141 | void setWakeupCallback(void (*function)(void)); |
Mike Fiore |
11:d8464345e1f1 | 1142 | |
Mike Fiore |
11:d8464345e1f1 | 1143 | template<typename T> |
Mike Fiore |
11:d8464345e1f1 | 1144 | void setWakeupCallback(T *object, void (T::*member)(void)) { |
Mike Fiore |
11:d8464345e1f1 | 1145 | _wakeup_callback.attach(object, member); |
Mike Fiore |
11:d8464345e1f1 | 1146 | } |
Mike Fiore |
11:d8464345e1f1 | 1147 | |
mfiore | 0:c62615f15125 | 1148 | private: |
mfiore | 0:c62615f15125 | 1149 | mdot_stats _stats; |
mfiore | 0:c62615f15125 | 1150 | |
Mike Fiore |
11:d8464345e1f1 | 1151 | FunctionPointer _wakeup_callback; |
Mike Fiore |
11:d8464345e1f1 | 1152 | |
Mike Fiore |
12:54f9cac9d690 | 1153 | bool _standbyFlag; |
Mike Fiore |
12:54f9cac9d690 | 1154 | bool _testMode; |
Mike Fiore |
12:54f9cac9d690 | 1155 | uint8_t _savedPort; |
Mike Fiore |
12:54f9cac9d690 | 1156 | void handleTestModePacket(); |
Mike Fiore |
12:54f9cac9d690 | 1157 | |
mfiore | 0:c62615f15125 | 1158 | }; |
mfiore | 0:c62615f15125 | 1159 | |
mfiore | 0:c62615f15125 | 1160 | #endif |