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