| Demo HCI Implementation for WiMOD-LR Devices V1.3.1

- Main Page
- Classes
- Files

- File List
- File Members

WiMOD_SAP_LORAWAN_IDs.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------
32
33
34 /*
35 * THIS IS AN EXAMPLE IMPLEMENTATION ACCORDING THE THE HCI SPEC: V1.12
36 * FOR FIRMWARE: LoRaWAN_EndNode_Modem
37 *
38 * SEE FILE: WiMOD_LoRaWAN_EndNode_Modem_HCI_Spec_V1_12.pdf
39 * for detailed information
40 *
41 */
42
43
44 #ifndef ARDUINO_WIMOD_SAP_LORAWAN_IDS_H_
45 #define ARDUINO_WIMOD_SAP_LORAWAN_IDS_H_
46
47 //------------------------------------------------------------------------------
48 //
49 // Section Includes Files
50 //
51 //------------------------------------------------------------------------------
52
53 #include "utils/WMDefs.h"
54
55 //------------------------------------------------------------------------------
56 //
57 // Service Access Point Identifier
58 //
59 //------------------------------------------------------------------------------
60
62 #define LORAWAN_SAP_ID 0x10
63
64
65
66 //------------------------------------------------------------------------------
67 //
68 // LoRaWAN Message Identifier
69 //
70 //------------------------------------------------------------------------------
72
73 // Status Codes
74
75 #define LORAWAN_STATUS_OK 0x00 //Operation successful
76 #define LORAWAN_STATUS_ERROR 0x01 //Operation failed
77 #define LORAWAN_STATUS_CMD_NOT_SUPPORTED 0x02 //Command is not supported
78 #define LORAWAN_STATUS_WRONG_PARAMETER 0x03 //HCI message contains wrong parameter
79 #define LORAWAN_STATUS_WRONG_DEVICE_MODE 0x04 //Stack is running in a wrong mode
80 #define LORAWAN_STATUS_DEVICE_NOT_ACTIVATED 0x05 //Device is not activated
81 #define LORAWAN_STATUS_DEVICE_BUSY 0x06 //Device is busy, command rejected
82 #define LORAWAN_STATUS_QUEUE_FULL 0x07 //Message queue is full, command rejected
83 #define LORAWAN_STATUS_LENGTH_ERROR 0x08 //HCI message length is invalid or radio payload size is too large
84 #define LORAWAN_STATUS_NO_FACTORY_SETTINGS 0x09 //Factory Settings EEPROM block missing
85 #define LORAWAN_STATUS_CHANNEL_BLOCKED 0x0A //Channel blocked by Duty Cycle
86 #define LORAWAN_STATUS_CHANNEL_NOT AVAILABLE 0x0B //No channel available (e.g. no channel defined for the configured spreading factor)
87
89
93 typedef enum TLoRaWANStatus
94 {
95 LoRaWAN_Status_Ok = 0,
96 LoRaWAN_Status_Error,
97 LoRaWAN_Status_Cmd_Not_Supported,
98 LoRaWAN_Status_Wrong_parameter,
99 LoRaWAN_Status_Wrong_DeviceMode,
100 LoRaWAN_Status_Device_Not_Activated,
101 LoRaWAN_Status_Device_Busy,
102 LoRaWAN_Status_Queue_Full,
103 LoRaWAN_Status_Length_Error,
104 LoRaWAN_Status_No_Factory_Settings,
105 LoRaWAN_Status_Channel_Blocked,
106 LoRaWAN_Status_Channel_Not_Available,
107 } TLoRaWANStatus;
108
110
111 #define LORAWAN_FORMAT_STATUS_JOIN_OK 0x00
112 #define LORAWAN_FORMAT_STATUS_JOIN_OK_EXT_HCI 0x01
113
114
115 // Status Format Codes
116 // This is a bit mask field!
117 #define LORAWAN_FORMAT_OK 0x00
118 #define LORAWAN_FORMAT_EXT_HCI_OUT_ACTIVE 0x01
119 #define LORAWAN_FORMAT_ACK_RECEIVED 0x02
120 #define LORAWAN_FORMAT_FP_RECEIVED 0x04
121
122 // Message IDs
123 #define LORAWAN_MSG_ACTIVATE_DEVICE_REQ 0x01
124 #define LORAWAN_MSG_ACTIVATE_DEVICE_RSP 0x02
125 #define LORAWAN_MSG_SET_JOIN_PARAM_REQ 0x05
126 #define LORAWAN_MSG_SET_JOIN_PARAM_RSP 0x06
127 #define LORAWAN_MSG_JOIN_NETWORK_REQ 0x09
128 #define LORAWAN_MSG_JOIN_NETWORK_RSP 0x0A
129 #define LORAWAN_MSG_JOIN_NETWORK_TX_IND 0x0B
130 #define LORAWAN_MSG_JOIN_NETWORK_IND 0x0C
131 #define LORAWAN_MSG_SEND_UDATA_REQ 0x0D
132 #define LORAWAN_MSG_SEND_UDATA_RSP 0x0E
133 #define LORAWAN_MSG_SEND_UDATA_TX_IND 0x0F
134 #define LORAWAN_MSG_RECV_UDATA_IND 0x10
135 #define LORAWAN_MSG_SEND_CDATA_REQ 0x11
136 #define LORAWAN_MSG_SEND_CDATA_RSP 0x12
137 #define LORAWAN_MSG_SEND_CDATA_TX_IND 0x13
138 #define LORAWAN_MSG_RECV_CDATA_IND 0x14
139 #define LORAWAN_MSG_RECV_ACK_IND 0x15
140 #define LORAWAN_MSG_RECV_NO_DATA_IND 0x16
141 #define LORAWAN_MSG_SET_RSTACK_CONFIG_REQ 0x19
142 #define LORAWAN_MSG_SET_RSTACK_CONFIG_RSP 0x1A
143 #define LORAWAN_MSG_GET_RSTACK_CONFIG_REQ 0x1B
144 #define LORAWAN_MSG_GET_RSTACK_CONFIG_RSP 0x1C
145 #define LORAWAN_MSG_REACTIVATE_DEVICE_REQ 0x1D
146 #define LORAWAN_MSG_REACTIVATE_DEVICE_RSP 0x1E
147 #define LORAWAN_MSG_DEACTIVATE_DEVICE_REQ 0x21
148 #define LORAWAN_MSG_DEACTIVATE_DEVICE_RSP 0x22
149 #define LORAWAN_MSG_FACTORY_RESET_REQ 0x23
150 #define LORAWAN_MSG_FACTORY_RESET_RSP 0x24
151 #define LORAWAN_MSG_SET_DEVICE_EUI_REQ 0x25
152 #define LORAWAN_MSG_SET_DEVICE_EUI_RSP 0x26
153 #define LORAWAN_MSG_GET_DEVICE_EUI_REQ 0x27
154 #define LORAWAN_MSG_GET_DEVICE_EUI_RSP 0x28
155 #define LORAWAN_MSG_GET_NWK_STATUS_REQ 0x29
156 #define LORAWAN_MSG_GET_NWK_STATUS_RSP 0x2A
157 #define LORAWAN_MSG_SEND_MAC_CMD_REQ 0x2B
158 #define LORAWAN_MSG_SEND_MAC_CMD_RSP 0x2C
159 #define LORAWAN_MSG_RECV_MAC_CMD_IND 0x2D
160 #define LORAWAN_MSG_SET_CUSTOM_CFG_REQ 0x31
161 #define LORAWAN_MSG_SET_CUSTOM_CFG_RSP 0x32
162 #define LORAWAN_MSG_GET_CUSTOM_CFG_REQ 0x33
163 #define LORAWAN_MSG_GET_CUSTOM_CFG_RSP 0x34
164
165
166
167 // Radio Stack Config Options; bit field
168
169 #define LORAWAN_STK_OPTION_ADR (0x01 << 0)
170 #define LORAWAN_STK_OPTION_DUTY_CYCLE_CTRL (0x01 << 1)
171 #define LORAWAN_STK_OPTION_DEV_CLASS_C (0x01 << 2)
172 #define LORAWAN_STK_OPTION_EXT_PKT_FORMAT (0x01 << 6)
173 #define LORAWAN_STK_OPTION_MAC_CMD (0x01 << 7)
174
175
176 // LoRa Data Rate Index
177
178 #define LORAWAN_DATA_RATE_LORA_SF12_125KHZ 0
179 #define LORAWAN_DATA_RATE_LORA_SF11_125KHZ 1
180 #define LORAWAN_DATA_RATE_LORA_SF10_125KHZ 2
181 #define LORAWAN_DATA_RATE_LORA_SF9_125KHZ 3
182 #define LORAWAN_DATA_RATE_LORA_SF8_125KHZ 4
183 #define LORAWAN_DATA_RATE_LORA_SF7_125KHZ 5
184 #define LORAWAN_DATA_RATE_LORA_SF7_250KHZ 6
185 #define LORAWAN_DATA_RATE_LORA_FSK 7
186
187 #define IS_LORAWAN_DATA_RATE(x) ( ((x) >= LORAWAN_DATA_RATE_LORA_SF12_125KHZ) && \
188 ((X) <= LORAWAN_DATA_RATE_LORA_FSK) )
189
191
195 typedef enum TLoRaWANDataRate
196 {
197 LoRaWAN_DataRate_LoRa_SF12_125kHz = 0,
198 LoRaWAN_DataRate_LoRa_SF11_125kHz,
199 LoRaWAN_DataRate_LoRa_SF10_125kHz,
200 LoRaWAN_DataRate_LoRa_SF9_125kHz,
201 LoRaWAN_DataRate_LoRa_SF8_125kHz,
202 LoRaWAN_DataRate_LoRa_SF7_125kHz,
203 LoRaWAN_DataRate_LoRa_SF7_250kHz,
204 LoRaWAN_DataRate_LoRa_FSK,
205 } TLoRaWANDataRate;
206
208
209 // LoRa Channel Index ( EU868 )
210
211 #define LORAWAN_CH_EU_868_1_MHZ 0
212 #define LORAWAN_CH_EU_868_3_MHZ 1
213 #define LORAWAN_CH_EU_868_5_MHZ 2
214 #define LORAWAN_CH_EU_869_525_MHZ 128
215
216 #define IS_LORAWAN_CH_EU(x) ( ((x) == LORAWAN_CH_EU_868_1_MHZ) || \
217 ((x) == LORAWAN_CH_EU_868_3_MHZ) || \
218 ((x) == LORAWAN_CH_EU_868_5_MHZ) || \
219 ((x) == LORAWAN_CH_EU_869_525_MHZ) )
220
222
226 typedef enum TLoRaWAN_Channel_EU
227 {
228 LoRaWAN_Channel_EU_868_1_Mhz = 0,
229 LoRaWAN_Channel_EU_868_3_Mhz = 1,
230 LoRaWAN_Channel_EU_868_5_Mhz = 2,
231 LoRaWAN_Channel_EU_869_525_Mhz = 128,
232 } TLoRaWAN_Channel_EU;
233
234
236
237 // LoRa Channel Index ( India )
238
239 #define LORAWAN_CH_IN_865_062_5_MHZ 0
240 #define LORAWAN_CH_IN_865_402_5_MHZ 1
241 #define LORAWAN_CH_IN_868_5_MHZ 2
242 #define LORAWAN_CH_IN_866_550_MHZ 128
243
244 #define IS_LORAWAN_CH_IN(x) ( ((x) == LORAWAN_CH_IN_865_062_5_MHZ) || \
245 ((x) == LORAWAN_CH_IN_865_402_5_MHZ) || \
246 ((x) == LORAWAN_CH_IN_868_5_MHZ) || \
247 ((x) == LORAWAN_CH_IN_866_550_MHZ) )
248
250
254 typedef enum TLoRaWAN_Channel_India
255 {
256 LoRaWAN_Channel_India_865_062_5_Mhz = 0,
257 LoRaWAN_Channel_India_865_402_5_Mhz = 1,
258 LoRaWAN_Channel_India_868_5_Mhz = 2,
259 LoRaWAN_Channel_India_866_550_Mhz = 128,
260 } TLoRaWAN_Channel_India;
261
263
264 // @deprecated removed in HCI spec V1_15
265
267 //
268 //#define LORAWAN_CH_NZ_865_0_MHZ 0
269 //#define LORAWAN_CH_NZ_865_2_MHZ 1
270 //#define LORAWAN_CH_NZ_865_4_MHZ 2
271 //#define LORAWAN_CH_NZ_866_2_MHZ 3
272 //#define LORAWAN_CH_NZ_866_4_MHZ 4
273 //#define LORAWAN_CH_NZ_866_6_MHZ 5
274 //#define LORAWAN_CH_NZ_866_8_MHZ 6
275 //#define LORAWAN_CH_NZ_867_0_MHZ 7
276 //#define LORAWAN_CH_NZ_865_6_MHZ 8
277 //#define LORAWAN_CH_NZ_865_9_MHZ 9
278 //#define LORAWAN_CH_NZ_867_2_MHZ 128
279 //
280 /*
281 //#define IS_LORAWAN_CH_NZ(x) ( ((x) == LORAWAN_CH_NZ_865_0_MHZ) || \
282 // ((x) == LORAWAN_CH_NZ_865_2_MHZ) || \
283 // ((x) == LORAWAN_CH_NZ_865_4_MHZ) || \
284 // ((x) == LORAWAN_CH_NZ_866_2_MHZ) || \
285 // ((x) == LORAWAN_CH_NZ_866_4_MHZ) || \
286 // ((x) == LORAWAN_CH_NZ_865_4_MHZ) || \
287 // ((x) == LORAWAN_CH_NZ_866_6_MHZ) || \
288 // ((x) == LORAWAN_CH_NZ_867_0_MHZ) || \
289 // ((x) == LORAWAN_CH_NZ_865_6_MHZ) || \
290 // ((x) == LORAWAN_CH_NZ_865_9_MHZ) || \
291 // ((x) == LORAWAN_CH_NZ_867_2_MHZ) )
292 */
293 //
295
296 // @deprecated removed in HCI spec V1_15
298 // * @brief Channel definition for New Zealand
299 // */
300 //typedef enum TLoRaWAN_Channel_NewZealand
301 //{
302 // LoRaWAN_Channel_NewZealand_865_0_Mhz = 0, /*!< carrier frequency of 865.000 MHz */
303 // LoRaWAN_Channel_NewZealand_865_2_Mhz = 1, /*!< carrier frequency of 866.200 MHz */
304 // LoRaWAN_Channel_NewZealand_865_4_Mhz = 2, /*!< carrier frequency of 865.400 MHz */
305 // LoRaWAN_Channel_NewZealand_866_2_Mhz = 3, /*!< carrier frequency of 866.200 MHz */
306 // LoRaWAN_Channel_NewZealand_866_4_Mhz = 4, /*!< carrier frequency of 866.400 MHz */
307 // LoRaWAN_Channel_NewZealand_866_6_Mhz = 5, /*!< carrier frequency of 866.600 MHz */
308 // LoRaWAN_Channel_NewZealand_866_8_Mhz = 6, /*!< carrier frequency of 866.800 MHz */
309 // LoRaWAN_Channel_NewZealand_867_0_Mhz = 7, /*!< carrier frequency of 867.000 MHz */
310 // LoRaWAN_Channel_NewZealand_865_6_Mhz = 8, /*!< carrier frequency of 865.600 MHz */
311 // LoRaWAN_Channel_NewZealand_865_9_Mhz = 9, /*!< carrier frequency of 865.900 MHz */
312 // LoRaWAN_Channel_NewZealand_867_2_Mhz = 128, /*!< carrier frequency of 867.200 MHz */
313 //} TLoRaWAN_Channel_NewZealand;
314
315
317
318 // @deprecated removed in HCI spec V1_15
320 //
321 //#define LORAWAN_CH_SG_923_5_MHZ 0
322 //#define LORAWAN_CH_SG_923_7_MHZ 1
323 //#define LORAWAN_CH_SG_923_9_MHZ 2
324 //#define LORAWAN_CH_SG_924_1_MHZ 3
325 //#define LORAWAN_CH_SG_924_3_MHZ 4
326 //#define LORAWAN_CH_SG_924_5_MHZ 5
327 //#define LORAWAN_CH_SG_924_7_MHZ 6
328 //#define LORAWAN_CH_SG_924_9_MHZ 7
329 //#define LORAWAN_CH_SG_923_8_MHZ 8
330 //#define LORAWAN_CH_SG_922_5_MHZ 128
331 //
332 /*
333 //#define IS_LORAWAN_CH_SG(x) ( ((x) == LORAWAN_CH_SG_923_5_MHZ) || \
334 // ((x) == LORAWAN_CH_SG_923_7_MHZ) || \
335 // ((x) == LORAWAN_CH_SG_923_9_MHZ) || \
336 // ((x) == LORAWAN_CH_SG_924_1_MHZ) || \
337 // ((x) == LORAWAN_CH_SG_924_3_MHZ) || \
338 // ((x) == LORAWAN_CH_SG_924_5_MHZ) || \
339 // ((x) == LORAWAN_CH_SG_924_7_MHZ) || \
340 // ((x) == LORAWAN_CH_SG_924_9_MHZ) || \
341 // ((x) == LORAWAN_CH_SG_923_8_MHZ) || \
342 // ((x) == LORAWAN_CH_SG_922_5_MHZ) )
343 */
345
346 // @deprecated removed in HCI spec V1_15
348 // * @brief Channel definition for Singapore
349 // */
350 //typedef enum TLoRaWAN_Channel_Singapore
351 //{
352 // LoRaWAN_Channel_Singapore_923_5_Mhz = 0, /*!< carrier frequency of 923.500 MHz */
353 // LoRaWAN_Channel_Singapore_923_7_Mhz = 1, /*!< carrier frequency of 823.700 MHz */
354 // LoRaWAN_Channel_Singapore_923_9_Mhz = 2, /*!< carrier frequency of 923.900 MHz */
355 // LoRaWAN_Channel_Singapore_924_1_Mhz = 3, /*!< carrier frequency of 924.100 MHz */
356 // LoRaWAN_Channel_Singapore_924_3_Mhz = 4, /*!< carrier frequency of 924.300 MHz */
357 // LoRaWAN_Channel_Singapore_924_5_Mhz = 5, /*!< carrier frequency of 924.500 MHz */
358 // LoRaWAN_Channel_Singapore_924_7_Mhz = 6, /*!< carrier frequency of 924.700 MHz */
359 // LoRaWAN_Channel_Singapore_924_9_Mhz = 7, /*!< carrier frequency of 924.900 MHz */
360 // LoRaWAN_Channel_Singapore_923_8_Mhz = 8, /*!< carrier frequency of 923.800 MHz */
361 // LoRaWAN_Channel_Singapore_922_5_Mhz = 128, /*!< carrier frequency of 922.500 MHz */
362 //} TLoRaWAN_Channel_Singapore;
363 //
364
366
367 // LoRa Radio Band Index
368
369 #define LORAWAN_BAND_EU_868 1
370 #define LORAWAN_BAND_RESERVED 2
371 #define LORAWAN_BAND_IN_865 3
372 //#define LORAWAN_BAND_NZ_865 4 // @deprecated removed in HCI spec V1_15
373 //#define LORAWAN_BAND_SG_923 5 // @deprecated removed in HCI spec V1_15
374 #define LORAWAN_BAND_EU_868_RX2_SF9 129
375
376 #define IS_LORAWAN_BAND(x) ( ((x) == LORAWAN_BAND_EU_868) || \
377 ((x) == LORAWAN_BAND_IN_865) || \
378 ((x) == LORAWAN_BAND_NZ_865) || \
379 ((x) == LORAWAN_BAND_SG_923) || \
380 ((x) == LORAWAN_BAND_EU_868_RX2_SF9) )
381
386 typedef enum TLoRaWAN_FreqBand
387 {
388 LoRaWAN_FreqBand_EU_868 = 1,
389 LoRaWAN_FreqBand_Reserved = 2,
390 LoRaWAN_FreqBand_India_865 = 3,
391 // LoRaWAN_FreqBand_NewZealand_865 = 4, /*!< NewZealand */ // @deprecated removed in HCI spec V1_15
392 // LoRaWAN_FreqBand_Singapore_923 = 5, /*!< Singapore */ // @deprecated removed in HCI spec V1_15
393 LoRaWAN_FreqBand_EU_868_RX2_SF9 = 129,
394 } TLoRaWAN_FreqBand;
395
396
398 // LoRa Radio Power Level
399
400 #define LORAWAN_TX_POWER_LEVEL_MIN 0
401 #define LORAWAN_TX_POWER_LEVEL_MAX 20
402
403 #define IS_LORAWAN_TX_POWER_LEVEL(x) ( ((x) >= LORAWAN_TX_POWER_LEVEL_MIN) && \
404 ((X) <= LORAWAN_TX_POWER_LEVEL_MAX) )
405
406
407 // LoRa Radio Power Saving Mode
408
409 #define LORAWAN_POWER_SAVING_MODE_OFF 0
410 #define LORAWAN_POWER_SAVING_MODE_AUTO 1
411
413
417 typedef enum TLoRaWAN_PowerSaving
418 {
419 LoRaWAN_PowerSaving_Off = 0,
420 LoRaWAN_PowerSaving_On = 1,
421 } TLoRaWAN_PowerSaving;
422
423
425 // LoRaWAN Network Status
426
427 #define LORAWAN_NWK_SATUS_INACTIVE 0
428 #define LORAWAN_NWK_STATUS_ACTIVE_ABP 1
429 #define LORAWAN_NWK_STATUS_ACTIVE_OTAA 2
430 #define LORAWAN_NWK_STATUS_JOINING_OTAA 3
431
433
437 typedef enum TLoRaWAN_NwkStatus
438 {
439 LoRaWAN_NwkStatus_Inactive = 0,
440 LoRaWAN_NwkStatus_Active_ABP = 1,
441 LoRaWAN_NwkStatus_Active_OTAA = 2,
442 LoRaWAN_NwkStatus_Joining_OTAA = 3,
443 } TLoRaWAN_NwkStatus;
444
446
447 // LoRaWAN MAC Commands
448
449 #define LORAWAN_MAC_DATA_SERVICE_TYPE_U_DATA 0
450 #define LORAWAN_MAC_DATA_SERVICE_TYPE_C_DATA 1
451
453
454 //------------------------------------------------------------------------------
455 //
456 // misc. defines
457 //
458 //------------------------------------------------------------------------------
460
461 #define WiMODLORAWAN_NWK_SESSION_KEY_LEN 16 // 128 bit
462 #define WiMODLORAWAN_APP_SESSION_KEY_LEN 16 // 128 bit
463
464 #define WiMODLORAWAN_DEV_EUI_LEN 8 // 64 bit
465 #define WiMODLORAWAN_APP_EUI_LEN 8 // 64 bit
466 #define WiMODLORAWAN_APP_KEY_LEN 16 // 128 bit
467
468 #define WiMODLORAWAN_MAC_CMD_PAYLOAD_LENGTH 30
469
471
472 //------------------------------------------------------------------------------
473 //
474 // structures
475 //
476 //------------------------------------------------------------------------------
477
481 typedef struct TWiMODLORAWAN_ActivateDeviceData
482 {
483 UINT32 DeviceAddress;
484 UINT8 NwkSKey[WiMODLORAWAN_NWK_SESSION_KEY_LEN];
485 UINT8 AppSKey[WiMODLORAWAN_NWK_SESSION_KEY_LEN];
486 } TWiMODLORAWAN_ActivateDeviceData;
487
488
492 typedef struct TWiMODLORAWAN_JoinParams
493 {
494 UINT8 AppEUI[WiMODLORAWAN_APP_EUI_LEN];
495 UINT8 AppKey[WiMODLORAWAN_APP_KEY_LEN];
496 } TWiMODLORAWAN_JoinParams;
497
498
502 typedef enum TWiMOD_OptIndInfos
503 {
504 LORAWAN_OPT_TX_IND_INFOS_NOT_AVAILABLE = 0,
505 LORAWAN_OPT_TX_IND_INFOS_EXCL_PKT_CNT = 1,
506 LORAWAN_OPT_TX_IND_INFOS_INCL_PKT_CNT = 2,
507 } TWiMOD_OptIndInfos;
508
509
510
514 typedef struct TWiMODLORAWAN_TxIndData
515 {
516 TWiMOD_OptIndInfos FieldAvailability;
518 UINT8 StatusFormat;
519 // optional - see StatusFormat code
520 UINT8 ChannelIndex;
521 // optional - see StatusFormat code
522 UINT8 DataRateIndex;
523 // optional - see StatusFormat code
524 UINT8 NumTxPackets;
525 // new in V1.14 optional
526 UINT8 PowerLevel;
527 // new in V1.14 optional
528 UINT32 RfMsgAirtime;
529 } TWiMODLORAWAN_TxIndData;
530
531 /*
532 * Number of payload bytes for a user defined message
533 *
534 * Note: the actual number of payload bytes can be less, if the air frame
535 * contains a list of MAC commands.
536 */
538 #define WiMODLORAWAN_APP_PAYLOAD_LEN 128
539
544 typedef struct TWiMODLORAWAN_TX_Data
545 {
546 UINT8 Port;
547 UINT8 Length;
548 UINT8 Payload[WiMODLORAWAN_APP_PAYLOAD_LEN];
549 } TWiMODLORAWAN_TX_Data;
550
551
555 typedef struct TWiMODLORAWAN_RX_Data
556 {
557 UINT8 StatusFormat;
558 UINT8 Port;
559 UINT8 Length;
560 UINT8 Payload[WiMODLORAWAN_APP_PAYLOAD_LEN];
562 // optional RX info
563 UINT8 ChannelIndex;
564 UINT8 DataRateIndex;
565 INT8 RSSI;
566 INT8 SNR;
567 UINT8 RxSlot;
568 bool OptionalInfoAvaiable;
569 } TWiMODLORAWAN_RX_Data;
570
571
575 typedef struct TWiMODLORAWAN_RX_MacCmdData
576 {
577 UINT8 Length;
578 UINT8 MacCmdData[WiMODLORAWAN_APP_PAYLOAD_LEN];
580 // optional RX info
581 UINT8 ChannelIndex;
582 UINT8 DataRateIndex;
583 INT8 RSSI;
584 INT8 SNR;
585 UINT8 RxSlot;
586 bool OptionalInfoAvaiable;
587 } TWiMODLORAWAN_RX_MacCmdData;
588
592 typedef struct TWiMODLORAWAN_RX_JoinedNwkData
593 {
594 UINT8 StatusFormat;
595 UINT32 DeviceAddress;
597 // optional RX info
598 UINT8 ChannelIndex;
599 UINT8 DataRateIndex;
600 INT8 RSSI;
601 INT8 SNR;
602 UINT8 RxSlot;
603 bool OptionalInfoAvaiable;
604 } TWiMODLORAWAN_RX_JoinedNwkData;
605
609 typedef struct TWiMODLORAWAN_RadioStackConfig
610 {
611 UINT8 DataRateIndex;
612 UINT8 TXPowerLevel;
613 UINT8 Options;
614 UINT8 PowerSavingMode;
615 UINT8 Retransmissions;
616 UINT8 BandIndex;
617 } TWiMODLORAWAN_RadioStackConfig;
618
622 typedef struct TWiMODLORAWAN_MacCmd
623 {
624 UINT8 DataServiceType; // see LORAWAN_MAC_DATA_SERVICE_TYPE
625 UINT8 MacCmdID; // see LoRaWAN Spec for command IDs
626 UINT8 Payload[WiMODLORAWAN_MAC_CMD_PAYLOAD_LENGTH];
627 UINT8 Length;
628 } TWiMODLORAWAN_MacCmd;
629
630
634 typedef struct TWiMODLORAWAN_RX_ACK_Data
635 {
636 UINT8 StatusFormat;
638 // optional RX info
639 UINT8 ChannelIndex;
640 UINT8 DataRateIndex;
641 INT8 RSSI;
642 INT8 SNR;
643 UINT8 RxSlot;
644 bool OptionalInfoAvaiable;
645 } TWiMODLORAWAN_RX_ACK_Data;
646
647
651 typedef struct TWiMODLORAWAN_NwkStatus_Data
652 {
653 UINT8 NetworkStatus;
654 UINT32 DeviceAddress;
655 UINT8 DataRateIndex;
656 UINT8 PowerLevel;
657 UINT8 MaxPayloadSize;
658 } TWiMODLORAWAN_NwkStatus_Data;
659
660
661 #endif /* ARDUINO_WIMOD_SAP_LORAWAN_IDS_H_ */
TLoRaWANStatus
TLoRaWANStatus
Status code enumeration for LoRaWAN SAP of the WiMOD EndNode Modem firmware.
Definition: WiMOD_SAP_LORAWAN_IDs.h:93
TWiMODLORAWAN_NwkStatus_Data::PowerLevel
UINT8 PowerLevel
Definition: WiMOD_SAP_LORAWAN_IDs.h:656
TWiMODLORAWAN_RX_JoinedNwkData
Structure containing data of the joined network indication.
Definition: WiMOD_SAP_LORAWAN_IDs.h:592
LoRaWAN_DataRate_LoRa_SF10_125kHz
Definition: WiMOD_SAP_LORAWAN_IDs.h:199
TWiMODLORAWAN_ActivateDeviceData
Activation data structure for LoRa network activation.
Definition: WiMOD_SAP_LORAWAN_IDs.h:481
LoRaWAN_DataRate_LoRa_SF9_125kHz
Definition: WiMOD_SAP_LORAWAN_IDs.h:200
TWiMODLORAWAN_MacCmd::Length
UINT8 Length
Definition: WiMOD_SAP_LORAWAN_IDs.h:627
TWiMODLORAWAN_RX_JoinedNwkData::OptionalInfoAvaiable
bool OptionalInfoAvaiable
Definition: WiMOD_SAP_LORAWAN_IDs.h:603
TWiMODLORAWAN_RadioStackConfig::Options
UINT8 Options
Definition: WiMOD_SAP_LORAWAN_IDs.h:613
LoRaWAN_NwkStatus_Active_OTAA
Definition: WiMOD_SAP_LORAWAN_IDs.h:441
TWiMODLORAWAN_RX_MacCmdData::DataRateIndex
UINT8 DataRateIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:582
TWiMODLORAWAN_RX_MacCmdData
Structure containing a received MAC command.
Definition: WiMOD_SAP_LORAWAN_IDs.h:575
TWiMODLORAWAN_ActivateDeviceData::DeviceAddress
UINT32 DeviceAddress
Definition: WiMOD_SAP_LORAWAN_IDs.h:483
TWiMODLORAWAN_TxIndData::PowerLevel
UINT8 PowerLevel
Definition: WiMOD_SAP_LORAWAN_IDs.h:526
LoRaWAN_DataRate_LoRa_SF12_125kHz
Definition: WiMOD_SAP_LORAWAN_IDs.h:197
LoRaWAN_FreqBand_India_865
Definition: WiMOD_SAP_LORAWAN_IDs.h:390
LoRaWAN_Channel_EU_868_5_Mhz
Definition: WiMOD_SAP_LORAWAN_IDs.h:230
TWiMOD_OptIndInfos
TWiMOD_OptIndInfos
Optional TX information flag.
Definition: WiMOD_SAP_LORAWAN_IDs.h:502
LoRaWAN_Status_Channel_Not_Available
Definition: WiMOD_SAP_LORAWAN_IDs.h:106
LoRaWAN_Status_Queue_Full
Definition: WiMOD_SAP_LORAWAN_IDs.h:102
TWiMODLORAWAN_TxIndData
struct TWiMODLORAWAN_TxIndData TWiMODLORAWAN_TxIndData
Activation data structure for LoRa network activation.
TWiMODLORAWAN_TxIndData::ChannelIndex
UINT8 ChannelIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:520
LoRaWAN_Status_Wrong_parameter
Definition: WiMOD_SAP_LORAWAN_IDs.h:98
TWiMODLORAWAN_RX_ACK_Data::RSSI
INT8 RSSI
Definition: WiMOD_SAP_LORAWAN_IDs.h:641
TWiMODLORAWAN_RX_Data::RSSI
INT8 RSSI
Definition: WiMOD_SAP_LORAWAN_IDs.h:565
LoRaWAN_Status_Wrong_DeviceMode
Definition: WiMOD_SAP_LORAWAN_IDs.h:99
LoRaWAN_FreqBand_Reserved
Definition: WiMOD_SAP_LORAWAN_IDs.h:389
TWiMODLORAWAN_JoinParams
struct TWiMODLORAWAN_JoinParams TWiMODLORAWAN_JoinParams
JOIN data structure for LoRa network activation.
TWiMODLORAWAN_RX_JoinedNwkData::DeviceAddress
UINT32 DeviceAddress
Definition: WiMOD_SAP_LORAWAN_IDs.h:595
TWiMODLORAWAN_RadioStackConfig::DataRateIndex
UINT8 DataRateIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:611
TWiMODLORAWAN_RX_Data::RxSlot
UINT8 RxSlot
Definition: WiMOD_SAP_LORAWAN_IDs.h:567
TLoRaWAN_PowerSaving
TLoRaWAN_PowerSaving
Power Saving modes.
Definition: WiMOD_SAP_LORAWAN_IDs.h:417
TWiMODLORAWAN_RadioStackConfig::PowerSavingMode
UINT8 PowerSavingMode
Definition: WiMOD_SAP_LORAWAN_IDs.h:614
LoRaWAN_Channel_EU_868_3_Mhz
Definition: WiMOD_SAP_LORAWAN_IDs.h:229
LoRaWAN_DataRate_LoRa_SF11_125kHz
Definition: WiMOD_SAP_LORAWAN_IDs.h:198
TWiMODLORAWAN_RX_ACK_Data
struct TWiMODLORAWAN_RX_ACK_Data TWiMODLORAWAN_RX_ACK_Data
Data structure for received Acknowledgment data.
TLoRaWAN_FreqBand
TLoRaWAN_FreqBand
Channel definition for New Zealand.
Definition: WiMOD_SAP_LORAWAN_IDs.h:386
LoRaWAN_DataRate_LoRa_FSK
Definition: WiMOD_SAP_LORAWAN_IDs.h:204
TWiMODLORAWAN_ActivateDeviceData
struct TWiMODLORAWAN_ActivateDeviceData TWiMODLORAWAN_ActivateDeviceData
Activation data structure for LoRa network activation.
LoRaWAN_Status_Device_Not_Activated
Definition: WiMOD_SAP_LORAWAN_IDs.h:100
TWiMODLORAWAN_RX_Data::DataRateIndex
UINT8 DataRateIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:564
LoRaWAN_Channel_India_866_550_Mhz
Definition: WiMOD_SAP_LORAWAN_IDs.h:259
TWiMODLORAWAN_ActivateDeviceData::AppSKey
UINT8 AppSKey[WiMODLORAWAN_NWK_SESSION_KEY_LEN]
Definition: WiMOD_SAP_LORAWAN_IDs.h:485
TWiMODLORAWAN_RX_MacCmdData::Length
UINT8 Length
Definition: WiMOD_SAP_LORAWAN_IDs.h:577
TWiMODLORAWAN_RX_JoinedNwkData
struct TWiMODLORAWAN_RX_JoinedNwkData TWiMODLORAWAN_RX_JoinedNwkData
Structure containing data of the joined network indication.
TLoRaWANDataRate
TLoRaWANDataRate
LoRa data rate definitions.
Definition: WiMOD_SAP_LORAWAN_IDs.h:195
TWiMODLORAWAN_RX_JoinedNwkData::ChannelIndex
UINT8 ChannelIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:598
TWiMODLORAWAN_RX_ACK_Data::RxSlot
UINT8 RxSlot
Definition: WiMOD_SAP_LORAWAN_IDs.h:643
TWiMODLORAWAN_RX_MacCmdData::SNR
INT8 SNR
Definition: WiMOD_SAP_LORAWAN_IDs.h:584
LORAWAN_OPT_TX_IND_INFOS_INCL_PKT_CNT
Definition: WiMOD_SAP_LORAWAN_IDs.h:506
TWiMODLORAWAN_TxIndData::StatusFormat
UINT8 StatusFormat
Definition: WiMOD_SAP_LORAWAN_IDs.h:518
TWiMODLORAWAN_MacCmd::DataServiceType
UINT8 DataServiceType
Definition: WiMOD_SAP_LORAWAN_IDs.h:624
TWiMODLORAWAN_TxIndData::NumTxPackets
UINT8 NumTxPackets
Definition: WiMOD_SAP_LORAWAN_IDs.h:524
TWiMODLORAWAN_NwkStatus_Data::DeviceAddress
UINT32 DeviceAddress
Definition: WiMOD_SAP_LORAWAN_IDs.h:654
TWiMODLORAWAN_RX_Data::ChannelIndex
UINT8 ChannelIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:563
LoRaWAN_FreqBand_EU_868_RX2_SF9
Definition: WiMOD_SAP_LORAWAN_IDs.h:393
TWiMODLORAWAN_RX_MacCmdData::RSSI
INT8 RSSI
Definition: WiMOD_SAP_LORAWAN_IDs.h:583
TWiMODLORAWAN_RX_MacCmdData
struct TWiMODLORAWAN_RX_MacCmdData TWiMODLORAWAN_RX_MacCmdData
Structure containing a received MAC command.
TWiMODLORAWAN_RadioStackConfig::TXPowerLevel
UINT8 TXPowerLevel
Definition: WiMOD_SAP_LORAWAN_IDs.h:612
LoRaWAN_NwkStatus_Active_ABP
Definition: WiMOD_SAP_LORAWAN_IDs.h:440
TWiMODLORAWAN_RadioStackConfig::BandIndex
UINT8 BandIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:616
TWiMODLORAWAN_RX_ACK_Data::DataRateIndex
UINT8 DataRateIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:640
LoRaWAN_Status_Channel_Blocked
Definition: WiMOD_SAP_LORAWAN_IDs.h:105
TWiMODLORAWAN_TX_Data::Port
UINT8 Port
Definition: WiMOD_SAP_LORAWAN_IDs.h:546
TWiMODLORAWAN_RX_Data::OptionalInfoAvaiable
bool OptionalInfoAvaiable
Definition: WiMOD_SAP_LORAWAN_IDs.h:568
LoRaWAN_DataRate_LoRa_SF7_125kHz
Definition: WiMOD_SAP_LORAWAN_IDs.h:202
TWiMODLORAWAN_RX_JoinedNwkData::DataRateIndex
UINT8 DataRateIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:599
TWiMODLORAWAN_NwkStatus_Data::DataRateIndex
UINT8 DataRateIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:655
TWiMODLORAWAN_RX_Data::Length
UINT8 Length
Definition: WiMOD_SAP_LORAWAN_IDs.h:559
LoRaWAN_Channel_India_865_062_5_Mhz
Definition: WiMOD_SAP_LORAWAN_IDs.h:256
TWiMODLORAWAN_NwkStatus_Data::NetworkStatus
UINT8 NetworkStatus
Definition: WiMOD_SAP_LORAWAN_IDs.h:653
LORAWAN_OPT_TX_IND_INFOS_NOT_AVAILABLE
Definition: WiMOD_SAP_LORAWAN_IDs.h:504
TLoRaWAN_Channel_India
TLoRaWAN_Channel_India
Channel definition for India.
Definition: WiMOD_SAP_LORAWAN_IDs.h:254
TWiMODLORAWAN_TxIndData::RfMsgAirtime
UINT32 RfMsgAirtime
Definition: WiMOD_SAP_LORAWAN_IDs.h:528
TWiMODLORAWAN_RX_MacCmdData::RxSlot
UINT8 RxSlot
Definition: WiMOD_SAP_LORAWAN_IDs.h:585
TWiMODLORAWAN_MacCmd::MacCmdID
UINT8 MacCmdID
Definition: WiMOD_SAP_LORAWAN_IDs.h:625
LoRaWAN_DataRate_LoRa_SF8_125kHz
Definition: WiMOD_SAP_LORAWAN_IDs.h:201
TWiMODLORAWAN_JoinParams
JOIN data structure for LoRa network activation.
Definition: WiMOD_SAP_LORAWAN_IDs.h:492
LoRaWAN_Status_Device_Busy
Definition: WiMOD_SAP_LORAWAN_IDs.h:101
LoRaWAN_Status_Error
Definition: WiMOD_SAP_LORAWAN_IDs.h:96
TWiMODLORAWAN_RX_Data
struct TWiMODLORAWAN_RX_Data TWiMODLORAWAN_RX_Data
Structure containing RX (user) payload data.
TLoRaWAN_NwkStatus
TLoRaWAN_NwkStatus
Network Status Status defines.
Definition: WiMOD_SAP_LORAWAN_IDs.h:437
TWiMODLORAWAN_RX_ACK_Data::SNR
INT8 SNR
Definition: WiMOD_SAP_LORAWAN_IDs.h:642
TWiMODLORAWAN_NwkStatus_Data::MaxPayloadSize
UINT8 MaxPayloadSize
Definition: WiMOD_SAP_LORAWAN_IDs.h:657
LoRaWAN_NwkStatus_Joining_OTAA
Definition: WiMOD_SAP_LORAWAN_IDs.h:442
LoRaWAN_Channel_India_865_402_5_Mhz
Definition: WiMOD_SAP_LORAWAN_IDs.h:257
TWiMODLORAWAN_RX_JoinedNwkData::RSSI
INT8 RSSI
Definition: WiMOD_SAP_LORAWAN_IDs.h:600
TWiMODLORAWAN_RX_Data::SNR
INT8 SNR
Definition: WiMOD_SAP_LORAWAN_IDs.h:566
TWiMODLORAWAN_ActivateDeviceData::NwkSKey
UINT8 NwkSKey[WiMODLORAWAN_NWK_SESSION_KEY_LEN]
Definition: WiMOD_SAP_LORAWAN_IDs.h:484
TWiMODLORAWAN_RX_ACK_Data
Data structure for received Acknowledgment data.
Definition: WiMOD_SAP_LORAWAN_IDs.h:634
LoRaWAN_Status_No_Factory_Settings
Definition: WiMOD_SAP_LORAWAN_IDs.h:104
TWiMODLORAWAN_RX_JoinedNwkData::StatusFormat
UINT8 StatusFormat
Definition: WiMOD_SAP_LORAWAN_IDs.h:594
TWiMODLORAWAN_RX_MacCmdData::OptionalInfoAvaiable
bool OptionalInfoAvaiable
Definition: WiMOD_SAP_LORAWAN_IDs.h:586
LoRaWAN_Channel_India_868_5_Mhz
Definition: WiMOD_SAP_LORAWAN_IDs.h:258
TWiMODLORAWAN_NwkStatus_Data
struct TWiMODLORAWAN_NwkStatus_Data TWiMODLORAWAN_NwkStatus_Data
Structure containing all data about LoRaWAN network status.
LoRaWAN_PowerSaving_On
Definition: WiMOD_SAP_LORAWAN_IDs.h:420
LoRaWAN_DataRate_LoRa_SF7_250kHz
Definition: WiMOD_SAP_LORAWAN_IDs.h:203
TWiMODLORAWAN_RadioStackConfig
struct TWiMODLORAWAN_RadioStackConfig TWiMODLORAWAN_RadioStackConfig
Radio stack configuration related to to LoRaWAN specific options.
TWiMODLORAWAN_RX_MacCmdData::ChannelIndex
UINT8 ChannelIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:581
LoRaWAN_PowerSaving_Off
Definition: WiMOD_SAP_LORAWAN_IDs.h:419
TWiMODLORAWAN_TX_Data::Length
UINT8 Length
Definition: WiMOD_SAP_LORAWAN_IDs.h:547
LoRaWAN_Status_Cmd_Not_Supported
Definition: WiMOD_SAP_LORAWAN_IDs.h:97
TWiMODLORAWAN_RX_JoinedNwkData::SNR
INT8 SNR
Definition: WiMOD_SAP_LORAWAN_IDs.h:601
TWiMODLORAWAN_RX_Data::StatusFormat
UINT8 StatusFormat
Definition: WiMOD_SAP_LORAWAN_IDs.h:557
TWiMODLORAWAN_TxIndData::DataRateIndex
UINT8 DataRateIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:522
LoRaWAN_Channel_EU_869_525_Mhz
Definition: WiMOD_SAP_LORAWAN_IDs.h:231
TWiMODLORAWAN_RadioStackConfig::Retransmissions
UINT8 Retransmissions
Definition: WiMOD_SAP_LORAWAN_IDs.h:615
LoRaWAN_FreqBand_EU_868
Definition: WiMOD_SAP_LORAWAN_IDs.h:388
TWiMODLORAWAN_RX_ACK_Data::StatusFormat
UINT8 StatusFormat
Definition: WiMOD_SAP_LORAWAN_IDs.h:636
TWiMODLORAWAN_TX_Data
struct TWiMODLORAWAN_TX_Data TWiMODLORAWAN_TX_Data
Structure containing all data necessary to transmitting a data message.
LORAWAN_OPT_TX_IND_INFOS_EXCL_PKT_CNT
Definition: WiMOD_SAP_LORAWAN_IDs.h:505
TWiMODLORAWAN_TxIndData
Activation data structure for LoRa network activation.
Definition: WiMOD_SAP_LORAWAN_IDs.h:514
TWiMODLORAWAN_MacCmd
LoRaWAN MAC command structure.
Definition: WiMOD_SAP_LORAWAN_IDs.h:622
TWiMODLORAWAN_RadioStackConfig
Radio stack configuration related to to LoRaWAN specific options.
Definition: WiMOD_SAP_LORAWAN_IDs.h:609
LoRaWAN_NwkStatus_Inactive
Definition: WiMOD_SAP_LORAWAN_IDs.h:439
TWiMODLORAWAN_TxIndData::FieldAvailability
TWiMOD_OptIndInfos FieldAvailability
Definition: WiMOD_SAP_LORAWAN_IDs.h:516
TWiMODLORAWAN_MacCmd
struct TWiMODLORAWAN_MacCmd TWiMODLORAWAN_MacCmd
LoRaWAN MAC command structure.
TWiMODLORAWAN_RX_JoinedNwkData::RxSlot
UINT8 RxSlot
Definition: WiMOD_SAP_LORAWAN_IDs.h:602
TLoRaWAN_Channel_EU
TLoRaWAN_Channel_EU
Channel definition for EU 868MHz Band.
Definition: WiMOD_SAP_LORAWAN_IDs.h:226
TWiMODLORAWAN_RX_ACK_Data::OptionalInfoAvaiable
bool OptionalInfoAvaiable
Definition: WiMOD_SAP_LORAWAN_IDs.h:644
TWiMODLORAWAN_NwkStatus_Data
Structure containing all data about LoRaWAN network status.
Definition: WiMOD_SAP_LORAWAN_IDs.h:651
LoRaWAN_Status_Ok
Definition: WiMOD_SAP_LORAWAN_IDs.h:95
LoRaWAN_Status_Length_Error
Definition: WiMOD_SAP_LORAWAN_IDs.h:103
TWiMODLORAWAN_TX_Data
Structure containing all data necessary to transmitting a data message.
Definition: WiMOD_SAP_LORAWAN_IDs.h:544
LoRaWAN_Channel_EU_868_1_Mhz
Definition: WiMOD_SAP_LORAWAN_IDs.h:228
TWiMODLORAWAN_RX_Data::Port
UINT8 Port
Definition: WiMOD_SAP_LORAWAN_IDs.h:558
TWiMODLORAWAN_RX_Data
Structure containing RX (user) payload data.
Definition: WiMOD_SAP_LORAWAN_IDs.h:555
TWiMODLORAWAN_RX_ACK_Data::ChannelIndex
UINT8 ChannelIndex
Definition: WiMOD_SAP_LORAWAN_IDs.h:639