end node on synchronous star LoRa network.

Dependencies:   SX127x sx12xx_hal TSL2561

radio chip selection

Radio chip driver is not included, allowing choice of radio device.
If you're using SX1272 or SX1276, then import sx127x driver into your program.
if you're using SX1261 or SX1262, then import sx126x driver into your program.
if you're using SX1280, then import sx1280 driver into your program.
If you're using NAmote72 or Murata discovery, then you must import only sx127x driver.

This project for use with LoRaWAN_singlechannel_gateway project.

Alternately gateway running on raspberry pi can be used as gateway.

LoRaWAN on single radio channel

Network description is at gateway project page. Synchronous star network.

Hardware Support

This project supports SX1276 and SX1272, sx126x kit, sx126x shield, and sx128x 2.4GHz. The ST board B-L072Z-LRWAN1 is also supported (TypeABZ module). When B-L072Z-LRWAN1 target is selected, TARGET_DISCO_L072CZ_LRWAN1 is defined by tools, allowing correct radio driver configuration for this platform. Alternately, any mbed board that can use LoRa radio shield board should work, but NUCLEO boards are tested.

End-node Unique ID

DevEUI is created from CPU serial number. AppEUI and AppKey are declared as software constants.

End-node Configuration

Data rate definition LORAMAC_DEFAULT_DATARATE configured in LoRaMac-definitions.h. See gateway project page for configuration of gateway.
LoRaWAN addressing is configured in Comissioning.h; only OTA mode is functional.
Header file board/lora_config.h, selects application layer options (i.e. sensors) to be compiled in.

Serial Interface

Serial port operates at 115200bps.
Application layer single_us915_main.cpp User button triggers uplink (i.e. blue button on nucleo board), or jumper enables continuously sends repeated uplink packets. The MAC layer holds each uplink request until the allocated timeslot.

commandargumentsdescription
?-print available commands
. (period)-print status (DevEUI, DevAddr, etc)
ullength integerset payload length of test uplink packets

sensor demo

Selected grove sensors may be plugged into SX1272 shield.
To enable, edit lora_config.h to define SENSORS.

Sensor connections on SX1272MB2xAS:

D8 D9: buttonRX TX: (unused)A3 A4: Rotary Angle Sensor
D6 D7: RGB LEDSCL SDA: digital light sensorA1 A2: Rotary Angle Sensor

Digital input pin, state reported via uplink: PC8
Digital output pin, controlled via downlink: PC6
PWM out: PB_10

Jumper enables auto-repeated transmit: PC10 and PC12 on NUCLEO board, located on end of morpho headers nearby JP4.

Committer:
dudmuck
Date:
Wed Jun 07 19:56:28 2017 +0000
Revision:
8:ab2f9a8d2eaa
Parent:
2:f2d9aa163652
Child:
10:00997daeb0c0
prevent rx window from colliding with beacon reception

Who changed what in which revision?

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