publish for gps with lora

Dependents:   Dinghy_RaceTrak_Node_GPS_with_LoRa

Fork of LoRaWAN-lib by Christopher De Bank

Committer:
Rishin
Date:
Wed Nov 22 21:37:37 2017 +0000
Revision:
12:97ffb19b5627
Parent:
8:26002607de9c
initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mluis 2:14a5d6ad92d5 1 /*!
mluis 2:14a5d6ad92d5 2 * \file LoRaMac.h
mluis 2:14a5d6ad92d5 3 *
mluis 2:14a5d6ad92d5 4 * \brief LoRa MAC layer implementation
mluis 2:14a5d6ad92d5 5 *
mluis 2:14a5d6ad92d5 6 * \copyright Revised BSD License, see section \ref LICENSE.
mluis 2:14a5d6ad92d5 7 *
mluis 2:14a5d6ad92d5 8 * \code
mluis 2:14a5d6ad92d5 9 * ______ _
mluis 2:14a5d6ad92d5 10 * / _____) _ | |
mluis 2:14a5d6ad92d5 11 * ( (____ _____ ____ _| |_ _____ ____| |__
mluis 2:14a5d6ad92d5 12 * \____ \| ___ | (_ _) ___ |/ ___) _ \
mluis 2:14a5d6ad92d5 13 * _____) ) ____| | | || |_| ____( (___| | | |
mluis 2:14a5d6ad92d5 14 * (______/|_____)_|_|_| \__)_____)\____)_| |_|
mluis 2:14a5d6ad92d5 15 * (C)2013 Semtech
mluis 2:14a5d6ad92d5 16 *
mluis 2:14a5d6ad92d5 17 * ___ _____ _ ___ _ _____ ___ ___ ___ ___
mluis 2:14a5d6ad92d5 18 * / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
mluis 2:14a5d6ad92d5 19 * \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
mluis 2:14a5d6ad92d5 20 * |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
mluis 2:14a5d6ad92d5 21 * embedded.connectivity.solutions===============
mluis 2:14a5d6ad92d5 22 *
mluis 2:14a5d6ad92d5 23 * \endcode
mluis 2:14a5d6ad92d5 24 *
mluis 2:14a5d6ad92d5 25 * \author Miguel Luis ( Semtech )
mluis 2:14a5d6ad92d5 26 *
mluis 2:14a5d6ad92d5 27 * \author Gregory Cristian ( Semtech )
mluis 2:14a5d6ad92d5 28 *
mluis 2:14a5d6ad92d5 29 * \author Daniel Jäckle ( STACKFORCE )
mluis 2:14a5d6ad92d5 30 *
mluis 2:14a5d6ad92d5 31 * \defgroup LORAMAC LoRa MAC layer implementation
mluis 2:14a5d6ad92d5 32 * This module specifies the API implementation of the LoRaMAC layer.
mluis 2:14a5d6ad92d5 33 * This is a placeholder for a detailed description of the LoRaMac
mluis 2:14a5d6ad92d5 34 * layer and the supported features.
mluis 2:14a5d6ad92d5 35 * \{
mluis 2:14a5d6ad92d5 36 *
mluis 2:14a5d6ad92d5 37 * \example classA/LoRaMote/main.c
mluis 2:14a5d6ad92d5 38 * LoRaWAN class A application example for the LoRaMote.
mluis 2:14a5d6ad92d5 39 *
mluis 2:14a5d6ad92d5 40 * \example classB/LoRaMote/main.c
mluis 2:14a5d6ad92d5 41 * LoRaWAN class B application example for the LoRaMote.
mluis 2:14a5d6ad92d5 42 *
mluis 2:14a5d6ad92d5 43 * \example classC/LoRaMote/main.c
mluis 2:14a5d6ad92d5 44 * LoRaWAN class C application example for the LoRaMote.
mluis 2:14a5d6ad92d5 45 */
mluis 0:91d1a7783bb9 46 #ifndef __LORAMAC_H__
mluis 0:91d1a7783bb9 47 #define __LORAMAC_H__
mluis 0:91d1a7783bb9 48
mluis 0:91d1a7783bb9 49 // Includes board dependent definitions such as channels frequencies
mluis 7:c16969e0f70f 50 #include "LoRaMac-definitions.h"
mluis 0:91d1a7783bb9 51
mluis 0:91d1a7783bb9 52 /*!
mluis 8:26002607de9c 53 * Beacon interval in ms
mluis 0:91d1a7783bb9 54 */
mluis 8:26002607de9c 55 #define BEACON_INTERVAL 128000
mluis 0:91d1a7783bb9 56
mluis 0:91d1a7783bb9 57 /*!
mluis 8:26002607de9c 58 * Class A&B receive delay 1 in ms
mluis 0:91d1a7783bb9 59 */
mluis 8:26002607de9c 60 #define RECEIVE_DELAY1 1000
mluis 2:14a5d6ad92d5 61
mluis 2:14a5d6ad92d5 62 /*!
mluis 8:26002607de9c 63 * Class A&B receive delay 2 in ms
mluis 2:14a5d6ad92d5 64 */
mluis 8:26002607de9c 65 #define RECEIVE_DELAY2 2000
mluis 0:91d1a7783bb9 66
mluis 0:91d1a7783bb9 67 /*!
mluis 8:26002607de9c 68 * Join accept receive delay 1 in ms
mluis 0:91d1a7783bb9 69 */
mluis 8:26002607de9c 70 #define JOIN_ACCEPT_DELAY1 5000
mluis 2:14a5d6ad92d5 71
mluis 2:14a5d6ad92d5 72 /*!
mluis 8:26002607de9c 73 * Join accept receive delay 2 in ms
mluis 2:14a5d6ad92d5 74 */
mluis 8:26002607de9c 75 #define JOIN_ACCEPT_DELAY2 6000
mluis 0:91d1a7783bb9 76
mluis 0:91d1a7783bb9 77 /*!
mluis 8:26002607de9c 78 * Class A&B maximum receive window delay in ms
mluis 0:91d1a7783bb9 79 */
mluis 8:26002607de9c 80 #define MAX_RX_WINDOW 3000
mluis 0:91d1a7783bb9 81
mluis 0:91d1a7783bb9 82 /*!
mluis 0:91d1a7783bb9 83 * Maximum allowed gap for the FCNT field
mluis 0:91d1a7783bb9 84 */
mluis 0:91d1a7783bb9 85 #define MAX_FCNT_GAP 16384
mluis 0:91d1a7783bb9 86
mluis 0:91d1a7783bb9 87 /*!
mluis 0:91d1a7783bb9 88 * ADR acknowledgement counter limit
mluis 0:91d1a7783bb9 89 */
mluis 0:91d1a7783bb9 90 #define ADR_ACK_LIMIT 64
mluis 0:91d1a7783bb9 91
mluis 0:91d1a7783bb9 92 /*!
mluis 0:91d1a7783bb9 93 * Number of ADR acknowledgement requests before returning to default datarate
mluis 0:91d1a7783bb9 94 */
mluis 0:91d1a7783bb9 95 #define ADR_ACK_DELAY 32
mluis 0:91d1a7783bb9 96
mluis 0:91d1a7783bb9 97 /*!
mluis 0:91d1a7783bb9 98 * Number of seconds after the start of the second reception window without
mluis 0:91d1a7783bb9 99 * receiving an acknowledge.
mluis 2:14a5d6ad92d5 100 * AckTimeout = \ref ACK_TIMEOUT + Random( -\ref ACK_TIMEOUT_RND, \ref ACK_TIMEOUT_RND )
mluis 0:91d1a7783bb9 101 */
mluis 8:26002607de9c 102 #define ACK_TIMEOUT 2000
mluis 0:91d1a7783bb9 103
mluis 0:91d1a7783bb9 104 /*!
mluis 0:91d1a7783bb9 105 * Random number of seconds after the start of the second reception window without
mluis 0:91d1a7783bb9 106 * receiving an acknowledge
mluis 2:14a5d6ad92d5 107 * AckTimeout = \ref ACK_TIMEOUT + Random( -\ref ACK_TIMEOUT_RND, \ref ACK_TIMEOUT_RND )
mluis 0:91d1a7783bb9 108 */
mluis 8:26002607de9c 109 #define ACK_TIMEOUT_RND 1000
mluis 0:91d1a7783bb9 110
mluis 0:91d1a7783bb9 111 /*!
mluis 8:26002607de9c 112 * Check the Mac layer state every MAC_STATE_CHECK_TIMEOUT in ms
mluis 0:91d1a7783bb9 113 */
mluis 8:26002607de9c 114 #define MAC_STATE_CHECK_TIMEOUT 1000
mluis 0:91d1a7783bb9 115
mluis 0:91d1a7783bb9 116 /*!
mluis 0:91d1a7783bb9 117 * Maximum number of times the MAC layer tries to get an acknowledge.
mluis 0:91d1a7783bb9 118 */
mluis 0:91d1a7783bb9 119 #define MAX_ACK_RETRIES 8
mluis 0:91d1a7783bb9 120
mluis 0:91d1a7783bb9 121 /*!
mluis 2:14a5d6ad92d5 122 * RSSI free threshold [dBm]
mluis 0:91d1a7783bb9 123 */
mluis 2:14a5d6ad92d5 124 #define RSSI_FREE_TH ( int8_t )( -90 )
mluis 0:91d1a7783bb9 125
mluis 2:14a5d6ad92d5 126 /*!
mluis 2:14a5d6ad92d5 127 * Frame direction definition for up-link communications
mluis 0:91d1a7783bb9 128 */
mluis 0:91d1a7783bb9 129 #define UP_LINK 0
mluis 2:14a5d6ad92d5 130
mluis 2:14a5d6ad92d5 131 /*!
mluis 2:14a5d6ad92d5 132 * Frame direction definition for down-link communications
mluis 2:14a5d6ad92d5 133 */
mluis 0:91d1a7783bb9 134 #define DOWN_LINK 1
mluis 0:91d1a7783bb9 135
mluis 0:91d1a7783bb9 136 /*!
mluis 0:91d1a7783bb9 137 * Sets the length of the LoRaMAC footer field.
mluis 0:91d1a7783bb9 138 * Mainly indicates the MIC field length
mluis 0:91d1a7783bb9 139 */
mluis 0:91d1a7783bb9 140 #define LORAMAC_MFR_LEN 4
mluis 0:91d1a7783bb9 141
mluis 0:91d1a7783bb9 142 /*!
mluis 0:91d1a7783bb9 143 * LoRaWAN devices classes definition
mluis 0:91d1a7783bb9 144 */
mluis 2:14a5d6ad92d5 145 typedef enum eDeviceClass
mluis 0:91d1a7783bb9 146 {
mluis 2:14a5d6ad92d5 147 /*!
mluis 2:14a5d6ad92d5 148 * LoRaWAN device class A
mluis 2:14a5d6ad92d5 149 *
mluis 7:c16969e0f70f 150 * LoRaWAN Specification V1.0.1, chapter 3ff
mluis 2:14a5d6ad92d5 151 */
mluis 0:91d1a7783bb9 152 CLASS_A,
mluis 2:14a5d6ad92d5 153 /*!
mluis 2:14a5d6ad92d5 154 * LoRaWAN device class B
mluis 2:14a5d6ad92d5 155 *
mluis 7:c16969e0f70f 156 * LoRaWAN Specification V1.0.1, chapter 8ff
mluis 2:14a5d6ad92d5 157 */
mluis 0:91d1a7783bb9 158 CLASS_B,
mluis 2:14a5d6ad92d5 159 /*!
mluis 2:14a5d6ad92d5 160 * LoRaWAN device class C
mluis 2:14a5d6ad92d5 161 *
mluis 7:c16969e0f70f 162 * LoRaWAN Specification V1.0.1, chapter 17ff
mluis 2:14a5d6ad92d5 163 */
mluis 0:91d1a7783bb9 164 CLASS_C,
mluis 0:91d1a7783bb9 165 }DeviceClass_t;
mluis 0:91d1a7783bb9 166
mluis 0:91d1a7783bb9 167 /*!
mluis 0:91d1a7783bb9 168 * LoRaMAC channels parameters definition
mluis 0:91d1a7783bb9 169 */
mluis 2:14a5d6ad92d5 170 typedef union uDrRange
mluis 0:91d1a7783bb9 171 {
mluis 2:14a5d6ad92d5 172 /*!
mluis 2:14a5d6ad92d5 173 * Byte-access to the bits
mluis 2:14a5d6ad92d5 174 */
mluis 0:91d1a7783bb9 175 int8_t Value;
mluis 2:14a5d6ad92d5 176 /*!
mluis 2:14a5d6ad92d5 177 * Structure to store the minimum and the maximum datarate
mluis 2:14a5d6ad92d5 178 */
mluis 2:14a5d6ad92d5 179 struct sFields
mluis 0:91d1a7783bb9 180 {
mluis 2:14a5d6ad92d5 181 /*!
mluis 2:14a5d6ad92d5 182 * Minimum data rate
mluis 2:14a5d6ad92d5 183 *
mluis 2:14a5d6ad92d5 184 * EU868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]
mluis 2:14a5d6ad92d5 185 *
mluis 2:14a5d6ad92d5 186 * US915 - [DR_0, DR_1, DR_2, DR_3, DR_4]
mluis 2:14a5d6ad92d5 187 */
mluis 0:91d1a7783bb9 188 int8_t Min : 4;
mluis 2:14a5d6ad92d5 189 /*!
mluis 2:14a5d6ad92d5 190 * Maximum data rate
mluis 2:14a5d6ad92d5 191 *
mluis 2:14a5d6ad92d5 192 * EU868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]
mluis 2:14a5d6ad92d5 193 *
mluis 2:14a5d6ad92d5 194 * US915 - [DR_0, DR_1, DR_2, DR_3, DR_4]
mluis 2:14a5d6ad92d5 195 */
mluis 0:91d1a7783bb9 196 int8_t Max : 4;
mluis 0:91d1a7783bb9 197 }Fields;
mluis 0:91d1a7783bb9 198 }DrRange_t;
mluis 0:91d1a7783bb9 199
mluis 2:14a5d6ad92d5 200 /*!
mluis 2:14a5d6ad92d5 201 * LoRaMAC band parameters definition
mluis 2:14a5d6ad92d5 202 */
mluis 2:14a5d6ad92d5 203 typedef struct sBand
mluis 0:91d1a7783bb9 204 {
mluis 2:14a5d6ad92d5 205 /*!
mluis 2:14a5d6ad92d5 206 * Duty cycle
mluis 2:14a5d6ad92d5 207 */
mluis 0:91d1a7783bb9 208 uint16_t DCycle;
mluis 2:14a5d6ad92d5 209 /*!
mluis 2:14a5d6ad92d5 210 * Maximum Tx power
mluis 2:14a5d6ad92d5 211 */
mluis 0:91d1a7783bb9 212 int8_t TxMaxPower;
mluis 2:14a5d6ad92d5 213 /*!
mluis 2:14a5d6ad92d5 214 * Time stamp of the last Tx frame
mluis 2:14a5d6ad92d5 215 */
mluis 2:14a5d6ad92d5 216 TimerTime_t LastTxDoneTime;
mluis 2:14a5d6ad92d5 217 /*!
mluis 2:14a5d6ad92d5 218 * Holds the time where the device is off
mluis 2:14a5d6ad92d5 219 */
mluis 2:14a5d6ad92d5 220 TimerTime_t TimeOff;
mluis 0:91d1a7783bb9 221 }Band_t;
mluis 0:91d1a7783bb9 222
mluis 2:14a5d6ad92d5 223 /*!
mluis 2:14a5d6ad92d5 224 * LoRaMAC channel definition
mluis 2:14a5d6ad92d5 225 */
mluis 2:14a5d6ad92d5 226 typedef struct sChannelParams
mluis 0:91d1a7783bb9 227 {
mluis 2:14a5d6ad92d5 228 /*!
mluis 2:14a5d6ad92d5 229 * Frequency in Hz
mluis 2:14a5d6ad92d5 230 */
mluis 2:14a5d6ad92d5 231 uint32_t Frequency;
mluis 2:14a5d6ad92d5 232 /*!
mluis 2:14a5d6ad92d5 233 * Data rate definition
mluis 2:14a5d6ad92d5 234 */
mluis 2:14a5d6ad92d5 235 DrRange_t DrRange;
mluis 2:14a5d6ad92d5 236 /*!
mluis 2:14a5d6ad92d5 237 * Band index
mluis 2:14a5d6ad92d5 238 */
mluis 2:14a5d6ad92d5 239 uint8_t Band;
mluis 0:91d1a7783bb9 240 }ChannelParams_t;
mluis 0:91d1a7783bb9 241
mluis 2:14a5d6ad92d5 242 /*!
mluis 2:14a5d6ad92d5 243 * LoRaMAC receive window 2 channel parameters
mluis 2:14a5d6ad92d5 244 */
mluis 2:14a5d6ad92d5 245 typedef struct sRx2ChannelParams
mluis 0:91d1a7783bb9 246 {
mluis 2:14a5d6ad92d5 247 /*!
mluis 2:14a5d6ad92d5 248 * Frequency in Hz
mluis 2:14a5d6ad92d5 249 */
mluis 2:14a5d6ad92d5 250 uint32_t Frequency;
mluis 2:14a5d6ad92d5 251 /*!
mluis 2:14a5d6ad92d5 252 * Data rate
mluis 2:14a5d6ad92d5 253 *
mluis 2:14a5d6ad92d5 254 * EU868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]
mluis 2:14a5d6ad92d5 255 *
mluis 2:14a5d6ad92d5 256 * US915 - [DR_8, DR_9, DR_10, DR_11, DR_12, DR_13]
mluis 2:14a5d6ad92d5 257 */
mluis 2:14a5d6ad92d5 258 uint8_t Datarate;
mluis 0:91d1a7783bb9 259 }Rx2ChannelParams_t;
mluis 0:91d1a7783bb9 260
mluis 2:14a5d6ad92d5 261 /*!
mluis 7:c16969e0f70f 262 * Global MAC layer parameters
mluis 7:c16969e0f70f 263 */
mluis 7:c16969e0f70f 264 typedef struct sLoRaMacParams
mluis 7:c16969e0f70f 265 {
mluis 7:c16969e0f70f 266 /*!
mluis 7:c16969e0f70f 267 * Channels TX power
mluis 7:c16969e0f70f 268 */
mluis 7:c16969e0f70f 269 int8_t ChannelsTxPower;
mluis 7:c16969e0f70f 270 /*!
mluis 7:c16969e0f70f 271 * Channels data rate
mluis 7:c16969e0f70f 272 */
mluis 7:c16969e0f70f 273 int8_t ChannelsDatarate;
mluis 7:c16969e0f70f 274 /*!
mluis 8:26002607de9c 275 * System overall timing error in milliseconds.
mluis 8:26002607de9c 276 * [-SystemMaxRxError : +SystemMaxRxError]
mluis 8:26002607de9c 277 * Default: +/-10 ms
mluis 8:26002607de9c 278 */
mluis 8:26002607de9c 279 uint32_t SystemMaxRxError;
mluis 8:26002607de9c 280 /*!
mluis 8:26002607de9c 281 * Minimum required number of symbols to detect an Rx frame
mluis 8:26002607de9c 282 * Default: 6 symbols
mluis 8:26002607de9c 283 */
mluis 8:26002607de9c 284 uint8_t MinRxSymbols;
mluis 8:26002607de9c 285 /*!
mluis 7:c16969e0f70f 286 * LoRaMac maximum time a reception window stays open
mluis 7:c16969e0f70f 287 */
mluis 7:c16969e0f70f 288 uint32_t MaxRxWindow;
mluis 7:c16969e0f70f 289 /*!
mluis 7:c16969e0f70f 290 * Receive delay 1
mluis 7:c16969e0f70f 291 */
mluis 7:c16969e0f70f 292 uint32_t ReceiveDelay1;
mluis 7:c16969e0f70f 293 /*!
mluis 7:c16969e0f70f 294 * Receive delay 2
mluis 7:c16969e0f70f 295 */
mluis 7:c16969e0f70f 296 uint32_t ReceiveDelay2;
mluis 7:c16969e0f70f 297 /*!
mluis 7:c16969e0f70f 298 * Join accept delay 1
mluis 7:c16969e0f70f 299 */
mluis 7:c16969e0f70f 300 uint32_t JoinAcceptDelay1;
mluis 7:c16969e0f70f 301 /*!
mluis 7:c16969e0f70f 302 * Join accept delay 1
mluis 7:c16969e0f70f 303 */
mluis 7:c16969e0f70f 304 uint32_t JoinAcceptDelay2;
mluis 7:c16969e0f70f 305 /*!
mluis 7:c16969e0f70f 306 * Number of uplink messages repetitions [1:15] (unconfirmed messages only)
mluis 7:c16969e0f70f 307 */
mluis 7:c16969e0f70f 308 uint8_t ChannelsNbRep;
mluis 7:c16969e0f70f 309 /*!
mluis 7:c16969e0f70f 310 * Datarate offset between uplink and downlink on first window
mluis 7:c16969e0f70f 311 */
mluis 7:c16969e0f70f 312 uint8_t Rx1DrOffset;
mluis 7:c16969e0f70f 313 /*!
mluis 7:c16969e0f70f 314 * LoRaMAC 2nd reception window settings
mluis 7:c16969e0f70f 315 */
mluis 7:c16969e0f70f 316 Rx2ChannelParams_t Rx2Channel;
mluis 7:c16969e0f70f 317 /*!
mluis 7:c16969e0f70f 318 * Mask indicating which channels are enabled
mluis 7:c16969e0f70f 319 */
mluis 7:c16969e0f70f 320 uint16_t ChannelsMask[6];
mluis 7:c16969e0f70f 321 }LoRaMacParams_t;
mluis 7:c16969e0f70f 322
mluis 7:c16969e0f70f 323 /*!
mluis 2:14a5d6ad92d5 324 * LoRaMAC multicast channel parameter
mluis 2:14a5d6ad92d5 325 */
mluis 2:14a5d6ad92d5 326 typedef struct sMulticastParams
mluis 0:91d1a7783bb9 327 {
mluis 2:14a5d6ad92d5 328 /*!
mluis 2:14a5d6ad92d5 329 * Address
mluis 2:14a5d6ad92d5 330 */
mluis 0:91d1a7783bb9 331 uint32_t Address;
mluis 2:14a5d6ad92d5 332 /*!
mluis 2:14a5d6ad92d5 333 * Network session key
mluis 2:14a5d6ad92d5 334 */
mluis 0:91d1a7783bb9 335 uint8_t NwkSKey[16];
mluis 2:14a5d6ad92d5 336 /*!
mluis 2:14a5d6ad92d5 337 * Application session key
mluis 2:14a5d6ad92d5 338 */
mluis 0:91d1a7783bb9 339 uint8_t AppSKey[16];
mluis 2:14a5d6ad92d5 340 /*!
mluis 2:14a5d6ad92d5 341 * Downlink counter
mluis 2:14a5d6ad92d5 342 */
mluis 0:91d1a7783bb9 343 uint32_t DownLinkCounter;
mluis 2:14a5d6ad92d5 344 /*!
mluis 2:14a5d6ad92d5 345 * Reference pointer to the next multicast channel parameters in the list
mluis 2:14a5d6ad92d5 346 */
mluis 2:14a5d6ad92d5 347 struct sMulticastParams *Next;
mluis 0:91d1a7783bb9 348 }MulticastParams_t;
mluis 0:91d1a7783bb9 349
mluis 0:91d1a7783bb9 350 /*!
mluis 0:91d1a7783bb9 351 * LoRaMAC frame types
mluis 2:14a5d6ad92d5 352 *
mluis 7:c16969e0f70f 353 * LoRaWAN Specification V1.0.1, chapter 4.2.1, table 1
mluis 0:91d1a7783bb9 354 */
mluis 2:14a5d6ad92d5 355 typedef enum eLoRaMacFrameType
mluis 0:91d1a7783bb9 356 {
mluis 2:14a5d6ad92d5 357 /*!
mluis 2:14a5d6ad92d5 358 * LoRaMAC join request frame
mluis 2:14a5d6ad92d5 359 */
mluis 0:91d1a7783bb9 360 FRAME_TYPE_JOIN_REQ = 0x00,
mluis 2:14a5d6ad92d5 361 /*!
mluis 2:14a5d6ad92d5 362 * LoRaMAC join accept frame
mluis 2:14a5d6ad92d5 363 */
mluis 0:91d1a7783bb9 364 FRAME_TYPE_JOIN_ACCEPT = 0x01,
mluis 2:14a5d6ad92d5 365 /*!
mluis 2:14a5d6ad92d5 366 * LoRaMAC unconfirmed up-link frame
mluis 2:14a5d6ad92d5 367 */
mluis 0:91d1a7783bb9 368 FRAME_TYPE_DATA_UNCONFIRMED_UP = 0x02,
mluis 2:14a5d6ad92d5 369 /*!
mluis 2:14a5d6ad92d5 370 * LoRaMAC unconfirmed down-link frame
mluis 2:14a5d6ad92d5 371 */
mluis 0:91d1a7783bb9 372 FRAME_TYPE_DATA_UNCONFIRMED_DOWN = 0x03,
mluis 2:14a5d6ad92d5 373 /*!
mluis 2:14a5d6ad92d5 374 * LoRaMAC confirmed up-link frame
mluis 2:14a5d6ad92d5 375 */
mluis 0:91d1a7783bb9 376 FRAME_TYPE_DATA_CONFIRMED_UP = 0x04,
mluis 2:14a5d6ad92d5 377 /*!
mluis 2:14a5d6ad92d5 378 * LoRaMAC confirmed down-link frame
mluis 2:14a5d6ad92d5 379 */
mluis 0:91d1a7783bb9 380 FRAME_TYPE_DATA_CONFIRMED_DOWN = 0x05,
mluis 2:14a5d6ad92d5 381 /*!
mluis 2:14a5d6ad92d5 382 * LoRaMAC RFU frame
mluis 2:14a5d6ad92d5 383 */
mluis 0:91d1a7783bb9 384 FRAME_TYPE_RFU = 0x06,
mluis 2:14a5d6ad92d5 385 /*!
mluis 2:14a5d6ad92d5 386 * LoRaMAC proprietary frame
mluis 2:14a5d6ad92d5 387 */
mluis 0:91d1a7783bb9 388 FRAME_TYPE_PROPRIETARY = 0x07,
mluis 0:91d1a7783bb9 389 }LoRaMacFrameType_t;
mluis 0:91d1a7783bb9 390
mluis 0:91d1a7783bb9 391 /*!
mluis 0:91d1a7783bb9 392 * LoRaMAC mote MAC commands
mluis 2:14a5d6ad92d5 393 *
mluis 7:c16969e0f70f 394 * LoRaWAN Specification V1.0.1, chapter 5, table 4
mluis 0:91d1a7783bb9 395 */
mluis 2:14a5d6ad92d5 396 typedef enum eLoRaMacMoteCmd
mluis 0:91d1a7783bb9 397 {
mluis 2:14a5d6ad92d5 398 /*!
mluis 2:14a5d6ad92d5 399 * LinkCheckReq
mluis 2:14a5d6ad92d5 400 */
mluis 0:91d1a7783bb9 401 MOTE_MAC_LINK_CHECK_REQ = 0x02,
mluis 2:14a5d6ad92d5 402 /*!
mluis 2:14a5d6ad92d5 403 * LinkADRAns
mluis 2:14a5d6ad92d5 404 */
mluis 0:91d1a7783bb9 405 MOTE_MAC_LINK_ADR_ANS = 0x03,
mluis 2:14a5d6ad92d5 406 /*!
mluis 2:14a5d6ad92d5 407 * DutyCycleAns
mluis 2:14a5d6ad92d5 408 */
mluis 0:91d1a7783bb9 409 MOTE_MAC_DUTY_CYCLE_ANS = 0x04,
mluis 2:14a5d6ad92d5 410 /*!
mluis 2:14a5d6ad92d5 411 * RXParamSetupAns
mluis 2:14a5d6ad92d5 412 */
mluis 0:91d1a7783bb9 413 MOTE_MAC_RX_PARAM_SETUP_ANS = 0x05,
mluis 2:14a5d6ad92d5 414 /*!
mluis 2:14a5d6ad92d5 415 * DevStatusAns
mluis 2:14a5d6ad92d5 416 */
mluis 0:91d1a7783bb9 417 MOTE_MAC_DEV_STATUS_ANS = 0x06,
mluis 2:14a5d6ad92d5 418 /*!
mluis 2:14a5d6ad92d5 419 * NewChannelAns
mluis 2:14a5d6ad92d5 420 */
mluis 0:91d1a7783bb9 421 MOTE_MAC_NEW_CHANNEL_ANS = 0x07,
mluis 2:14a5d6ad92d5 422 /*!
mluis 2:14a5d6ad92d5 423 * RXTimingSetupAns
mluis 2:14a5d6ad92d5 424 */
mluis 0:91d1a7783bb9 425 MOTE_MAC_RX_TIMING_SETUP_ANS = 0x08,
mluis 0:91d1a7783bb9 426 }LoRaMacMoteCmd_t;
mluis 0:91d1a7783bb9 427
mluis 0:91d1a7783bb9 428 /*!
mluis 0:91d1a7783bb9 429 * LoRaMAC server MAC commands
mluis 2:14a5d6ad92d5 430 *
mluis 7:c16969e0f70f 431 * LoRaWAN Specification V1.0.1 chapter 5, table 4
mluis 0:91d1a7783bb9 432 */
mluis 2:14a5d6ad92d5 433 typedef enum eLoRaMacSrvCmd
mluis 0:91d1a7783bb9 434 {
mluis 2:14a5d6ad92d5 435 /*!
mluis 2:14a5d6ad92d5 436 * LinkCheckAns
mluis 2:14a5d6ad92d5 437 */
mluis 0:91d1a7783bb9 438 SRV_MAC_LINK_CHECK_ANS = 0x02,
mluis 2:14a5d6ad92d5 439 /*!
mluis 2:14a5d6ad92d5 440 * LinkADRReq
mluis 2:14a5d6ad92d5 441 */
mluis 0:91d1a7783bb9 442 SRV_MAC_LINK_ADR_REQ = 0x03,
mluis 2:14a5d6ad92d5 443 /*!
mluis 2:14a5d6ad92d5 444 * DutyCycleReq
mluis 2:14a5d6ad92d5 445 */
mluis 0:91d1a7783bb9 446 SRV_MAC_DUTY_CYCLE_REQ = 0x04,
mluis 2:14a5d6ad92d5 447 /*!
mluis 2:14a5d6ad92d5 448 * RXParamSetupReq
mluis 2:14a5d6ad92d5 449 */
mluis 0:91d1a7783bb9 450 SRV_MAC_RX_PARAM_SETUP_REQ = 0x05,
mluis 2:14a5d6ad92d5 451 /*!
mluis 2:14a5d6ad92d5 452 * DevStatusReq
mluis 2:14a5d6ad92d5 453 */
mluis 0:91d1a7783bb9 454 SRV_MAC_DEV_STATUS_REQ = 0x06,
mluis 2:14a5d6ad92d5 455 /*!
mluis 2:14a5d6ad92d5 456 * NewChannelReq
mluis 2:14a5d6ad92d5 457 */
mluis 0:91d1a7783bb9 458 SRV_MAC_NEW_CHANNEL_REQ = 0x07,
mluis 2:14a5d6ad92d5 459 /*!
mluis 2:14a5d6ad92d5 460 * RXTimingSetupReq
mluis 2:14a5d6ad92d5 461 */
mluis 0:91d1a7783bb9 462 SRV_MAC_RX_TIMING_SETUP_REQ = 0x08,
mluis 0:91d1a7783bb9 463 }LoRaMacSrvCmd_t;
mluis 0:91d1a7783bb9 464
mluis 0:91d1a7783bb9 465 /*!
mluis 0:91d1a7783bb9 466 * LoRaMAC Battery level indicator
mluis 0:91d1a7783bb9 467 */
mluis 2:14a5d6ad92d5 468 typedef enum eLoRaMacBatteryLevel
mluis 0:91d1a7783bb9 469 {
mluis 2:14a5d6ad92d5 470 /*!
mluis 2:14a5d6ad92d5 471 * External power source
mluis 2:14a5d6ad92d5 472 */
mluis 0:91d1a7783bb9 473 BAT_LEVEL_EXT_SRC = 0x00,
mluis 2:14a5d6ad92d5 474 /*!
mluis 2:14a5d6ad92d5 475 * Battery level empty
mluis 2:14a5d6ad92d5 476 */
mluis 0:91d1a7783bb9 477 BAT_LEVEL_EMPTY = 0x01,
mluis 2:14a5d6ad92d5 478 /*!
mluis 2:14a5d6ad92d5 479 * Battery level full
mluis 2:14a5d6ad92d5 480 */
mluis 0:91d1a7783bb9 481 BAT_LEVEL_FULL = 0xFE,
mluis 2:14a5d6ad92d5 482 /*!
mluis 2:14a5d6ad92d5 483 * Battery level - no measurement available
mluis 2:14a5d6ad92d5 484 */
mluis 0:91d1a7783bb9 485 BAT_LEVEL_NO_MEASURE = 0xFF,
mluis 0:91d1a7783bb9 486 }LoRaMacBatteryLevel_t;
mluis 0:91d1a7783bb9 487
mluis 0:91d1a7783bb9 488 /*!
mluis 2:14a5d6ad92d5 489 * LoRaMAC header field definition (MHDR field)
mluis 2:14a5d6ad92d5 490 *
mluis 7:c16969e0f70f 491 * LoRaWAN Specification V1.0.1, chapter 4.2
mluis 0:91d1a7783bb9 492 */
mluis 2:14a5d6ad92d5 493 typedef union uLoRaMacHeader
mluis 0:91d1a7783bb9 494 {
mluis 2:14a5d6ad92d5 495 /*!
mluis 2:14a5d6ad92d5 496 * Byte-access to the bits
mluis 2:14a5d6ad92d5 497 */
mluis 0:91d1a7783bb9 498 uint8_t Value;
mluis 2:14a5d6ad92d5 499 /*!
mluis 2:14a5d6ad92d5 500 * Structure containing single access to header bits
mluis 2:14a5d6ad92d5 501 */
mluis 2:14a5d6ad92d5 502 struct sHdrBits
mluis 0:91d1a7783bb9 503 {
mluis 2:14a5d6ad92d5 504 /*!
mluis 2:14a5d6ad92d5 505 * Major version
mluis 2:14a5d6ad92d5 506 */
mluis 0:91d1a7783bb9 507 uint8_t Major : 2;
mluis 2:14a5d6ad92d5 508 /*!
mluis 2:14a5d6ad92d5 509 * RFU
mluis 2:14a5d6ad92d5 510 */
mluis 0:91d1a7783bb9 511 uint8_t RFU : 3;
mluis 2:14a5d6ad92d5 512 /*!
mluis 2:14a5d6ad92d5 513 * Message type
mluis 2:14a5d6ad92d5 514 */
mluis 0:91d1a7783bb9 515 uint8_t MType : 3;
mluis 0:91d1a7783bb9 516 }Bits;
mluis 0:91d1a7783bb9 517 }LoRaMacHeader_t;
mluis 0:91d1a7783bb9 518
mluis 0:91d1a7783bb9 519 /*!
mluis 2:14a5d6ad92d5 520 * LoRaMAC frame control field definition (FCtrl)
mluis 2:14a5d6ad92d5 521 *
mluis 7:c16969e0f70f 522 * LoRaWAN Specification V1.0.1, chapter 4.3.1
mluis 0:91d1a7783bb9 523 */
mluis 2:14a5d6ad92d5 524 typedef union uLoRaMacFrameCtrl
mluis 0:91d1a7783bb9 525 {
mluis 2:14a5d6ad92d5 526 /*!
mluis 2:14a5d6ad92d5 527 * Byte-access to the bits
mluis 2:14a5d6ad92d5 528 */
mluis 0:91d1a7783bb9 529 uint8_t Value;
mluis 4:37c12dbc8dc7 530 /*!
mluis 4:37c12dbc8dc7 531 * Structure containing single access to bits
mluis 4:37c12dbc8dc7 532 */
mluis 2:14a5d6ad92d5 533 struct sCtrlBits
mluis 0:91d1a7783bb9 534 {
mluis 2:14a5d6ad92d5 535 /*!
mluis 2:14a5d6ad92d5 536 * Frame options length
mluis 2:14a5d6ad92d5 537 */
mluis 0:91d1a7783bb9 538 uint8_t FOptsLen : 4;
mluis 2:14a5d6ad92d5 539 /*!
mluis 2:14a5d6ad92d5 540 * Frame pending bit
mluis 2:14a5d6ad92d5 541 */
mluis 0:91d1a7783bb9 542 uint8_t FPending : 1;
mluis 2:14a5d6ad92d5 543 /*!
mluis 2:14a5d6ad92d5 544 * Message acknowledge bit
mluis 2:14a5d6ad92d5 545 */
mluis 0:91d1a7783bb9 546 uint8_t Ack : 1;
mluis 2:14a5d6ad92d5 547 /*!
mluis 2:14a5d6ad92d5 548 * ADR acknowledgment request bit
mluis 2:14a5d6ad92d5 549 */
mluis 0:91d1a7783bb9 550 uint8_t AdrAckReq : 1;
mluis 2:14a5d6ad92d5 551 /*!
mluis 2:14a5d6ad92d5 552 * ADR control in frame header
mluis 2:14a5d6ad92d5 553 */
mluis 0:91d1a7783bb9 554 uint8_t Adr : 1;
mluis 0:91d1a7783bb9 555 }Bits;
mluis 0:91d1a7783bb9 556 }LoRaMacFrameCtrl_t;
mluis 0:91d1a7783bb9 557
mluis 0:91d1a7783bb9 558 /*!
mluis 2:14a5d6ad92d5 559 * Enumeration containing the status of the operation of a MAC service
mluis 0:91d1a7783bb9 560 */
mluis 2:14a5d6ad92d5 561 typedef enum eLoRaMacEventInfoStatus
mluis 0:91d1a7783bb9 562 {
mluis 2:14a5d6ad92d5 563 /*!
mluis 2:14a5d6ad92d5 564 * Service performed successfully
mluis 2:14a5d6ad92d5 565 */
mluis 0:91d1a7783bb9 566 LORAMAC_EVENT_INFO_STATUS_OK = 0,
mluis 2:14a5d6ad92d5 567 /*!
mluis 8:26002607de9c 568 * An error occurred during the execution of the service
mluis 2:14a5d6ad92d5 569 */
mluis 0:91d1a7783bb9 570 LORAMAC_EVENT_INFO_STATUS_ERROR,
mluis 2:14a5d6ad92d5 571 /*!
mluis 8:26002607de9c 572 * A Tx timeout occurred
mluis 2:14a5d6ad92d5 573 */
mluis 0:91d1a7783bb9 574 LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT,
mluis 2:14a5d6ad92d5 575 /*!
mluis 8:26002607de9c 576 * An Rx timeout occurred on receive window 2
mluis 2:14a5d6ad92d5 577 */
mluis 0:91d1a7783bb9 578 LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT,
mluis 2:14a5d6ad92d5 579 /*!
mluis 8:26002607de9c 580 * An Rx error occurred on receive window 1
mluis 8:26002607de9c 581 */
mluis 8:26002607de9c 582 LORAMAC_EVENT_INFO_STATUS_RX1_ERROR,
mluis 8:26002607de9c 583 /*!
mluis 8:26002607de9c 584 * An Rx error occurred on receive window 2
mluis 2:14a5d6ad92d5 585 */
mluis 0:91d1a7783bb9 586 LORAMAC_EVENT_INFO_STATUS_RX2_ERROR,
mluis 2:14a5d6ad92d5 587 /*!
mluis 8:26002607de9c 588 * An error occurred in the join procedure
mluis 2:14a5d6ad92d5 589 */
mluis 0:91d1a7783bb9 590 LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL,
mluis 2:14a5d6ad92d5 591 /*!
mluis 2:14a5d6ad92d5 592 * A frame with an invalid downlink counter was received. The
mluis 2:14a5d6ad92d5 593 * downlink counter of the frame was equal to the local copy
mluis 2:14a5d6ad92d5 594 * of the downlink counter of the node.
mluis 2:14a5d6ad92d5 595 */
mluis 2:14a5d6ad92d5 596 LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED,
mluis 2:14a5d6ad92d5 597 /*!
mluis 8:26002607de9c 598 * The MAC could not retransmit a frame since the MAC decreased the datarate. The
mluis 8:26002607de9c 599 * payload size is not applicable for the datarate.
mluis 8:26002607de9c 600 */
mluis 8:26002607de9c 601 LORAMAC_EVENT_INFO_STATUS_TX_DR_PAYLOAD_SIZE_ERROR,
mluis 8:26002607de9c 602 /*!
mluis 4:37c12dbc8dc7 603 * The node has lost MAX_FCNT_GAP or more frames.
mluis 4:37c12dbc8dc7 604 */
mluis 4:37c12dbc8dc7 605 LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOSS,
mluis 4:37c12dbc8dc7 606 /*!
mluis 8:26002607de9c 607 * An address error occurred
mluis 2:14a5d6ad92d5 608 */
mluis 0:91d1a7783bb9 609 LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL,
mluis 2:14a5d6ad92d5 610 /*!
mluis 2:14a5d6ad92d5 611 * message integrity check failure
mluis 2:14a5d6ad92d5 612 */
mluis 0:91d1a7783bb9 613 LORAMAC_EVENT_INFO_STATUS_MIC_FAIL,
mluis 0:91d1a7783bb9 614 }LoRaMacEventInfoStatus_t;
mluis 0:91d1a7783bb9 615
mluis 0:91d1a7783bb9 616 /*!
mluis 2:14a5d6ad92d5 617 * LoRaMac tx/rx operation state
mluis 2:14a5d6ad92d5 618 */
mluis 2:14a5d6ad92d5 619 typedef union eLoRaMacFlags_t
mluis 2:14a5d6ad92d5 620 {
mluis 2:14a5d6ad92d5 621 /*!
mluis 2:14a5d6ad92d5 622 * Byte-access to the bits
mluis 2:14a5d6ad92d5 623 */
mluis 2:14a5d6ad92d5 624 uint8_t Value;
mluis 4:37c12dbc8dc7 625 /*!
mluis 4:37c12dbc8dc7 626 * Structure containing single access to bits
mluis 4:37c12dbc8dc7 627 */
mluis 2:14a5d6ad92d5 628 struct sMacFlagBits
mluis 2:14a5d6ad92d5 629 {
mluis 2:14a5d6ad92d5 630 /*!
mluis 2:14a5d6ad92d5 631 * MCPS-Req pending
mluis 2:14a5d6ad92d5 632 */
mluis 2:14a5d6ad92d5 633 uint8_t McpsReq : 1;
mluis 2:14a5d6ad92d5 634 /*!
mluis 2:14a5d6ad92d5 635 * MCPS-Ind pending
mluis 2:14a5d6ad92d5 636 */
mluis 2:14a5d6ad92d5 637 uint8_t McpsInd : 1;
mluis 2:14a5d6ad92d5 638 /*!
mluis 8:26002607de9c 639 * MCPS-Ind pending. Skip indication to the application layer
mluis 8:26002607de9c 640 */
mluis 8:26002607de9c 641 uint8_t McpsIndSkip : 1;
mluis 8:26002607de9c 642 /*!
mluis 2:14a5d6ad92d5 643 * MLME-Req pending
mluis 2:14a5d6ad92d5 644 */
mluis 2:14a5d6ad92d5 645 uint8_t MlmeReq : 1;
mluis 2:14a5d6ad92d5 646 /*!
mluis 2:14a5d6ad92d5 647 * MAC cycle done
mluis 2:14a5d6ad92d5 648 */
mluis 2:14a5d6ad92d5 649 uint8_t MacDone : 1;
mluis 2:14a5d6ad92d5 650 }Bits;
mluis 2:14a5d6ad92d5 651 }LoRaMacFlags_t;
mluis 2:14a5d6ad92d5 652
mluis 2:14a5d6ad92d5 653 /*!
mluis 2:14a5d6ad92d5 654 *
mluis 2:14a5d6ad92d5 655 * \brief LoRaMAC data services
mluis 2:14a5d6ad92d5 656 *
mluis 2:14a5d6ad92d5 657 * \details The following table list the primitives which are supported by the
mluis 2:14a5d6ad92d5 658 * specific MAC data service:
mluis 2:14a5d6ad92d5 659 *
mluis 2:14a5d6ad92d5 660 * Name | Request | Indication | Response | Confirm
mluis 2:14a5d6ad92d5 661 * --------------------- | :-----: | :--------: | :------: | :-----:
mluis 2:14a5d6ad92d5 662 * \ref MCPS_UNCONFIRMED | YES | YES | NO | YES
mluis 2:14a5d6ad92d5 663 * \ref MCPS_CONFIRMED | YES | YES | NO | YES
mluis 2:14a5d6ad92d5 664 * \ref MCPS_MULTICAST | NO | YES | NO | NO
mluis 2:14a5d6ad92d5 665 * \ref MCPS_PROPRIETARY | YES | YES | NO | YES
mluis 2:14a5d6ad92d5 666 *
mluis 2:14a5d6ad92d5 667 * The following table provides links to the function implementations of the
mluis 2:14a5d6ad92d5 668 * related MCPS primitives:
mluis 2:14a5d6ad92d5 669 *
mluis 2:14a5d6ad92d5 670 * Primitive | Function
mluis 2:14a5d6ad92d5 671 * ---------------- | :---------------------:
mluis 2:14a5d6ad92d5 672 * MCPS-Request | \ref LoRaMacMlmeRequest
mluis 2:14a5d6ad92d5 673 * MCPS-Confirm | MacMcpsConfirm in \ref LoRaMacPrimitives_t
mluis 2:14a5d6ad92d5 674 * MCPS-Indication | MacMcpsIndication in \ref LoRaMacPrimitives_t
mluis 2:14a5d6ad92d5 675 */
mluis 2:14a5d6ad92d5 676 typedef enum eMcps
mluis 2:14a5d6ad92d5 677 {
mluis 2:14a5d6ad92d5 678 /*!
mluis 2:14a5d6ad92d5 679 * Unconfirmed LoRaMAC frame
mluis 2:14a5d6ad92d5 680 */
mluis 2:14a5d6ad92d5 681 MCPS_UNCONFIRMED,
mluis 2:14a5d6ad92d5 682 /*!
mluis 2:14a5d6ad92d5 683 * Confirmed LoRaMAC frame
mluis 2:14a5d6ad92d5 684 */
mluis 2:14a5d6ad92d5 685 MCPS_CONFIRMED,
mluis 2:14a5d6ad92d5 686 /*!
mluis 2:14a5d6ad92d5 687 * Multicast LoRaMAC frame
mluis 2:14a5d6ad92d5 688 */
mluis 2:14a5d6ad92d5 689 MCPS_MULTICAST,
mluis 2:14a5d6ad92d5 690 /*!
mluis 2:14a5d6ad92d5 691 * Proprietary frame
mluis 2:14a5d6ad92d5 692 */
mluis 2:14a5d6ad92d5 693 MCPS_PROPRIETARY,
mluis 2:14a5d6ad92d5 694 }Mcps_t;
mluis 2:14a5d6ad92d5 695
mluis 2:14a5d6ad92d5 696 /*!
mluis 2:14a5d6ad92d5 697 * LoRaMAC MCPS-Request for an unconfirmed frame
mluis 2:14a5d6ad92d5 698 */
mluis 2:14a5d6ad92d5 699 typedef struct sMcpsReqUnconfirmed
mluis 2:14a5d6ad92d5 700 {
mluis 2:14a5d6ad92d5 701 /*!
mluis 2:14a5d6ad92d5 702 * Frame port field. Must be set if the payload is not empty. Use the
mluis 2:14a5d6ad92d5 703 * application specific frame port values: [1...223]
mluis 2:14a5d6ad92d5 704 *
mluis 7:c16969e0f70f 705 * LoRaWAN Specification V1.0.1, chapter 4.3.2
mluis 2:14a5d6ad92d5 706 */
mluis 2:14a5d6ad92d5 707 uint8_t fPort;
mluis 2:14a5d6ad92d5 708 /*!
mluis 2:14a5d6ad92d5 709 * Pointer to the buffer of the frame payload
mluis 2:14a5d6ad92d5 710 */
mluis 2:14a5d6ad92d5 711 void *fBuffer;
mluis 2:14a5d6ad92d5 712 /*!
mluis 2:14a5d6ad92d5 713 * Size of the frame payload
mluis 2:14a5d6ad92d5 714 */
mluis 2:14a5d6ad92d5 715 uint16_t fBufferSize;
mluis 2:14a5d6ad92d5 716 /*!
mluis 2:14a5d6ad92d5 717 * Uplink datarate, if ADR is off
mluis 2:14a5d6ad92d5 718 */
mluis 2:14a5d6ad92d5 719 int8_t Datarate;
mluis 2:14a5d6ad92d5 720 }McpsReqUnconfirmed_t;
mluis 2:14a5d6ad92d5 721
mluis 2:14a5d6ad92d5 722 /*!
mluis 2:14a5d6ad92d5 723 * LoRaMAC MCPS-Request for a confirmed frame
mluis 2:14a5d6ad92d5 724 */
mluis 2:14a5d6ad92d5 725 typedef struct sMcpsReqConfirmed
mluis 2:14a5d6ad92d5 726 {
mluis 2:14a5d6ad92d5 727 /*!
mluis 2:14a5d6ad92d5 728 * Frame port field. Must be set if the payload is not empty. Use the
mluis 2:14a5d6ad92d5 729 * application specific frame port values: [1...223]
mluis 2:14a5d6ad92d5 730 *
mluis 7:c16969e0f70f 731 * LoRaWAN Specification V1.0.1, chapter 4.3.2
mluis 2:14a5d6ad92d5 732 */
mluis 2:14a5d6ad92d5 733 uint8_t fPort;
mluis 2:14a5d6ad92d5 734 /*!
mluis 2:14a5d6ad92d5 735 * Pointer to the buffer of the frame payload
mluis 2:14a5d6ad92d5 736 */
mluis 2:14a5d6ad92d5 737 void *fBuffer;
mluis 2:14a5d6ad92d5 738 /*!
mluis 2:14a5d6ad92d5 739 * Size of the frame payload
mluis 2:14a5d6ad92d5 740 */
mluis 2:14a5d6ad92d5 741 uint16_t fBufferSize;
mluis 2:14a5d6ad92d5 742 /*!
mluis 2:14a5d6ad92d5 743 * Uplink datarate, if ADR is off
mluis 2:14a5d6ad92d5 744 */
mluis 2:14a5d6ad92d5 745 int8_t Datarate;
mluis 2:14a5d6ad92d5 746 /*!
mluis 3:b9d87593a8ae 747 * Number of trials to transmit the frame, if the LoRaMAC layer did not
mluis 3:b9d87593a8ae 748 * receive an acknowledgment. The MAC performs a datarate adaptation,
mluis 7:c16969e0f70f 749 * according to the LoRaWAN Specification V1.0.1, chapter 19.4, according
mluis 3:b9d87593a8ae 750 * to the following table:
mluis 3:b9d87593a8ae 751 *
mluis 3:b9d87593a8ae 752 * Transmission nb | Data Rate
mluis 3:b9d87593a8ae 753 * ----------------|-----------
mluis 3:b9d87593a8ae 754 * 1 (first) | DR
mluis 3:b9d87593a8ae 755 * 2 | DR
mluis 3:b9d87593a8ae 756 * 3 | max(DR-1,0)
mluis 3:b9d87593a8ae 757 * 4 | max(DR-1,0)
mluis 3:b9d87593a8ae 758 * 5 | max(DR-2,0)
mluis 3:b9d87593a8ae 759 * 6 | max(DR-2,0)
mluis 3:b9d87593a8ae 760 * 7 | max(DR-3,0)
mluis 3:b9d87593a8ae 761 * 8 | max(DR-3,0)
mluis 3:b9d87593a8ae 762 *
mluis 3:b9d87593a8ae 763 * Note, that if NbTrials is set to 1 or 2, the MAC will not decrease
mluis 3:b9d87593a8ae 764 * the datarate, in case the LoRaMAC layer did not receive an acknowledgment
mluis 2:14a5d6ad92d5 765 */
mluis 3:b9d87593a8ae 766 uint8_t NbTrials;
mluis 2:14a5d6ad92d5 767 }McpsReqConfirmed_t;
mluis 2:14a5d6ad92d5 768
mluis 2:14a5d6ad92d5 769 /*!
mluis 2:14a5d6ad92d5 770 * LoRaMAC MCPS-Request for a proprietary frame
mluis 2:14a5d6ad92d5 771 */
mluis 2:14a5d6ad92d5 772 typedef struct sMcpsReqProprietary
mluis 2:14a5d6ad92d5 773 {
mluis 2:14a5d6ad92d5 774 /*!
mluis 2:14a5d6ad92d5 775 * Pointer to the buffer of the frame payload
mluis 2:14a5d6ad92d5 776 */
mluis 2:14a5d6ad92d5 777 void *fBuffer;
mluis 2:14a5d6ad92d5 778 /*!
mluis 2:14a5d6ad92d5 779 * Size of the frame payload
mluis 2:14a5d6ad92d5 780 */
mluis 2:14a5d6ad92d5 781 uint16_t fBufferSize;
mluis 2:14a5d6ad92d5 782 /*!
mluis 2:14a5d6ad92d5 783 * Uplink datarate, if ADR is off
mluis 2:14a5d6ad92d5 784 */
mluis 2:14a5d6ad92d5 785 int8_t Datarate;
mluis 2:14a5d6ad92d5 786 }McpsReqProprietary_t;
mluis 2:14a5d6ad92d5 787
mluis 2:14a5d6ad92d5 788 /*!
mluis 2:14a5d6ad92d5 789 * LoRaMAC MCPS-Request structure
mluis 2:14a5d6ad92d5 790 */
mluis 2:14a5d6ad92d5 791 typedef struct sMcpsReq
mluis 2:14a5d6ad92d5 792 {
mluis 2:14a5d6ad92d5 793 /*!
mluis 2:14a5d6ad92d5 794 * MCPS-Request type
mluis 2:14a5d6ad92d5 795 */
mluis 2:14a5d6ad92d5 796 Mcps_t Type;
mluis 2:14a5d6ad92d5 797
mluis 2:14a5d6ad92d5 798 /*!
mluis 2:14a5d6ad92d5 799 * MCPS-Request parameters
mluis 2:14a5d6ad92d5 800 */
mluis 2:14a5d6ad92d5 801 union uMcpsParam
mluis 2:14a5d6ad92d5 802 {
mluis 2:14a5d6ad92d5 803 /*!
mluis 2:14a5d6ad92d5 804 * MCPS-Request parameters for an unconfirmed frame
mluis 2:14a5d6ad92d5 805 */
mluis 2:14a5d6ad92d5 806 McpsReqUnconfirmed_t Unconfirmed;
mluis 2:14a5d6ad92d5 807 /*!
mluis 2:14a5d6ad92d5 808 * MCPS-Request parameters for a confirmed frame
mluis 2:14a5d6ad92d5 809 */
mluis 2:14a5d6ad92d5 810 McpsReqConfirmed_t Confirmed;
mluis 2:14a5d6ad92d5 811 /*!
mluis 2:14a5d6ad92d5 812 * MCPS-Request parameters for a proprietary frame
mluis 2:14a5d6ad92d5 813 */
mluis 2:14a5d6ad92d5 814 McpsReqProprietary_t Proprietary;
mluis 2:14a5d6ad92d5 815 }Req;
mluis 2:14a5d6ad92d5 816 }McpsReq_t;
mluis 2:14a5d6ad92d5 817
mluis 2:14a5d6ad92d5 818 /*!
mluis 2:14a5d6ad92d5 819 * LoRaMAC MCPS-Confirm
mluis 0:91d1a7783bb9 820 */
mluis 2:14a5d6ad92d5 821 typedef struct sMcpsConfirm
mluis 2:14a5d6ad92d5 822 {
mluis 2:14a5d6ad92d5 823 /*!
mluis 2:14a5d6ad92d5 824 * Holds the previously performed MCPS-Request
mluis 2:14a5d6ad92d5 825 */
mluis 2:14a5d6ad92d5 826 Mcps_t McpsRequest;
mluis 2:14a5d6ad92d5 827 /*!
mluis 2:14a5d6ad92d5 828 * Status of the operation
mluis 2:14a5d6ad92d5 829 */
mluis 2:14a5d6ad92d5 830 LoRaMacEventInfoStatus_t Status;
mluis 2:14a5d6ad92d5 831 /*!
mluis 2:14a5d6ad92d5 832 * Uplink datarate
mluis 2:14a5d6ad92d5 833 */
mluis 2:14a5d6ad92d5 834 uint8_t Datarate;
mluis 2:14a5d6ad92d5 835 /*!
mluis 2:14a5d6ad92d5 836 * Transmission power
mluis 2:14a5d6ad92d5 837 */
mluis 2:14a5d6ad92d5 838 int8_t TxPower;
mluis 2:14a5d6ad92d5 839 /*!
mluis 2:14a5d6ad92d5 840 * Set if an acknowledgement was received
mluis 2:14a5d6ad92d5 841 */
mluis 2:14a5d6ad92d5 842 bool AckReceived;
mluis 2:14a5d6ad92d5 843 /*!
mluis 2:14a5d6ad92d5 844 * Provides the number of retransmissions
mluis 2:14a5d6ad92d5 845 */
mluis 2:14a5d6ad92d5 846 uint8_t NbRetries;
mluis 2:14a5d6ad92d5 847 /*!
mluis 2:14a5d6ad92d5 848 * The transmission time on air of the frame
mluis 2:14a5d6ad92d5 849 */
mluis 2:14a5d6ad92d5 850 TimerTime_t TxTimeOnAir;
mluis 2:14a5d6ad92d5 851 /*!
mluis 2:14a5d6ad92d5 852 * The uplink counter value related to the frame
mluis 2:14a5d6ad92d5 853 */
mluis 2:14a5d6ad92d5 854 uint32_t UpLinkCounter;
mluis 8:26002607de9c 855 /*!
mluis 8:26002607de9c 856 * The uplink frequency related to the frame
mluis 8:26002607de9c 857 */
mluis 8:26002607de9c 858 uint32_t UpLinkFrequency;
mluis 2:14a5d6ad92d5 859 }McpsConfirm_t;
mluis 2:14a5d6ad92d5 860
mluis 2:14a5d6ad92d5 861 /*!
mluis 2:14a5d6ad92d5 862 * LoRaMAC MCPS-Indication primitive
mluis 2:14a5d6ad92d5 863 */
mluis 2:14a5d6ad92d5 864 typedef struct sMcpsIndication
mluis 0:91d1a7783bb9 865 {
mluis 2:14a5d6ad92d5 866 /*!
mluis 2:14a5d6ad92d5 867 * MCPS-Indication type
mluis 2:14a5d6ad92d5 868 */
mluis 2:14a5d6ad92d5 869 Mcps_t McpsIndication;
mluis 2:14a5d6ad92d5 870 /*!
mluis 2:14a5d6ad92d5 871 * Status of the operation
mluis 2:14a5d6ad92d5 872 */
mluis 2:14a5d6ad92d5 873 LoRaMacEventInfoStatus_t Status;
mluis 2:14a5d6ad92d5 874 /*!
mluis 2:14a5d6ad92d5 875 * Multicast
mluis 2:14a5d6ad92d5 876 */
mluis 2:14a5d6ad92d5 877 uint8_t Multicast;
mluis 2:14a5d6ad92d5 878 /*!
mluis 2:14a5d6ad92d5 879 * Application port
mluis 2:14a5d6ad92d5 880 */
mluis 2:14a5d6ad92d5 881 uint8_t Port;
mluis 2:14a5d6ad92d5 882 /*!
mluis 2:14a5d6ad92d5 883 * Downlink datarate
mluis 2:14a5d6ad92d5 884 */
mluis 2:14a5d6ad92d5 885 uint8_t RxDatarate;
mluis 2:14a5d6ad92d5 886 /*!
mluis 2:14a5d6ad92d5 887 * Frame pending status
mluis 2:14a5d6ad92d5 888 */
mluis 2:14a5d6ad92d5 889 uint8_t FramePending;
mluis 2:14a5d6ad92d5 890 /*!
mluis 2:14a5d6ad92d5 891 * Pointer to the received data stream
mluis 2:14a5d6ad92d5 892 */
mluis 2:14a5d6ad92d5 893 uint8_t *Buffer;
mluis 2:14a5d6ad92d5 894 /*!
mluis 2:14a5d6ad92d5 895 * Size of the received data stream
mluis 2:14a5d6ad92d5 896 */
mluis 2:14a5d6ad92d5 897 uint8_t BufferSize;
mluis 2:14a5d6ad92d5 898 /*!
mluis 2:14a5d6ad92d5 899 * Indicates, if data is available
mluis 2:14a5d6ad92d5 900 */
mluis 2:14a5d6ad92d5 901 bool RxData;
mluis 2:14a5d6ad92d5 902 /*!
mluis 2:14a5d6ad92d5 903 * Rssi of the received packet
mluis 2:14a5d6ad92d5 904 */
mluis 2:14a5d6ad92d5 905 int16_t Rssi;
mluis 2:14a5d6ad92d5 906 /*!
mluis 2:14a5d6ad92d5 907 * Snr of the received packet
mluis 2:14a5d6ad92d5 908 */
mluis 2:14a5d6ad92d5 909 uint8_t Snr;
mluis 2:14a5d6ad92d5 910 /*!
mluis 2:14a5d6ad92d5 911 * Receive window
mluis 2:14a5d6ad92d5 912 *
mluis 2:14a5d6ad92d5 913 * [0: Rx window 1, 1: Rx window 2]
mluis 2:14a5d6ad92d5 914 */
mluis 2:14a5d6ad92d5 915 uint8_t RxSlot;
mluis 2:14a5d6ad92d5 916 /*!
mluis 2:14a5d6ad92d5 917 * Set if an acknowledgement was received
mluis 2:14a5d6ad92d5 918 */
mluis 2:14a5d6ad92d5 919 bool AckReceived;
mluis 2:14a5d6ad92d5 920 /*!
mluis 2:14a5d6ad92d5 921 * The downlink counter value for the received frame
mluis 2:14a5d6ad92d5 922 */
mluis 2:14a5d6ad92d5 923 uint32_t DownLinkCounter;
mluis 2:14a5d6ad92d5 924 }McpsIndication_t;
mluis 2:14a5d6ad92d5 925
mluis 2:14a5d6ad92d5 926 /*!
mluis 2:14a5d6ad92d5 927 * \brief LoRaMAC management services
mluis 2:14a5d6ad92d5 928 *
mluis 2:14a5d6ad92d5 929 * \details The following table list the primitives which are supported by the
mluis 2:14a5d6ad92d5 930 * specific MAC management service:
mluis 2:14a5d6ad92d5 931 *
mluis 2:14a5d6ad92d5 932 * Name | Request | Indication | Response | Confirm
mluis 2:14a5d6ad92d5 933 * --------------------- | :-----: | :--------: | :------: | :-----:
mluis 2:14a5d6ad92d5 934 * \ref MLME_JOIN | YES | NO | NO | YES
mluis 2:14a5d6ad92d5 935 * \ref MLME_LINK_CHECK | YES | NO | NO | YES
mluis 8:26002607de9c 936 * \ref MLME_TXCW | YES | NO | NO | YES
mluis 2:14a5d6ad92d5 937 *
mluis 2:14a5d6ad92d5 938 * The following table provides links to the function implementations of the
mluis 2:14a5d6ad92d5 939 * related MLME primitives.
mluis 2:14a5d6ad92d5 940 *
mluis 2:14a5d6ad92d5 941 * Primitive | Function
mluis 2:14a5d6ad92d5 942 * ---------------- | :---------------------:
mluis 2:14a5d6ad92d5 943 * MLME-Request | \ref LoRaMacMlmeRequest
mluis 2:14a5d6ad92d5 944 * MLME-Confirm | MacMlmeConfirm in \ref LoRaMacPrimitives_t
mluis 2:14a5d6ad92d5 945 */
mluis 2:14a5d6ad92d5 946 typedef enum eMlme
mluis 2:14a5d6ad92d5 947 {
mluis 2:14a5d6ad92d5 948 /*!
mluis 2:14a5d6ad92d5 949 * Initiates the Over-the-Air activation
mluis 2:14a5d6ad92d5 950 *
mluis 7:c16969e0f70f 951 * LoRaWAN Specification V1.0.1, chapter 6.2
mluis 2:14a5d6ad92d5 952 */
mluis 2:14a5d6ad92d5 953 MLME_JOIN,
mluis 2:14a5d6ad92d5 954 /*!
mluis 2:14a5d6ad92d5 955 * LinkCheckReq - Connectivity validation
mluis 2:14a5d6ad92d5 956 *
mluis 7:c16969e0f70f 957 * LoRaWAN Specification V1.0.1, chapter 5, table 4
mluis 2:14a5d6ad92d5 958 */
mluis 2:14a5d6ad92d5 959 MLME_LINK_CHECK,
mluis 8:26002607de9c 960 /*!
mluis 8:26002607de9c 961 * Sets Tx continuous wave mode
mluis 8:26002607de9c 962 *
mluis 8:26002607de9c 963 * LoRaWAN end-device certification
mluis 8:26002607de9c 964 */
mluis 8:26002607de9c 965 MLME_TXCW,
mluis 8:26002607de9c 966 /*!
mluis 8:26002607de9c 967 * Sets Tx continuous wave mode (new LoRa-Alliance CC definition)
mluis 8:26002607de9c 968 *
mluis 8:26002607de9c 969 * LoRaWAN end-device certification
mluis 8:26002607de9c 970 */
mluis 8:26002607de9c 971 MLME_TXCW_1,
mluis 2:14a5d6ad92d5 972 }Mlme_t;
mluis 2:14a5d6ad92d5 973
mluis 2:14a5d6ad92d5 974 /*!
mluis 2:14a5d6ad92d5 975 * LoRaMAC MLME-Request for the join service
mluis 2:14a5d6ad92d5 976 */
mluis 2:14a5d6ad92d5 977 typedef struct sMlmeReqJoin
mluis 2:14a5d6ad92d5 978 {
mluis 2:14a5d6ad92d5 979 /*!
mluis 2:14a5d6ad92d5 980 * Globally unique end-device identifier
mluis 2:14a5d6ad92d5 981 *
mluis 7:c16969e0f70f 982 * LoRaWAN Specification V1.0.1, chapter 6.2.1
mluis 2:14a5d6ad92d5 983 */
mluis 2:14a5d6ad92d5 984 uint8_t *DevEui;
mluis 2:14a5d6ad92d5 985 /*!
mluis 2:14a5d6ad92d5 986 * Application identifier
mluis 2:14a5d6ad92d5 987 *
mluis 7:c16969e0f70f 988 * LoRaWAN Specification V1.0.1, chapter 6.1.2
mluis 2:14a5d6ad92d5 989 */
mluis 2:14a5d6ad92d5 990 uint8_t *AppEui;
mluis 2:14a5d6ad92d5 991 /*!
mluis 2:14a5d6ad92d5 992 * AES-128 application key
mluis 2:14a5d6ad92d5 993 *
mluis 7:c16969e0f70f 994 * LoRaWAN Specification V1.0.1, chapter 6.2.2
mluis 2:14a5d6ad92d5 995 */
mluis 2:14a5d6ad92d5 996 uint8_t *AppKey;
mluis 8:26002607de9c 997 /*!
mluis 8:26002607de9c 998 * Number of trials for the join request.
mluis 8:26002607de9c 999 */
mluis 8:26002607de9c 1000 uint8_t NbTrials;
mluis 2:14a5d6ad92d5 1001 }MlmeReqJoin_t;
mluis 2:14a5d6ad92d5 1002
mluis 2:14a5d6ad92d5 1003 /*!
mluis 8:26002607de9c 1004 * LoRaMAC MLME-Request for Tx continuous wave mode
mluis 8:26002607de9c 1005 */
mluis 8:26002607de9c 1006 typedef struct sMlmeReqTxCw
mluis 8:26002607de9c 1007 {
mluis 8:26002607de9c 1008 /*!
mluis 8:26002607de9c 1009 * Time in seconds while the radio is kept in continuous wave mode
mluis 8:26002607de9c 1010 */
mluis 8:26002607de9c 1011 uint16_t Timeout;
mluis 8:26002607de9c 1012 /*!
mluis 8:26002607de9c 1013 * RF frequency to set (Only used with new way)
mluis 8:26002607de9c 1014 */
mluis 8:26002607de9c 1015 uint32_t Frequency;
mluis 8:26002607de9c 1016 /*!
mluis 8:26002607de9c 1017 * RF output power to set (Only used with new way)
mluis 8:26002607de9c 1018 */
mluis 8:26002607de9c 1019 uint8_t Power;
mluis 8:26002607de9c 1020 }MlmeReqTxCw_t;
mluis 8:26002607de9c 1021
mluis 8:26002607de9c 1022 /*!
mluis 4:37c12dbc8dc7 1023 * LoRaMAC MLME-Request structure
mluis 2:14a5d6ad92d5 1024 */
mluis 2:14a5d6ad92d5 1025 typedef struct sMlmeReq
mluis 2:14a5d6ad92d5 1026 {
mluis 2:14a5d6ad92d5 1027 /*!
mluis 2:14a5d6ad92d5 1028 * MLME-Request type
mluis 2:14a5d6ad92d5 1029 */
mluis 2:14a5d6ad92d5 1030 Mlme_t Type;
mluis 2:14a5d6ad92d5 1031
mluis 2:14a5d6ad92d5 1032 /*!
mluis 2:14a5d6ad92d5 1033 * MLME-Request parameters
mluis 2:14a5d6ad92d5 1034 */
mluis 2:14a5d6ad92d5 1035 union uMlmeParam
mluis 2:14a5d6ad92d5 1036 {
mluis 2:14a5d6ad92d5 1037 /*!
mluis 2:14a5d6ad92d5 1038 * MLME-Request parameters for a join request
mluis 2:14a5d6ad92d5 1039 */
mluis 2:14a5d6ad92d5 1040 MlmeReqJoin_t Join;
mluis 8:26002607de9c 1041 /*!
mluis 8:26002607de9c 1042 * MLME-Request parameters for Tx continuous mode request
mluis 8:26002607de9c 1043 */
mluis 8:26002607de9c 1044 MlmeReqTxCw_t TxCw;
mluis 2:14a5d6ad92d5 1045 }Req;
mluis 2:14a5d6ad92d5 1046 }MlmeReq_t;
mluis 2:14a5d6ad92d5 1047
mluis 2:14a5d6ad92d5 1048 /*!
mluis 2:14a5d6ad92d5 1049 * LoRaMAC MLME-Confirm primitive
mluis 2:14a5d6ad92d5 1050 */
mluis 2:14a5d6ad92d5 1051 typedef struct sMlmeConfirm
mluis 2:14a5d6ad92d5 1052 {
mluis 2:14a5d6ad92d5 1053 /*!
mluis 2:14a5d6ad92d5 1054 * Holds the previously performed MLME-Request
mluis 2:14a5d6ad92d5 1055 */
mluis 2:14a5d6ad92d5 1056 Mlme_t MlmeRequest;
mluis 2:14a5d6ad92d5 1057 /*!
mluis 2:14a5d6ad92d5 1058 * Status of the operation
mluis 2:14a5d6ad92d5 1059 */
mluis 0:91d1a7783bb9 1060 LoRaMacEventInfoStatus_t Status;
mluis 2:14a5d6ad92d5 1061 /*!
mluis 2:14a5d6ad92d5 1062 * The transmission time on air of the frame
mluis 2:14a5d6ad92d5 1063 */
mluis 2:14a5d6ad92d5 1064 TimerTime_t TxTimeOnAir;
mluis 2:14a5d6ad92d5 1065 /*!
mluis 2:14a5d6ad92d5 1066 * Demodulation margin. Contains the link margin [dB] of the last
mluis 2:14a5d6ad92d5 1067 * successfully received LinkCheckReq
mluis 2:14a5d6ad92d5 1068 */
mluis 0:91d1a7783bb9 1069 uint8_t DemodMargin;
mluis 2:14a5d6ad92d5 1070 /*!
mluis 2:14a5d6ad92d5 1071 * Number of gateways which received the last LinkCheckReq
mluis 2:14a5d6ad92d5 1072 */
mluis 0:91d1a7783bb9 1073 uint8_t NbGateways;
mluis 8:26002607de9c 1074 /*!
mluis 8:26002607de9c 1075 * Provides the number of retransmissions
mluis 8:26002607de9c 1076 */
mluis 8:26002607de9c 1077 uint8_t NbRetries;
mluis 2:14a5d6ad92d5 1078 }MlmeConfirm_t;
mluis 2:14a5d6ad92d5 1079
mluis 2:14a5d6ad92d5 1080 /*!
mluis 2:14a5d6ad92d5 1081 * LoRa Mac Information Base (MIB)
mluis 2:14a5d6ad92d5 1082 *
mluis 2:14a5d6ad92d5 1083 * The following table lists the MIB parameters and the related attributes:
mluis 2:14a5d6ad92d5 1084 *
mluis 2:14a5d6ad92d5 1085 * Attribute | Get | Set
mluis 2:14a5d6ad92d5 1086 * --------------------------------- | :-: | :-:
mluis 2:14a5d6ad92d5 1087 * \ref MIB_DEVICE_CLASS | YES | YES
mluis 2:14a5d6ad92d5 1088 * \ref MIB_NETWORK_JOINED | YES | YES
mluis 2:14a5d6ad92d5 1089 * \ref MIB_ADR | YES | YES
mluis 2:14a5d6ad92d5 1090 * \ref MIB_NET_ID | YES | YES
mluis 2:14a5d6ad92d5 1091 * \ref MIB_DEV_ADDR | YES | YES
mluis 2:14a5d6ad92d5 1092 * \ref MIB_NWK_SKEY | YES | YES
mluis 2:14a5d6ad92d5 1093 * \ref MIB_APP_SKEY | YES | YES
mluis 2:14a5d6ad92d5 1094 * \ref MIB_PUBLIC_NETWORK | YES | YES
mluis 3:b9d87593a8ae 1095 * \ref MIB_REPEATER_SUPPORT | YES | YES
mluis 2:14a5d6ad92d5 1096 * \ref MIB_CHANNELS | YES | NO
mluis 2:14a5d6ad92d5 1097 * \ref MIB_RX2_CHANNEL | YES | YES
mluis 2:14a5d6ad92d5 1098 * \ref MIB_CHANNELS_MASK | YES | YES
mluis 8:26002607de9c 1099 * \ref MIB_CHANNELS_DEFAULT_MASK | YES | YES
mluis 2:14a5d6ad92d5 1100 * \ref MIB_CHANNELS_NB_REP | YES | YES
mluis 2:14a5d6ad92d5 1101 * \ref MIB_MAX_RX_WINDOW_DURATION | YES | YES
mluis 2:14a5d6ad92d5 1102 * \ref MIB_RECEIVE_DELAY_1 | YES | YES
mluis 2:14a5d6ad92d5 1103 * \ref MIB_RECEIVE_DELAY_2 | YES | YES
mluis 2:14a5d6ad92d5 1104 * \ref MIB_JOIN_ACCEPT_DELAY_1 | YES | YES
mluis 2:14a5d6ad92d5 1105 * \ref MIB_JOIN_ACCEPT_DELAY_2 | YES | YES
mluis 2:14a5d6ad92d5 1106 * \ref MIB_CHANNELS_DATARATE | YES | YES
mluis 4:37c12dbc8dc7 1107 * \ref MIB_CHANNELS_DEFAULT_DATARATE| YES | YES
mluis 2:14a5d6ad92d5 1108 * \ref MIB_CHANNELS_TX_POWER | YES | YES
mluis 8:26002607de9c 1109 * \ref MIB_CHANNELS_DEFAULT_TX_POWER| YES | YES
mluis 4:37c12dbc8dc7 1110 * \ref MIB_UPLINK_COUNTER | YES | YES
mluis 4:37c12dbc8dc7 1111 * \ref MIB_DOWNLINK_COUNTER | YES | YES
mluis 2:14a5d6ad92d5 1112 * \ref MIB_MULTICAST_CHANNEL | YES | NO
mluis 8:26002607de9c 1113 * \ref MIB_SYSTEM_MAX_RX_ERROR | YES | YES
mluis 8:26002607de9c 1114 * \ref MIB_MIN_RX_SYMBOLS | YES | YES
mluis 2:14a5d6ad92d5 1115 *
mluis 2:14a5d6ad92d5 1116 * The following table provides links to the function implementations of the
mluis 2:14a5d6ad92d5 1117 * related MIB primitives:
mluis 2:14a5d6ad92d5 1118 *
mluis 2:14a5d6ad92d5 1119 * Primitive | Function
mluis 2:14a5d6ad92d5 1120 * ---------------- | :---------------------:
mluis 2:14a5d6ad92d5 1121 * MIB-Set | \ref LoRaMacMibSetRequestConfirm
mluis 2:14a5d6ad92d5 1122 * MIB-Get | \ref LoRaMacMibGetRequestConfirm
mluis 2:14a5d6ad92d5 1123 */
mluis 2:14a5d6ad92d5 1124 typedef enum eMib
mluis 2:14a5d6ad92d5 1125 {
mluis 2:14a5d6ad92d5 1126 /*!
mluis 2:14a5d6ad92d5 1127 * LoRaWAN device class
mluis 2:14a5d6ad92d5 1128 *
mluis 7:c16969e0f70f 1129 * LoRaWAN Specification V1.0.1
mluis 2:14a5d6ad92d5 1130 */
mluis 2:14a5d6ad92d5 1131 MIB_DEVICE_CLASS,
mluis 2:14a5d6ad92d5 1132 /*!
mluis 2:14a5d6ad92d5 1133 * LoRaWAN Network joined attribute
mluis 2:14a5d6ad92d5 1134 *
mluis 7:c16969e0f70f 1135 * LoRaWAN Specification V1.0.1
mluis 2:14a5d6ad92d5 1136 */
mluis 2:14a5d6ad92d5 1137 MIB_NETWORK_JOINED,
mluis 2:14a5d6ad92d5 1138 /*!
mluis 2:14a5d6ad92d5 1139 * Adaptive data rate
mluis 2:14a5d6ad92d5 1140 *
mluis 7:c16969e0f70f 1141 * LoRaWAN Specification V1.0.1, chapter 4.3.1.1
mluis 2:14a5d6ad92d5 1142 *
mluis 2:14a5d6ad92d5 1143 * [true: ADR enabled, false: ADR disabled]
mluis 2:14a5d6ad92d5 1144 */
mluis 2:14a5d6ad92d5 1145 MIB_ADR,
mluis 2:14a5d6ad92d5 1146 /*!
mluis 2:14a5d6ad92d5 1147 * Network identifier
mluis 2:14a5d6ad92d5 1148 *
mluis 7:c16969e0f70f 1149 * LoRaWAN Specification V1.0.1, chapter 6.1.1
mluis 2:14a5d6ad92d5 1150 */
mluis 2:14a5d6ad92d5 1151 MIB_NET_ID,
mluis 2:14a5d6ad92d5 1152 /*!
mluis 2:14a5d6ad92d5 1153 * End-device address
mluis 2:14a5d6ad92d5 1154 *
mluis 7:c16969e0f70f 1155 * LoRaWAN Specification V1.0.1, chapter 6.1.1
mluis 2:14a5d6ad92d5 1156 */
mluis 2:14a5d6ad92d5 1157 MIB_DEV_ADDR,
mluis 2:14a5d6ad92d5 1158 /*!
mluis 2:14a5d6ad92d5 1159 * Network session key
mluis 2:14a5d6ad92d5 1160 *
mluis 7:c16969e0f70f 1161 * LoRaWAN Specification V1.0.1, chapter 6.1.3
mluis 2:14a5d6ad92d5 1162 */
mluis 2:14a5d6ad92d5 1163 MIB_NWK_SKEY,
mluis 2:14a5d6ad92d5 1164 /*!
mluis 2:14a5d6ad92d5 1165 * Application session key
mluis 2:14a5d6ad92d5 1166 *
mluis 7:c16969e0f70f 1167 * LoRaWAN Specification V1.0.1, chapter 6.1.4
mluis 2:14a5d6ad92d5 1168 */
mluis 2:14a5d6ad92d5 1169 MIB_APP_SKEY,
mluis 2:14a5d6ad92d5 1170 /*!
mluis 2:14a5d6ad92d5 1171 * Set the network type to public or private
mluis 2:14a5d6ad92d5 1172 *
mluis 7:c16969e0f70f 1173 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1174 *
mluis 2:14a5d6ad92d5 1175 * [true: public network, false: private network]
mluis 2:14a5d6ad92d5 1176 */
mluis 2:14a5d6ad92d5 1177 MIB_PUBLIC_NETWORK,
mluis 2:14a5d6ad92d5 1178 /*!
mluis 2:14a5d6ad92d5 1179 * Support the operation with repeaters
mluis 2:14a5d6ad92d5 1180 *
mluis 7:c16969e0f70f 1181 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1182 *
mluis 2:14a5d6ad92d5 1183 * [true: repeater support enabled, false: repeater support disabled]
mluis 2:14a5d6ad92d5 1184 */
mluis 2:14a5d6ad92d5 1185 MIB_REPEATER_SUPPORT,
mluis 2:14a5d6ad92d5 1186 /*!
mluis 2:14a5d6ad92d5 1187 * Communication channels. A get request will return a
mluis 2:14a5d6ad92d5 1188 * pointer which references the first entry of the channel list. The
mluis 2:14a5d6ad92d5 1189 * list is of size LORA_MAX_NB_CHANNELS
mluis 2:14a5d6ad92d5 1190 *
mluis 7:c16969e0f70f 1191 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1192 */
mluis 2:14a5d6ad92d5 1193 MIB_CHANNELS,
mluis 2:14a5d6ad92d5 1194 /*!
mluis 2:14a5d6ad92d5 1195 * Set receive window 2 channel
mluis 2:14a5d6ad92d5 1196 *
mluis 7:c16969e0f70f 1197 * LoRaWAN Specification V1.0.1, chapter 3.3.2
mluis 2:14a5d6ad92d5 1198 */
mluis 2:14a5d6ad92d5 1199 MIB_RX2_CHANNEL,
mluis 2:14a5d6ad92d5 1200 /*!
mluis 8:26002607de9c 1201 * Set receive window 2 channel
mluis 8:26002607de9c 1202 *
mluis 8:26002607de9c 1203 * LoRaWAN Specification V1.0.1, chapter 3.3.2
mluis 8:26002607de9c 1204 */
mluis 8:26002607de9c 1205 MIB_RX2_DEFAULT_CHANNEL,
mluis 8:26002607de9c 1206 /*!
mluis 2:14a5d6ad92d5 1207 * LoRaWAN channels mask
mluis 2:14a5d6ad92d5 1208 *
mluis 7:c16969e0f70f 1209 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1210 */
mluis 2:14a5d6ad92d5 1211 MIB_CHANNELS_MASK,
mluis 2:14a5d6ad92d5 1212 /*!
mluis 8:26002607de9c 1213 * LoRaWAN default channels mask
mluis 8:26002607de9c 1214 *
mluis 8:26002607de9c 1215 * LoRaWAN Specification V1.0.1, chapter 7
mluis 8:26002607de9c 1216 */
mluis 8:26002607de9c 1217 MIB_CHANNELS_DEFAULT_MASK,
mluis 8:26002607de9c 1218 /*!
mluis 2:14a5d6ad92d5 1219 * Set the number of repetitions on a channel
mluis 2:14a5d6ad92d5 1220 *
mluis 7:c16969e0f70f 1221 * LoRaWAN Specification V1.0.1, chapter 5.2
mluis 2:14a5d6ad92d5 1222 */
mluis 2:14a5d6ad92d5 1223 MIB_CHANNELS_NB_REP,
mluis 2:14a5d6ad92d5 1224 /*!
mluis 8:26002607de9c 1225 * Maximum receive window duration in [ms]
mluis 2:14a5d6ad92d5 1226 *
mluis 7:c16969e0f70f 1227 * LoRaWAN Specification V1.0.1, chapter 3.3.3
mluis 2:14a5d6ad92d5 1228 */
mluis 2:14a5d6ad92d5 1229 MIB_MAX_RX_WINDOW_DURATION,
mluis 2:14a5d6ad92d5 1230 /*!
mluis 8:26002607de9c 1231 * Receive delay 1 in [ms]
mluis 2:14a5d6ad92d5 1232 *
mluis 7:c16969e0f70f 1233 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1234 */
mluis 2:14a5d6ad92d5 1235 MIB_RECEIVE_DELAY_1,
mluis 2:14a5d6ad92d5 1236 /*!
mluis 8:26002607de9c 1237 * Receive delay 2 in [ms]
mluis 2:14a5d6ad92d5 1238 *
mluis 7:c16969e0f70f 1239 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1240 */
mluis 2:14a5d6ad92d5 1241 MIB_RECEIVE_DELAY_2,
mluis 2:14a5d6ad92d5 1242 /*!
mluis 8:26002607de9c 1243 * Join accept delay 1 in [ms]
mluis 2:14a5d6ad92d5 1244 *
mluis 7:c16969e0f70f 1245 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1246 */
mluis 2:14a5d6ad92d5 1247 MIB_JOIN_ACCEPT_DELAY_1,
mluis 2:14a5d6ad92d5 1248 /*!
mluis 8:26002607de9c 1249 * Join accept delay 2 in [ms]
mluis 2:14a5d6ad92d5 1250 *
mluis 7:c16969e0f70f 1251 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1252 */
mluis 2:14a5d6ad92d5 1253 MIB_JOIN_ACCEPT_DELAY_2,
mluis 2:14a5d6ad92d5 1254 /*!
mluis 4:37c12dbc8dc7 1255 * Default Data rate of a channel
mluis 4:37c12dbc8dc7 1256 *
mluis 7:c16969e0f70f 1257 * LoRaWAN Specification V1.0.1, chapter 7
mluis 4:37c12dbc8dc7 1258 *
mluis 4:37c12dbc8dc7 1259 * EU868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]
mluis 4:37c12dbc8dc7 1260 *
mluis 4:37c12dbc8dc7 1261 * US915 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_8, DR_9, DR_10, DR_11, DR_12, DR_13]
mluis 4:37c12dbc8dc7 1262 */
mluis 4:37c12dbc8dc7 1263 MIB_CHANNELS_DEFAULT_DATARATE,
mluis 4:37c12dbc8dc7 1264 /*!
mluis 2:14a5d6ad92d5 1265 * Data rate of a channel
mluis 2:14a5d6ad92d5 1266 *
mluis 7:c16969e0f70f 1267 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1268 *
mluis 2:14a5d6ad92d5 1269 * EU868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]
mluis 2:14a5d6ad92d5 1270 *
mluis 2:14a5d6ad92d5 1271 * US915 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_8, DR_9, DR_10, DR_11, DR_12, DR_13]
mluis 2:14a5d6ad92d5 1272 */
mluis 2:14a5d6ad92d5 1273 MIB_CHANNELS_DATARATE,
mluis 2:14a5d6ad92d5 1274 /*!
mluis 2:14a5d6ad92d5 1275 * Transmission power of a channel
mluis 2:14a5d6ad92d5 1276 *
mluis 7:c16969e0f70f 1277 * LoRaWAN Specification V1.0.1, chapter 7
mluis 2:14a5d6ad92d5 1278 *
mluis 2:14a5d6ad92d5 1279 * EU868 - [TX_POWER_20_DBM, TX_POWER_14_DBM, TX_POWER_11_DBM,
mluis 2:14a5d6ad92d5 1280 * TX_POWER_08_DBM, TX_POWER_05_DBM, TX_POWER_02_DBM]
mluis 2:14a5d6ad92d5 1281 *
mluis 2:14a5d6ad92d5 1282 * US915 - [TX_POWER_30_DBM, TX_POWER_28_DBM, TX_POWER_26_DBM,
mluis 2:14a5d6ad92d5 1283 * TX_POWER_24_DBM, TX_POWER_22_DBM, TX_POWER_20_DBM,
mluis 2:14a5d6ad92d5 1284 * TX_POWER_18_DBM, TX_POWER_14_DBM, TX_POWER_12_DBM,
mluis 2:14a5d6ad92d5 1285 * TX_POWER_10_DBM]
mluis 2:14a5d6ad92d5 1286 */
mluis 2:14a5d6ad92d5 1287 MIB_CHANNELS_TX_POWER,
mluis 2:14a5d6ad92d5 1288 /*!
mluis 8:26002607de9c 1289 * Transmission power of a channel
mluis 8:26002607de9c 1290 *
mluis 8:26002607de9c 1291 * LoRaWAN Specification V1.0.1, chapter 7
mluis 8:26002607de9c 1292 *
mluis 8:26002607de9c 1293 * EU868 - [TX_POWER_20_DBM, TX_POWER_14_DBM, TX_POWER_11_DBM,
mluis 8:26002607de9c 1294 * TX_POWER_08_DBM, TX_POWER_05_DBM, TX_POWER_02_DBM]
mluis 8:26002607de9c 1295 *
mluis 8:26002607de9c 1296 * US915 - [TX_POWER_30_DBM, TX_POWER_28_DBM, TX_POWER_26_DBM,
mluis 8:26002607de9c 1297 * TX_POWER_24_DBM, TX_POWER_22_DBM, TX_POWER_20_DBM,
mluis 8:26002607de9c 1298 * TX_POWER_18_DBM, TX_POWER_14_DBM, TX_POWER_12_DBM,
mluis 8:26002607de9c 1299 * TX_POWER_10_DBM]
mluis 8:26002607de9c 1300 */
mluis 8:26002607de9c 1301 MIB_CHANNELS_DEFAULT_TX_POWER,
mluis 8:26002607de9c 1302 /*!
mluis 2:14a5d6ad92d5 1303 * LoRaWAN Up-link counter
mluis 2:14a5d6ad92d5 1304 *
mluis 7:c16969e0f70f 1305 * LoRaWAN Specification V1.0.1, chapter 4.3.1.5
mluis 2:14a5d6ad92d5 1306 */
mluis 2:14a5d6ad92d5 1307 MIB_UPLINK_COUNTER,
mluis 2:14a5d6ad92d5 1308 /*!
mluis 2:14a5d6ad92d5 1309 * LoRaWAN Down-link counter
mluis 2:14a5d6ad92d5 1310 *
mluis 7:c16969e0f70f 1311 * LoRaWAN Specification V1.0.1, chapter 4.3.1.5
mluis 2:14a5d6ad92d5 1312 */
mluis 2:14a5d6ad92d5 1313 MIB_DOWNLINK_COUNTER,
mluis 2:14a5d6ad92d5 1314 /*!
mluis 2:14a5d6ad92d5 1315 * Multicast channels. A get request will return a pointer to the first
mluis 2:14a5d6ad92d5 1316 * entry of the multicast channel linked list. If the pointer is equal to
mluis 2:14a5d6ad92d5 1317 * NULL, the list is empty.
mluis 2:14a5d6ad92d5 1318 */
mluis 2:14a5d6ad92d5 1319 MIB_MULTICAST_CHANNEL,
mluis 8:26002607de9c 1320 /*!
mluis 8:26002607de9c 1321 * System overall timing error in milliseconds.
mluis 8:26002607de9c 1322 * [-SystemMaxRxError : +SystemMaxRxError]
mluis 8:26002607de9c 1323 * Default: +/-10 ms
mluis 8:26002607de9c 1324 */
mluis 8:26002607de9c 1325 MIB_SYSTEM_MAX_RX_ERROR,
mluis 8:26002607de9c 1326 /*!
mluis 8:26002607de9c 1327 * Minimum required number of symbols to detect an Rx frame
mluis 8:26002607de9c 1328 * Default: 6 symbols
mluis 8:26002607de9c 1329 */
mluis 8:26002607de9c 1330 MIB_MIN_RX_SYMBOLS,
mluis 2:14a5d6ad92d5 1331 }Mib_t;
mluis 2:14a5d6ad92d5 1332
mluis 2:14a5d6ad92d5 1333 /*!
mluis 2:14a5d6ad92d5 1334 * LoRaMAC MIB parameters
mluis 2:14a5d6ad92d5 1335 */
mluis 2:14a5d6ad92d5 1336 typedef union uMibParam
mluis 2:14a5d6ad92d5 1337 {
mluis 2:14a5d6ad92d5 1338 /*!
mluis 2:14a5d6ad92d5 1339 * LoRaWAN device class
mluis 2:14a5d6ad92d5 1340 *
mluis 2:14a5d6ad92d5 1341 * Related MIB type: \ref MIB_DEVICE_CLASS
mluis 2:14a5d6ad92d5 1342 */
mluis 2:14a5d6ad92d5 1343 DeviceClass_t Class;
mluis 2:14a5d6ad92d5 1344 /*!
mluis 2:14a5d6ad92d5 1345 * LoRaWAN network joined attribute
mluis 2:14a5d6ad92d5 1346 *
mluis 2:14a5d6ad92d5 1347 * Related MIB type: \ref MIB_NETWORK_JOINED
mluis 2:14a5d6ad92d5 1348 */
mluis 2:14a5d6ad92d5 1349 bool IsNetworkJoined;
mluis 2:14a5d6ad92d5 1350 /*!
mluis 2:14a5d6ad92d5 1351 * Activation state of ADR
mluis 2:14a5d6ad92d5 1352 *
mluis 2:14a5d6ad92d5 1353 * Related MIB type: \ref MIB_ADR
mluis 2:14a5d6ad92d5 1354 */
mluis 2:14a5d6ad92d5 1355 bool AdrEnable;
mluis 2:14a5d6ad92d5 1356 /*!
mluis 2:14a5d6ad92d5 1357 * Network identifier
mluis 2:14a5d6ad92d5 1358 *
mluis 2:14a5d6ad92d5 1359 * Related MIB type: \ref MIB_NET_ID
mluis 2:14a5d6ad92d5 1360 */
mluis 2:14a5d6ad92d5 1361 uint32_t NetID;
mluis 2:14a5d6ad92d5 1362 /*!
mluis 2:14a5d6ad92d5 1363 * End-device address
mluis 2:14a5d6ad92d5 1364 *
mluis 2:14a5d6ad92d5 1365 * Related MIB type: \ref MIB_DEV_ADDR
mluis 2:14a5d6ad92d5 1366 */
mluis 2:14a5d6ad92d5 1367 uint32_t DevAddr;
mluis 2:14a5d6ad92d5 1368 /*!
mluis 2:14a5d6ad92d5 1369 * Network session key
mluis 2:14a5d6ad92d5 1370 *
mluis 2:14a5d6ad92d5 1371 * Related MIB type: \ref MIB_NWK_SKEY
mluis 2:14a5d6ad92d5 1372 */
mluis 2:14a5d6ad92d5 1373 uint8_t *NwkSKey;
mluis 2:14a5d6ad92d5 1374 /*!
mluis 2:14a5d6ad92d5 1375 * Application session key
mluis 2:14a5d6ad92d5 1376 *
mluis 2:14a5d6ad92d5 1377 * Related MIB type: \ref MIB_APP_SKEY
mluis 2:14a5d6ad92d5 1378 */
mluis 2:14a5d6ad92d5 1379 uint8_t *AppSKey;
mluis 2:14a5d6ad92d5 1380 /*!
mluis 2:14a5d6ad92d5 1381 * Enable or disable a public network
mluis 2:14a5d6ad92d5 1382 *
mluis 2:14a5d6ad92d5 1383 * Related MIB type: \ref MIB_PUBLIC_NETWORK
mluis 2:14a5d6ad92d5 1384 */
mluis 2:14a5d6ad92d5 1385 bool EnablePublicNetwork;
mluis 2:14a5d6ad92d5 1386 /*!
mluis 2:14a5d6ad92d5 1387 * Enable or disable repeater support
mluis 2:14a5d6ad92d5 1388 *
mluis 2:14a5d6ad92d5 1389 * Related MIB type: \ref MIB_REPEATER_SUPPORT
mluis 2:14a5d6ad92d5 1390 */
mluis 2:14a5d6ad92d5 1391 bool EnableRepeaterSupport;
mluis 2:14a5d6ad92d5 1392 /*!
mluis 2:14a5d6ad92d5 1393 * LoRaWAN Channel
mluis 2:14a5d6ad92d5 1394 *
mluis 2:14a5d6ad92d5 1395 * Related MIB type: \ref MIB_CHANNELS
mluis 2:14a5d6ad92d5 1396 */
mluis 2:14a5d6ad92d5 1397 ChannelParams_t* ChannelList;
mluis 2:14a5d6ad92d5 1398 /*!
mluis 2:14a5d6ad92d5 1399 * Channel for the receive window 2
mluis 2:14a5d6ad92d5 1400 *
mluis 2:14a5d6ad92d5 1401 * Related MIB type: \ref MIB_RX2_CHANNEL
mluis 2:14a5d6ad92d5 1402 */
mluis 2:14a5d6ad92d5 1403 Rx2ChannelParams_t Rx2Channel;
mluis 8:26002607de9c 1404 /*!
mluis 8:26002607de9c 1405 * Channel for the receive window 2
mluis 8:26002607de9c 1406 *
mluis 8:26002607de9c 1407 * Related MIB type: \ref MIB_RX2_DEFAULT_CHANNEL
mluis 8:26002607de9c 1408 */
mluis 8:26002607de9c 1409 Rx2ChannelParams_t Rx2DefaultChannel;
mluis 2:14a5d6ad92d5 1410 /*!
mluis 2:14a5d6ad92d5 1411 * Channel mask
mluis 2:14a5d6ad92d5 1412 *
mluis 2:14a5d6ad92d5 1413 * Related MIB type: \ref MIB_CHANNELS_MASK
mluis 2:14a5d6ad92d5 1414 */
mluis 2:14a5d6ad92d5 1415 uint16_t* ChannelsMask;
mluis 2:14a5d6ad92d5 1416 /*!
mluis 8:26002607de9c 1417 * Default channel mask
mluis 8:26002607de9c 1418 *
mluis 8:26002607de9c 1419 * Related MIB type: \ref MIB_CHANNELS_DEFAULT_MASK
mluis 8:26002607de9c 1420 */
mluis 8:26002607de9c 1421 uint16_t* ChannelsDefaultMask;
mluis 8:26002607de9c 1422 /*!
mluis 2:14a5d6ad92d5 1423 * Number of frame repetitions
mluis 2:14a5d6ad92d5 1424 *
mluis 2:14a5d6ad92d5 1425 * Related MIB type: \ref MIB_CHANNELS_NB_REP
mluis 2:14a5d6ad92d5 1426 */
mluis 2:14a5d6ad92d5 1427 uint8_t ChannelNbRep;
mluis 2:14a5d6ad92d5 1428 /*!
mluis 2:14a5d6ad92d5 1429 * Maximum receive window duration
mluis 2:14a5d6ad92d5 1430 *
mluis 2:14a5d6ad92d5 1431 * Related MIB type: \ref MIB_MAX_RX_WINDOW_DURATION
mluis 2:14a5d6ad92d5 1432 */
mluis 2:14a5d6ad92d5 1433 uint32_t MaxRxWindow;
mluis 2:14a5d6ad92d5 1434 /*!
mluis 2:14a5d6ad92d5 1435 * Receive delay 1
mluis 2:14a5d6ad92d5 1436 *
mluis 2:14a5d6ad92d5 1437 * Related MIB type: \ref MIB_RECEIVE_DELAY_1
mluis 2:14a5d6ad92d5 1438 */
mluis 2:14a5d6ad92d5 1439 uint32_t ReceiveDelay1;
mluis 2:14a5d6ad92d5 1440 /*!
mluis 2:14a5d6ad92d5 1441 * Receive delay 2
mluis 2:14a5d6ad92d5 1442 *
mluis 2:14a5d6ad92d5 1443 * Related MIB type: \ref MIB_RECEIVE_DELAY_2
mluis 2:14a5d6ad92d5 1444 */
mluis 2:14a5d6ad92d5 1445 uint32_t ReceiveDelay2;
mluis 2:14a5d6ad92d5 1446 /*!
mluis 2:14a5d6ad92d5 1447 * Join accept delay 1
mluis 2:14a5d6ad92d5 1448 *
mluis 2:14a5d6ad92d5 1449 * Related MIB type: \ref MIB_JOIN_ACCEPT_DELAY_1
mluis 2:14a5d6ad92d5 1450 */
mluis 2:14a5d6ad92d5 1451 uint32_t JoinAcceptDelay1;
mluis 2:14a5d6ad92d5 1452 /*!
mluis 2:14a5d6ad92d5 1453 * Join accept delay 2
mluis 2:14a5d6ad92d5 1454 *
mluis 2:14a5d6ad92d5 1455 * Related MIB type: \ref MIB_JOIN_ACCEPT_DELAY_2
mluis 2:14a5d6ad92d5 1456 */
mluis 2:14a5d6ad92d5 1457 uint32_t JoinAcceptDelay2;
mluis 2:14a5d6ad92d5 1458 /*!
mluis 2:14a5d6ad92d5 1459 * Channels data rate
mluis 2:14a5d6ad92d5 1460 *
mluis 4:37c12dbc8dc7 1461 * Related MIB type: \ref MIB_CHANNELS_DEFAULT_DATARATE
mluis 4:37c12dbc8dc7 1462 */
mluis 4:37c12dbc8dc7 1463 int8_t ChannelsDefaultDatarate;
mluis 4:37c12dbc8dc7 1464 /*!
mluis 4:37c12dbc8dc7 1465 * Channels data rate
mluis 4:37c12dbc8dc7 1466 *
mluis 2:14a5d6ad92d5 1467 * Related MIB type: \ref MIB_CHANNELS_DATARATE
mluis 2:14a5d6ad92d5 1468 */
mluis 2:14a5d6ad92d5 1469 int8_t ChannelsDatarate;
mluis 2:14a5d6ad92d5 1470 /*!
mluis 2:14a5d6ad92d5 1471 * Channels TX power
mluis 2:14a5d6ad92d5 1472 *
mluis 8:26002607de9c 1473 * Related MIB type: \ref MIB_CHANNELS_DEFAULT_TX_POWER
mluis 8:26002607de9c 1474 */
mluis 8:26002607de9c 1475 int8_t ChannelsDefaultTxPower;
mluis 8:26002607de9c 1476 /*!
mluis 8:26002607de9c 1477 * Channels TX power
mluis 8:26002607de9c 1478 *
mluis 2:14a5d6ad92d5 1479 * Related MIB type: \ref MIB_CHANNELS_TX_POWER
mluis 2:14a5d6ad92d5 1480 */
mluis 2:14a5d6ad92d5 1481 int8_t ChannelsTxPower;
mluis 2:14a5d6ad92d5 1482 /*!
mluis 2:14a5d6ad92d5 1483 * LoRaWAN Up-link counter
mluis 2:14a5d6ad92d5 1484 *
mluis 2:14a5d6ad92d5 1485 * Related MIB type: \ref MIB_UPLINK_COUNTER
mluis 2:14a5d6ad92d5 1486 */
mluis 2:14a5d6ad92d5 1487 uint32_t UpLinkCounter;
mluis 2:14a5d6ad92d5 1488 /*!
mluis 2:14a5d6ad92d5 1489 * LoRaWAN Down-link counter
mluis 2:14a5d6ad92d5 1490 *
mluis 2:14a5d6ad92d5 1491 * Related MIB type: \ref MIB_DOWNLINK_COUNTER
mluis 2:14a5d6ad92d5 1492 */
mluis 2:14a5d6ad92d5 1493 uint32_t DownLinkCounter;
mluis 2:14a5d6ad92d5 1494 /*!
mluis 2:14a5d6ad92d5 1495 * Multicast channel
mluis 2:14a5d6ad92d5 1496 *
mluis 2:14a5d6ad92d5 1497 * Related MIB type: \ref MIB_MULTICAST_CHANNEL
mluis 2:14a5d6ad92d5 1498 */
mluis 2:14a5d6ad92d5 1499 MulticastParams_t* MulticastList;
mluis 8:26002607de9c 1500 /*!
mluis 8:26002607de9c 1501 * System overall timing error in milliseconds.
mluis 8:26002607de9c 1502 *
mluis 8:26002607de9c 1503 * Related MIB type: \ref MIB_SYSTEM_MAX_RX_ERROR
mluis 8:26002607de9c 1504 */
mluis 8:26002607de9c 1505 uint32_t SystemMaxRxError;
mluis 8:26002607de9c 1506 /*!
mluis 8:26002607de9c 1507 * Minimum required number of symbols to detect an Rx frame
mluis 8:26002607de9c 1508 *
mluis 8:26002607de9c 1509 * Related MIB type: \ref MIB_MIN_RX_SYMBOLS
mluis 8:26002607de9c 1510 */
mluis 8:26002607de9c 1511 uint8_t MinRxSymbols;
mluis 2:14a5d6ad92d5 1512 }MibParam_t;
mluis 2:14a5d6ad92d5 1513
mluis 2:14a5d6ad92d5 1514 /*!
mluis 2:14a5d6ad92d5 1515 * LoRaMAC MIB-RequestConfirm structure
mluis 2:14a5d6ad92d5 1516 */
mluis 2:14a5d6ad92d5 1517 typedef struct eMibRequestConfirm
mluis 2:14a5d6ad92d5 1518 {
mluis 2:14a5d6ad92d5 1519 /*!
mluis 2:14a5d6ad92d5 1520 * MIB-Request type
mluis 2:14a5d6ad92d5 1521 */
mluis 2:14a5d6ad92d5 1522 Mib_t Type;
mluis 2:14a5d6ad92d5 1523
mluis 2:14a5d6ad92d5 1524 /*!
mluis 2:14a5d6ad92d5 1525 * MLME-RequestConfirm parameters
mluis 2:14a5d6ad92d5 1526 */
mluis 2:14a5d6ad92d5 1527 MibParam_t Param;
mluis 2:14a5d6ad92d5 1528 }MibRequestConfirm_t;
mluis 2:14a5d6ad92d5 1529
mluis 2:14a5d6ad92d5 1530 /*!
mluis 2:14a5d6ad92d5 1531 * LoRaMAC tx information
mluis 2:14a5d6ad92d5 1532 */
mluis 2:14a5d6ad92d5 1533 typedef struct sLoRaMacTxInfo
mluis 2:14a5d6ad92d5 1534 {
mluis 2:14a5d6ad92d5 1535 /*!
mluis 2:14a5d6ad92d5 1536 * Defines the size of the applicative payload which can be processed
mluis 2:14a5d6ad92d5 1537 */
mluis 2:14a5d6ad92d5 1538 uint8_t MaxPossiblePayload;
mluis 2:14a5d6ad92d5 1539 /*!
mluis 2:14a5d6ad92d5 1540 * The current payload size, dependent on the current datarate
mluis 2:14a5d6ad92d5 1541 */
mluis 2:14a5d6ad92d5 1542 uint8_t CurrentPayloadSize;
mluis 2:14a5d6ad92d5 1543 }LoRaMacTxInfo_t;
mluis 2:14a5d6ad92d5 1544
mluis 2:14a5d6ad92d5 1545 /*!
mluis 2:14a5d6ad92d5 1546 * LoRaMAC Status
mluis 2:14a5d6ad92d5 1547 */
mluis 2:14a5d6ad92d5 1548 typedef enum eLoRaMacStatus
mluis 2:14a5d6ad92d5 1549 {
mluis 2:14a5d6ad92d5 1550 /*!
mluis 2:14a5d6ad92d5 1551 * Service started successfully
mluis 2:14a5d6ad92d5 1552 */
mluis 2:14a5d6ad92d5 1553 LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1554 /*!
mluis 2:14a5d6ad92d5 1555 * Service not started - LoRaMAC is busy
mluis 2:14a5d6ad92d5 1556 */
mluis 2:14a5d6ad92d5 1557 LORAMAC_STATUS_BUSY,
mluis 2:14a5d6ad92d5 1558 /*!
mluis 2:14a5d6ad92d5 1559 * Service unknown
mluis 2:14a5d6ad92d5 1560 */
mluis 2:14a5d6ad92d5 1561 LORAMAC_STATUS_SERVICE_UNKNOWN,
mluis 2:14a5d6ad92d5 1562 /*!
mluis 2:14a5d6ad92d5 1563 * Service not started - invalid parameter
mluis 2:14a5d6ad92d5 1564 */
mluis 2:14a5d6ad92d5 1565 LORAMAC_STATUS_PARAMETER_INVALID,
mluis 2:14a5d6ad92d5 1566 /*!
mluis 3:b9d87593a8ae 1567 * Service not started - invalid frequency
mluis 3:b9d87593a8ae 1568 */
mluis 3:b9d87593a8ae 1569 LORAMAC_STATUS_FREQUENCY_INVALID,
mluis 3:b9d87593a8ae 1570 /*!
mluis 3:b9d87593a8ae 1571 * Service not started - invalid datarate
mluis 3:b9d87593a8ae 1572 */
mluis 3:b9d87593a8ae 1573 LORAMAC_STATUS_DATARATE_INVALID,
mluis 3:b9d87593a8ae 1574 /*!
mluis 3:b9d87593a8ae 1575 * Service not started - invalid frequency and datarate
mluis 3:b9d87593a8ae 1576 */
mluis 3:b9d87593a8ae 1577 LORAMAC_STATUS_FREQ_AND_DR_INVALID,
mluis 3:b9d87593a8ae 1578 /*!
mluis 2:14a5d6ad92d5 1579 * Service not started - the device is not in a LoRaWAN
mluis 2:14a5d6ad92d5 1580 */
mluis 2:14a5d6ad92d5 1581 LORAMAC_STATUS_NO_NETWORK_JOINED,
mluis 2:14a5d6ad92d5 1582 /*!
mluis 8:26002607de9c 1583 * Service not started - payload lenght error
mluis 2:14a5d6ad92d5 1584 */
mluis 2:14a5d6ad92d5 1585 LORAMAC_STATUS_LENGTH_ERROR,
mluis 2:14a5d6ad92d5 1586 /*!
mluis 8:26002607de9c 1587 * Service not started - payload lenght error
mluis 2:14a5d6ad92d5 1588 */
mluis 2:14a5d6ad92d5 1589 LORAMAC_STATUS_MAC_CMD_LENGTH_ERROR,
mluis 2:14a5d6ad92d5 1590 /*!
mluis 2:14a5d6ad92d5 1591 * Service not started - the device is switched off
mluis 2:14a5d6ad92d5 1592 */
mluis 2:14a5d6ad92d5 1593 LORAMAC_STATUS_DEVICE_OFF,
mluis 2:14a5d6ad92d5 1594 }LoRaMacStatus_t;
mluis 0:91d1a7783bb9 1595
mluis 0:91d1a7783bb9 1596 /*!
mluis 0:91d1a7783bb9 1597 * LoRaMAC events structure
mluis 0:91d1a7783bb9 1598 * Used to notify upper layers of MAC events
mluis 0:91d1a7783bb9 1599 */
mluis 2:14a5d6ad92d5 1600 typedef struct sLoRaMacPrimitives
mluis 0:91d1a7783bb9 1601 {
mluis 0:91d1a7783bb9 1602 /*!
mluis 2:14a5d6ad92d5 1603 * \brief MCPS-Confirm primitive
mluis 0:91d1a7783bb9 1604 *
mluis 2:14a5d6ad92d5 1605 * \param [OUT] MCPS-Confirm parameters
mluis 2:14a5d6ad92d5 1606 */
mluis 2:14a5d6ad92d5 1607 void ( *MacMcpsConfirm )( McpsConfirm_t *McpsConfirm );
mluis 2:14a5d6ad92d5 1608 /*!
mluis 2:14a5d6ad92d5 1609 * \brief MCPS-Indication primitive
mluis 2:14a5d6ad92d5 1610 *
mluis 2:14a5d6ad92d5 1611 * \param [OUT] MCPS-Indication parameters
mluis 0:91d1a7783bb9 1612 */
mluis 2:14a5d6ad92d5 1613 void ( *MacMcpsIndication )( McpsIndication_t *McpsIndication );
mluis 1:91e4e6c60d1e 1614 /*!
mluis 2:14a5d6ad92d5 1615 * \brief MLME-Confirm primitive
mluis 1:91e4e6c60d1e 1616 *
mluis 2:14a5d6ad92d5 1617 * \param [OUT] MLME-Confirm parameters
mluis 2:14a5d6ad92d5 1618 */
mluis 2:14a5d6ad92d5 1619 void ( *MacMlmeConfirm )( MlmeConfirm_t *MlmeConfirm );
mluis 2:14a5d6ad92d5 1620 }LoRaMacPrimitives_t;
mluis 2:14a5d6ad92d5 1621
mluis 2:14a5d6ad92d5 1622 typedef struct sLoRaMacCallback
mluis 2:14a5d6ad92d5 1623 {
mluis 2:14a5d6ad92d5 1624 /*!
mluis 2:14a5d6ad92d5 1625 * \brief Measures the battery level
mluis 2:14a5d6ad92d5 1626 *
mluis 2:14a5d6ad92d5 1627 * \retval Battery level [0: node is connected to an external
mluis 2:14a5d6ad92d5 1628 * power source, 1..254: battery level, where 1 is the minimum
mluis 2:14a5d6ad92d5 1629 * and 254 is the maximum value, 255: the node was not able
mluis 2:14a5d6ad92d5 1630 * to measure the battery level]
mluis 1:91e4e6c60d1e 1631 */
mluis 1:91e4e6c60d1e 1632 uint8_t ( *GetBatteryLevel )( void );
mluis 2:14a5d6ad92d5 1633 }LoRaMacCallback_t;
mluis 0:91d1a7783bb9 1634
mluis 0:91d1a7783bb9 1635 /*!
mluis 2:14a5d6ad92d5 1636 * \brief LoRaMAC layer initialization
mluis 0:91d1a7783bb9 1637 *
mluis 2:14a5d6ad92d5 1638 * \details In addition to the initialization of the LoRaMAC layer, this
mluis 2:14a5d6ad92d5 1639 * function initializes the callback primitives of the MCPS and
mluis 2:14a5d6ad92d5 1640 * MLME services. Every data field of \ref LoRaMacPrimitives_t must be
mluis 2:14a5d6ad92d5 1641 * set to a valid callback function.
mluis 2:14a5d6ad92d5 1642 *
mluis 2:14a5d6ad92d5 1643 * \param [IN] events - Pointer to a structure defining the LoRaMAC
mluis 2:14a5d6ad92d5 1644 * event functions. Refer to \ref LoRaMacPrimitives_t.
mluis 0:91d1a7783bb9 1645 *
mluis 2:14a5d6ad92d5 1646 * \param [IN] events - Pointer to a structure defining the LoRaMAC
mluis 2:14a5d6ad92d5 1647 * callback functions. Refer to \ref LoRaMacCallback_t.
mluis 2:14a5d6ad92d5 1648 *
mluis 2:14a5d6ad92d5 1649 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
mluis 2:14a5d6ad92d5 1650 * returns are:
mluis 2:14a5d6ad92d5 1651 * \ref LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1652 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
mluis 0:91d1a7783bb9 1653 */
mluis 2:14a5d6ad92d5 1654 LoRaMacStatus_t LoRaMacInitialization( LoRaMacPrimitives_t *primitives, LoRaMacCallback_t *callbacks );
mluis 0:91d1a7783bb9 1655
mluis 0:91d1a7783bb9 1656 /*!
mluis 2:14a5d6ad92d5 1657 * \brief Queries the LoRaMAC if it is possible to send the next frame with
mluis 2:14a5d6ad92d5 1658 * a given payload size. The LoRaMAC takes scheduled MAC commands into
mluis 2:14a5d6ad92d5 1659 * account and reports, when the frame can be send or not.
mluis 2:14a5d6ad92d5 1660 *
mluis 2:14a5d6ad92d5 1661 * \param [IN] size - Size of applicative payload to be send next
mluis 0:91d1a7783bb9 1662 *
mluis 2:14a5d6ad92d5 1663 * \param [OUT] txInfo - The structure \ref LoRaMacTxInfo_t contains
mluis 2:14a5d6ad92d5 1664 * information about the actual maximum payload possible
mluis 2:14a5d6ad92d5 1665 * ( according to the configured datarate or the next
mluis 2:14a5d6ad92d5 1666 * datarate according to ADR ), and the maximum frame
mluis 2:14a5d6ad92d5 1667 * size, taking the scheduled MAC commands into account.
mluis 0:91d1a7783bb9 1668 *
mluis 2:14a5d6ad92d5 1669 * \retval LoRaMacStatus_t Status of the operation. When the parameters are
mluis 2:14a5d6ad92d5 1670 * not valid, the function returns \ref LORAMAC_STATUS_PARAMETER_INVALID.
mluis 2:14a5d6ad92d5 1671 * In case of a length error caused by the applicative payload size, the
mluis 2:14a5d6ad92d5 1672 * function returns LORAMAC_STATUS_LENGTH_ERROR. In case of a length error
mluis 2:14a5d6ad92d5 1673 * due to additional MAC commands in the queue, the function returns
mluis 2:14a5d6ad92d5 1674 * LORAMAC_STATUS_MAC_CMD_LENGTH_ERROR. In case the query is valid, and
mluis 2:14a5d6ad92d5 1675 * the LoRaMAC is able to send the frame, the function returns LORAMAC_STATUS_OK. *
mluis 0:91d1a7783bb9 1676 */
mluis 2:14a5d6ad92d5 1677 LoRaMacStatus_t LoRaMacQueryTxPossible( uint8_t size, LoRaMacTxInfo_t* txInfo );
mluis 0:91d1a7783bb9 1678
mluis 0:91d1a7783bb9 1679 /*!
mluis 2:14a5d6ad92d5 1680 * \brief LoRaMAC channel add service
mluis 2:14a5d6ad92d5 1681 *
mluis 2:14a5d6ad92d5 1682 * \details Adds a new channel to the channel list and activates the id in
mluis 2:14a5d6ad92d5 1683 * the channel mask. For the US915 band, all channels are enabled
mluis 2:14a5d6ad92d5 1684 * by default. It is not possible to activate less than 6 125 kHz
mluis 2:14a5d6ad92d5 1685 * channels.
mluis 2:14a5d6ad92d5 1686 *
mluis 2:14a5d6ad92d5 1687 * \param [IN] id - Id of the channel. Possible values are:
mluis 0:91d1a7783bb9 1688 *
mluis 2:14a5d6ad92d5 1689 * 0-15 for EU868
mluis 2:14a5d6ad92d5 1690 * 0-72 for US915
mluis 2:14a5d6ad92d5 1691 *
mluis 2:14a5d6ad92d5 1692 * \param [IN] params - Channel parameters to set.
mluis 0:91d1a7783bb9 1693 *
mluis 2:14a5d6ad92d5 1694 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
mluis 2:14a5d6ad92d5 1695 * \ref LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1696 * \ref LORAMAC_STATUS_BUSY,
mluis 2:14a5d6ad92d5 1697 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
mluis 0:91d1a7783bb9 1698 */
mluis 2:14a5d6ad92d5 1699 LoRaMacStatus_t LoRaMacChannelAdd( uint8_t id, ChannelParams_t params );
mluis 0:91d1a7783bb9 1700
mluis 0:91d1a7783bb9 1701 /*!
mluis 2:14a5d6ad92d5 1702 * \brief LoRaMAC channel remove service
mluis 2:14a5d6ad92d5 1703 *
mluis 2:14a5d6ad92d5 1704 * \details Deactivates the id in the channel mask.
mluis 2:14a5d6ad92d5 1705 *
mluis 2:14a5d6ad92d5 1706 * \param [IN] id - Id of the channel.
mluis 2:14a5d6ad92d5 1707 *
mluis 2:14a5d6ad92d5 1708 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
mluis 2:14a5d6ad92d5 1709 * \ref LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1710 * \ref LORAMAC_STATUS_BUSY,
mluis 2:14a5d6ad92d5 1711 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
mluis 0:91d1a7783bb9 1712 */
mluis 2:14a5d6ad92d5 1713 LoRaMacStatus_t LoRaMacChannelRemove( uint8_t id );
mluis 0:91d1a7783bb9 1714
mluis 0:91d1a7783bb9 1715 /*!
mluis 2:14a5d6ad92d5 1716 * \brief LoRaMAC multicast channel link service
mluis 2:14a5d6ad92d5 1717 *
mluis 2:14a5d6ad92d5 1718 * \details Links a multicast channel into the linked list.
mluis 2:14a5d6ad92d5 1719 *
mluis 2:14a5d6ad92d5 1720 * \param [IN] channelParam - Multicast channel parameters to link.
mluis 0:91d1a7783bb9 1721 *
mluis 2:14a5d6ad92d5 1722 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
mluis 2:14a5d6ad92d5 1723 * \ref LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1724 * \ref LORAMAC_STATUS_BUSY,
mluis 2:14a5d6ad92d5 1725 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
mluis 0:91d1a7783bb9 1726 */
mluis 2:14a5d6ad92d5 1727 LoRaMacStatus_t LoRaMacMulticastChannelLink( MulticastParams_t *channelParam );
mluis 2:14a5d6ad92d5 1728
mluis 2:14a5d6ad92d5 1729 /*!
mluis 2:14a5d6ad92d5 1730 * \brief LoRaMAC multicast channel unlink service
mluis 2:14a5d6ad92d5 1731 *
mluis 2:14a5d6ad92d5 1732 * \details Unlinks a multicast channel from the linked list.
mluis 2:14a5d6ad92d5 1733 *
mluis 2:14a5d6ad92d5 1734 * \param [IN] channelParam - Multicast channel parameters to unlink.
mluis 2:14a5d6ad92d5 1735 *
mluis 2:14a5d6ad92d5 1736 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
mluis 2:14a5d6ad92d5 1737 * \ref LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1738 * \ref LORAMAC_STATUS_BUSY,
mluis 2:14a5d6ad92d5 1739 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
mluis 2:14a5d6ad92d5 1740 */
mluis 2:14a5d6ad92d5 1741 LoRaMacStatus_t LoRaMacMulticastChannelUnlink( MulticastParams_t *channelParam );
mluis 0:91d1a7783bb9 1742
mluis 0:91d1a7783bb9 1743 /*!
mluis 2:14a5d6ad92d5 1744 * \brief LoRaMAC MIB-Get
mluis 2:14a5d6ad92d5 1745 *
mluis 2:14a5d6ad92d5 1746 * \details The mac information base service to get attributes of the LoRaMac
mluis 2:14a5d6ad92d5 1747 * layer.
mluis 2:14a5d6ad92d5 1748 *
mluis 2:14a5d6ad92d5 1749 * The following code-snippet shows how to use the API to get the
mluis 2:14a5d6ad92d5 1750 * parameter AdrEnable, defined by the enumeration type
mluis 2:14a5d6ad92d5 1751 * \ref MIB_ADR.
mluis 2:14a5d6ad92d5 1752 * \code
mluis 2:14a5d6ad92d5 1753 * MibRequestConfirm_t mibReq;
mluis 2:14a5d6ad92d5 1754 * mibReq.Type = MIB_ADR;
mluis 0:91d1a7783bb9 1755 *
mluis 2:14a5d6ad92d5 1756 * if( LoRaMacMibGetRequestConfirm( &mibReq ) == LORAMAC_STATUS_OK )
mluis 2:14a5d6ad92d5 1757 * {
mluis 2:14a5d6ad92d5 1758 * // LoRaMAC updated the parameter mibParam.AdrEnable
mluis 2:14a5d6ad92d5 1759 * }
mluis 2:14a5d6ad92d5 1760 * \endcode
mluis 2:14a5d6ad92d5 1761 *
mluis 2:14a5d6ad92d5 1762 * \param [IN] mibRequest - MIB-GET-Request to perform. Refer to \ref MibRequestConfirm_t.
mluis 2:14a5d6ad92d5 1763 *
mluis 2:14a5d6ad92d5 1764 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
mluis 2:14a5d6ad92d5 1765 * \ref LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1766 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN,
mluis 2:14a5d6ad92d5 1767 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
mluis 0:91d1a7783bb9 1768 */
mluis 2:14a5d6ad92d5 1769 LoRaMacStatus_t LoRaMacMibGetRequestConfirm( MibRequestConfirm_t *mibGet );
mluis 0:91d1a7783bb9 1770
mluis 0:91d1a7783bb9 1771 /*!
mluis 2:14a5d6ad92d5 1772 * \brief LoRaMAC MIB-Set
mluis 2:14a5d6ad92d5 1773 *
mluis 2:14a5d6ad92d5 1774 * \details The mac information base service to set attributes of the LoRaMac
mluis 2:14a5d6ad92d5 1775 * layer.
mluis 2:14a5d6ad92d5 1776 *
mluis 2:14a5d6ad92d5 1777 * The following code-snippet shows how to use the API to set the
mluis 2:14a5d6ad92d5 1778 * parameter AdrEnable, defined by the enumeration type
mluis 2:14a5d6ad92d5 1779 * \ref MIB_ADR.
mluis 2:14a5d6ad92d5 1780 *
mluis 2:14a5d6ad92d5 1781 * \code
mluis 2:14a5d6ad92d5 1782 * MibRequestConfirm_t mibReq;
mluis 2:14a5d6ad92d5 1783 * mibReq.Type = MIB_ADR;
mluis 2:14a5d6ad92d5 1784 * mibReq.Param.AdrEnable = true;
mluis 0:91d1a7783bb9 1785 *
mluis 2:14a5d6ad92d5 1786 * if( LoRaMacMibGetRequestConfirm( &mibReq ) == LORAMAC_STATUS_OK )
mluis 2:14a5d6ad92d5 1787 * {
mluis 2:14a5d6ad92d5 1788 * // LoRaMAC updated the parameter
mluis 2:14a5d6ad92d5 1789 * }
mluis 2:14a5d6ad92d5 1790 * \endcode
mluis 2:14a5d6ad92d5 1791 *
mluis 2:14a5d6ad92d5 1792 * \param [IN] mibRequest - MIB-SET-Request to perform. Refer to \ref MibRequestConfirm_t.
mluis 2:14a5d6ad92d5 1793 *
mluis 2:14a5d6ad92d5 1794 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
mluis 2:14a5d6ad92d5 1795 * \ref LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1796 * \ref LORAMAC_STATUS_BUSY,
mluis 2:14a5d6ad92d5 1797 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN,
mluis 2:14a5d6ad92d5 1798 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
mluis 0:91d1a7783bb9 1799 */
mluis 2:14a5d6ad92d5 1800 LoRaMacStatus_t LoRaMacMibSetRequestConfirm( MibRequestConfirm_t *mibSet );
mluis 0:91d1a7783bb9 1801
mluis 0:91d1a7783bb9 1802 /*!
mluis 2:14a5d6ad92d5 1803 * \brief LoRaMAC MLME-Request
mluis 2:14a5d6ad92d5 1804 *
mluis 2:14a5d6ad92d5 1805 * \details The Mac layer management entity handles management services. The
mluis 2:14a5d6ad92d5 1806 * following code-snippet shows how to use the API to perform a
mluis 2:14a5d6ad92d5 1807 * network join request.
mluis 2:14a5d6ad92d5 1808 *
mluis 2:14a5d6ad92d5 1809 * \code
mluis 2:14a5d6ad92d5 1810 * static uint8_t DevEui[] =
mluis 2:14a5d6ad92d5 1811 * {
mluis 2:14a5d6ad92d5 1812 * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
mluis 2:14a5d6ad92d5 1813 * };
mluis 2:14a5d6ad92d5 1814 * static uint8_t AppEui[] =
mluis 2:14a5d6ad92d5 1815 * {
mluis 2:14a5d6ad92d5 1816 * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
mluis 2:14a5d6ad92d5 1817 * };
mluis 2:14a5d6ad92d5 1818 * static uint8_t AppKey[] =
mluis 2:14a5d6ad92d5 1819 * {
mluis 2:14a5d6ad92d5 1820 * 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
mluis 2:14a5d6ad92d5 1821 * 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
mluis 2:14a5d6ad92d5 1822 * };
mluis 0:91d1a7783bb9 1823 *
mluis 2:14a5d6ad92d5 1824 * MlmeReq_t mlmeReq;
mluis 2:14a5d6ad92d5 1825 * mlmeReq.Type = MLME_JOIN;
mluis 2:14a5d6ad92d5 1826 * mlmeReq.Req.Join.DevEui = DevEui;
mluis 2:14a5d6ad92d5 1827 * mlmeReq.Req.Join.AppEui = AppEui;
mluis 2:14a5d6ad92d5 1828 * mlmeReq.Req.Join.AppKey = AppKey;
mluis 2:14a5d6ad92d5 1829 *
mluis 2:14a5d6ad92d5 1830 * if( LoRaMacMlmeRequest( &mlmeReq ) == LORAMAC_STATUS_OK )
mluis 2:14a5d6ad92d5 1831 * {
mluis 2:14a5d6ad92d5 1832 * // Service started successfully. Waiting for the Mlme-Confirm event
mluis 2:14a5d6ad92d5 1833 * }
mluis 2:14a5d6ad92d5 1834 * \endcode
mluis 2:14a5d6ad92d5 1835 *
mluis 2:14a5d6ad92d5 1836 * \param [IN] mlmeRequest - MLME-Request to perform. Refer to \ref MlmeReq_t.
mluis 2:14a5d6ad92d5 1837 *
mluis 2:14a5d6ad92d5 1838 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
mluis 2:14a5d6ad92d5 1839 * \ref LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1840 * \ref LORAMAC_STATUS_BUSY,
mluis 2:14a5d6ad92d5 1841 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN,
mluis 2:14a5d6ad92d5 1842 * \ref LORAMAC_STATUS_PARAMETER_INVALID,
mluis 2:14a5d6ad92d5 1843 * \ref LORAMAC_STATUS_NO_NETWORK_JOINED,
mluis 2:14a5d6ad92d5 1844 * \ref LORAMAC_STATUS_LENGTH_ERROR,
mluis 2:14a5d6ad92d5 1845 * \ref LORAMAC_STATUS_DEVICE_OFF.
mluis 0:91d1a7783bb9 1846 */
mluis 2:14a5d6ad92d5 1847 LoRaMacStatus_t LoRaMacMlmeRequest( MlmeReq_t *mlmeRequest );
mluis 0:91d1a7783bb9 1848
mluis 0:91d1a7783bb9 1849 /*!
mluis 2:14a5d6ad92d5 1850 * \brief LoRaMAC MCPS-Request
mluis 2:14a5d6ad92d5 1851 *
mluis 2:14a5d6ad92d5 1852 * \details The Mac Common Part Sublayer handles data services. The following
mluis 2:14a5d6ad92d5 1853 * code-snippet shows how to use the API to send an unconfirmed
mluis 2:14a5d6ad92d5 1854 * LoRaMAC frame.
mluis 0:91d1a7783bb9 1855 *
mluis 2:14a5d6ad92d5 1856 * \code
mluis 2:14a5d6ad92d5 1857 * uint8_t myBuffer[] = { 1, 2, 3 };
mluis 2:14a5d6ad92d5 1858 *
mluis 2:14a5d6ad92d5 1859 * McpsReq_t mcpsReq;
mluis 2:14a5d6ad92d5 1860 * mcpsReq.Type = MCPS_UNCONFIRMED;
mluis 2:14a5d6ad92d5 1861 * mcpsReq.Req.Unconfirmed.fPort = 1;
mluis 2:14a5d6ad92d5 1862 * mcpsReq.Req.Unconfirmed.fBuffer = myBuffer;
mluis 2:14a5d6ad92d5 1863 * mcpsReq.Req.Unconfirmed.fBufferSize = sizeof( myBuffer );
mluis 0:91d1a7783bb9 1864 *
mluis 2:14a5d6ad92d5 1865 * if( LoRaMacMcpsRequest( &mcpsReq ) == LORAMAC_STATUS_OK )
mluis 2:14a5d6ad92d5 1866 * {
mluis 2:14a5d6ad92d5 1867 * // Service started successfully. Waiting for the MCPS-Confirm event
mluis 2:14a5d6ad92d5 1868 * }
mluis 2:14a5d6ad92d5 1869 * \endcode
mluis 2:14a5d6ad92d5 1870 *
mluis 2:14a5d6ad92d5 1871 * \param [IN] mcpsRequest - MCPS-Request to perform. Refer to \ref McpsReq_t.
mluis 2:14a5d6ad92d5 1872 *
mluis 2:14a5d6ad92d5 1873 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
mluis 2:14a5d6ad92d5 1874 * \ref LORAMAC_STATUS_OK,
mluis 2:14a5d6ad92d5 1875 * \ref LORAMAC_STATUS_BUSY,
mluis 2:14a5d6ad92d5 1876 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN,
mluis 2:14a5d6ad92d5 1877 * \ref LORAMAC_STATUS_PARAMETER_INVALID,
mluis 2:14a5d6ad92d5 1878 * \ref LORAMAC_STATUS_NO_NETWORK_JOINED,
mluis 2:14a5d6ad92d5 1879 * \ref LORAMAC_STATUS_LENGTH_ERROR,
mluis 2:14a5d6ad92d5 1880 * \ref LORAMAC_STATUS_DEVICE_OFF.
mluis 0:91d1a7783bb9 1881 */
mluis 2:14a5d6ad92d5 1882 LoRaMacStatus_t LoRaMacMcpsRequest( McpsReq_t *mcpsRequest );
mluis 0:91d1a7783bb9 1883
mluis 2:14a5d6ad92d5 1884 /*! \} defgroup LORAMAC */
mluis 0:91d1a7783bb9 1885
mluis 0:91d1a7783bb9 1886 #endif // __LORAMAC_H__