diff --git a/_lo_ra_w_a_n_8h_source.html b/_lo_ra_w_a_n_8h_source.html index 298a1ee2..199b40dc 100644 --- a/_lo_ra_w_a_n_8h_source.html +++ b/_lo_ra_w_a_n_8h_source.html @@ -103,808 +103,814 @@ $(document).ready(function(){initNavTree('_lo_ra_w_a_n_8h_source.html',''); init
15 #define RADIOLIB_LORAWAN_CLASS_B (0x0B)
16 #define RADIOLIB_LORAWAN_CLASS_C (0x0C)
17 
-
18 // preamble format
-
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 
-
24 // MAC header field encoding MSB LSB DESCRIPTION
-
25 #define RADIOLIB_LORAWAN_MHDR_MTYPE_JOIN_REQUEST (0x00 << 5) // 7 5 message type: join request
-
26 #define RADIOLIB_LORAWAN_MHDR_MTYPE_JOIN_ACCEPT (0x01 << 5) // 7 5 join accept
-
27 #define RADIOLIB_LORAWAN_MHDR_MTYPE_UNCONF_DATA_UP (0x02 << 5) // 7 5 unconfirmed data up
-
28 #define RADIOLIB_LORAWAN_MHDR_MTYPE_UNCONF_DATA_DOWN (0x03 << 5) // 7 5 unconfirmed data down
-
29 #define RADIOLIB_LORAWAN_MHDR_MTYPE_CONF_DATA_UP (0x04 << 5) // 7 5 confirmed data up
-
30 #define RADIOLIB_LORAWAN_MHDR_MTYPE_CONF_DATA_DOWN (0x05 << 5) // 7 5 confirmed data down
-
31 #define RADIOLIB_LORAWAN_MHDR_MTYPE_PROPRIETARY (0x07 << 5) // 7 5 proprietary
-
32 #define RADIOLIB_LORAWAN_MHDR_MTYPE_MASK (0x07 << 5) // 7 5 bitmask of all possible options
-
33 #define RADIOLIB_LORAWAN_MHDR_MAJOR_R1 (0x00 << 0) // 1 0 major version: LoRaWAN R1
-
34 
-
35 // frame control field encoding
-
36 #define RADIOLIB_LORAWAN_FCTRL_ADR_ENABLED (0x01 << 7) // 7 7 adaptive data rate: enabled
-
37 #define RADIOLIB_LORAWAN_FCTRL_ADR_DISABLED (0x00 << 7) // 7 7 disabled
-
38 #define RADIOLIB_LORAWAN_FCTRL_ADR_ACK_REQ (0x01 << 6) // 6 6 adaptive data rate ACK request
-
39 #define RADIOLIB_LORAWAN_FCTRL_ACK (0x01 << 5) // 5 5 confirmed message acknowledge
-
40 #define RADIOLIB_LORAWAN_FCTRL_FRAME_PENDING (0x01 << 4) // 4 4 downlink frame is pending
-
41 
-
42 // fPort field
-
43 #define RADIOLIB_LORAWAN_FPORT_MAC_COMMAND (0x00 << 0) // 7 0 payload contains MAC commands only
-
44 #define RADIOLIB_LORAWAN_FPORT_TS009 (0xE0 << 0) // 7 0 fPort used for TS009 testing
-
45 #define RADIOLIB_LORAWAN_FPORT_RESERVED (0xE0 << 0) // 7 0 fPort values equal to and larger than this are reserved
-
46 
-
47 // MAC commands - only those sent from end-device to gateway
-
48 #define RADIOLIB_LORAWAN_LINK_CHECK_REQ (0x02 << 0) // 7 0 MAC command: request to check connectivity to network
-
49 #define RADIOLIB_LORAWAN_LINK_ADR_ANS (0x03 << 0) // 7 0 answer to ADR change
-
50 #define RADIOLIB_LORAWAN_DUTY_CYCLE_ANS (0x04 << 0) // 7 0 answer to duty cycle change
-
51 #define RADIOLIB_LORAWAN_RX_PARAM_SETUP_ANS (0x05 << 0) // 7 0 answer to reception slot setup request
-
52 #define RADIOLIB_LORAWAN_DEV_STATUS_ANS (0x06 << 0) // 7 0 device status information
-
53 #define RADIOLIB_LORAWAN_NEW_CHANNEL_ANS (0x07 << 0) // 7 0 acknowledges change of a radio channel
-
54 #define RADIOLIB_LORAWAN_RX_TIMING_SETUP_ANS (0x08 << 0) // 7 0 acknowledges change of a reception slots timing
-
55 
-
56 #define RADIOLIB_LORAWAN_NOPTS_LEN (8)
-
57 
-
58 // data rate encoding
-
59 #define RADIOLIB_LORAWAN_DATA_RATE_FSK_50_K (0x01 << 7) // 7 7 FSK @ 50 kbps
-
60 #define RADIOLIB_LORAWAN_DATA_RATE_SF_12 (0x06 << 4) // 6 4 LoRa spreading factor: SF12
-
61 #define RADIOLIB_LORAWAN_DATA_RATE_SF_11 (0x05 << 4) // 6 4 SF11
-
62 #define RADIOLIB_LORAWAN_DATA_RATE_SF_10 (0x04 << 4) // 6 4 SF10
-
63 #define RADIOLIB_LORAWAN_DATA_RATE_SF_9 (0x03 << 4) // 6 4 SF9
-
64 #define RADIOLIB_LORAWAN_DATA_RATE_SF_8 (0x02 << 4) // 6 4 SF8
-
65 #define RADIOLIB_LORAWAN_DATA_RATE_SF_7 (0x01 << 4) // 6 4 SF7
-
66 #define RADIOLIB_LORAWAN_DATA_RATE_BW_500_KHZ (0x00 << 2) // 3 2 LoRa bandwidth: 500 kHz
-
67 #define RADIOLIB_LORAWAN_DATA_RATE_BW_250_KHZ (0x01 << 2) // 3 2 250 kHz
-
68 #define RADIOLIB_LORAWAN_DATA_RATE_BW_125_KHZ (0x02 << 2) // 3 2 125 kHz
-
69 #define RADIOLIB_LORAWAN_DATA_RATE_BW_RESERVED (0x03 << 2) // 3 2 reserved value
-
70 #define RADIOLIB_LORAWAN_DATA_RATE_CR_4_5 (0x00 << 0) // 1 0 LoRa coding rate: 4/5
-
71 #define RADIOLIB_LORAWAN_DATA_RATE_CR_4_6 (0x01 << 0) // 1 0 4/6
-
72 #define RADIOLIB_LORAWAN_DATA_RATE_CR_4_7 (0x02 << 0) // 1 0 4/7
-
73 #define RADIOLIB_LORAWAN_DATA_RATE_CR_4_8 (0x03 << 0) // 1 0 4/8
-
74 #define RADIOLIB_LORAWAN_DATA_RATE_UNUSED (0xFF << 0) // 7 0 unused data rate
-
75 
-
76 #define RADIOLIB_LORAWAN_CHANNEL_DIR_UPLINK (0x00 << 0)
-
77 #define RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK (0x01 << 0)
-
78 #define RADIOLIB_LORAWAN_CHANNEL_DIR_BOTH (0x02 << 0)
-
79 #define RADIOLIB_LORAWAN_CHANNEL_DIR_NONE (0x03 << 0)
-
80 #define RADIOLIB_LORAWAN_BAND_DYNAMIC (0)
-
81 #define RADIOLIB_LORAWAN_BAND_FIXED (1)
-
82 #define RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES (15)
-
83 #define RADIOLIB_LORAWAN_CHANNEL_INDEX_NONE (0xFF >> 0)
-
84 
-
85 // recommended default settings
-
86 #define RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS (1000)
-
87 #define RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS ((RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS) + 1000)
-
88 #define RADIOLIB_LORAWAN_RX1_DR_OFFSET (0)
-
89 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DELAY_1_MS (5000)
-
90 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DELAY_2_MS (6000)
-
91 #define RADIOLIB_LORAWAN_MAX_FCNT_GAP (16384)
-
92 #define RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP (0x06)
-
93 #define RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP (0x05)
-
94 #define RADIOLIB_LORAWAN_RETRANSMIT_TIMEOUT_MIN_MS (1000)
-
95 #define RADIOLIB_LORAWAN_RETRANSMIT_TIMEOUT_MAX_MS (3000)
-
96 #define RADIOLIB_LORAWAN_POWER_STEP_SIZE_DBM (-2)
-
97 #define RADIOLIB_LORAWAN_REJOIN_MAX_COUNT_N (10) // send rejoin request 16384 uplinks
-
98 #define RADIOLIB_LORAWAN_REJOIN_MAX_TIME_N (15) // once every year, not actually implemented
-
99 
-
100 // join request message layout
-
101 #define RADIOLIB_LORAWAN_JOIN_REQUEST_LEN (23)
-
102 #define RADIOLIB_LORAWAN_JOIN_REQUEST_JOIN_EUI_POS (1)
-
103 #define RADIOLIB_LORAWAN_JOIN_REQUEST_DEV_EUI_POS (9)
-
104 #define RADIOLIB_LORAWAN_JOIN_REQUEST_DEV_NONCE_POS (17)
-
105 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE (0xFF)
-
106 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE_0 (0x00)
-
107 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE_1 (0x01)
-
108 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE_2 (0x02)
-
109 
-
110 // join accept message layout
-
111 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_MAX_LEN (33)
-
112 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JOIN_NONCE_POS (1)
-
113 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_HOME_NET_ID_POS (4)
-
114 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DEV_ADDR_POS (7)
-
115 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JOIN_EUI_POS (4)
-
116 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DL_SETTINGS_POS (11)
-
117 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_RX_DELAY_POS (12)
-
118 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DEV_NONCE_POS (12)
-
119 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_POS (13)
-
120 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_LEN (16)
-
121 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_TYPE_POS (RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_POS + RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_LEN - 1)
-
122 
-
123 // join accept message variables
-
124 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_R_1_0 (0x00 << 7) // 7 7 LoRaWAN revision: 1.0
-
125 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_R_1_1 (0x01 << 7) // 7 7 1.1
-
126 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_F_NWK_S_INT_KEY (0x01)
-
127 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_APP_S_KEY (0x02)
-
128 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_S_NWK_S_INT_KEY (0x03)
-
129 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_NWK_S_ENC_KEY (0x04)
-
130 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JS_ENC_KEY (0x05)
-
131 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JS_INT_KEY (0x06)
-
132 
-
133 // frame header layout
-
134 #define RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS (16)
-
135 #define RADIOLIB_LORAWAN_FHDR_DEV_ADDR_POS (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 1)
-
136 #define RADIOLIB_LORAWAN_FHDR_FCTRL_POS (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 5)
-
137 #define RADIOLIB_LORAWAN_FHDR_FCNT_POS (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 6)
-
138 #define RADIOLIB_LORAWAN_FHDR_FOPTS_POS (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 8)
-
139 #define RADIOLIB_LORAWAN_FHDR_FOPTS_LEN_MASK (0x0F)
-
140 #define RADIOLIB_LORAWAN_FHDR_FOPTS_MAX_LEN (15)
-
141 #define RADIOLIB_LORAWAN_FHDR_FPORT_POS(FOPTS) (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 8 + (FOPTS))
-
142 #define RADIOLIB_LORAWAN_FRAME_PAYLOAD_POS(FOPTS) (RADIOLIB_LORAWAN_FHDR_LEN_START_OFFS + 9 + (FOPTS))
-
143 #define RADIOLIB_LORAWAN_FRAME_LEN(PAYLOAD, FOPTS) (16 + 13 + (PAYLOAD) + (FOPTS))
-
144 
-
145 // payload encryption/MIC blocks common layout
-
146 #define RADIOLIB_LORAWAN_BLOCK_MAGIC_POS (0)
-
147 #define RADIOLIB_LORAWAN_BLOCK_CONF_FCNT_POS (1)
-
148 #define RADIOLIB_LORAWAN_BLOCK_DIR_POS (5)
-
149 #define RADIOLIB_LORAWAN_BLOCK_DEV_ADDR_POS (6)
-
150 #define RADIOLIB_LORAWAN_BLOCK_FCNT_POS (10)
-
151 
-
152 // payload encryption block layout
-
153 #define RADIOLIB_LORAWAN_ENC_BLOCK_MAGIC (0x01)
-
154 #define RADIOLIB_LORAWAN_ENC_BLOCK_COUNTER_ID_POS (4)
-
155 #define RADIOLIB_LORAWAN_ENC_BLOCK_COUNTER_POS (15)
-
156 
-
157 // payload MIC blocks layout
-
158 #define RADIOLIB_LORAWAN_MIC_BLOCK_MAGIC (0x49)
-
159 #define RADIOLIB_LORAWAN_MIC_BLOCK_LEN_POS (15)
-
160 #define RADIOLIB_LORAWAN_MIC_DATA_RATE_POS (3)
-
161 #define RADIOLIB_LORAWAN_MIC_CH_INDEX_POS (4)
+
18 // modulation type
+
19 #define RADIOLIB_LORAWAN_MODULATION_LORA (0)
+
20 #define RADIOLIB_LORAWAN_MODULATION_GFSK (1)
+
21 #define RADIOLIB_LORAWAN_MODULATION_LR_FHSS (2)
+
22 
+
23 // preamble format
+
24 #define RADIOLIB_LORAWAN_LORA_SYNC_WORD (0x34)
+
25 #define RADIOLIB_LORAWAN_LORA_PREAMBLE_LEN (8)
+
26 #define RADIOLIB_LORAWAN_GFSK_SYNC_WORD (0xC194C1)
+
27 #define RADIOLIB_LORAWAN_GFSK_PREAMBLE_LEN (5)
+
28 #define RADIOLIB_LORAWAN_LR_FHSS_SYNC_WORD (0x2C0F7995)
+
29 
+
30 // MAC header field encoding MSB LSB DESCRIPTION
+
31 #define RADIOLIB_LORAWAN_MHDR_MTYPE_JOIN_REQUEST (0x00 << 5) // 7 5 message type: join request
+
32 #define RADIOLIB_LORAWAN_MHDR_MTYPE_JOIN_ACCEPT (0x01 << 5) // 7 5 join accept
+
33 #define RADIOLIB_LORAWAN_MHDR_MTYPE_UNCONF_DATA_UP (0x02 << 5) // 7 5 unconfirmed data up
+
34 #define RADIOLIB_LORAWAN_MHDR_MTYPE_UNCONF_DATA_DOWN (0x03 << 5) // 7 5 unconfirmed data down
+
35 #define RADIOLIB_LORAWAN_MHDR_MTYPE_CONF_DATA_UP (0x04 << 5) // 7 5 confirmed data up
+
36 #define RADIOLIB_LORAWAN_MHDR_MTYPE_CONF_DATA_DOWN (0x05 << 5) // 7 5 confirmed data down
+
37 #define RADIOLIB_LORAWAN_MHDR_MTYPE_PROPRIETARY (0x07 << 5) // 7 5 proprietary
+
38 #define RADIOLIB_LORAWAN_MHDR_MTYPE_MASK (0x07 << 5) // 7 5 bitmask of all possible options
+
39 #define RADIOLIB_LORAWAN_MHDR_MAJOR_R1 (0x00 << 0) // 1 0 major version: LoRaWAN R1
+
40 
+
41 // frame control field encoding
+
42 #define RADIOLIB_LORAWAN_FCTRL_ADR_ENABLED (0x01 << 7) // 7 7 adaptive data rate: enabled
+
43 #define RADIOLIB_LORAWAN_FCTRL_ADR_DISABLED (0x00 << 7) // 7 7 disabled
+
44 #define RADIOLIB_LORAWAN_FCTRL_ADR_ACK_REQ (0x01 << 6) // 6 6 adaptive data rate ACK request
+
45 #define RADIOLIB_LORAWAN_FCTRL_ACK (0x01 << 5) // 5 5 confirmed message acknowledge
+
46 #define RADIOLIB_LORAWAN_FCTRL_FRAME_PENDING (0x01 << 4) // 4 4 downlink frame is pending
+
47 
+
48 // fPort field
+
49 #define RADIOLIB_LORAWAN_FPORT_MAC_COMMAND (0x00 << 0) // 7 0 payload contains MAC commands only
+
50 #define RADIOLIB_LORAWAN_FPORT_TS009 (0xE0 << 0) // 7 0 fPort used for TS009 testing
+
51 #define RADIOLIB_LORAWAN_FPORT_RESERVED (0xE0 << 0) // 7 0 fPort values equal to and larger than this are reserved
+
52 
+
53 // MAC commands - only those sent from end-device to gateway
+
54 #define RADIOLIB_LORAWAN_LINK_CHECK_REQ (0x02 << 0) // 7 0 MAC command: request to check connectivity to network
+
55 #define RADIOLIB_LORAWAN_LINK_ADR_ANS (0x03 << 0) // 7 0 answer to ADR change
+
56 #define RADIOLIB_LORAWAN_DUTY_CYCLE_ANS (0x04 << 0) // 7 0 answer to duty cycle change
+
57 #define RADIOLIB_LORAWAN_RX_PARAM_SETUP_ANS (0x05 << 0) // 7 0 answer to reception slot setup request
+
58 #define RADIOLIB_LORAWAN_DEV_STATUS_ANS (0x06 << 0) // 7 0 device status information
+
59 #define RADIOLIB_LORAWAN_NEW_CHANNEL_ANS (0x07 << 0) // 7 0 acknowledges change of a radio channel
+
60 #define RADIOLIB_LORAWAN_RX_TIMING_SETUP_ANS (0x08 << 0) // 7 0 acknowledges change of a reception slots timing
+
61 
+
62 #define RADIOLIB_LORAWAN_NOPTS_LEN (8)
+
63 
+
64 // data rate encoding
+
65 #define RADIOLIB_LORAWAN_DATA_RATE_FSK_50_K (0x01 << 7) // 7 7 FSK @ 50 kbps
+
66 #define RADIOLIB_LORAWAN_DATA_RATE_SF_12 (0x06 << 4) // 6 4 LoRa spreading factor: SF12
+
67 #define RADIOLIB_LORAWAN_DATA_RATE_SF_11 (0x05 << 4) // 6 4 SF11
+
68 #define RADIOLIB_LORAWAN_DATA_RATE_SF_10 (0x04 << 4) // 6 4 SF10
+
69 #define RADIOLIB_LORAWAN_DATA_RATE_SF_9 (0x03 << 4) // 6 4 SF9
+
70 #define RADIOLIB_LORAWAN_DATA_RATE_SF_8 (0x02 << 4) // 6 4 SF8
+
71 #define RADIOLIB_LORAWAN_DATA_RATE_SF_7 (0x01 << 4) // 6 4 SF7
+
72 #define RADIOLIB_LORAWAN_DATA_RATE_BW_500_KHZ (0x00 << 2) // 3 2 LoRa bandwidth: 500 kHz
+
73 #define RADIOLIB_LORAWAN_DATA_RATE_BW_250_KHZ (0x01 << 2) // 3 2 250 kHz
+
74 #define RADIOLIB_LORAWAN_DATA_RATE_BW_125_KHZ (0x02 << 2) // 3 2 125 kHz
+
75 #define RADIOLIB_LORAWAN_DATA_RATE_BW_RESERVED (0x03 << 2) // 3 2 reserved value
+
76 #define RADIOLIB_LORAWAN_DATA_RATE_CR_4_5 (0x00 << 0) // 1 0 LoRa coding rate: 4/5
+
77 #define RADIOLIB_LORAWAN_DATA_RATE_CR_4_6 (0x01 << 0) // 1 0 4/6
+
78 #define RADIOLIB_LORAWAN_DATA_RATE_CR_4_7 (0x02 << 0) // 1 0 4/7
+
79 #define RADIOLIB_LORAWAN_DATA_RATE_CR_4_8 (0x03 << 0) // 1 0 4/8
+
80 #define RADIOLIB_LORAWAN_DATA_RATE_UNUSED (0xFF << 0) // 7 0 unused data rate
+
81 
+
82 #define RADIOLIB_LORAWAN_CHANNEL_DIR_UPLINK (0x00 << 0)
+
83 #define RADIOLIB_LORAWAN_CHANNEL_DIR_DOWNLINK (0x01 << 0)
+
84 #define RADIOLIB_LORAWAN_CHANNEL_DIR_BOTH (0x02 << 0)
+
85 #define RADIOLIB_LORAWAN_CHANNEL_DIR_NONE (0x03 << 0)
+
86 #define RADIOLIB_LORAWAN_BAND_DYNAMIC (0)
+
87 #define RADIOLIB_LORAWAN_BAND_FIXED (1)
+
88 #define RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES (15)
+
89 #define RADIOLIB_LORAWAN_CHANNEL_INDEX_NONE (0xFF >> 0)
+
90 
+
91 // recommended default settings
+
92 #define RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS (1000)
+
93 #define RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS ((RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS) + 1000)
+
94 #define RADIOLIB_LORAWAN_RX1_DR_OFFSET (0)
+
95 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DELAY_1_MS (5000)
+
96 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DELAY_2_MS (6000)
+
97 #define RADIOLIB_LORAWAN_MAX_FCNT_GAP (16384)
+
98 #define RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP (0x06)
+
99 #define RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP (0x05)
+
100 #define RADIOLIB_LORAWAN_RETRANSMIT_TIMEOUT_MIN_MS (1000)
+
101 #define RADIOLIB_LORAWAN_RETRANSMIT_TIMEOUT_MAX_MS (3000)
+
102 #define RADIOLIB_LORAWAN_POWER_STEP_SIZE_DBM (-2)
+
103 #define RADIOLIB_LORAWAN_REJOIN_MAX_COUNT_N (10) // send rejoin request 16384 uplinks
+
104 #define RADIOLIB_LORAWAN_REJOIN_MAX_TIME_N (15) // once every year, not actually implemented
+
105 
+
106 // join request message layout
+
107 #define RADIOLIB_LORAWAN_JOIN_REQUEST_LEN (23)
+
108 #define RADIOLIB_LORAWAN_JOIN_REQUEST_JOIN_EUI_POS (1)
+
109 #define RADIOLIB_LORAWAN_JOIN_REQUEST_DEV_EUI_POS (9)
+
110 #define RADIOLIB_LORAWAN_JOIN_REQUEST_DEV_NONCE_POS (17)
+
111 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE (0xFF)
+
112 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE_0 (0x00)
+
113 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE_1 (0x01)
+
114 #define RADIOLIB_LORAWAN_JOIN_REQUEST_TYPE_2 (0x02)
+
115 
+
116 // join accept message layout
+
117 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_MAX_LEN (33)
+
118 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JOIN_NONCE_POS (1)
+
119 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_HOME_NET_ID_POS (4)
+
120 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DEV_ADDR_POS (7)
+
121 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JOIN_EUI_POS (4)
+
122 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DL_SETTINGS_POS (11)
+
123 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_RX_DELAY_POS (12)
+
124 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_DEV_NONCE_POS (12)
+
125 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_POS (13)
+
126 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_LEN (16)
+
127 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_TYPE_POS (RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_POS + RADIOLIB_LORAWAN_JOIN_ACCEPT_CFLIST_LEN - 1)
+
128 
+
129 // join accept message variables
+
130 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_R_1_0 (0x00 << 7) // 7 7 LoRaWAN revision: 1.0
+
131 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_R_1_1 (0x01 << 7) // 7 7 1.1
+
132 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_F_NWK_S_INT_KEY (0x01)
+
133 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_APP_S_KEY (0x02)
+
134 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_S_NWK_S_INT_KEY (0x03)
+
135 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_NWK_S_ENC_KEY (0x04)
+
136 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JS_ENC_KEY (0x05)
+
137 #define RADIOLIB_LORAWAN_JOIN_ACCEPT_JS_INT_KEY (0x06)
+
138 
+
139 // frame header layout
+
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))
+
150 
+
151 // payload encryption/MIC blocks common layout
+
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)
+
157 
+
158 // payload encryption block layout
+
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)
162 
-
163 // maximum allowed dwell time on bands that implement dwell time limitations
-
164 #define RADIOLIB_LORAWAN_DWELL_TIME (400)
-
165 
-
166 // unused frame counter value
-
167 #define RADIOLIB_LORAWAN_FCNT_NONE (0xFFFFFFFF)
+
163 // payload MIC blocks layout
+
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)
168 
-
169 // MAC commands
-
170 #define RADIOLIB_LORAWAN_NUM_MAC_COMMANDS (16)
+
169 // maximum allowed dwell time on bands that implement dwell time limitations
+
170 #define RADIOLIB_LORAWAN_DWELL_TIME (400)
171 
-
172 #define RADIOLIB_LORAWAN_MAC_RESET (0x01)
-
173 #define RADIOLIB_LORAWAN_MAC_LINK_CHECK (0x02)
-
174 #define RADIOLIB_LORAWAN_MAC_LINK_ADR (0x03)
-
175 #define RADIOLIB_LORAWAN_MAC_DUTY_CYCLE (0x04)
-
176 #define RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP (0x05)
-
177 #define RADIOLIB_LORAWAN_MAC_DEV_STATUS (0x06)
-
178 #define RADIOLIB_LORAWAN_MAC_NEW_CHANNEL (0x07)
-
179 #define RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP (0x08)
-
180 #define RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP (0x09)
-
181 #define RADIOLIB_LORAWAN_MAC_DL_CHANNEL (0x0A)
-
182 #define RADIOLIB_LORAWAN_MAC_REKEY (0x0B)
-
183 #define RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP (0x0C)
-
184 #define RADIOLIB_LORAWAN_MAC_DEVICE_TIME (0x0D)
-
185 #define RADIOLIB_LORAWAN_MAC_FORCE_REJOIN (0x0E)
-
186 #define RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP (0x0F)
-
187 #define RADIOLIB_LORAWAN_MAC_PROPRIETARY (0x80)
-
188 
-
189 // the length of internal MAC command queue - hopefully this is enough for most use cases
-
190 #define RADIOLIB_LORAWAN_MAC_COMMAND_QUEUE_SIZE (9)
-
191 
-
192 // the maximum number of simultaneously available channels
-
193 #define RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS (16)
+
172 // unused frame counter value
+
173 #define RADIOLIB_LORAWAN_FCNT_NONE (0xFFFFFFFF)
+
174 
+
175 // MAC commands
+
176 #define RADIOLIB_LORAWAN_NUM_MAC_COMMANDS (16)
+
177 
+
178 #define RADIOLIB_LORAWAN_MAC_RESET (0x01)
+
179 #define RADIOLIB_LORAWAN_MAC_LINK_CHECK (0x02)
+
180 #define RADIOLIB_LORAWAN_MAC_LINK_ADR (0x03)
+
181 #define RADIOLIB_LORAWAN_MAC_DUTY_CYCLE (0x04)
+
182 #define RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP (0x05)
+
183 #define RADIOLIB_LORAWAN_MAC_DEV_STATUS (0x06)
+
184 #define RADIOLIB_LORAWAN_MAC_NEW_CHANNEL (0x07)
+
185 #define RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP (0x08)
+
186 #define RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP (0x09)
+
187 #define RADIOLIB_LORAWAN_MAC_DL_CHANNEL (0x0A)
+
188 #define RADIOLIB_LORAWAN_MAC_REKEY (0x0B)
+
189 #define RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP (0x0C)
+
190 #define RADIOLIB_LORAWAN_MAC_DEVICE_TIME (0x0D)
+
191 #define RADIOLIB_LORAWAN_MAC_FORCE_REJOIN (0x0E)
+
192 #define RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP (0x0F)
+
193 #define RADIOLIB_LORAWAN_MAC_PROPRIETARY (0x80)
194 
-
195 // maximum MAC command sizes
-
196 #define RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_DOWN (5)
-
197 #define RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_UP (2)
-
198 #define RADIOLIB_LORAWAN_MAX_NUM_ADR_COMMANDS (8)
-
199 
-
204 struct LoRaWANMacSpec_t {
-
206  const uint8_t cid;
-
207 
-
209  const uint8_t lenDn;
-
210 
-
212  const uint8_t lenUp;
+
195 // the length of internal MAC command queue - hopefully this is enough for most use cases
+
196 #define RADIOLIB_LORAWAN_MAC_COMMAND_QUEUE_SIZE (9)
+
197 
+
198 // the maximum number of simultaneously available channels
+
199 #define RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS (16)
+
200 
+
201 // maximum MAC command sizes
+
202 #define RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_DOWN (5)
+
203 #define RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_UP (2)
+
204 #define RADIOLIB_LORAWAN_MAX_NUM_ADR_COMMANDS (8)
+
205 
+
210 struct LoRaWANMacSpec_t {
+
212  const uint8_t cid;
213 
-
215  const bool user;
-
216 };
-
217 
-
218 constexpr LoRaWANMacSpec_t MacTable[RADIOLIB_LORAWAN_NUM_MAC_COMMANDS + 1] = {
-
219  { 0x00, 0, 0, false }, // not an actual MAC command, exists for index offsetting
-
220  { RADIOLIB_LORAWAN_MAC_RESET, 1, 1, false },
-
221  { RADIOLIB_LORAWAN_MAC_LINK_CHECK, 2, 0, true },
-
222  { RADIOLIB_LORAWAN_MAC_LINK_ADR, 4, 1, false },
-
223  { RADIOLIB_LORAWAN_MAC_DUTY_CYCLE, 1, 0, false },
-
224  { RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP, 4, 1, false },
-
225  { RADIOLIB_LORAWAN_MAC_DEV_STATUS, 0, 2, false },
-
226  { RADIOLIB_LORAWAN_MAC_NEW_CHANNEL, 5, 1, false },
-
227  { RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP, 1, 0, false },
-
228  { RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP, 1, 0, false },
-
229  { RADIOLIB_LORAWAN_MAC_DL_CHANNEL, 4, 1, false },
-
230  { RADIOLIB_LORAWAN_MAC_REKEY, 1, 1, false },
-
231  { RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP, 1, 0, false },
-
232  { RADIOLIB_LORAWAN_MAC_DEVICE_TIME, 5, 0, true },
-
233  { RADIOLIB_LORAWAN_MAC_FORCE_REJOIN, 2, 0, false },
-
234  { RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP, 1, 1, false },
-
235  { RADIOLIB_LORAWAN_MAC_PROPRIETARY, 5, 0, true }
-
236 };
-
237 
-
242 struct LoRaWANMacCommand_t {
-
244  uint8_t cid;
-
245 
-
247  uint8_t payload[RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_DOWN];
-
248 
-
250  uint8_t len;
+
215  const uint8_t lenDn;
+
216 
+
218  const uint8_t lenUp;
+
219 
+
221  const bool user;
+
222 };
+
223 
+
224 constexpr LoRaWANMacSpec_t MacTable[RADIOLIB_LORAWAN_NUM_MAC_COMMANDS + 1] = {
+
225  { 0x00, 0, 0, false }, // not an actual MAC command, exists for index offsetting
+
226  { RADIOLIB_LORAWAN_MAC_RESET, 1, 1, false },
+
227  { RADIOLIB_LORAWAN_MAC_LINK_CHECK, 2, 0, true },
+
228  { RADIOLIB_LORAWAN_MAC_LINK_ADR, 4, 1, false },
+
229  { RADIOLIB_LORAWAN_MAC_DUTY_CYCLE, 1, 0, false },
+
230  { RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP, 4, 1, false },
+
231  { RADIOLIB_LORAWAN_MAC_DEV_STATUS, 0, 2, false },
+
232  { RADIOLIB_LORAWAN_MAC_NEW_CHANNEL, 5, 1, false },
+
233  { RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP, 1, 0, false },
+
234  { RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP, 1, 0, false },
+
235  { RADIOLIB_LORAWAN_MAC_DL_CHANNEL, 4, 1, false },
+
236  { RADIOLIB_LORAWAN_MAC_REKEY, 1, 1, false },
+
237  { RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP, 1, 0, false },
+
238  { RADIOLIB_LORAWAN_MAC_DEVICE_TIME, 5, 0, true },
+
239  { RADIOLIB_LORAWAN_MAC_FORCE_REJOIN, 2, 0, false },
+
240  { RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP, 1, 1, false },
+
241  { RADIOLIB_LORAWAN_MAC_PROPRIETARY, 5, 0, true }
+
242 };
+
243 
+
248 struct LoRaWANMacCommand_t {
+
250  uint8_t cid;
251 
-
253  uint8_t repeat;
-
254 };
-
255 
-
260 struct LoRaWANMacCommandQueue_t {
-
262  uint8_t numCommands;
-
263 
-
265  uint8_t len;
-
266 
-
268  LoRaWANMacCommand_t commands[RADIOLIB_LORAWAN_MAC_COMMAND_QUEUE_SIZE];
-
269 };
-
270 
-
271 #define RADIOLIB_LORAWAN_NONCES_VERSION_VAL (0x0001)
+
253  uint8_t payload[RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_DOWN];
+
254 
+
256  uint8_t len;
+
257 
+
259  uint8_t repeat;
+
260 };
+
261 
+
266 struct LoRaWANMacCommandQueue_t {
+
268  uint8_t numCommands;
+
269 
+
271  uint8_t len;
272 
-
273 enum LoRaWANSchemeBase_t {
-
274  RADIOLIB_LORAWAN_NONCES_START = 0x00,
-
275  RADIOLIB_LORAWAN_NONCES_VERSION = RADIOLIB_LORAWAN_NONCES_START, // 2 bytes
-
276  RADIOLIB_LORAWAN_NONCES_MODE = RADIOLIB_LORAWAN_NONCES_VERSION + sizeof(uint16_t), // 2 bytes
-
277  RADIOLIB_LORAWAN_NONCES_CLASS = RADIOLIB_LORAWAN_NONCES_MODE + sizeof(uint16_t), // 1 byte
-
278  RADIOLIB_LORAWAN_NONCES_PLAN = RADIOLIB_LORAWAN_NONCES_CLASS + sizeof(uint8_t), // 1 byte
-
279  RADIOLIB_LORAWAN_NONCES_CHECKSUM = RADIOLIB_LORAWAN_NONCES_PLAN + sizeof(uint8_t), // 2 bytes
-
280  RADIOLIB_LORAWAN_NONCES_DEV_NONCE = RADIOLIB_LORAWAN_NONCES_CHECKSUM + sizeof(uint16_t), // 2 bytes
-
281  RADIOLIB_LORAWAN_NONCES_JOIN_NONCE = RADIOLIB_LORAWAN_NONCES_DEV_NONCE + sizeof(uint16_t), // 3 bytes
-
282  RADIOLIB_LORAWAN_NONCES_ACTIVE = RADIOLIB_LORAWAN_NONCES_JOIN_NONCE + 3, // 1 byte
-
283  RADIOLIB_LORAWAN_NONCES_SIGNATURE = RADIOLIB_LORAWAN_NONCES_ACTIVE + sizeof(uint8_t), // 2 bytes
-
284  RADIOLIB_LORAWAN_NONCES_BUF_SIZE = RADIOLIB_LORAWAN_NONCES_SIGNATURE + sizeof(uint16_t) // Nonces buffer size
-
285 };
-
286 
-
287 enum LoRaWANSchemeSession_t {
-
288  RADIOLIB_LORAWAN_SESSION_START = 0x00,
-
289  RADIOLIB_LORAWAN_SESSION_NWK_SENC_KEY = RADIOLIB_LORAWAN_SESSION_START, // 16 bytes
-
290  RADIOLIB_LORAWAN_SESSION_APP_SKEY = RADIOLIB_LORAWAN_SESSION_NWK_SENC_KEY + RADIOLIB_AES128_BLOCK_SIZE, // 16 bytes
-
291  RADIOLIB_LORAWAN_SESSION_FNWK_SINT_KEY = RADIOLIB_LORAWAN_SESSION_APP_SKEY + RADIOLIB_AES128_BLOCK_SIZE, // 16 bytes
-
292  RADIOLIB_LORAWAN_SESSION_SNWK_SINT_KEY = RADIOLIB_LORAWAN_SESSION_FNWK_SINT_KEY + RADIOLIB_AES128_BLOCK_SIZE, // 16 bytes
-
293  RADIOLIB_LORAWAN_SESSION_DEV_ADDR = RADIOLIB_LORAWAN_SESSION_SNWK_SINT_KEY + RADIOLIB_AES128_BLOCK_SIZE, // 4 bytes
-
294  RADIOLIB_LORAWAN_SESSION_NONCES_SIGNATURE = RADIOLIB_LORAWAN_SESSION_DEV_ADDR + sizeof(uint32_t), // 2 bytes
-
295  RADIOLIB_LORAWAN_SESSION_A_FCNT_DOWN = RADIOLIB_LORAWAN_SESSION_NONCES_SIGNATURE + sizeof(uint16_t), // 4 bytes
-
296  RADIOLIB_LORAWAN_SESSION_CONF_FCNT_UP = RADIOLIB_LORAWAN_SESSION_A_FCNT_DOWN + sizeof(uint32_t), // 4 bytes
-
297  RADIOLIB_LORAWAN_SESSION_CONF_FCNT_DOWN = RADIOLIB_LORAWAN_SESSION_CONF_FCNT_UP + sizeof(uint32_t), // 4 bytes
-
298  RADIOLIB_LORAWAN_SESSION_RJ_COUNT0 = RADIOLIB_LORAWAN_SESSION_CONF_FCNT_DOWN + sizeof(uint32_t), // 2 bytes
-
299  RADIOLIB_LORAWAN_SESSION_RJ_COUNT1 = RADIOLIB_LORAWAN_SESSION_RJ_COUNT0 + sizeof(uint16_t), // 2 bytes
-
300  RADIOLIB_LORAWAN_SESSION_HOMENET_ID = RADIOLIB_LORAWAN_SESSION_RJ_COUNT1 + sizeof(uint16_t), // 4 bytes
-
301  RADIOLIB_LORAWAN_SESSION_VERSION = RADIOLIB_LORAWAN_SESSION_HOMENET_ID + sizeof(uint32_t), // 1 byte
-
302  RADIOLIB_LORAWAN_SESSION_DUTY_CYCLE = RADIOLIB_LORAWAN_SESSION_VERSION + sizeof(uint8_t), // 1 byte
-
303  RADIOLIB_LORAWAN_SESSION_RX_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_DUTY_CYCLE + MacTable[RADIOLIB_LORAWAN_MAC_DUTY_CYCLE].lenDn, // 4 bytes
-
304  RADIOLIB_LORAWAN_SESSION_RX_TIMING_SETUP = RADIOLIB_LORAWAN_SESSION_RX_PARAM_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP].lenDn, // 1 byte
-
305  RADIOLIB_LORAWAN_SESSION_TX_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_RX_TIMING_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP].lenDn, // 1 byte
-
306  RADIOLIB_LORAWAN_SESSION_ADR_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_TX_PARAM_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP].lenDn, // 1 byte
-
307  RADIOLIB_LORAWAN_SESSION_REJOIN_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_ADR_PARAM_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP].lenDn, // 1 byte
-
308  RADIOLIB_LORAWAN_SESSION_BEACON_FREQ = RADIOLIB_LORAWAN_SESSION_REJOIN_PARAM_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP].lenDn, // 3 bytes
-
309  RADIOLIB_LORAWAN_SESSION_PING_SLOT_CHANNEL = RADIOLIB_LORAWAN_SESSION_BEACON_FREQ + 3, // 4 bytes
-
310  RADIOLIB_LORAWAN_SESSION_PERIODICITY = RADIOLIB_LORAWAN_SESSION_PING_SLOT_CHANNEL + 4, // 1 byte
-
311  RADIOLIB_LORAWAN_SESSION_LAST_TIME = RADIOLIB_LORAWAN_SESSION_PERIODICITY + 1, // 4 bytes
-
312  RADIOLIB_LORAWAN_SESSION_UL_CHANNELS = RADIOLIB_LORAWAN_SESSION_LAST_TIME + 4, // 16*5 bytes
-
313  RADIOLIB_LORAWAN_SESSION_DL_CHANNELS = RADIOLIB_LORAWAN_SESSION_UL_CHANNELS + 16*MacTable[RADIOLIB_LORAWAN_MAC_NEW_CHANNEL].lenDn, // 16*4 bytes
-
314  RADIOLIB_LORAWAN_SESSION_MAC_QUEUE_UL = RADIOLIB_LORAWAN_SESSION_DL_CHANNELS + 16*MacTable[RADIOLIB_LORAWAN_MAC_DL_CHANNEL].lenDn, // 9*8+2 bytes
-
315  RADIOLIB_LORAWAN_SESSION_N_FCNT_DOWN = RADIOLIB_LORAWAN_SESSION_MAC_QUEUE_UL + sizeof(LoRaWANMacCommandQueue_t), // 4 bytes
-
316  RADIOLIB_LORAWAN_SESSION_ADR_FCNT = RADIOLIB_LORAWAN_SESSION_N_FCNT_DOWN + sizeof(uint32_t), // 4 bytes
-
317  RADIOLIB_LORAWAN_SESSION_LINK_ADR = RADIOLIB_LORAWAN_SESSION_ADR_FCNT + sizeof(uint32_t), // 4 bytes
-
318  RADIOLIB_LORAWAN_SESSION_FCNT_UP = RADIOLIB_LORAWAN_SESSION_LINK_ADR + MacTable[RADIOLIB_LORAWAN_MAC_LINK_ADR].lenDn, // 4 bytes
-
319  RADIOLIB_LORAWAN_SESSION_SIGNATURE = RADIOLIB_LORAWAN_SESSION_FCNT_UP + sizeof(uint32_t), // 2 bytes
-
320  RADIOLIB_LORAWAN_SESSION_BUF_SIZE = RADIOLIB_LORAWAN_SESSION_SIGNATURE + sizeof(uint16_t) // Session buffer size
-
321 };
-
322 
-
328 struct LoRaWANChannel_t {
-
330  bool enabled;
-
331 
-
333  uint8_t idx;
-
334 
-
336  float freq;
+
274  LoRaWANMacCommand_t commands[RADIOLIB_LORAWAN_MAC_COMMAND_QUEUE_SIZE];
+
275 };
+
276 
+
277 #define RADIOLIB_LORAWAN_NONCES_VERSION_VAL (0x0001)
+
278 
+
279 enum LoRaWANSchemeBase_t {
+
280  RADIOLIB_LORAWAN_NONCES_START = 0x00,
+
281  RADIOLIB_LORAWAN_NONCES_VERSION = RADIOLIB_LORAWAN_NONCES_START, // 2 bytes
+
282  RADIOLIB_LORAWAN_NONCES_MODE = RADIOLIB_LORAWAN_NONCES_VERSION + sizeof(uint16_t), // 2 bytes
+
283  RADIOLIB_LORAWAN_NONCES_CLASS = RADIOLIB_LORAWAN_NONCES_MODE + sizeof(uint16_t), // 1 byte
+
284  RADIOLIB_LORAWAN_NONCES_PLAN = RADIOLIB_LORAWAN_NONCES_CLASS + sizeof(uint8_t), // 1 byte
+
285  RADIOLIB_LORAWAN_NONCES_CHECKSUM = RADIOLIB_LORAWAN_NONCES_PLAN + sizeof(uint8_t), // 2 bytes
+
286  RADIOLIB_LORAWAN_NONCES_DEV_NONCE = RADIOLIB_LORAWAN_NONCES_CHECKSUM + sizeof(uint16_t), // 2 bytes
+
287  RADIOLIB_LORAWAN_NONCES_JOIN_NONCE = RADIOLIB_LORAWAN_NONCES_DEV_NONCE + sizeof(uint16_t), // 3 bytes
+
288  RADIOLIB_LORAWAN_NONCES_ACTIVE = RADIOLIB_LORAWAN_NONCES_JOIN_NONCE + 3, // 1 byte
+
289  RADIOLIB_LORAWAN_NONCES_SIGNATURE = RADIOLIB_LORAWAN_NONCES_ACTIVE + sizeof(uint8_t), // 2 bytes
+
290  RADIOLIB_LORAWAN_NONCES_BUF_SIZE = RADIOLIB_LORAWAN_NONCES_SIGNATURE + sizeof(uint16_t) // Nonces buffer size
+
291 };
+
292 
+
293 enum LoRaWANSchemeSession_t {
+
294  RADIOLIB_LORAWAN_SESSION_START = 0x00,
+
295  RADIOLIB_LORAWAN_SESSION_NWK_SENC_KEY = RADIOLIB_LORAWAN_SESSION_START, // 16 bytes
+
296  RADIOLIB_LORAWAN_SESSION_APP_SKEY = RADIOLIB_LORAWAN_SESSION_NWK_SENC_KEY + RADIOLIB_AES128_BLOCK_SIZE, // 16 bytes
+
297  RADIOLIB_LORAWAN_SESSION_FNWK_SINT_KEY = RADIOLIB_LORAWAN_SESSION_APP_SKEY + RADIOLIB_AES128_BLOCK_SIZE, // 16 bytes
+
298  RADIOLIB_LORAWAN_SESSION_SNWK_SINT_KEY = RADIOLIB_LORAWAN_SESSION_FNWK_SINT_KEY + RADIOLIB_AES128_BLOCK_SIZE, // 16 bytes
+
299  RADIOLIB_LORAWAN_SESSION_DEV_ADDR = RADIOLIB_LORAWAN_SESSION_SNWK_SINT_KEY + RADIOLIB_AES128_BLOCK_SIZE, // 4 bytes
+
300  RADIOLIB_LORAWAN_SESSION_NONCES_SIGNATURE = RADIOLIB_LORAWAN_SESSION_DEV_ADDR + sizeof(uint32_t), // 2 bytes
+
301  RADIOLIB_LORAWAN_SESSION_A_FCNT_DOWN = RADIOLIB_LORAWAN_SESSION_NONCES_SIGNATURE + sizeof(uint16_t), // 4 bytes
+
302  RADIOLIB_LORAWAN_SESSION_CONF_FCNT_UP = RADIOLIB_LORAWAN_SESSION_A_FCNT_DOWN + sizeof(uint32_t), // 4 bytes
+
303  RADIOLIB_LORAWAN_SESSION_CONF_FCNT_DOWN = RADIOLIB_LORAWAN_SESSION_CONF_FCNT_UP + sizeof(uint32_t), // 4 bytes
+
304  RADIOLIB_LORAWAN_SESSION_RJ_COUNT0 = RADIOLIB_LORAWAN_SESSION_CONF_FCNT_DOWN + sizeof(uint32_t), // 2 bytes
+
305  RADIOLIB_LORAWAN_SESSION_RJ_COUNT1 = RADIOLIB_LORAWAN_SESSION_RJ_COUNT0 + sizeof(uint16_t), // 2 bytes
+
306  RADIOLIB_LORAWAN_SESSION_HOMENET_ID = RADIOLIB_LORAWAN_SESSION_RJ_COUNT1 + sizeof(uint16_t), // 4 bytes
+
307  RADIOLIB_LORAWAN_SESSION_VERSION = RADIOLIB_LORAWAN_SESSION_HOMENET_ID + sizeof(uint32_t), // 1 byte
+
308  RADIOLIB_LORAWAN_SESSION_DUTY_CYCLE = RADIOLIB_LORAWAN_SESSION_VERSION + sizeof(uint8_t), // 1 byte
+
309  RADIOLIB_LORAWAN_SESSION_RX_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_DUTY_CYCLE + MacTable[RADIOLIB_LORAWAN_MAC_DUTY_CYCLE].lenDn, // 4 bytes
+
310  RADIOLIB_LORAWAN_SESSION_RX_TIMING_SETUP = RADIOLIB_LORAWAN_SESSION_RX_PARAM_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_RX_PARAM_SETUP].lenDn, // 1 byte
+
311  RADIOLIB_LORAWAN_SESSION_TX_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_RX_TIMING_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_RX_TIMING_SETUP].lenDn, // 1 byte
+
312  RADIOLIB_LORAWAN_SESSION_ADR_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_TX_PARAM_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_TX_PARAM_SETUP].lenDn, // 1 byte
+
313  RADIOLIB_LORAWAN_SESSION_REJOIN_PARAM_SETUP = RADIOLIB_LORAWAN_SESSION_ADR_PARAM_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_ADR_PARAM_SETUP].lenDn, // 1 byte
+
314  RADIOLIB_LORAWAN_SESSION_BEACON_FREQ = RADIOLIB_LORAWAN_SESSION_REJOIN_PARAM_SETUP + MacTable[RADIOLIB_LORAWAN_MAC_REJOIN_PARAM_SETUP].lenDn, // 3 bytes
+
315  RADIOLIB_LORAWAN_SESSION_PING_SLOT_CHANNEL = RADIOLIB_LORAWAN_SESSION_BEACON_FREQ + 3, // 4 bytes
+
316  RADIOLIB_LORAWAN_SESSION_PERIODICITY = RADIOLIB_LORAWAN_SESSION_PING_SLOT_CHANNEL + 4, // 1 byte
+
317  RADIOLIB_LORAWAN_SESSION_LAST_TIME = RADIOLIB_LORAWAN_SESSION_PERIODICITY + 1, // 4 bytes
+
318  RADIOLIB_LORAWAN_SESSION_UL_CHANNELS = RADIOLIB_LORAWAN_SESSION_LAST_TIME + 4, // 16*5 bytes
+
319  RADIOLIB_LORAWAN_SESSION_DL_CHANNELS = RADIOLIB_LORAWAN_SESSION_UL_CHANNELS + 16*MacTable[RADIOLIB_LORAWAN_MAC_NEW_CHANNEL].lenDn, // 16*4 bytes
+
320  RADIOLIB_LORAWAN_SESSION_MAC_QUEUE_UL = RADIOLIB_LORAWAN_SESSION_DL_CHANNELS + 16*MacTable[RADIOLIB_LORAWAN_MAC_DL_CHANNEL].lenDn, // 9*8+2 bytes
+
321  RADIOLIB_LORAWAN_SESSION_N_FCNT_DOWN = RADIOLIB_LORAWAN_SESSION_MAC_QUEUE_UL + sizeof(LoRaWANMacCommandQueue_t), // 4 bytes
+
322  RADIOLIB_LORAWAN_SESSION_ADR_FCNT = RADIOLIB_LORAWAN_SESSION_N_FCNT_DOWN + sizeof(uint32_t), // 4 bytes
+
323  RADIOLIB_LORAWAN_SESSION_LINK_ADR = RADIOLIB_LORAWAN_SESSION_ADR_FCNT + sizeof(uint32_t), // 4 bytes
+
324  RADIOLIB_LORAWAN_SESSION_FCNT_UP = RADIOLIB_LORAWAN_SESSION_LINK_ADR + MacTable[RADIOLIB_LORAWAN_MAC_LINK_ADR].lenDn, // 4 bytes
+
325  RADIOLIB_LORAWAN_SESSION_SIGNATURE = RADIOLIB_LORAWAN_SESSION_FCNT_UP + sizeof(uint32_t), // 2 bytes
+
326  RADIOLIB_LORAWAN_SESSION_BUF_SIZE = RADIOLIB_LORAWAN_SESSION_SIGNATURE + sizeof(uint16_t) // Session buffer size
+
327 };
+
328 
+
334 struct LoRaWANChannel_t {
+
336  bool enabled;
337 
-
339  uint8_t drMin;
+
339  uint8_t idx;
340 
-
342  uint8_t drMax;
-
343 };
-
344 
-
345 // alias for unused channel
-
346 #define RADIOLIB_LORAWAN_CHANNEL_NONE { .enabled = false, .idx = RADIOLIB_LORAWAN_CHANNEL_INDEX_NONE, .freq = 0, .drMin = 0, .drMax = 0 }
-
347 
-
353 struct LoRaWANChannelSpan_t {
-
355  uint8_t numChannels;
-
356 
-
358  float freqStart;
-
359 
-
361  float freqStep;
+
342  float freq;
+
343 
+
345  uint8_t drMin;
+
346 
+
348  uint8_t drMax;
+
349 };
+
350 
+
351 // alias for unused channel
+
352 #define RADIOLIB_LORAWAN_CHANNEL_NONE { .enabled = false, .idx = RADIOLIB_LORAWAN_CHANNEL_INDEX_NONE, .freq = 0, .drMin = 0, .drMax = 0 }
+
353 
+
359 struct LoRaWANChannelSpan_t {
+
361  uint8_t numChannels;
362 
-
364  uint8_t drMin;
+
364  float freqStart;
365 
-
367  uint8_t drMax;
-
368 
-
370  uint8_t joinRequestDataRate;
-
371 };
-
372 
-
373 // alias for unused channel span
-
374 #define RADIOLIB_LORAWAN_CHANNEL_SPAN_NONE { .numChannels = 0, .freqStart = 0, .freqStep = 0, .drMin = 0, .drMax = 0, .joinRequestDataRate = RADIOLIB_LORAWAN_DATA_RATE_UNUSED }
-
375 
-
380 struct LoRaWANBand_t {
-
382  uint8_t bandNum;
-
383 
-
385  uint8_t bandType;
-
386 
-
388  uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];
+
367  float freqStep;
+
368 
+
370  uint8_t drMin;
+
371 
+
373  uint8_t drMax;
+
374 
+
376  uint8_t joinRequestDataRate;
+
377 };
+
378 
+
379 // alias for unused channel span
+
380 #define RADIOLIB_LORAWAN_CHANNEL_SPAN_NONE { .numChannels = 0, .freqStart = 0, .freqStep = 0, .drMin = 0, .drMax = 0, .joinRequestDataRate = RADIOLIB_LORAWAN_DATA_RATE_UNUSED }
+
381 
+
386 struct LoRaWANBand_t {
+
388  uint8_t bandNum;
389 
-
391  int8_t powerMax;
+
391  uint8_t bandType;
392 
-
394  int8_t powerNumSteps;
+
394  uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];
395 
-
397  RadioLibTime_t dutyCycle;
+
397  int8_t powerMax;
398 
-
400  RadioLibTime_t dwellTimeUp;
+
400  int8_t powerNumSteps;
401 
-
403  RadioLibTime_t dwellTimeDn;
+
403  RadioLibTime_t dutyCycle;
404 
-
406  LoRaWANChannel_t txFreqs[3];
+
406  RadioLibTime_t dwellTimeUp;
407 
-
409  LoRaWANChannel_t txJoinReq[3];
-
410 
-
412  uint8_t numTxSpans;
+
409  RadioLibTime_t dwellTimeDn;
+
410 
+
412  LoRaWANChannel_t txFreqs[3];
413 
-
415  LoRaWANChannelSpan_t txSpans[2];
-
416 
-
418  LoRaWANChannelSpan_t rx1Span;
+
415  LoRaWANChannel_t txJoinReq[3];
+
416 
+
418  uint8_t numTxSpans;
419 
-
421  uint8_t rx1DataRateBase;
+
421  LoRaWANChannelSpan_t txSpans[2];
422 
-
424  LoRaWANChannel_t rx2;
-
425 
-
427  uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];
-
428 };
-
429 
-
430 // supported bands
-
431 extern const LoRaWANBand_t EU868;
-
432 extern const LoRaWANBand_t US915;
-
433 extern const LoRaWANBand_t CN780;
-
434 extern const LoRaWANBand_t EU433;
-
435 extern const LoRaWANBand_t AU915;
-
436 extern const LoRaWANBand_t CN500;
-
437 extern const LoRaWANBand_t AS923;
-
438 extern const LoRaWANBand_t KR920;
-
439 extern const LoRaWANBand_t IN865;
-
440 
-
445 enum LoRaWANBandNum_t {
-
446  BandEU868,
-
447  BandUS915,
-
448  BandCN780,
-
449  BandEU433,
-
450  BandAU915,
-
451  BandCN500,
-
452  BandAS923,
-
453  BandKR920,
-
454  BandIN865,
-
455  BandLast
-
456 };
-
457 
-
458 // provide easy access to the number of currently supported bands
-
459 #define RADIOLIB_LORAWAN_NUM_SUPPORTED_BANDS (BandLast - BandEU868)
-
460 
-
461 // array of currently supported bands
-
462 extern const LoRaWANBand_t* LoRaWANBands[];
+
424  LoRaWANChannelSpan_t rx1Span;
+
425 
+
427  uint8_t rx1DataRateBase;
+
428 
+
430  LoRaWANChannel_t rx2;
+
431 
+
433  uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES];
+
434 };
+
435 
+
436 // supported bands
+
437 extern const LoRaWANBand_t EU868;
+
438 extern const LoRaWANBand_t US915;
+
439 extern const LoRaWANBand_t CN780;
+
440 extern const LoRaWANBand_t EU433;
+
441 extern const LoRaWANBand_t AU915;
+
442 extern const LoRaWANBand_t CN500;
+
443 extern const LoRaWANBand_t AS923;
+
444 extern const LoRaWANBand_t KR920;
+
445 extern const LoRaWANBand_t IN865;
+
446 
+
451 enum LoRaWANBandNum_t {
+
452  BandEU868,
+
453  BandUS915,
+
454  BandCN780,
+
455  BandEU433,
+
456  BandAU915,
+
457  BandCN500,
+
458  BandAS923,
+
459  BandKR920,
+
460  BandIN865,
+
461  BandLast
+
462 };
463 
-
468 struct LoRaWANJoinEvent_t {
-
470  bool newSession = false;
-
471 
-
473  uint16_t devNonce = 0;
-
474 
-
476  uint32_t joinNonce = 0;
-
477 };
-
478 
-
483 struct LoRaWANEvent_t {
-
485  uint8_t dir;
-
486 
-
488  bool confirmed;
-
489 
-
492  bool confirming;
-
493 
-
495  uint8_t datarate;
-
496 
-
498  float freq;
-
499 
-
501  int16_t power;
+
464 // provide easy access to the number of currently supported bands
+
465 #define RADIOLIB_LORAWAN_NUM_SUPPORTED_BANDS (BandLast - BandEU868)
+
466 
+
467 // array of currently supported bands
+
468 extern const LoRaWANBand_t* LoRaWANBands[];
+
469 
+
474 struct LoRaWANJoinEvent_t {
+
476  bool newSession = false;
+
477 
+
479  uint16_t devNonce = 0;
+
480 
+
482  uint32_t joinNonce = 0;
+
483 };
+
484 
+
489 struct LoRaWANEvent_t {
+
491  uint8_t dir;
+
492 
+
494  bool confirmed;
+
495 
+
498  bool confirming;
+
499 
+
501  uint8_t datarate;
502 
-
504  uint32_t fCnt;
+
504  float freq;
505 
-
507  uint8_t fPort;
-
508 };
-
509 
-
514 class LoRaWANNode {
-
515  public:
-
516 
-
523  LoRaWANNode(PhysicalLayer* phy, const LoRaWANBand_t* band, uint8_t subBand = 0);
-
524 
-
528  void clearSession();
-
529 
-
534  uint8_t* getBufferNonces();
+
507  int16_t power;
+
508 
+
510  uint32_t fCnt;
+
511 
+
513  uint8_t fPort;
+
514 };
+
515 
+
520 class LoRaWANNode {
+
521  public:
+
522 
+
529  LoRaWANNode(PhysicalLayer* phy, const LoRaWANBand_t* band, uint8_t subBand = 0);
+
530 
+
534  void clearSession();
535 
-
541  int16_t setBufferNonces(uint8_t* persistentBuffer);
-
542 
-
547  uint8_t* getBufferSession();
+
540  uint8_t* getBufferNonces();
+
541 
+
547  int16_t setBufferNonces(uint8_t* persistentBuffer);
548 
-
554  int16_t setBufferSession(uint8_t* persistentBuffer);
-
555 
-
563  void beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t* nwkKey, uint8_t* appKey);
-
564 
-
571  int16_t activateOTAA(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED, LoRaWANJoinEvent_t *joinEvent = NULL);
-
572 
-
582  void beginABP(uint32_t addr, uint8_t* fNwkSIntKey, uint8_t* sNwkSIntKey, uint8_t* nwkSEncKey, uint8_t* appSKey);
-
583 
-
590  int16_t activateABP(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED);
-
591 
-
593  bool isActivated();
-
594 
-
601  int16_t setRx2Dr(uint8_t dr);
-
602 
-
610  int16_t sendMacCommandReq(uint8_t cid);
-
611 
-
612  #if defined(RADIOLIB_BUILD_ARDUINO)
-
622  int16_t uplink(String& str, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
-
623  #endif
-
624 
-
634  int16_t uplink(const char* str, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
-
635 
-
646  int16_t uplink(uint8_t* data, size_t len, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
-
647 
-
648  #if defined(RADIOLIB_BUILD_ARDUINO)
-
656  int16_t downlink(String& str, LoRaWANEvent_t* event = NULL);
-
657  #endif
-
658 
-
667  int16_t downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event = NULL);
-
668 
-
675  int16_t downlink(LoRaWANEvent_t* event = NULL);
-
676 
-
677  #if defined(RADIOLIB_BUILD_ARDUINO)
-
690  int16_t sendReceive(String& strUp, uint8_t fPort, String& strDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
-
691  #endif
-
692 
-
706  int16_t sendReceive(const char* strUp, uint8_t fPort, uint8_t* dataDown, size_t* lenDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
-
707 
-
722  int16_t sendReceive(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);
-
723 
-
736  int16_t sendReceive(uint8_t* dataUp, size_t lenUp, uint8_t fPort = 1, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
-
737 
-
743  void setDeviceStatus(uint8_t battLevel);
-
744 
-
749  uint32_t getFCntUp();
+
553  uint8_t* getBufferSession();
+
554 
+
560  int16_t setBufferSession(uint8_t* persistentBuffer);
+
561 
+
569  void beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t* nwkKey, uint8_t* appKey);
+
570 
+
577  int16_t activateOTAA(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED, LoRaWANJoinEvent_t *joinEvent = NULL);
+
578 
+
588  void beginABP(uint32_t addr, uint8_t* fNwkSIntKey, uint8_t* sNwkSIntKey, uint8_t* nwkSEncKey, uint8_t* appSKey);
+
589 
+
596  int16_t activateABP(uint8_t initialDr = RADIOLIB_LORAWAN_DATA_RATE_UNUSED);
+
597 
+
599  bool isActivated();
+
600 
+
607  int16_t setRx2Dr(uint8_t dr);
+
608 
+
616  int16_t sendMacCommandReq(uint8_t cid);
+
617 
+
618  #if defined(RADIOLIB_BUILD_ARDUINO)
+
628  int16_t uplink(String& str, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
+
629  #endif
+
630 
+
640  int16_t uplink(const char* str, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
+
641 
+
652  int16_t uplink(uint8_t* data, size_t len, uint8_t fPort, bool isConfirmed = false, LoRaWANEvent_t* event = NULL);
+
653 
+
654  #if defined(RADIOLIB_BUILD_ARDUINO)
+
662  int16_t downlink(String& str, LoRaWANEvent_t* event = NULL);
+
663  #endif
+
664 
+
673  int16_t downlink(uint8_t* data, size_t* len, LoRaWANEvent_t* event = NULL);
+
674 
+
681  int16_t downlink(LoRaWANEvent_t* event = NULL);
+
682 
+
683  #if defined(RADIOLIB_BUILD_ARDUINO)
+
696  int16_t sendReceive(String& strUp, uint8_t fPort, String& strDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
+
697  #endif
+
698 
+
712  int16_t sendReceive(const char* strUp, uint8_t fPort, uint8_t* dataDown, size_t* lenDown, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
+
713 
+
728  int16_t sendReceive(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);
+
729 
+
742  int16_t sendReceive(uint8_t* dataUp, size_t lenUp, uint8_t fPort = 1, bool isConfirmed = false, LoRaWANEvent_t* eventUp = NULL, LoRaWANEvent_t* eventDown = NULL);
+
743 
+
749  void setDeviceStatus(uint8_t battLevel);
750 
-
755  uint32_t getNFCntDown();
+
755  uint32_t getFCntUp();
756 
-
761  uint32_t getAFCntDown();
+
761  uint32_t getNFCntDown();
762 
-
768  void resetFCntDown();
-
769 
-
775  int16_t setDatarate(uint8_t drUp);
-
776 
-
781  void setADR(bool enable = true);
+
767  uint32_t getAFCntDown();
+
768 
+
774  void resetFCntDown();
+
775 
+
781  int16_t setDatarate(uint8_t drUp);
782 
-
789  void setDutyCycle(bool enable = true, RadioLibTime_t msPerHour = 0);
-
790 
-
798  RadioLibTime_t dutyCycleInterval(RadioLibTime_t msPerHour, RadioLibTime_t airtime);
-
799 
-
801  RadioLibTime_t timeUntilUplink();
-
802 
-
809  void setDwellTime(bool enable, RadioLibTime_t msPerUplink = 0);
-
810 
-
816  uint8_t maxPayloadDwellTime();
-
817 
-
823  int16_t setTxPower(int8_t txPower);
-
824 
-
833  int16_t getMacLinkCheckAns(uint8_t* margin, uint8_t* gwCnt);
-
834 
-
844  int16_t getMacDeviceTimeAns(uint32_t* gpsEpoch, uint8_t* fraction, bool returnUnix = true);
-
845 
-
850  uint64_t getDevAddr();
+
787  void setADR(bool enable = true);
+
788 
+
795  void setDutyCycle(bool enable = true, RadioLibTime_t msPerHour = 0);
+
796 
+
804  RadioLibTime_t dutyCycleInterval(RadioLibTime_t msPerHour, RadioLibTime_t airtime);
+
805 
+
807  RadioLibTime_t timeUntilUplink();
+
808 
+
815  void setDwellTime(bool enable, RadioLibTime_t msPerUplink = 0);
+
816 
+
822  uint8_t maxPayloadDwellTime();
+
823 
+
829  int16_t setTxPower(int8_t txPower);
+
830 
+
839  int16_t getMacLinkCheckAns(uint8_t* margin, uint8_t* gwCnt);
+
840 
+
850  int16_t getMacDeviceTimeAns(uint32_t* gpsEpoch, uint8_t* fraction, bool returnUnix = true);
851 
-
856  RadioLibTime_t getLastToA();
+
856  uint64_t getDevAddr();
857 
-
862  bool TS009 = false;
+
862  RadioLibTime_t getLastToA();
863 
-
864 #if !RADIOLIB_GODMODE
-
865  private:
-
866 #endif
-
867  PhysicalLayer* phyLayer = NULL;
-
868  const LoRaWANBand_t* band = NULL;
+
868  bool TS009 = false;
869 
-
870  static int16_t checkBufferCommon(uint8_t *buffer, uint16_t size);
-
871 
-
872  void activateCommon(uint8_t initialDr);
-
873 
-
874  // a buffer that holds all LW base parameters that should persist at all times!
-
875  uint8_t bufferNonces[RADIOLIB_LORAWAN_NONCES_BUF_SIZE] = { 0 };
-
876 
-
877  // a buffer that holds all LW session parameters that preferably persist, but can be afforded to get lost
-
878  uint8_t bufferSession[RADIOLIB_LORAWAN_SESSION_BUF_SIZE] = { 0 };
+
870 #if !RADIOLIB_GODMODE
+
871  private:
+
872 #endif
+
873  PhysicalLayer* phyLayer = NULL;
+
874  const LoRaWANBand_t* band = NULL;
+
875 
+
876  static int16_t checkBufferCommon(uint8_t *buffer, uint16_t size);
+
877 
+
878  void activateCommon(uint8_t initialDr);
879 
-
880  LoRaWANMacCommandQueue_t commandsUp = {
-
881  .numCommands = 0,
-
882  .len = 0,
-
883  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
-
884  };
-
885  LoRaWANMacCommandQueue_t commandsDown = {
-
886  .numCommands = 0,
-
887  .len = 0,
-
888  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
-
889  };
-
890 
-
891  uint16_t lwMode = RADIOLIB_LORAWAN_MODE_NONE;
-
892  uint8_t lwClass = RADIOLIB_LORAWAN_CLASS_A;
-
893  bool isActive = false;
-
894 
-
895  uint64_t joinEUI = 0;
-
896  uint64_t devEUI = 0;
-
897  uint8_t nwkKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
898  uint8_t appKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
899 
-
900  // the following is either provided by the network server (OTAA)
-
901  // or directly entered by the user (ABP)
-
902  uint32_t devAddr = 0;
-
903  uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
904  uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
905  uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
906  uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
907  uint8_t jSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
-
908 
-
909  uint16_t keyCheckSum = 0;
-
910 
-
911  // device-specific parameters, persistent through sessions
-
912  uint16_t devNonce = 0;
-
913  uint32_t joinNonce = 0;
+
880  // a buffer that holds all LW base parameters that should persist at all times!
+
881  uint8_t bufferNonces[RADIOLIB_LORAWAN_NONCES_BUF_SIZE] = { 0 };
+
882 
+
883  // a buffer that holds all LW session parameters that preferably persist, but can be afforded to get lost
+
884  uint8_t bufferSession[RADIOLIB_LORAWAN_SESSION_BUF_SIZE] = { 0 };
+
885 
+
886  LoRaWANMacCommandQueue_t commandsUp = {
+
887  .numCommands = 0,
+
888  .len = 0,
+
889  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
+
890  };
+
891  LoRaWANMacCommandQueue_t commandsDown = {
+
892  .numCommands = 0,
+
893  .len = 0,
+
894  .commands = { { .cid = 0, .payload = { 0 }, .len = 0, .repeat = 0, } },
+
895  };
+
896 
+
897  uint16_t lwMode = RADIOLIB_LORAWAN_MODE_NONE;
+
898  uint8_t lwClass = RADIOLIB_LORAWAN_CLASS_A;
+
899  bool isActive = false;
+
900 
+
901  uint64_t joinEUI = 0;
+
902  uint64_t devEUI = 0;
+
903  uint8_t nwkKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
904  uint8_t appKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
905 
+
906  // the following is either provided by the network server (OTAA)
+
907  // or directly entered by the user (ABP)
+
908  uint32_t devAddr = 0;
+
909  uint8_t appSKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
910  uint8_t fNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
911  uint8_t sNwkSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
912  uint8_t nwkSEncKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
+
913  uint8_t jSIntKey[RADIOLIB_AES128_KEY_SIZE] = { 0 };
914 
-
915  // session-specific parameters
-
916  uint32_t homeNetId = 0;
-
917  uint8_t adrLimitExp = RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP;
-
918  uint8_t adrDelayExp = RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP;
-
919  uint8_t nbTrans = 1; // Number of allowed frame retransmissions
-
920  uint8_t txPowerSteps = 0;
-
921  uint8_t txPowerMax = 0;
-
922  uint32_t fCntUp = 0;
-
923  uint32_t aFCntDown = 0;
-
924  uint32_t nFCntDown = 0;
-
925  uint32_t confFCntUp = RADIOLIB_LORAWAN_FCNT_NONE;
-
926  uint32_t confFCntDown = RADIOLIB_LORAWAN_FCNT_NONE;
-
927  uint32_t adrFCnt = 0;
-
928 
-
929  // whether the current configured channel is in FSK mode
-
930  bool FSK = false;
-
931 
-
932  // ADR is enabled by default
-
933  bool adrEnabled = true;
+
915  uint16_t keyCheckSum = 0;
+
916 
+
917  // device-specific parameters, persistent through sessions
+
918  uint16_t devNonce = 0;
+
919  uint32_t joinNonce = 0;
+
920 
+
921  // session-specific parameters
+
922  uint32_t homeNetId = 0;
+
923  uint8_t adrLimitExp = RADIOLIB_LORAWAN_ADR_ACK_LIMIT_EXP;
+
924  uint8_t adrDelayExp = RADIOLIB_LORAWAN_ADR_ACK_DELAY_EXP;
+
925  uint8_t nbTrans = 1; // Number of allowed frame retransmissions
+
926  uint8_t txPowerSteps = 0;
+
927  uint8_t txPowerMax = 0;
+
928  uint32_t fCntUp = 0;
+
929  uint32_t aFCntDown = 0;
+
930  uint32_t nFCntDown = 0;
+
931  uint32_t confFCntUp = RADIOLIB_LORAWAN_FCNT_NONE;
+
932  uint32_t confFCntDown = RADIOLIB_LORAWAN_FCNT_NONE;
+
933  uint32_t adrFCnt = 0;
934 
-
935  // duty cycle is set upon initialization and activated in regions that impose this
-
936  bool dutyCycleEnabled = false;
-
937  uint32_t dutyCycle = 0;
-
938 
-
939  // dwell time is set upon initialization and activated in regions that impose this
-
940  bool dwellTimeEnabledUp = false;
-
941  uint16_t dwellTimeUp = 0;
-
942  bool dwellTimeEnabledDn = false;
-
943  uint16_t dwellTimeDn = 0;
-
944 
-
945  // enable/disable CSMA for LoRaWAN
-
946  bool enableCSMA;
-
947 
-
948  // number of backoff slots to be decremented after DIFS phase. 0 to disable BO.
-
949  // A random BO avoids collisions in the case where two or more nodes start the CSMA
-
950  // process at the same time.
-
951  uint8_t backoffMax;
-
952 
-
953  // number of CADs to estimate a clear CH
-
954  uint8_t difsSlots;
-
955 
-
956  // available channel frequencies from list passed during OTA activation
-
957  LoRaWANChannel_t availableChannels[2][RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS];
-
958 
-
959  // currently configured channels for TX and RX1
-
960  LoRaWANChannel_t currentChannels[2] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE };
+
935  // modulation of the currently configured channel
+
936  uint8_t modulation = RADIOLIB_LORAWAN_MODULATION_LORA;
+
937 
+
938  // ADR is enabled by default
+
939  bool adrEnabled = true;
+
940 
+
941  // duty cycle is set upon initialization and activated in regions that impose this
+
942  bool dutyCycleEnabled = false;
+
943  uint32_t dutyCycle = 0;
+
944 
+
945  // dwell time is set upon initialization and activated in regions that impose this
+
946  bool dwellTimeEnabledUp = false;
+
947  uint16_t dwellTimeUp = 0;
+
948  bool dwellTimeEnabledDn = false;
+
949  uint16_t dwellTimeDn = 0;
+
950 
+
951  // enable/disable CSMA for LoRaWAN
+
952  bool enableCSMA;
+
953 
+
954  // number of backoff slots to be decremented after DIFS phase. 0 to disable BO.
+
955  // A random BO avoids collisions in the case where two or more nodes start the CSMA
+
956  // process at the same time.
+
957  uint8_t backoffMax;
+
958 
+
959  // number of CADs to estimate a clear CH
+
960  uint8_t difsSlots;
961 
-
962  // currently configured datarates for TX and RX1
-
963  uint8_t dataRates[2] = { RADIOLIB_LORAWAN_DATA_RATE_UNUSED, RADIOLIB_LORAWAN_DATA_RATE_UNUSED };
+
962  // available channel frequencies from list passed during OTA activation
+
963  LoRaWANChannel_t availableChannels[2][RADIOLIB_LORAWAN_NUM_AVAILABLE_CHANNELS];
964 
-
965  // Rx2 channel properties - may be changed by MAC command
-
966  LoRaWANChannel_t rx2 = RADIOLIB_LORAWAN_CHANNEL_NONE;
+
965  // currently configured channels for TX and RX1
+
966  LoRaWANChannel_t currentChannels[2] = { RADIOLIB_LORAWAN_CHANNEL_NONE, RADIOLIB_LORAWAN_CHANNEL_NONE };
967 
-
968  // offset between TX and RX1 (such that RX1 has equal or lower DR)
-
969  uint8_t rx1DrOffset = 0;
+
968  // currently configured datarates for TX and RX1
+
969  uint8_t dataRates[2] = { RADIOLIB_LORAWAN_DATA_RATE_UNUSED, RADIOLIB_LORAWAN_DATA_RATE_UNUSED };
970 
-
971  // LoRaWAN revision (1.0 vs 1.1)
-
972  uint8_t rev = 0;
+
971  // Rx2 channel properties - may be changed by MAC command
+
972  LoRaWANChannel_t rx2 = RADIOLIB_LORAWAN_CHANNEL_NONE;
973 
-
974  // Time on Air of last uplink
-
975  RadioLibTime_t lastToA = 0;
+
974  // offset between TX and RX1 (such that RX1 has equal or lower DR)
+
975  uint8_t rx1DrOffset = 0;
976 
-
977  // timestamp to measure the RX1/2 delay (from uplink end)
-
978  RadioLibTime_t rxDelayStart = 0;
+
977  // LoRaWAN revision (1.0 vs 1.1)
+
978  uint8_t rev = 0;
979 
-
980  // timestamp when the Rx1/2 windows were closed (timeout or uplink received)
-
981  RadioLibTime_t rxDelayEnd = 0;
+
980  // Time on Air of last uplink
+
981  RadioLibTime_t lastToA = 0;
982 
-
983  // delays between the uplink and RX1/2 windows
-
984  RadioLibTime_t rxDelays[2] = { RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS, RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS };
+
983  // timestamp to measure the RX1/2 delay (from uplink end)
+
984  RadioLibTime_t rxDelayStart = 0;
985 
-
986  // device status - battery level
-
987  uint8_t battLevel = 0xFF;
+
986  // timestamp when the Rx1/2 windows were closed (timeout or uplink received)
+
987  RadioLibTime_t rxDelayEnd = 0;
988 
-
989  // indicates whether an uplink has MAC commands as payload
-
990  bool isMACPayload = false;
+
989  // delays between the uplink and RX1/2 windows
+
990  RadioLibTime_t rxDelays[2] = { RADIOLIB_LORAWAN_RECEIVE_DELAY_1_MS, RADIOLIB_LORAWAN_RECEIVE_DELAY_2_MS };
991 
-
992  // save the selected sub-band in case this must be restored in ADR control
-
993  uint8_t subBand = 0;
+
992  // device status - battery level
+
993  uint8_t battLevel = 0xFF;
994 
-
995  // this will reset the device credentials, so the device starts completely new
-
996  void clearNonces();
+
995  // indicates whether an uplink has MAC commands as payload
+
996  bool isMACPayload = false;
997 
-
998  // wait for, open and listen during Rx1 and Rx2 windows; only performs listening
-
999  int16_t downlinkCommon();
+
998  // save the selected sub-band in case this must be restored in ADR control
+
999  uint8_t subBand = 0;
1000 
-
1001  // method to generate message integrity code
-
1002  uint32_t generateMIC(uint8_t* msg, size_t len, uint8_t* key);
+
1001  // this will reset the device credentials, so the device starts completely new
+
1002  void clearNonces();
1003 
-
1004  // method to verify message integrity code
-
1005  // it assumes that the MIC is the last 4 bytes of the message
-
1006  bool verifyMIC(uint8_t* msg, size_t len, uint8_t* key);
-
1007 
-
1008  // configure the common physical layer properties (preamble, sync word etc.)
-
1009  // channels must be configured separately by setupChannelsDyn()!
-
1010  int16_t setPhyProperties(uint8_t dir);
-
1011 
-
1012  // setup uplink/downlink channel data rates and frequencies
-
1013  // for dynamic channels, there is a small set of predefined channels
-
1014  // in case of JoinRequest, add some optional extra frequencies
-
1015  int16_t setupChannelsDyn(bool joinRequest = false);
-
1016 
-
1017  // setup uplink/downlink channel data rates and frequencies
-
1018  // for fixed bands, we only allow one sub-band at a time to be selected
-
1019  int16_t setupChannelsFix(uint8_t subBand);
-
1020 
-
1021  // a join-accept can piggy-back a set of channels or channel masks
-
1022  int16_t processCFList(uint8_t* cfList);
-
1023 
-
1024  // select a set of random TX/RX channels for up- and downlink
-
1025  int16_t selectChannels();
+
1004  // wait for, open and listen during Rx1 and Rx2 windows; only performs listening
+
1005  int16_t downlinkCommon();
+
1006 
+
1007  // method to generate message integrity code
+
1008  uint32_t generateMIC(uint8_t* msg, size_t len, uint8_t* key);
+
1009 
+
1010  // method to verify message integrity code
+
1011  // it assumes that the MIC is the last 4 bytes of the message
+
1012  bool verifyMIC(uint8_t* msg, size_t len, uint8_t* key);
+
1013 
+
1014  // configure the common physical layer properties (preamble, sync word etc.)
+
1015  // channels must be configured separately by setupChannelsDyn()!
+
1016  int16_t setPhyProperties(uint8_t dir);
+
1017 
+
1018  // setup uplink/downlink channel data rates and frequencies
+
1019  // for dynamic channels, there is a small set of predefined channels
+
1020  // in case of JoinRequest, add some optional extra frequencies
+
1021  int16_t setupChannelsDyn(bool joinRequest = false);
+
1022 
+
1023  // setup uplink/downlink channel data rates and frequencies
+
1024  // for fixed bands, we only allow one sub-band at a time to be selected
+
1025  int16_t setupChannelsFix(uint8_t subBand);
1026 
-
1027  // find the first usable data rate for the given band
-
1028  int16_t findDataRate(uint8_t dr, DataRate_t* dataRate);
+
1027  // a join-accept can piggy-back a set of channels or channel masks
+
1028  int16_t processCFList(uint8_t* cfList);
1029 
-
1030  // restore all available channels from persistent storage
-
1031  int16_t restoreChannels();
+
1030  // select a set of random TX/RX channels for up- and downlink
+
1031  int16_t selectChannels();
1032 
-
1033  // push MAC command to queue, done by copy
-
1034  int16_t pushMacCommand(LoRaWANMacCommand_t* cmd, LoRaWANMacCommandQueue_t* queue);
+
1033  // find the first usable data rate for the given band
+
1034  int16_t findDataRate(uint8_t dr, DataRate_t* dataRate);
1035 
-
1036  // delete a specific MAC command from queue, indicated by the command ID
-
1037  // if a payload pointer is supplied, this returns the payload of the MAC command
-
1038  int16_t deleteMacCommand(uint8_t cid, LoRaWANMacCommandQueue_t* queue, uint8_t* payload = NULL);
-
1039 
-
1040  // execute mac command, return the number of processed bytes for sequential processing
-
1041  bool execMacCommand(LoRaWANMacCommand_t* cmd);
-
1042 
-
1043  // apply a channel mask to a set of readily defined channels (dynamic bands only)
-
1044  bool applyChannelMaskDyn(uint8_t chMaskCntl, uint16_t chMask);
+
1036  // restore all available channels from persistent storage
+
1037  int16_t restoreChannels();
+
1038 
+
1039  // push MAC command to queue, done by copy
+
1040  int16_t pushMacCommand(LoRaWANMacCommand_t* cmd, LoRaWANMacCommandQueue_t* queue);
+
1041 
+
1042  // delete a specific MAC command from queue, indicated by the command ID
+
1043  // if a payload pointer is supplied, this returns the payload of the MAC command
+
1044  int16_t deleteMacCommand(uint8_t cid, LoRaWANMacCommandQueue_t* queue, uint8_t* payload = NULL);
1045 
-
1046  // define or delete channels from a fixed set of channels (fixed bands only)
-
1047  bool applyChannelMaskFix(uint8_t chMaskCntl, uint16_t chMask);
+
1046  // execute mac command, return the number of processed bytes for sequential processing
+
1047  bool execMacCommand(LoRaWANMacCommand_t* cmd);
1048 
-
1049  // get the payload length for a specific MAC command
-
1050  uint8_t getMacPayloadLength(uint8_t cid);
-
1051 
-
1058  void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA = false);
-
1059 
-
1060  // Performs CSMA as per LoRa Alliance Technical Recommendation 13 (TR-013).
-
1061  void performCSMA();
-
1062 
-
1063  // perform a single CAD operation for the under SF/CH combination. Returns either busy or otherwise.
-
1064  bool performCAD();
+
1049  // apply a channel mask to a set of readily defined channels (dynamic bands only)
+
1050  bool applyChannelMaskDyn(uint8_t chMaskCntl, uint16_t chMask);
+
1051 
+
1052  // define or delete channels from a fixed set of channels (fixed bands only)
+
1053  bool applyChannelMaskFix(uint8_t chMaskCntl, uint16_t chMask);
+
1054 
+
1055  // get the payload length for a specific MAC command
+
1056  uint8_t getMacPayloadLength(uint8_t cid);
+
1057 
+
1064  void setCSMA(uint8_t backoffMax, uint8_t difsSlots, bool enableCSMA = false);
1065 
-
1066  // function to encrypt and decrypt payloads
-
1067  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);
+
1066  // Performs CSMA as per LoRa Alliance Technical Recommendation 13 (TR-013).
+
1067  void performCSMA();
1068 
-
1069  // 16-bit checksum method that takes a uint8_t array of even length and calculates the checksum
-
1070  static uint16_t checkSum16(uint8_t *key, uint16_t keyLen);
+
1069  // perform a single CAD operation for the under SF/CH combination. Returns either busy or otherwise.
+
1070  bool performCAD();
1071 
-
1072  // network-to-host conversion method - takes data from network packet and converts it to the host endians
-
1073  template<typename T>
-
1074  static T ntoh(uint8_t* buff, size_t size = 0);
-
1075 
-
1076  // host-to-network conversion method - takes data from host variable and and converts it to network packet endians
-
1077  template<typename T>
-
1078  static void hton(uint8_t* buff, T val, size_t size = 0);
-
1079 };
-
1080 
-
1081 #endif
-
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:514
+
1072  // function to encrypt and decrypt payloads
+
1073  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);
+
1074 
+
1075  // 16-bit checksum method that takes a uint8_t array of even length and calculates the checksum
+
1076  static uint16_t checkSum16(uint8_t *key, uint16_t keyLen);
+
1077 
+
1078  // network-to-host conversion method - takes data from network packet and converts it to the host endians
+
1079  template<typename T>
+
1080  static T ntoh(uint8_t* buff, size_t size = 0);
+
1081 
+
1082  // host-to-network conversion method - takes data from host variable and and converts it to network packet endians
+
1083  template<typename T>
+
1084  static void hton(uint8_t* buff, T val, size_t size = 0);
+
1085 };
+
1086 
+
1087 #endif
+
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:520
LoRaWANNode::clearSession
void clearSession()
Clear an active session, so that the device will have to rejoin the network.
Definition: LoRaWAN.cpp:57
LoRaWANNode::setBufferNonces
int16_t setBufferNonces(uint8_t *persistentBuffer)
Fill the internal buffer that holds the LW base parameters with a supplied buffer.
Definition: LoRaWAN.cpp:73
-
LoRaWANNode::setDatarate
int16_t setDatarate(uint8_t drUp)
Set uplink datarate. This should not be used when ADR is enabled.
Definition: LoRaWAN.cpp:1977
+
LoRaWANNode::setDatarate
int16_t setDatarate(uint8_t drUp)
Set uplink datarate. This should not be used when ADR is enabled.
Definition: LoRaWAN.cpp:1990
LoRaWANNode::uplink
int16_t uplink(const char *str, uint8_t fPort, bool isConfirmed=false, LoRaWANEvent_t *event=NULL)
Send a message to the server.
Definition: LoRaWAN.cpp:858
LoRaWANNode::beginOTAA
void beginOTAA(uint64_t joinEUI, uint64_t devEUI, uint8_t *nwkKey, uint8_t *appKey)
Set the device credentials and activation configuration.
Definition: LoRaWAN.cpp:445
-
LoRaWANNode::maxPayloadDwellTime
uint8_t maxPayloadDwellTime()
Returns the maximum payload given the currently present dwell time limits. WARNING: the addition of M...
Definition: LoRaWAN.cpp:2060
-
LoRaWANNode::setDutyCycle
void setDutyCycle(bool enable=true, RadioLibTime_t msPerHour=0)
Toggle adherence to dutyCycle limits to on or off.
Definition: LoRaWAN.cpp:2018
-
LoRaWANNode::timeUntilUplink
RadioLibTime_t timeUntilUplink()
Returns time in milliseconds until next uplink is available under dutyCycle limits.
Definition: LoRaWAN.cpp:2042
+
LoRaWANNode::maxPayloadDwellTime
uint8_t maxPayloadDwellTime()
Returns the maximum payload given the currently present dwell time limits. WARNING: the addition of M...
Definition: LoRaWAN.cpp:2073
+
LoRaWANNode::setDutyCycle
void setDutyCycle(bool enable=true, RadioLibTime_t msPerHour=0)
Toggle adherence to dutyCycle limits to on or off.
Definition: LoRaWAN.cpp:2031
+
LoRaWANNode::timeUntilUplink
RadioLibTime_t timeUntilUplink()
Returns time in milliseconds until next uplink is available under dutyCycle limits.
Definition: LoRaWAN.cpp:2055
LoRaWANNode::setDeviceStatus
void setDeviceStatus(uint8_t battLevel)
Set device status.
Definition: LoRaWAN.cpp:1671
-
LoRaWANNode::dutyCycleInterval
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:2032
-
LoRaWANNode::setDwellTime
void setDwellTime(bool enable, RadioLibTime_t msPerUplink=0)
Toggle adherence to dwellTime limits to on or off.
Definition: LoRaWAN.cpp:2051
+
LoRaWANNode::dutyCycleInterval
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:2045
+
LoRaWANNode::setDwellTime
void setDwellTime(bool enable, RadioLibTime_t msPerUplink=0)
Toggle adherence to dwellTime limits to on or off.
Definition: LoRaWAN.cpp:2064
LoRaWANNode::getAFCntDown
uint32_t getAFCntDown()
Returns the last application downlink's frame counter; also 0 if no application downlink occured yet.
Definition: LoRaWAN.cpp:1687
-
LoRaWANNode::getLastToA
RadioLibTime_t getLastToA()
Get the Time-on-air of the last uplink message.
Definition: LoRaWAN.cpp:2896
+
LoRaWANNode::getLastToA
RadioLibTime_t getLastToA()
Get the Time-on-air of the last uplink message.
Definition: LoRaWAN.cpp:2909
LoRaWANNode::activateABP
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:782
-
LoRaWANNode::TS009
bool TS009
TS009 Protocol Specification Verification switch (allows FPort 224 and cuts off uplink payload instea...
Definition: LoRaWAN.h:862
+
LoRaWANNode::TS009
bool TS009
TS009 Protocol Specification Verification switch (allows FPort 224 and cuts off uplink payload instea...
Definition: LoRaWAN.h:868
LoRaWANNode::getBufferNonces
uint8_t * getBufferNonces()
Returns the pointer to the internal buffer that holds the LW base parameters.
Definition: LoRaWAN.cpp:65
LoRaWANNode::sendReceive
int16_t sendReceive(const char *strUp, uint8_t fPort, uint8_t *dataDown, size_t *lenDown, 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:1651
LoRaWANNode::getBufferSession
uint8_t * getBufferSession()
Returns the pointer to the internal buffer that holds the LW session parameters.
Definition: LoRaWAN.cpp:109
LoRaWANNode::beginABP
void beginABP(uint32_t addr, uint8_t *fNwkSIntKey, uint8_t *sNwkSIntKey, uint8_t *nwkSEncKey, uint8_t *appSKey)
Set the device credentials and activation configuration.
Definition: LoRaWAN.cpp:755
LoRaWANNode::isActivated
bool isActivated()
Whether there is an ongoing session active.
Definition: LoRaWAN.cpp:848
-
LoRaWANNode::setTxPower
int16_t setTxPower(int8_t txPower)
Configure TX power of the radio module.
Definition: LoRaWAN.cpp:2081
-
LoRaWANNode::getMacDeviceTimeAns
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:2875
+
LoRaWANNode::setTxPower
int16_t setTxPower(int8_t txPower)
Configure TX power of the radio module.
Definition: LoRaWAN.cpp:2094
+
LoRaWANNode::getMacDeviceTimeAns
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:2888
LoRaWANNode::getNFCntDown
uint32_t getNFCntDown()
Returns the last network downlink's frame counter; also 0 if no network downlink occured yet.
Definition: LoRaWAN.cpp:1683
-
LoRaWANNode::getDevAddr
uint64_t getDevAddr()
Returns the DevAddr of the device, regardless of OTAA or ABP mode.
Definition: LoRaWAN.cpp:2892
+
LoRaWANNode::getDevAddr
uint64_t getDevAddr()
Returns the DevAddr of the device, regardless of OTAA or ABP mode.
Definition: LoRaWAN.cpp:2905
LoRaWANNode::downlink
int16_t downlink(uint8_t *data, size_t *len, LoRaWANEvent_t *event=NULL)
Wait for downlink from the server in either RX1 or RX2 window.
Definition: LoRaWAN.cpp:1302
LoRaWANNode::setBufferSession
int16_t setBufferSession(uint8_t *persistentBuffer)
Fill the internal buffer that holds the LW session parameters with a supplied buffer.
Definition: LoRaWAN.cpp:128
LoRaWANNode::LoRaWANNode
LoRaWANNode(PhysicalLayer *phy, const LoRaWANBand_t *band, uint8_t subBand=0)
Default constructor.
Definition: LoRaWAN.cpp:30
LoRaWANNode::activateOTAA
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:462
LoRaWANNode::getFCntUp
uint32_t getFCntUp()
Returns the last uplink's frame counter; also 0 if no uplink occured yet.
Definition: LoRaWAN.cpp:1676
-
LoRaWANNode::setRx2Dr
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:2145
-
LoRaWANNode::sendMacCommandReq
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:2172
-
LoRaWANNode::getMacLinkCheckAns
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:2864
-
LoRaWANNode::setADR
void setADR(bool enable=true)
Toggle ADR to on or off.
Definition: LoRaWAN.cpp:2014
+
LoRaWANNode::setRx2Dr
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:2158
+
LoRaWANNode::sendMacCommandReq
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:2185
+
LoRaWANNode::getMacLinkCheckAns
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:2877
+
LoRaWANNode::setADR
void setADR(bool enable=true)
Toggle ADR to on or off.
Definition: LoRaWAN.cpp:2027
LoRaWANNode::resetFCntDown
void resetFCntDown()
Reset the downlink frame counters (application and network) This is unsafe and can possibly allow rep...
Definition: LoRaWAN.cpp:1691
PhysicalLayer
Provides common interface for protocols that run on LoRa/FSK modules, such as RTTY or LoRaWAN....
Definition: PhysicalLayer.h:54
RadioLibTime_t
unsigned long RadioLibTime_t
Type used for durations in RadioLib.
Definition: TypeDef.h:611
-
LoRaWANBand_t
Structure to save information about LoRaWAN band.
Definition: LoRaWAN.h:380
-
LoRaWANBand_t::powerMax
int8_t powerMax
Maximum allowed output power in this band in dBm.
Definition: LoRaWAN.h:391
-
LoRaWANBand_t::dutyCycle
RadioLibTime_t dutyCycle
Number of milliseconds per hour of allowed Time-on-Air.
Definition: LoRaWAN.h:397
-
LoRaWANBand_t::dataRates
uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
The corresponding datarates, bandwidths and coding rates for DR index.
Definition: LoRaWAN.h:427
-
LoRaWANBand_t::dwellTimeUp
RadioLibTime_t dwellTimeUp
Maximum dwell time per uplink message in milliseconds.
Definition: LoRaWAN.h:400
-
LoRaWANBand_t::payloadLenMax
uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
Array of allowed maximum payload lengths for each data rate.
Definition: LoRaWAN.h:388
-
LoRaWANBand_t::txFreqs
LoRaWANChannel_t txFreqs[3]
A set of default uplink (TX) channels for frequency-type bands.
Definition: LoRaWAN.h:406
-
LoRaWANBand_t::txJoinReq
LoRaWANChannel_t txJoinReq[3]
A set of possible extra channels for the Join-Request message for frequency-type bands.
Definition: LoRaWAN.h:409
-
LoRaWANBand_t::powerNumSteps
int8_t powerNumSteps
Number of power steps in this band.
Definition: LoRaWAN.h:394
-
LoRaWANBand_t::txSpans
LoRaWANChannelSpan_t txSpans[2]
Default uplink (TX) channel spans for mask-type bands, including Join-Request parameters.
Definition: LoRaWAN.h:415
-
LoRaWANBand_t::rx1DataRateBase
uint8_t rx1DataRateBase
The base downlink data rate. Used to calculate data rate changes for adaptive data rate.
Definition: LoRaWAN.h:421
-
LoRaWANBand_t::bandNum
uint8_t bandNum
Identier for this band.
Definition: LoRaWAN.h:382
-
LoRaWANBand_t::bandType
uint8_t bandType
Whether the channels are fixed per specification, or dynamically allocated through the network (plus ...
Definition: LoRaWAN.h:385
-
LoRaWANBand_t::rx2
LoRaWANChannel_t rx2
Backup channel for downlink (RX2) window.
Definition: LoRaWAN.h:424
-
LoRaWANBand_t::numTxSpans
uint8_t numTxSpans
The number of TX channel spans for mask-type bands.
Definition: LoRaWAN.h:412
-
LoRaWANBand_t::dwellTimeDn
RadioLibTime_t dwellTimeDn
Maximum dwell time per downlink message in milliseconds.
Definition: LoRaWAN.h:403
-
LoRaWANBand_t::rx1Span
LoRaWANChannelSpan_t rx1Span
Default downlink (RX1) channel span for mask-type bands.
Definition: LoRaWAN.h:418
+
LoRaWANBand_t
Structure to save information about LoRaWAN band.
Definition: LoRaWAN.h:386
+
LoRaWANBand_t::powerMax
int8_t powerMax
Maximum allowed output power in this band in dBm.
Definition: LoRaWAN.h:397
+
LoRaWANBand_t::dutyCycle
RadioLibTime_t dutyCycle
Number of milliseconds per hour of allowed Time-on-Air.
Definition: LoRaWAN.h:403
+
LoRaWANBand_t::dataRates
uint8_t dataRates[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
The corresponding datarates, bandwidths and coding rates for DR index.
Definition: LoRaWAN.h:433
+
LoRaWANBand_t::dwellTimeUp
RadioLibTime_t dwellTimeUp
Maximum dwell time per uplink message in milliseconds.
Definition: LoRaWAN.h:406
+
LoRaWANBand_t::payloadLenMax
uint8_t payloadLenMax[RADIOLIB_LORAWAN_CHANNEL_NUM_DATARATES]
Array of allowed maximum payload lengths for each data rate.
Definition: LoRaWAN.h:394
+
LoRaWANBand_t::txFreqs
LoRaWANChannel_t txFreqs[3]
A set of default uplink (TX) channels for frequency-type bands.
Definition: LoRaWAN.h:412
+
LoRaWANBand_t::txJoinReq
LoRaWANChannel_t txJoinReq[3]
A set of possible extra channels for the Join-Request message for frequency-type bands.
Definition: LoRaWAN.h:415
+
LoRaWANBand_t::powerNumSteps
int8_t powerNumSteps
Number of power steps in this band.
Definition: LoRaWAN.h:400
+
LoRaWANBand_t::txSpans
LoRaWANChannelSpan_t txSpans[2]
Default uplink (TX) channel spans for mask-type bands, including Join-Request parameters.
Definition: LoRaWAN.h:421
+
LoRaWANBand_t::rx1DataRateBase
uint8_t rx1DataRateBase
The base downlink data rate. Used to calculate data rate changes for adaptive data rate.
Definition: LoRaWAN.h:427
+
LoRaWANBand_t::bandNum
uint8_t bandNum
Identier for this band.
Definition: LoRaWAN.h:388
+
LoRaWANBand_t::bandType
uint8_t bandType
Whether the channels are fixed per specification, or dynamically allocated through the network (plus ...
Definition: LoRaWAN.h:391
+
LoRaWANBand_t::rx2
LoRaWANChannel_t rx2
Backup channel for downlink (RX2) window.
Definition: LoRaWAN.h:430
+
LoRaWANBand_t::numTxSpans
uint8_t numTxSpans
The number of TX channel spans for mask-type bands.
Definition: LoRaWAN.h:418
+
LoRaWANBand_t::dwellTimeDn
RadioLibTime_t dwellTimeDn
Maximum dwell time per downlink message in milliseconds.
Definition: LoRaWAN.h:409
+
LoRaWANBand_t::rx1Span
LoRaWANChannelSpan_t rx1Span
Default downlink (RX1) channel span for mask-type bands.
Definition: LoRaWAN.h:424
LoRaWANBandNum_t
IDs of all currently supported bands.
-
LoRaWANChannel_t
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition: LoRaWAN.h:328
-
LoRaWANChannel_t::freq
float freq
The channel frequency.
Definition: LoRaWAN.h:336
-
LoRaWANChannel_t::idx
uint8_t idx
The channel number, as specified by defaults or the network.
Definition: LoRaWAN.h:333
-
LoRaWANChannel_t::drMin
uint8_t drMin
Minimum allowed datarate for this channel.
Definition: LoRaWAN.h:339
-
LoRaWANChannel_t::enabled
bool enabled
Whether this channel is enabled (can be used) or is disabled.
Definition: LoRaWAN.h:330
-
LoRaWANChannel_t::drMax
uint8_t drMax
Maximum allowed datarate for this channel (inclusive)
Definition: LoRaWAN.h:342
-
LoRaWANChannelSpan_t
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition: LoRaWAN.h:353
-
LoRaWANChannelSpan_t::joinRequestDataRate
uint8_t joinRequestDataRate
Allowed data rates for a join request message.
Definition: LoRaWAN.h:370
-
LoRaWANChannelSpan_t::freqStart
float freqStart
Center frequency of the first channel in span.
Definition: LoRaWAN.h:358
-
LoRaWANChannelSpan_t::numChannels
uint8_t numChannels
Total number of channels in the span.
Definition: LoRaWAN.h:355
-
LoRaWANChannelSpan_t::drMax
uint8_t drMax
Maximum allowed datarate for all channels in this span (inclusive)
Definition: LoRaWAN.h:367
-
LoRaWANChannelSpan_t::freqStep
float freqStep
Frequency step between adjacent channels.
Definition: LoRaWAN.h:361
-
LoRaWANChannelSpan_t::drMin
uint8_t drMin
Minimum allowed datarate for all channels in this span.
Definition: LoRaWAN.h:364
-
LoRaWANEvent_t
Structure to save extra information about uplink/downlink event.
Definition: LoRaWAN.h:483
-
LoRaWANEvent_t::freq
float freq
Frequency in MHz.
Definition: LoRaWAN.h:498
-
LoRaWANEvent_t::confirmed
bool confirmed
Whether the event is confirmed or not (e.g., confirmed uplink sent by user application)
Definition: LoRaWAN.h:488
-
LoRaWANEvent_t::fPort
uint8_t fPort
Port number.
Definition: LoRaWAN.h:507
-
LoRaWANEvent_t::power
int16_t power
Transmit power in dBm for uplink, or RSSI for downlink.
Definition: LoRaWAN.h:501
-
LoRaWANEvent_t::confirming
bool confirming
Whether the event is confirming a previous request (e.g., server downlink reply to confirmed uplink s...
Definition: LoRaWAN.h:492
-
LoRaWANEvent_t::datarate
uint8_t datarate
Datarate.
Definition: LoRaWAN.h:495
-
LoRaWANEvent_t::dir
uint8_t dir
Event direction, one of RADIOLIB_LORAWAN_CHANNEL_DIR_*.
Definition: LoRaWAN.h:485
-
LoRaWANEvent_t::fCnt
uint32_t fCnt
The appropriate frame counter - for different events, different frame counters will be reported!
Definition: LoRaWAN.h:504
-
LoRaWANJoinEvent_t
Structure to save extra information about activation event.
Definition: LoRaWAN.h:468
-
LoRaWANJoinEvent_t::newSession
bool newSession
Whether a new session was started.
Definition: LoRaWAN.h:470
-
LoRaWANJoinEvent_t::joinNonce
uint32_t joinNonce
The received Join-Request JoinNonce value.
Definition: LoRaWAN.h:476
-
LoRaWANJoinEvent_t::devNonce
uint16_t devNonce
The transmitted Join-Request DevNonce value.
Definition: LoRaWAN.h:473
-
LoRaWANMacCommand_t
Structure to save information about MAC command.
Definition: LoRaWAN.h:242
-
LoRaWANMacCommand_t::payload
uint8_t payload[RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_DOWN]
Payload buffer (5 bytes is the longest possible)
Definition: LoRaWAN.h:247
-
LoRaWANMacCommand_t::len
uint8_t len
Length of the payload.
Definition: LoRaWAN.h:250
-
LoRaWANMacCommand_t::cid
uint8_t cid
The command ID.
Definition: LoRaWAN.h:244
-
LoRaWANMacCommand_t::repeat
uint8_t repeat
Repetition counter (the command will be uplinked repeat + 1 times)
Definition: LoRaWAN.h:253
-
LoRaWANMacCommandQueue_t
Structure to hold information about a queue of MAC commands.
Definition: LoRaWAN.h:260
-
LoRaWANMacCommandQueue_t::commands
LoRaWANMacCommand_t commands[RADIOLIB_LORAWAN_MAC_COMMAND_QUEUE_SIZE]
MAC command buffer.
Definition: LoRaWAN.h:268
-
LoRaWANMacCommandQueue_t::numCommands
uint8_t numCommands
Number of commands in the queue.
Definition: LoRaWAN.h:262
-
LoRaWANMacCommandQueue_t::len
uint8_t len
Total length of the queue.
Definition: LoRaWAN.h:265
-
LoRaWANMacSpec_t
MAC command specification structure.
Definition: LoRaWAN.h:204
-
LoRaWANMacSpec_t::cid
const uint8_t cid
Command ID.
Definition: LoRaWAN.h:206
-
LoRaWANMacSpec_t::lenDn
const uint8_t lenDn
Uplink message length.
Definition: LoRaWAN.h:209
-
LoRaWANMacSpec_t::lenUp
const uint8_t lenUp
Downlink message length.
Definition: LoRaWAN.h:212
-
LoRaWANMacSpec_t::user
const bool user
Whether this MAC command can be issued by the user or not.
Definition: LoRaWAN.h:215
+
LoRaWANChannel_t
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition: LoRaWAN.h:334
+
LoRaWANChannel_t::freq
float freq
The channel frequency.
Definition: LoRaWAN.h:342
+
LoRaWANChannel_t::idx
uint8_t idx
The channel number, as specified by defaults or the network.
Definition: LoRaWAN.h:339
+
LoRaWANChannel_t::drMin
uint8_t drMin
Minimum allowed datarate for this channel.
Definition: LoRaWAN.h:345
+
LoRaWANChannel_t::enabled
bool enabled
Whether this channel is enabled (can be used) or is disabled.
Definition: LoRaWAN.h:336
+
LoRaWANChannel_t::drMax
uint8_t drMax
Maximum allowed datarate for this channel (inclusive)
Definition: LoRaWAN.h:348
+
LoRaWANChannelSpan_t
Structure to save information about LoRaWAN channels. To save space, adjacent channels are saved in "...
Definition: LoRaWAN.h:359
+
LoRaWANChannelSpan_t::joinRequestDataRate
uint8_t joinRequestDataRate
Allowed data rates for a join request message.
Definition: LoRaWAN.h:376
+
LoRaWANChannelSpan_t::freqStart
float freqStart
Center frequency of the first channel in span.
Definition: LoRaWAN.h:364
+
LoRaWANChannelSpan_t::numChannels
uint8_t numChannels
Total number of channels in the span.
Definition: LoRaWAN.h:361
+
LoRaWANChannelSpan_t::drMax
uint8_t drMax
Maximum allowed datarate for all channels in this span (inclusive)
Definition: LoRaWAN.h:373
+
LoRaWANChannelSpan_t::freqStep
float freqStep
Frequency step between adjacent channels.
Definition: LoRaWAN.h:367
+
LoRaWANChannelSpan_t::drMin
uint8_t drMin
Minimum allowed datarate for all channels in this span.
Definition: LoRaWAN.h:370
+
LoRaWANEvent_t
Structure to save extra information about uplink/downlink event.
Definition: LoRaWAN.h:489
+
LoRaWANEvent_t::freq
float freq
Frequency in MHz.
Definition: LoRaWAN.h:504
+
LoRaWANEvent_t::confirmed
bool confirmed
Whether the event is confirmed or not (e.g., confirmed uplink sent by user application)
Definition: LoRaWAN.h:494
+
LoRaWANEvent_t::fPort
uint8_t fPort
Port number.
Definition: LoRaWAN.h:513
+
LoRaWANEvent_t::power
int16_t power
Transmit power in dBm for uplink, or RSSI for downlink.
Definition: LoRaWAN.h:507
+
LoRaWANEvent_t::confirming
bool confirming
Whether the event is confirming a previous request (e.g., server downlink reply to confirmed uplink s...
Definition: LoRaWAN.h:498
+
LoRaWANEvent_t::datarate
uint8_t datarate
Datarate.
Definition: LoRaWAN.h:501
+
LoRaWANEvent_t::dir
uint8_t dir
Event direction, one of RADIOLIB_LORAWAN_CHANNEL_DIR_*.
Definition: LoRaWAN.h:491
+
LoRaWANEvent_t::fCnt
uint32_t fCnt
The appropriate frame counter - for different events, different frame counters will be reported!
Definition: LoRaWAN.h:510
+
LoRaWANJoinEvent_t
Structure to save extra information about activation event.
Definition: LoRaWAN.h:474
+
LoRaWANJoinEvent_t::newSession
bool newSession
Whether a new session was started.
Definition: LoRaWAN.h:476
+
LoRaWANJoinEvent_t::joinNonce
uint32_t joinNonce
The received Join-Request JoinNonce value.
Definition: LoRaWAN.h:482
+
LoRaWANJoinEvent_t::devNonce
uint16_t devNonce
The transmitted Join-Request DevNonce value.
Definition: LoRaWAN.h:479
+
LoRaWANMacCommand_t
Structure to save information about MAC command.
Definition: LoRaWAN.h:248
+
LoRaWANMacCommand_t::payload
uint8_t payload[RADIOLIB_LORAWAN_MAX_MAC_COMMAND_LEN_DOWN]
Payload buffer (5 bytes is the longest possible)
Definition: LoRaWAN.h:253
+
LoRaWANMacCommand_t::len
uint8_t len
Length of the payload.
Definition: LoRaWAN.h:256
+
LoRaWANMacCommand_t::cid
uint8_t cid
The command ID.
Definition: LoRaWAN.h:250
+
LoRaWANMacCommand_t::repeat
uint8_t repeat
Repetition counter (the command will be uplinked repeat + 1 times)
Definition: LoRaWAN.h:259
+
LoRaWANMacCommandQueue_t
Structure to hold information about a queue of MAC commands.
Definition: LoRaWAN.h:266
+
LoRaWANMacCommandQueue_t::commands
LoRaWANMacCommand_t commands[RADIOLIB_LORAWAN_MAC_COMMAND_QUEUE_SIZE]
MAC command buffer.
Definition: LoRaWAN.h:274
+
LoRaWANMacCommandQueue_t::numCommands
uint8_t numCommands
Number of commands in the queue.
Definition: LoRaWAN.h:268
+
LoRaWANMacCommandQueue_t::len
uint8_t len
Total length of the queue.
Definition: LoRaWAN.h:271
+
LoRaWANMacSpec_t
MAC command specification structure.
Definition: LoRaWAN.h:210
+
LoRaWANMacSpec_t::cid
const uint8_t cid
Command ID.
Definition: LoRaWAN.h:212
+
LoRaWANMacSpec_t::lenDn
const uint8_t lenDn
Uplink message length.
Definition: LoRaWAN.h:215
+
LoRaWANMacSpec_t::lenUp
const uint8_t lenUp
Downlink message length.
Definition: LoRaWAN.h:218
+
LoRaWANMacSpec_t::user
const bool user
Whether this MAC command can be issued by the user or not.
Definition: LoRaWAN.h:221
DataRate_t
Common data rate structure.
Definition: PhysicalLayer.h:38
diff --git a/_physical_layer_8h_source.html b/_physical_layer_8h_source.html index d89a2e00..8d7ec85b 100644 --- a/_physical_layer_8h_source.html +++ b/_physical_layer_8h_source.html @@ -306,7 +306,7 @@ $(document).ready(function(){initNavTree('_physical_layer_8h_source.html',''); i
BellClient
Client for Bell modem communication. The public interface is the same as Arduino Serial.
Definition: BellModem.h:57
FSK4Client
Client for FSK-4 communication. The public interface is the same as Arduino Serial.
Definition: FSK4.h:15
HellClient
Client for Hellschreiber transmissions.
Definition: Hellschreiber.h:90
-
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:514
+
LoRaWANNode
LoRaWAN-compatible node (class A device).
Definition: LoRaWAN.h:520
Module
Implements all common low-level methods to control the wireless module. Every module class contains o...
Definition: Module.h:65
MorseClient
Client for Morse Code communication. The public interface is the same as Arduino Serial.
Definition: Morse.h:93
PagerClient
Client for Pager communication.
Definition: Pager.h:62
diff --git a/search/all_10.js b/search/all_10.js index 030b6bd9..d0de60c9 100644 --- a/search/all_10.js +++ b/search/all_10.js @@ -125,8 +125,8 @@ var searchData= ['spireadregisterburst_559',['SPIreadRegisterBurst',['../class_module.html#ac993ab8e2ea0f5aa93339d1f6ffb54ee',1,'Module']]], ['spireadstream_560',['SPIreadStream',['../class_module.html#adacceb57ecfecb09150c135b2b44436f',1,'Module::SPIreadStream(uint16_t cmd, uint8_t *data, size_t numBytes, bool waitForGpio=true, bool verify=true)'],['../class_module.html#a085415b49ff72238f118b937ad896cbd',1,'Module::SPIreadStream(uint8_t *cmd, uint8_t cmdLen, uint8_t *data, size_t numBytes, bool waitForGpio=true, bool verify=true)']]], ['spisetregvalue_561',['SPIsetRegValue',['../class_module.html#ade75c5403a05156b43cc7562563ae2d7',1,'Module']]], - ['spitransfer_562',['spiTransfer',['../class_radio_lib_hal.html#aebcaaf0cefdaaf5b572d4261e472ac8a',1,'RadioLibHal']]], - ['spitransfer_563',['SPItransfer',['../class_module.html#aa6df70520aa015dd3a1bccdceae67232',1,'Module']]], + ['spitransfer_562',['SPItransfer',['../class_module.html#aa6df70520aa015dd3a1bccdceae67232',1,'Module']]], + ['spitransfer_563',['spiTransfer',['../class_radio_lib_hal.html#aebcaaf0cefdaaf5b572d4261e472ac8a',1,'RadioLibHal']]], ['spitransferstream_564',['SPItransferStream',['../class_module.html#a4174159e476de5cef6ea3f89c883cb5e',1,'Module']]], ['spiwriteregister_565',['SPIwriteRegister',['../class_module.html#a60ca6b4cae98f7d935191a569d519913',1,'Module']]], ['spiwriteregisterburst_566',['SPIwriteRegisterBurst',['../class_module.html#a2826f0fa116eb0a4dd18ddb9b21e4caf',1,'Module']]], diff --git a/search/functions_f.js b/search/functions_f.js index b515f7ca..fae1f4bd 100644 --- a/search/functions_f.js +++ b/search/functions_f.js @@ -115,8 +115,8 @@ var searchData= ['spireadregisterburst_1011',['SPIreadRegisterBurst',['../class_module.html#ac993ab8e2ea0f5aa93339d1f6ffb54ee',1,'Module']]], ['spireadstream_1012',['SPIreadStream',['../class_module.html#a085415b49ff72238f118b937ad896cbd',1,'Module::SPIreadStream(uint8_t *cmd, uint8_t cmdLen, uint8_t *data, size_t numBytes, bool waitForGpio=true, bool verify=true)'],['../class_module.html#adacceb57ecfecb09150c135b2b44436f',1,'Module::SPIreadStream(uint16_t cmd, uint8_t *data, size_t numBytes, bool waitForGpio=true, bool verify=true)']]], ['spisetregvalue_1013',['SPIsetRegValue',['../class_module.html#ade75c5403a05156b43cc7562563ae2d7',1,'Module']]], - ['spitransfer_1014',['spiTransfer',['../class_radio_lib_hal.html#aebcaaf0cefdaaf5b572d4261e472ac8a',1,'RadioLibHal']]], - ['spitransfer_1015',['SPItransfer',['../class_module.html#aa6df70520aa015dd3a1bccdceae67232',1,'Module']]], + ['spitransfer_1014',['SPItransfer',['../class_module.html#aa6df70520aa015dd3a1bccdceae67232',1,'Module']]], + ['spitransfer_1015',['spiTransfer',['../class_radio_lib_hal.html#aebcaaf0cefdaaf5b572d4261e472ac8a',1,'RadioLibHal']]], ['spitransferstream_1016',['SPItransferStream',['../class_module.html#a4174159e476de5cef6ea3f89c883cb5e',1,'Module']]], ['spiwriteregister_1017',['SPIwriteRegister',['../class_module.html#a60ca6b4cae98f7d935191a569d519913',1,'Module']]], ['spiwriteregisterburst_1018',['SPIwriteRegisterBurst',['../class_module.html#a2826f0fa116eb0a4dd18ddb9b21e4caf',1,'Module']]],