1 #if !defined(_RADIOLIB_LORAWAN_H) && !RADIOLIB_EXCLUDE_LORAWAN
2 #define _RADIOLIB_LORAWAN_H
4 #include "../../TypeDef.h"
5 #include "../PhysicalLayer/PhysicalLayer.h"
6 #include "../../utils/Cryptography.h"
9 #define RADIOLIB_LORAWAN_MODE_OTAA (0x07AA)
10 #define RADIOLIB_LORAWAN_MODE_ABP (0x0AB9)
11 #define RADIOLIB_LORAWAN_MODE_NONE (0x0000)
14 #define RADIOLIB_LORAWAN_CLASS_A (0x0A)
15 #define RADIOLIB_LORAWAN_CLASS_B (0x0B)
16 #define RADIOLIB_LORAWAN_CLASS_C (0x0C)
19 #define RADIOLIB_LORAWAN_LORA_SYNC_WORD (0x34)
20 #define RADIOLIB_LORAWAN_LORA_PREAMBLE_LEN (8)
21 #define RADIOLIB_LORAWAN_GFSK_SYNC_WORD (0xC194C1)
22 #define RADIOLIB_LORAWAN_GFSK_PREAMBLE_LEN (5)
23 #define RADIOLIB_LORAWAN_LR_FHSS_SYNC_WORD (0x2C0F7995)
26 #define RADIOLIB_LORAWAN_MHDR_MTYPE_JOIN_REQUEST (0x00 << 5)
27 #define RADIOLIB_LORAWAN_MHDR_MTYPE_JOIN_ACCEPT (0x01 << 5)
28 #define RADIOLIB_LORAWAN_MHDR_MTYPE_UNCONF_DATA_UP (0x02 << 5)
29 #define RADIOLIB_LORAWAN_MHDR_MTYPE_UNCONF_DATA_DOWN (0x03 << 5)
30 #define RADIOLIB_LORAWAN_MHDR_MTYPE_CONF_DATA_UP (0x04 << 5)
31 #define RADIOLIB_LORAWAN_MHDR_MTYPE_CONF_DATA_DOWN (0x05 << 5)
32 #define RADIOLIB_LORAWAN_MHDR_MTYPE_PROPRIETARY (0x07 << 5)
33 #define RADIOLIB_LORAWAN_MHDR_MTYPE_MASK (0x07 << 5)
34 #define RADIOLIB_LORAWAN_MHDR_MAJOR_R1 (0x00 << 0)
37 #define RADIOLIB_LORAWAN_FCTRL_ADR_ENABLED (0x01 << 7)
38 #define RADIOLIB_LORAWAN_FCTRL_ADR_DISABLED (0x00 << 7)
39 #define RADIOLIB_LORAWAN_FCTRL_ADR_ACK_REQ (0x01 << 6)
40 #define RADIOLIB_LORAWAN_FCTRL_ACK (0x01 << 5)
41 #define RADIOLIB_LORAWAN_FCTRL_FRAME_PENDING (0x01 << 4)
44 #define RADIOLIB_LORAWAN_FPORT_MAC_COMMAND (0x00 << 0)
45 #define RADIOLIB_LORAWAN_FPORT_PAYLOAD_MIN (0x01 << 0)
46 #define RADIOLIB_LORAWAN_FPORT_PAYLOAD_MAX (0xDF << 0)
47 #define RADIOLIB_LORAWAN_FPORT_TS009 (0xE0 << 0)
48 #define RADIOLIB_LORAWAN_FPORT_TS011 (0xE2 << 0)
49 #define RADIOLIB_LORAWAN_FPORT_RESERVED (0xE0 << 0)
52 #define RADIOLIB_LORAWAN_DATA_RATE_MODEM (0x03 << 6)
53 #define RADIOLIB_LORAWAN_DATA_RATE_LORA (0x00 << 6)
54 #define RADIOLIB_LORAWAN_DATA_RATE_FSK (0x01 << 6)
55 #define RADIOLIB_LORAWAN_DATA_RATE_LR_FHSS (0x02 << 6)
56 #define RADIOLIB_LORAWAN_DATA_RATE_SF (0x07 << 3)
57 #define RADIOLIB_LORAWAN_DATA_RATE_SF_12 (0x05 << 3)
58 #define RADIOLIB_LORAWAN_DATA_RATE_SF_11 (0x04 << 3)
59 #define RADIOLIB_LORAWAN_DATA_RATE_SF_10 (0x03 << 3)
60 #define RADIOLIB_LORAWAN_DATA_RATE_SF_9 (0x02 << 3)
61 #define RADIOLIB_LORAWAN_DATA_RATE_SF_8 (0x01 << 3)
62 #define RADIOLIB_LORAWAN_DATA_RATE_SF_7 (0x00 << 3)
63 #define RADIOLIB_LORAWAN_DATA_RATE_BW (0x03 << 1)
64 #define RADIOLIB_LORAWAN_DATA_RATE_BW_125_KHZ (0x00 << 1)
65 #define RADIOLIB_LORAWAN_DATA_RATE_BW_250_KHZ (0x01 << 1)
66 #define RADIOLIB_LORAWAN_DATA_RATE_BW_500_KHZ (0x02 << 1)
67 #define RADIOLIB_LORAWAN_DATA_RATE_BW_137_KHZ (0x00 << 1)
68 #define RADIOLIB_LORAWAN_DATA_RATE_BW_336_KHZ (0x01 << 1)
69 #define RADIOLIB_LORAWAN_DATA_RATE_BW_1523_KHZ (0x02 << 1)
70 #define RADIOLIB_LORAWAN_DATA_RATE_CR (0x01 << 0)
71 #define RADIOLIB_LORAWAN_DATA_RATE_CR_1_3 (0x00 << 0)
72 #define RADIOLIB_LORAWAN_DATA_RATE_CR_2_3 (0x01 << 0)
73 #define RADIOLIB_LORAWAN_DATA_RATE_UNUSED (0xFF << 0)
76 #define RADIOLIB_LORAWAN_UPLINK (0x00 << 0)
77 #define RADIOLIB_LORAWAN_DOWNLINK (0x01 << 0)
78 #define RADIOLIB_LORAWAN_DIR_RX2 (0x02 << 0)
79 #define RADIOLIB_LORAWAN_BAND_DYNAMIC (0)
80 #define RADIOLIB_LORAWAN_BAND_FIXED (1)
81 #define RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES (15)
82 #define RADIOLIB_LORAWAN_CHANNEL_INDEX_NONE (0xFF >> 0)
85 #define RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS (1000)
86 #define RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS ((RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS) + 1000)
87 #define RADIOLIB_LORAWAN_RX1_DR_OFFSET (0)
88 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DELAY_1_MS (5000)
89 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DELAY_2_MS (6000)
90 #define RADIOLIB_LORAWAN_MAX_FCNT_GAP (16384)
91 #define RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP (0x06)
92 #define RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP (0x05)
93 #define RADIOLIB_LORAWAN_RETRANSMIT_TIMEOUT_MIN_MS (1000)
94 #define RADIOLIB_LORAWAN_RETRANSMIT_TIMEOUT_MAX_MS (3000)
95 #define RADIOLIB_LORAWAN_POWER_STEP_SIZE_DBM (-2)
96 #define RADIOLIB_LORAWAN_REJOIN_MAX_COUNT_N (10)
97 #define RADIOLIB_LORAWAN_REJOIN_MAX_TIME_N (15)
100 #define RADIOLIB_LORAWAN_JOIN_REQUEST_LEN (23)
101 #define RADIOLIB_LORAWAN_JOIN_REQUEST_JOIN_EUI_POS (1)
102 #define RADIOLIB_LORAWAN_JOIN_REQUEST_DEV_EUI_POS (9)
103 #define RADIOLIB_LORAWAN_JOIN_REQUEST_DEV_NONCE_POS (17)
104 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE (0xFF)
105 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE_0 (0x00)
106 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE_1 (0x01)
107 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE_2 (0x02)
110 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_MAX_LEN (33)
111 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JOIN_NONCE_POS (1)
112 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_HOME_NET_ID_POS (4)
113 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DEV_ADDR_POS (7)
114 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DL_SETTINGS_POS (11)
115 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_RX_DELAY_POS (12)
116 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_POS (13)
117 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_LEN (16)
118 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_TYPE_POS (RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_POS + RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_LEN - 1)
121 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_AES_JOIN_NONCE_POS (1)
122 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_AES_JOIN_EUI_POS (4)
123 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_AES_DEV_NONCE_POS (12)
124 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_AES_DEV_ADDR_POS (1)
127 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_R_1_0 (0x00 << 7)
128 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_R_1_1 (0x01 << 7)
129 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_F_NWK_S_INT_KEY (0x01)
130 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_APP_S_KEY (0x02)
131 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_S_NWK_S_INT_KEY (0x03)
132 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_NWK_S_ENC_KEY (0x04)
133 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JS_ENC_KEY (0x05)
134 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JS_INT_KEY (0x06)
135 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_ROOT_WOR_S_KEY (0x01)
136 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_WOR_S_INT_KEY (0x01)
137 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_WOR_S_ENC_KEY (0x02)
140 #define RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS (16)
141 #define RADIOLIB_LORAWAN_FHDR_DEV_ADDR_POS (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 1)
142 #define RADIOLIB_LORAWAN_FHDR_FCTRL_POS (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 5)
143 #define RADIOLIB_LORAWAN_FHDR_FCNT_POS (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 6)
144 #define RADIOLIB_LORAWAN_FHDR_FOPTS_POS (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 8)
145 #define RADIOLIB_LORAWAN_FHDR_FOPTS_LEN_MASK (0x0F)
146 #define RADIOLIB_LORAWAN_FHDR_FOPTS_MAX_LEN (15)
147 #define RADIOLIB_LORAWAN_FHDR_FPORT_POS(FOPTS) (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 8 + (FOPTS))
148 #define RADIOLIB_LORAWAN_FRAME_PAYLOAD_POS(FOPTS) (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 9 + (FOPTS))
149 #define RADIOLIB_LORAWAN_FRAME_LEN(PAYLOAD, FOPTS) (16 + 13 + (PAYLOAD) + (FOPTS))
152 #define RADIOLIB_LORAWAN_BLOCK_MAGIC_POS (0)
153 #define RADIOLIB_LORAWAN_BLOCK_CONF_FCNT_POS (1)
154 #define RADIOLIB_LORAWAN_BLOCK_DIR_POS (5)
155 #define RADIOLIB_LORAWAN_BLOCK_DEV_ADDR_POS (6)
156 #define RADIOLIB_LORAWAN_BLOCK_FCNT_POS (10)
159 #define RADIOLIB_LORAWAN_ENC_BLOCK_MAGIC (0x01)
160 #define RADIOLIB_LORAWAN_ENC_BLOCK_COUNTER_ID_POS (4)
161 #define RADIOLIB_LORAWAN_ENC_BLOCK_COUNTER_POS (15)
164 #define RADIOLIB_LORAWAN_MIC_BLOCK_MAGIC (0x49)
165 #define RADIOLIB_LORAWAN_MIC_BLOCK_LEN_POS (15)
166 #define RADIOLIB_LORAWAN_MIC_DATA_RATE_POS (3)
167 #define RADIOLIB_LORAWAN_MIC_CH_INDEX_POS (4)
170 #define RADIOLIB_LORAWAN_DWELL_TIME (400)
173 #define RADIOLIB_LORAWAN_FCNT_NONE (0xFFFFFFFF)
176 #define RADIOLIB_LORAWAN_DIFS_DEFAULT (2)
177 #define RADIOLIB_LORAWAN_BACKOFF_MAX_DEFAULT (6)
178 #define RADIOLIB_LORAWAN_MAX_CHANGES_DEFAULT (4)
181 #define RADIOLIB_LORAWAN_NUM_MAC_COMMANDS (23)
183 #define RADIOLIB_LORAWAN_MAC_RESET (0x01)
184 #define RADIOLIB_LORAWAN_MAC_LINK_CHECK (0x02)
185 #define RADIOLIB_LORAWAN_MAC_LINK_ADR (0x03)
186 #define RADIOLIB_LORAWAN_MAC_DUTY_CYCLE (0x04)
187 #define RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP (0x05)
188 #define RADIOLIB_LORAWAN_MAC_DEV_STATUS (0x06)
189 #define RADIOLIB_LORAWAN_MAC_NEW_CHANNEL (0x07)
190 #define RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP (0x08)
191 #define RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP (0x09)
192 #define RADIOLIB_LORAWAN_MAC_DL_CHANNEL (0x0A)
193 #define RADIOLIB_LORAWAN_MAC_REKEY (0x0B)
194 #define RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP (0x0C)
195 #define RADIOLIB_LORAWAN_MAC_DEVICE_TIME (0x0D)
196 #define RADIOLIB_LORAWAN_MAC_FORCE_REJOIN (0x0E)
197 #define RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP (0x0F)
198 #define RADIOLIB_LORAWAN_MAC_PROPRIETARY (0x80)
201 #define RADIOLIB_LORAWAN_MAC_COMMAND_QUEUE_SIZE (9)
204 #define RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS (16)
207 #define RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_DOWN (5)
208 #define RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_UP (2)
209 #define RADIOLIB_LORAWAN_MAX_NUM_ADR_COMMANDS (8)
232 #define RADIOLIB_LORAWAN_MAC_COMMAND_NONE { .cid = 0, .lenDn = 0, .lenUp = 0, .persist = false, .user = false }
235 { RADIOLIB_LORAWAN_MAC_RESET, 1, 1,
false,
false },
236 { RADIOLIB_LORAWAN_MAC_LINK_CHECK, 2, 0,
false,
true },
237 { RADIOLIB_LORAWAN_MAC_LINK_ADR, 4, 1,
false,
false },
238 { RADIOLIB_LORAWAN_MAC_DUTY_CYCLE, 1, 0,
false,
false },
239 { RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP, 4, 1,
true,
false },
240 { RADIOLIB_LORAWAN_MAC_DEV_STATUS, 0, 2,
false,
false },
241 { RADIOLIB_LORAWAN_MAC_NEW_CHANNEL, 5, 1,
false,
false },
242 { RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP, 1, 0,
true,
false },
243 { RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP, 1, 0,
true,
false },
244 { RADIOLIB_LORAWAN_MAC_DL_CHANNEL, 4, 1,
true,
false },
245 { RADIOLIB_LORAWAN_MAC_REKEY, 1, 1,
false,
false },
246 { RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP, 1, 0,
false,
false },
247 { RADIOLIB_LORAWAN_MAC_DEVICE_TIME, 5, 0,
false,
true },
248 { RADIOLIB_LORAWAN_MAC_FORCE_REJOIN, 2, 0,
false,
false },
249 { RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP, 1, 1,
false,
false },
250 { RADIOLIB_LORAWAN_MAC_PROPRIETARY, 5, 0,
false,
true },
253 #define RADIOLIB_LORAWAN_NONCES_VERSION_VAL (0x0001)
255 enum LoRaWANSchemeBase_t {
256 RADIOLIB_LORAWAN_NONCES_START = 0x00,
257 RADIOLIB_LORAWAN_NONCES_VERSION = RADIOLIB_LORAWAN_NONCES_START,
258 RADIOLIB_LORAWAN_NONCES_MODE = RADIOLIB_LORAWAN_NONCES_VERSION +
sizeof(uint16_t),
259 RADIOLIB_LORAWAN_NONCES_CLASS = RADIOLIB_LORAWAN_NONCES_MODE +
sizeof(uint16_t),
260 RADIOLIB_LORAWAN_NONCES_PLAN = RADIOLIB_LORAWAN_NONCES_CLASS +
sizeof(uint8_t),
261 RADIOLIB_LORAWAN_NONCES_CHECKSUM = RADIOLIB_LORAWAN_NONCES_PLAN +
sizeof(uint8_t),
262 RADIOLIB_LORAWAN_NONCES_DEV_NONCE = RADIOLIB_LORAWAN_NONCES_CHECKSUM +
sizeof(uint16_t),
263 RADIOLIB_LORAWAN_NONCES_JOIN_NONCE = RADIOLIB_LORAWAN_NONCES_DEV_NONCE +
sizeof(uint16_t),
264 RADIOLIB_LORAWAN_NONCES_ACTIVE = RADIOLIB_LORAWAN_NONCES_JOIN_NONCE + 3,
265 RADIOLIB_LORAWAN_NONCES_SIGNATURE = RADIOLIB_LORAWAN_NONCES_ACTIVE +
sizeof(uint8_t),
266 RADIOLIB_LORAWAN_NONCES_BUF_SIZE = RADIOLIB_LORAWAN_NONCES_SIGNATURE +
sizeof(uint16_t)
269 enum LoRaWANSchemeSession_t {
270 RADIOLIB_LORAWAN_SESSION_START = 0x00,
271 RADIOLIB_LORAWAN_SESSION_NWK_SENC_KEY = RADIOLIB_LORAWAN_SESSION_START,
272 RADIOLIB_LORAWAN_SESSION_APP_SKEY = RADIOLIB_LORAWAN_SESSION_NWK_SENC_KEY + RADIOLIB_AES128_KEY_SIZE,
273 RADIOLIB_LORAWAN_SESSION_FNWK_SINT_KEY = RADIOLIB_LORAWAN_SESSION_APP_SKEY + RADIOLIB_AES128_KEY_SIZE,
274 RADIOLIB_LORAWAN_SESSION_SNWK_SINT_KEY = RADIOLIB_LORAWAN_SESSION_FNWK_SINT_KEY + RADIOLIB_AES128_KEY_SIZE,
275 RADIOLIB_LORAWAN_SESSION_DEV_ADDR = RADIOLIB_LORAWAN_SESSION_SNWK_SINT_KEY + RADIOLIB_AES128_KEY_SIZE,
276 RADIOLIB_LORAWAN_SESSION_NONCES_SIGNATURE = RADIOLIB_LORAWAN_SESSION_DEV_ADDR +
sizeof(uint32_t),
277 RADIOLIB_LORAWAN_SESSION_FCNT_UP = RADIOLIB_LORAWAN_SESSION_NONCES_SIGNATURE + 2,
278 RADIOLIB_LORAWAN_SESSION_N_FCNT_DOWN = RADIOLIB_LORAWAN_SESSION_FCNT_UP +
sizeof(uint32_t),
279 RADIOLIB_LORAWAN_SESSION_A_FCNT_DOWN = RADIOLIB_LORAWAN_SESSION_N_FCNT_DOWN +
sizeof(uint32_t),
280 RADIOLIB_LORAWAN_SESSION_ADR_FCNT = RADIOLIB_LORAWAN_SESSION_A_FCNT_DOWN +
sizeof(uint32_t),
281 RADIOLIB_LORAWAN_SESSION_CONF_FCNT_UP = RADIOLIB_LORAWAN_SESSION_ADR_FCNT +
sizeof(uint32_t),
282 RADIOLIB_LORAWAN_SESSION_CONF_FCNT_DOWN = RADIOLIB_LORAWAN_SESSION_CONF_FCNT_UP +
sizeof(uint32_t),
283 RADIOLIB_LORAWAN_SESSION_RJ_COUNT0 = RADIOLIB_LORAWAN_SESSION_CONF_FCNT_DOWN +
sizeof(uint32_t),
284 RADIOLIB_LORAWAN_SESSION_RJ_COUNT1 = RADIOLIB_LORAWAN_SESSION_RJ_COUNT0 +
sizeof(uint16_t),
285 RADIOLIB_LORAWAN_SESSION_HOMENET_ID = RADIOLIB_LORAWAN_SESSION_RJ_COUNT1 +
sizeof(uint16_t),
286 RADIOLIB_LORAWAN_SESSION_VERSION = RADIOLIB_LORAWAN_SESSION_HOMENET_ID +
sizeof(uint32_t),
287 RADIOLIB_LORAWAN_SESSION_LINK_ADR = RADIOLIB_LORAWAN_SESSION_VERSION +
sizeof(uint8_t),
288 RADIOLIB_LORAWAN_SESSION_DUTY_CYCLE = RADIOLIB_LORAWAN_SESSION_LINK_ADR + 14,
289 RADIOLIB_LORAWAN_SESSION_RX_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_DUTY_CYCLE + 1,
290 RADIOLIB_LORAWAN_SESSION_RX_TIMING_SETUP = RADIOLIB_LORAWAN_SESSION_RX_PARAM_SETUP + 4,
291 RADIOLIB_LORAWAN_SESSION_TX_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_RX_TIMING_SETUP + 1,
292 RADIOLIB_LORAWAN_SESSION_ADR_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_TX_PARAM_SETUP + 1,
293 RADIOLIB_LORAWAN_SESSION_REJOIN_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_ADR_PARAM_SETUP + 1,
294 RADIOLIB_LORAWAN_SESSION_BEACON_FREQ = RADIOLIB_LORAWAN_SESSION_REJOIN_PARAM_SETUP + 1,
295 RADIOLIB_LORAWAN_SESSION_PING_SLOT_CHANNEL = RADIOLIB_LORAWAN_SESSION_BEACON_FREQ + 3,
296 RADIOLIB_LORAWAN_SESSION_PERIODICITY = RADIOLIB_LORAWAN_SESSION_PING_SLOT_CHANNEL + 4,
297 RADIOLIB_LORAWAN_SESSION_LAST_TIME = RADIOLIB_LORAWAN_SESSION_PERIODICITY + 1,
298 RADIOLIB_LORAWAN_SESSION_UL_CHANNELS = RADIOLIB_LORAWAN_SESSION_LAST_TIME + 4,
299 RADIOLIB_LORAWAN_SESSION_DL_CHANNELS = RADIOLIB_LORAWAN_SESSION_UL_CHANNELS + RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS*5,
300 RADIOLIB_LORAWAN_SESSION_AVAILABLE_CHANNELS = RADIOLIB_LORAWAN_SESSION_DL_CHANNELS + RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS*4,
301 RADIOLIB_LORAWAN_SESSION_MAC_QUEUE = RADIOLIB_LORAWAN_SESSION_AVAILABLE_CHANNELS +
sizeof(uint16_t),
302 RADIOLIB_LORAWAN_SESSION_MAC_QUEUE_LEN = RADIOLIB_LORAWAN_SESSION_MAC_QUEUE + RADIOLIB_LORAWAN_FHDR_FOPTS_MAX_LEN,
303 RADIOLIB_LORAWAN_SESSION_SIGNATURE = RADIOLIB_LORAWAN_SESSION_MAC_QUEUE_LEN +
sizeof(uint8_t),
304 RADIOLIB_LORAWAN_SESSION_BUF_SIZE = RADIOLIB_LORAWAN_SESSION_SIGNATURE +
sizeof(uint16_t)
336 #define RADIOLIB_LORAWAN_CHANNEL_NONE { .enabled = false, .idx = RADIOLIB_LORAWAN_CHANNEL_INDEX_NONE, .freq = 0, \
337 .drMin = 0, .drMax = 0, .dr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED, .available = false }
365 #define RADIOLIB_LORAWAN_CHANNEL_SPAN_NONE { .numChannels = 0, .freqStart = 0, .freqStep = 0, .drMin = 0, .drMax = 0, .drJoinRequest = RADIOLIB_LORAWAN_DATA_RATE_UNUSED }
417 uint8_t rx1DrTable[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES][8];
429 uint8_t
dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];
465 #define RADIOLIB_LORAWAN_NUM_SUPPORTED_BANDS (BandLast - BandEU868)
576 int16_t
beginOTAA(uint64_t joinEUI, uint64_t devEUI,
const uint8_t* nwkKey,
const uint8_t* appKey);
588 int16_t
beginABP(uint32_t addr,
const uint8_t* fNwkSIntKey,
const uint8_t* sNwkSIntKey,
const uint8_t* nwkSEncKey,
const uint8_t* appSKey);
604 virtual int16_t
activateABP(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED);
609 #if defined(RADIOLIB_BUILD_ARDUINO)
681 virtual int16_t
sendReceive(
const uint8_t* dataUp,
size_t lenUp, uint8_t fPort, uint8_t* dataDown,
size_t* lenDown,
bool isConfirmed =
false,
LoRaWANEvent_t* eventUp = NULL,
LoRaWANEvent_t* eventDown = NULL);
711 int16_t
getMacDeviceTimeAns(uint32_t* gpsEpoch, uint8_t* fraction,
bool returnUnix =
true);
739 void setADR(
bool enable =
true);
764 void setCSMA(
bool csmaEnabled, uint8_t maxChanges = 4, uint8_t backoffMax = 0, uint8_t difsSlots = 2);
857 #if !RADIOLIB_GODMODE
864 uint8_t bufferNonces[RADIOLIB_LORAWAN_NONCES_BUF_SIZE] = { 0 };
867 uint8_t bufferSession[RADIOLIB_LORAWAN_SESSION_BUF_SIZE] = { 0 };
869 uint8_t fOptsUp[RADIOLIB_LORAWAN_FHDR_FOPTS_MAX_LEN] = { 0 };
870 uint8_t fOptsDown[RADIOLIB_LORAWAN_FHDR_FOPTS_MAX_LEN] = { 0 };
871 uint8_t fOptsUpLen = 0;
872 uint8_t fOptsDownLen = 0;
874 uint16_t lwMode = RADIOLIB_LORAWAN_MODE_NONE;
875 uint8_t lwClass = RADIOLIB_LORAWAN_CLASS_A;
876 bool isActive =
false;
878 uint64_t joinEUI = 0;
880 uint8_t nwkKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
881 uint8_t appKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
885 uint32_t devAddr = 0;
886 uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
887 uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
888 uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
889 uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
890 uint8_t jSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
892 uint16_t keyCheckSum = 0;
895 uint16_t devNonce = 0;
896 uint32_t joinNonce = 0;
899 uint32_t homeNetId = 0;
900 uint8_t adrLimitExp = RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP;
901 uint8_t adrDelayExp = RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP;
903 uint8_t txPowerSteps = 0;
904 uint8_t txPowerMax = 0;
906 uint32_t aFCntDown = 0;
907 uint32_t nFCntDown = 0;
908 uint32_t confFCntUp = RADIOLIB_LORAWAN_FCNT_NONE;
909 uint32_t confFCntDown = RADIOLIB_LORAWAN_FCNT_NONE;
910 uint32_t adrFCnt = 0;
913 bool adrEnabled =
true;
916 bool dutyCycleEnabled =
false;
917 uint32_t dutyCycle = 0;
920 bool dwellTimeEnabledUp =
false;
921 uint16_t dwellTimeUp = 0;
922 bool dwellTimeEnabledDn =
false;
923 uint16_t dwellTimeDn = 0;
929 bool csmaEnabled =
false;
932 uint8_t maxChanges = RADIOLIB_LORAWAN_MAX_CHANGES_DEFAULT;
937 uint8_t backoffMax = RADIOLIB_LORAWAN_BACKOFF_MAX_DEFAULT;
940 uint8_t difsSlots = RADIOLIB_LORAWAN_DIFS_DEFAULT;
946 LoRaWANChannel_t channels[3] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE,
947 RADIOLIB_LORAWAN_CHANNEL_NONE };
951 RadioLibTime_t rxDelays[3] = { 0, RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS, RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS };
954 uint8_t rx1DrOffset = 0;
969 uint8_t battLevel = 0xFF;
972 bool isMACPayload =
false;
984 void createSession(uint16_t lwMode, uint8_t initialDr);
987 void composeJoinRequest(uint8_t* joinRequestMsg);
993 void processCFList(uint8_t* cfList);
996 int16_t isValidUplink(uint8_t* len, uint8_t fPort);
1002 void composeUplink(
const uint8_t* in, uint8_t lenIn, uint8_t* out, uint8_t fPort,
bool isConfirmed);
1005 void micUplink(uint8_t* inOut, uint8_t lenInOut);
1008 int16_t transmitUplink(
LoRaWANChannel_t* chnl, uint8_t* in, uint8_t len,
bool retrans);
1014 int16_t parseDownlink(uint8_t* data,
size_t* len,
LoRaWANEvent_t* event = NULL);
1017 bool execMacCommand(uint8_t cid, uint8_t* optIn, uint8_t lenIn);
1018 bool execMacCommand(uint8_t cid, uint8_t* optIn, uint8_t lenIn, uint8_t* optOut);
1021 virtual bool derivedMacHandler(uint8_t cid, uint8_t* optIn, uint8_t lenIn, uint8_t* optOut);
1024 void preprocessMacLinkAdr(uint8_t* mPtr, uint8_t cLen, uint8_t* mAdrOpt);
1027 void postprocessMacLinkAdr(uint8_t* ack, uint8_t cLen);
1037 int16_t getMacLen(uint8_t cid, uint8_t* len, uint8_t dir,
bool inclusive =
false);
1042 bool isPersistentMacCommand(uint8_t cid, uint8_t dir);
1045 int16_t pushMacCommand(uint8_t cid, uint8_t* cOcts, uint8_t* out, uint8_t* lenOut, uint8_t dir);
1048 int16_t getMacPayload(uint8_t cid, uint8_t* in, uint8_t lenIn, uint8_t* out, uint8_t dir);
1051 int16_t deleteMacCommand(uint8_t cid, uint8_t* inOut, uint8_t* lenInOut, uint8_t dir);
1054 void clearMacCommands(uint8_t* inOut, uint8_t* lenInOut, uint8_t dir);
1057 int16_t setPhyProperties(
const LoRaWANChannel_t* chnl, uint8_t dir, int8_t pwr,
size_t pre = 0);
1060 bool csmaChannelClear(uint8_t difs, uint8_t numBackoff);
1063 bool cadChannelClear();
1066 void getChannelPlanMask(uint64_t* chMaskGrp0123, uint32_t* chMaskGrp45);
1071 void selectChannelPlanDyn(
bool joinRequest =
false);
1075 void selectChannelPlanFix();
1079 uint8_t getAvailableChannels(uint16_t* mask);
1082 void setAvailableChannels(uint16_t mask);
1085 int16_t selectChannels();
1088 bool applyChannelMask(uint64_t chMaskGrp0123, uint32_t chMaskGrp45);
1090 #if RADIOLIB_DEBUG_PROTOCOL
1092 void printChannels();
1096 uint32_t generateMIC(uint8_t* msg,
size_t len, uint8_t* key);
1100 bool verifyMIC(uint8_t* msg,
size_t len, uint8_t* key);
1103 int16_t findDataRate(uint8_t dr,
DataRate_t* dataRate);
1106 void processAES(
const uint8_t* in,
size_t len, uint8_t* key, uint8_t* out, uint32_t fCnt, uint8_t dir, uint8_t ctrId,
bool counter);
1109 static uint16_t checkSum16(
const uint8_t *key, uint16_t keyLen);
1112 static int16_t checkBufferCommon(
const uint8_t *buffer, uint16_t size);
1115 template<
typename T>
1116 static T ntoh(
const uint8_t* buff,
size_t size = 0);
1119 template<
typename T>
1120 static void hton(uint8_t* buff, T val,
size_t size = 0);
1123 template<
typename T>
1124 T LoRaWANNode::ntoh(
const uint8_t* buff,
size_t size) {
1125 const uint8_t* buffPtr = buff;
1126 size_t targetSize =
sizeof(T);
1131 for(
size_t i = 0; i < targetSize; i++) {
1132 res |= (uint32_t)(*(buffPtr++)) << 8*i;
1137 template<
typename T>
1138 void LoRaWANNode::hton(uint8_t* buff, T val,
size_t size) {
1139 uint8_t* buffPtr = buff;
1140 size_t targetSize =
sizeof(T);
1144 for(
size_t i = 0; i < targetSize; i++) {
1145 *(buffPtr++) = val >> 8*i;
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:526
void clearSession()
Clear an active session, so that the device will have to rejoin the network.
Definition: LoRaWAN.cpp:280
virtual int16_t sendReceive(const char *strUp, uint8_t fPort, bool isConfirmed=false, LoRaWANEvent_t *eventUp=NULL, LoRaWANEvent_t *eventDown=NULL)
Send a message to the server and wait for a downlink during Rx1 and/or Rx2 window.
Definition: LoRaWAN.cpp:45
int16_t setDatarate(uint8_t drUp)
Set uplink datarate. This should not be used when ADR is enabled.
Definition: LoRaWAN.cpp:2593
void scheduleTransmission(RadioLibTime_t tUplink)
Set the exact time a transmission should occur. Note: this is the internal clock time....
Definition: LoRaWAN.cpp:2724
RadioLibTime_t scanGuard
Rx window padding in milliseconds according to the spec, the Rx window must be at least enough time t...
Definition: LoRaWAN.h:855
void setCSMA(bool csmaEnabled, uint8_t maxChanges=4, uint8_t backoffMax=0, uint8_t difsSlots=2)
Configures CSMA for LoRaWAN as per TR013, LoRa Alliance.
Definition: LoRaWAN.cpp:2706
void setDutyCycle(bool enable=true, RadioLibTime_t msPerHour=0)
Toggle adherence to dutyCycle limits to on or off.
Definition: LoRaWAN.cpp:2683
int16_t beginABP(uint32_t addr, const uint8_t *fNwkSIntKey, const uint8_t *sNwkSIntKey, const uint8_t *nwkSEncKey, const uint8_t *appSKey)
Set the device credentials and activation configuration.
Definition: LoRaWAN.cpp:614
RadioLibTime_t timeUntilUplink()
Returns time in milliseconds until next uplink is available under dutyCycle limits.
Definition: LoRaWAN.cpp:3232
void setDeviceStatus(uint8_t battLevel)
Set device status.
Definition: LoRaWAN.cpp:2720
RadioLibTime_t dutyCycleInterval(RadioLibTime_t msPerHour, RadioLibTime_t airtime)
Calculate the minimum interval to adhere to a certain dutyCycle. This interval is based on the ToA of...
Definition: LoRaWAN.cpp:3222
void setDwellTime(bool enable, RadioLibTime_t msPerUplink=0)
Toggle adherence to dwellTime limits to on or off.
Definition: LoRaWAN.cpp:2695
uint32_t getAFCntDown()
Returns the last application downlink's frame counter; also 0 if no application downlink occured yet.
Definition: LoRaWAN.cpp:2740
RadioLibTime_t getLastToA()
Get the Time-on-air of the last uplink message (in milliseconds).
Definition: LoRaWAN.cpp:2753
virtual int16_t activateABP(uint8_t initialDr=RADIOLIB_LORAWAN_DATA_RATE_UNUSED)
Join network by restoring ABP session or performing over-the-air activation. In this procedure,...
Definition: LoRaWAN.cpp:960
bool TS009
TS009 Protocol Specification Verification switch (allows FPort 224 and cuts off uplink payload instea...
Definition: LoRaWAN.h:841
uint8_t * getBufferNonces()
Returns the pointer to the internal buffer that holds the LW base parameters.
Definition: LoRaWAN.cpp:229
uint8_t * getBufferSession()
Returns the pointer to the internal buffer that holds the LW session parameters.
Definition: LoRaWAN.cpp:429
bool isActivated()
Whether there is an ongoing session active.
Definition: LoRaWAN.cpp:1051
int16_t setTxPower(int8_t txPower)
Configure TX power of the radio module.
Definition: LoRaWAN.cpp:2626
int16_t getMacDeviceTimeAns(uint32_t *gpsEpoch, uint8_t *fraction, bool returnUnix=true)
Returns the network time after requesting a DeviceTime MAC command. Returns 'true' if a network respo...
Definition: LoRaWAN.cpp:2444
uint32_t getNFCntDown()
Returns the last network downlink's frame counter; also 0 if no network downlink occured yet.
Definition: LoRaWAN.cpp:2736
LoRaWANNode(PhysicalLayer *phy, const LoRaWANBand_t *band, uint8_t subBand=0)
Default constructor.
Definition: LoRaWAN.cpp:9
int16_t beginOTAA(uint64_t joinEUI, uint64_t devEUI, const uint8_t *nwkKey, const uint8_t *appKey)
Set the device credentials and activation configuration.
Definition: LoRaWAN.cpp:585
uint8_t getMaxPayloadLen()
Returns the maximum allowed uplink payload size given the current MAC state. Most importantly,...
Definition: LoRaWAN.cpp:3241
virtual int16_t activateOTAA(uint8_t initialDr=RADIOLIB_LORAWAN_DATA_RATE_UNUSED, LoRaWANJoinEvent_t *joinEvent=NULL)
Join network by restoring OTAA session or performing over-the-air activation. By this procedure,...
Definition: LoRaWAN.cpp:870
uint32_t getFCntUp()
Returns the last uplink's frame counter; also 0 if no uplink occured yet.
Definition: LoRaWAN.cpp:2729
int16_t setBufferNonces(const uint8_t *persistentBuffer)
Fill the internal buffer that holds the LW base parameters with a supplied buffer.
Definition: LoRaWAN.cpp:244
int16_t setRx2Dr(uint8_t dr)
Configure the Rx2 datarate for ABP mode. This should not be needed for LoRaWAN 1.1 as it is configure...
Definition: LoRaWAN.cpp:2652
int16_t sendMacCommandReq(uint8_t cid)
Add a MAC command to the uplink queue. Only LinkCheck and DeviceTime are available to the user....
Definition: LoRaWAN.cpp:2409
int16_t getMacLinkCheckAns(uint8_t *margin, uint8_t *gwCnt)
Returns the quality of connectivity after requesting a LinkCheck MAC command. Returns 'true' if a net...
Definition: LoRaWAN.cpp:2433
void setADR(bool enable=true)
Toggle ADR to on or off.
Definition: LoRaWAN.cpp:2679
int16_t setBufferSession(const uint8_t *persistentBuffer)
Fill the internal buffer that holds the LW session parameters with a supplied buffer.
Definition: LoRaWAN.cpp:461
uint32_t getDevAddr()
Returns the DevAddr of the device, regardless of OTAA or ABP mode.
Definition: LoRaWAN.cpp:2749
void resetFCntDown()
Reset the downlink frame counters (application and network) This is unsafe and can possibly allow rep...
Definition: LoRaWAN.cpp:2744
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:151
unsigned long RadioLibTime_t
Type used for durations in RadioLib.
Definition: TypeDef.h:642
Structure to save information about LoRaWAN band.
Definition: LoRaWAN.h:371
int8_t powerMax
Maximum allowed output power in this band in dBm.
Definition: LoRaWAN.h:388
bool txParamSupported
Whether this band implements the MAC command TxParamSetupReq.
Definition: LoRaWAN.h:403
LoRaWANChannel_t txAck[2]
Relay channels for ACK downlink.
Definition: LoRaWAN.h:426
RadioLibTime_t dutyCycle
Number of milliseconds per hour of allowed Time-on-Air.
Definition: LoRaWAN.h:394
uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
The corresponding datarates, bandwidths and coding rates for DR index.
Definition: LoRaWAN.h:429
RadioLibTime_t dwellTimeUp
Maximum dwell time per uplink message in milliseconds.
Definition: LoRaWAN.h:397
LoRaWANChannel_t txWoR[2]
Relay channels for WoR uplink.
Definition: LoRaWAN.h:423
uint32_t freqMin
Minimum allowed frequency (coded in 100 Hz steps)
Definition: LoRaWAN.h:379
uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
Array of allowed maximum application payload lengths for each data rate (N-value)
Definition: LoRaWAN.h:385
LoRaWANChannel_t txFreqs[3]
A set of default uplink (TX) channels for dynamic bands.
Definition: LoRaWAN.h:406
int8_t powerNumSteps
Number of power steps in this band.
Definition: LoRaWAN.h:391
LoRaWANChannelSpan_t txSpans[2]
Default uplink (TX) channel spans for fixed bands, including Join-Request parameters.
Definition: LoRaWAN.h:412
uint8_t bandNum
Identier for this band.
Definition: LoRaWAN.h:373
uint32_t freqMax
Maximum allowed frequency (coded in 100 Hz steps)
Definition: LoRaWAN.h:382
uint8_t bandType
Whether the channels are fixed per specification, or dynamically allocated through the network (plus ...
Definition: LoRaWAN.h:376
LoRaWANChannel_t rx2
Backup channel for downlink (RX2) window.
Definition: LoRaWAN.h:420
uint8_t numTxSpans
The number of TX channel spans for fixed bands.
Definition: LoRaWAN.h:409
RadioLibTime_t dwellTimeDn
Maximum dwell time per downlink message in milliseconds.
Definition: LoRaWAN.h:400
LoRaWANChannelSpan_t rx1Span
Default downlink (RX1) channel span for fixed bands.
Definition: LoRaWAN.h:415
IDs of all currently supported bands.
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition: LoRaWAN.h:312
bool available
Whether this channel is available for channel selection.
Definition: LoRaWAN.h:332
uint8_t dr
Datarate currently in use on this channel.
Definition: LoRaWAN.h:329
uint32_t freq
The channel frequency (coded in 100 Hz steps)
Definition: LoRaWAN.h:320
uint8_t idx
The channel number, as specified by defaults or the network.
Definition: LoRaWAN.h:317
uint8_t drMin
Minimum allowed datarate for this channel.
Definition: LoRaWAN.h:323
bool enabled
Whether this channel is enabled (can be used) or is disabled.
Definition: LoRaWAN.h:314
uint8_t drMax
Maximum allowed datarate for this channel (inclusive)
Definition: LoRaWAN.h:326
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition: LoRaWAN.h:344
uint8_t drJoinRequest
Allowed data rates for a join request message.
Definition: LoRaWAN.h:361
uint32_t freqStart
Center frequency of the first channel in span (coded in 100 Hz steps)
Definition: LoRaWAN.h:349
uint8_t numChannels
Total number of channels in the span.
Definition: LoRaWAN.h:346
uint8_t drMax
Maximum allowed datarate for all channels in this span (inclusive)
Definition: LoRaWAN.h:358
uint32_t freqStep
Frequency step between adjacent channels (coded in 100 Hz steps)
Definition: LoRaWAN.h:352
uint8_t drMin
Minimum allowed datarate for all channels in this span.
Definition: LoRaWAN.h:355
Structure to save extra information about uplink/downlink event.
Definition: LoRaWAN.h:489
float freq
Frequency in MHz.
Definition: LoRaWAN.h:507
bool confirmed
Whether the event is confirmed or not (e.g., confirmed uplink sent by user application)
Definition: LoRaWAN.h:494
uint8_t fPort
Port number.
Definition: LoRaWAN.h:516
int16_t power
Transmit power in dBm for uplink, or RSSI for downlink.
Definition: LoRaWAN.h:510
bool confirming
Whether the event is confirming a previous request (e.g., server downlink reply to confirmed uplink s...
Definition: LoRaWAN.h:498
uint8_t datarate
Datarate.
Definition: LoRaWAN.h:504
uint8_t dir
Event direction, one of RADIOLIB_LORAWAN_CHANNEL_DIR_*.
Definition: LoRaWAN.h:491
uint8_t nbTrans
Number of times this uplink was transmitted (ADR)
Definition: LoRaWAN.h:519
uint32_t fCnt
The appropriate frame counter - for different events, different frame counters will be reported!
Definition: LoRaWAN.h:513
bool frmPending
Whether further downlink messages are pending on the server side.
Definition: LoRaWAN.h:501
Structure to save extra information about activation event.
Definition: LoRaWAN.h:474
bool newSession
Whether a new session was started.
Definition: LoRaWAN.h:476
uint32_t joinNonce
The received Join-Request JoinNonce value.
Definition: LoRaWAN.h:482
uint16_t devNonce
The transmitted Join-Request DevNonce value.
Definition: LoRaWAN.h:479
MAC command specification structure.
Definition: LoRaWAN.h:215
const uint8_t lenDn
Uplink message length.
Definition: LoRaWAN.h:220
const bool user
Whether this MAC command can be issued by the user or not.
Definition: LoRaWAN.h:229
const uint8_t cid
Command ID.
Definition: LoRaWAN.h:217
const uint8_t lenUp
Downlink message length.
Definition: LoRaWAN.h:223
const bool persist
Some commands must be resent until Class A downlink received.
Definition: LoRaWAN.h:226
Common data rate structure.
Definition: PhysicalLayer.h:74