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:
Fri Aug 04 13:23:38 2017 -0700
Revision:
20:42839629a5dc
Parent:
16:915815632c1f
Child:
25:fed9d5b77183
add sleep() call, mbedignore rtos

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 16:915815632c1f 589
dudmuck 16:915815632c1f 590 LORAMAC_EVENT_INFO_STATUS_ERROR_INCOMPLETE,
dudmuck 16:915815632c1f 591 LORAMAC_EVENT_INFO_STATUS_STOP
dudmuck 0:8f0d0ae0a077 592 }LoRaMacEventInfoStatus_t;
dudmuck 0:8f0d0ae0a077 593
dudmuck 0:8f0d0ae0a077 594 /*!
dudmuck 0:8f0d0ae0a077 595 * LoRaMac tx/rx operation state
dudmuck 0:8f0d0ae0a077 596 */
dudmuck 0:8f0d0ae0a077 597 typedef union eLoRaMacFlags_t
dudmuck 0:8f0d0ae0a077 598 {
dudmuck 0:8f0d0ae0a077 599 /*!
dudmuck 0:8f0d0ae0a077 600 * Byte-access to the bits
dudmuck 0:8f0d0ae0a077 601 */
dudmuck 0:8f0d0ae0a077 602 uint8_t Value;
dudmuck 0:8f0d0ae0a077 603 /*!
dudmuck 0:8f0d0ae0a077 604 * Structure containing single access to bits
dudmuck 0:8f0d0ae0a077 605 */
dudmuck 0:8f0d0ae0a077 606 struct sMacFlagBits
dudmuck 0:8f0d0ae0a077 607 {
dudmuck 0:8f0d0ae0a077 608 /*!
dudmuck 0:8f0d0ae0a077 609 * MCPS-Req pending
dudmuck 0:8f0d0ae0a077 610 */
dudmuck 0:8f0d0ae0a077 611 uint8_t McpsReq : 1;
dudmuck 0:8f0d0ae0a077 612 /*!
dudmuck 0:8f0d0ae0a077 613 * MCPS-Ind pending
dudmuck 0:8f0d0ae0a077 614 */
dudmuck 0:8f0d0ae0a077 615 uint8_t McpsInd : 1;
dudmuck 0:8f0d0ae0a077 616 /*!
dudmuck 0:8f0d0ae0a077 617 * MCPS-Ind pending. Skip indication to the application layer
dudmuck 0:8f0d0ae0a077 618 */
dudmuck 0:8f0d0ae0a077 619 uint8_t McpsIndSkip : 1;
dudmuck 0:8f0d0ae0a077 620 /*!
dudmuck 0:8f0d0ae0a077 621 * MLME-Req pending
dudmuck 0:8f0d0ae0a077 622 */
dudmuck 0:8f0d0ae0a077 623 uint8_t MlmeReq : 1;
dudmuck 0:8f0d0ae0a077 624 /*!
dudmuck 0:8f0d0ae0a077 625 * MAC cycle done
dudmuck 0:8f0d0ae0a077 626 */
dudmuck 0:8f0d0ae0a077 627 uint8_t MacDone : 1;
dudmuck 0:8f0d0ae0a077 628 /*!
dudmuck 0:8f0d0ae0a077 629 * MLME-Ind pending
dudmuck 0:8f0d0ae0a077 630 */
dudmuck 0:8f0d0ae0a077 631 uint8_t MlmeInd : 1;
dudmuck 16:915815632c1f 632 uint8_t pending_tx :1;
dudmuck 0:8f0d0ae0a077 633 }Bits;
dudmuck 0:8f0d0ae0a077 634 }LoRaMacFlags_t;
dudmuck 0:8f0d0ae0a077 635
dudmuck 0:8f0d0ae0a077 636 /*!
dudmuck 0:8f0d0ae0a077 637 *
dudmuck 0:8f0d0ae0a077 638 * \brief LoRaMAC data services
dudmuck 0:8f0d0ae0a077 639 *
dudmuck 0:8f0d0ae0a077 640 * \details The following table list the primitives which are supported by the
dudmuck 0:8f0d0ae0a077 641 * specific MAC data service:
dudmuck 0:8f0d0ae0a077 642 *
dudmuck 0:8f0d0ae0a077 643 * Name | Request | Indication | Response | Confirm
dudmuck 0:8f0d0ae0a077 644 * --------------------- | :-----: | :--------: | :------: | :-----:
dudmuck 0:8f0d0ae0a077 645 * \ref MCPS_UNCONFIRMED | YES | YES | NO | YES
dudmuck 0:8f0d0ae0a077 646 * \ref MCPS_CONFIRMED | YES | YES | NO | YES
dudmuck 0:8f0d0ae0a077 647 * \ref MCPS_MULTICAST | NO | YES | NO | NO
dudmuck 0:8f0d0ae0a077 648 * \ref MCPS_PROPRIETARY | YES | YES | NO | YES
dudmuck 0:8f0d0ae0a077 649 *
dudmuck 0:8f0d0ae0a077 650 * The following table provides links to the function implementations of the
dudmuck 0:8f0d0ae0a077 651 * related MCPS primitives:
dudmuck 0:8f0d0ae0a077 652 *
dudmuck 0:8f0d0ae0a077 653 * Primitive | Function
dudmuck 0:8f0d0ae0a077 654 * ---------------- | :---------------------:
dudmuck 0:8f0d0ae0a077 655 * MCPS-Request | \ref LoRaMacMlmeRequest
dudmuck 0:8f0d0ae0a077 656 * MCPS-Confirm | MacMcpsConfirm in \ref LoRaMacPrimitives_t
dudmuck 0:8f0d0ae0a077 657 * MCPS-Indication | MacMcpsIndication in \ref LoRaMacPrimitives_t
dudmuck 0:8f0d0ae0a077 658 */
dudmuck 0:8f0d0ae0a077 659 typedef enum eMcps
dudmuck 0:8f0d0ae0a077 660 {
dudmuck 0:8f0d0ae0a077 661 /*!
dudmuck 0:8f0d0ae0a077 662 * Unconfirmed LoRaMAC frame
dudmuck 0:8f0d0ae0a077 663 */
dudmuck 0:8f0d0ae0a077 664 MCPS_UNCONFIRMED,
dudmuck 0:8f0d0ae0a077 665 /*!
dudmuck 0:8f0d0ae0a077 666 * Confirmed LoRaMAC frame
dudmuck 0:8f0d0ae0a077 667 */
dudmuck 0:8f0d0ae0a077 668 MCPS_CONFIRMED,
dudmuck 0:8f0d0ae0a077 669 /*!
dudmuck 0:8f0d0ae0a077 670 * Multicast LoRaMAC frame
dudmuck 0:8f0d0ae0a077 671 */
dudmuck 0:8f0d0ae0a077 672 MCPS_MULTICAST,
dudmuck 0:8f0d0ae0a077 673 /*!
dudmuck 0:8f0d0ae0a077 674 * Proprietary frame
dudmuck 0:8f0d0ae0a077 675 */
dudmuck 0:8f0d0ae0a077 676 MCPS_PROPRIETARY,
dudmuck 0:8f0d0ae0a077 677 }Mcps_t;
dudmuck 0:8f0d0ae0a077 678
dudmuck 0:8f0d0ae0a077 679 /*!
dudmuck 0:8f0d0ae0a077 680 * LoRaMAC MCPS-Request for an unconfirmed frame
dudmuck 0:8f0d0ae0a077 681 */
dudmuck 0:8f0d0ae0a077 682 typedef struct sMcpsReqUnconfirmed
dudmuck 0:8f0d0ae0a077 683 {
dudmuck 0:8f0d0ae0a077 684 /*!
dudmuck 0:8f0d0ae0a077 685 * Frame port field. Must be set if the payload is not empty. Use the
dudmuck 0:8f0d0ae0a077 686 * application specific frame port values: [1...223]
dudmuck 0:8f0d0ae0a077 687 *
dudmuck 0:8f0d0ae0a077 688 * LoRaWAN Specification V1.0.1, chapter 4.3.2
dudmuck 0:8f0d0ae0a077 689 */
dudmuck 0:8f0d0ae0a077 690 uint8_t fPort;
dudmuck 0:8f0d0ae0a077 691 /*!
dudmuck 0:8f0d0ae0a077 692 * Pointer to the buffer of the frame payload
dudmuck 0:8f0d0ae0a077 693 */
dudmuck 0:8f0d0ae0a077 694 void *fBuffer;
dudmuck 0:8f0d0ae0a077 695 /*!
dudmuck 0:8f0d0ae0a077 696 * Size of the frame payload
dudmuck 0:8f0d0ae0a077 697 */
dudmuck 0:8f0d0ae0a077 698 uint16_t fBufferSize;
dudmuck 0:8f0d0ae0a077 699 /*!
dudmuck 0:8f0d0ae0a077 700 * Uplink datarate, if ADR is off
dudmuck 0:8f0d0ae0a077 701 */
dudmuck 0:8f0d0ae0a077 702 //int8_t Datarate;
dudmuck 0:8f0d0ae0a077 703 }McpsReqUnconfirmed_t;
dudmuck 0:8f0d0ae0a077 704
dudmuck 0:8f0d0ae0a077 705 /*!
dudmuck 0:8f0d0ae0a077 706 * LoRaMAC MCPS-Request for a confirmed frame
dudmuck 0:8f0d0ae0a077 707 */
dudmuck 0:8f0d0ae0a077 708 typedef struct sMcpsReqConfirmed
dudmuck 0:8f0d0ae0a077 709 {
dudmuck 0:8f0d0ae0a077 710 /*!
dudmuck 0:8f0d0ae0a077 711 * Frame port field. Must be set if the payload is not empty. Use the
dudmuck 0:8f0d0ae0a077 712 * application specific frame port values: [1...223]
dudmuck 0:8f0d0ae0a077 713 *
dudmuck 0:8f0d0ae0a077 714 * LoRaWAN Specification V1.0.1, chapter 4.3.2
dudmuck 0:8f0d0ae0a077 715 */
dudmuck 0:8f0d0ae0a077 716 uint8_t fPort;
dudmuck 0:8f0d0ae0a077 717 /*!
dudmuck 0:8f0d0ae0a077 718 * Pointer to the buffer of the frame payload
dudmuck 0:8f0d0ae0a077 719 */
dudmuck 0:8f0d0ae0a077 720 void *fBuffer;
dudmuck 0:8f0d0ae0a077 721 /*!
dudmuck 0:8f0d0ae0a077 722 * Size of the frame payload
dudmuck 0:8f0d0ae0a077 723 */
dudmuck 0:8f0d0ae0a077 724 uint16_t fBufferSize;
dudmuck 0:8f0d0ae0a077 725 /*!
dudmuck 0:8f0d0ae0a077 726 * Uplink datarate, if ADR is off
dudmuck 0:8f0d0ae0a077 727 */
dudmuck 0:8f0d0ae0a077 728 //int8_t Datarate;
dudmuck 0:8f0d0ae0a077 729 /*!
dudmuck 0:8f0d0ae0a077 730 * Number of trials to transmit the frame, if the LoRaMAC layer did not
dudmuck 0:8f0d0ae0a077 731 * receive an acknowledgment. The MAC performs a datarate adaptation,
dudmuck 0:8f0d0ae0a077 732 * according to the LoRaWAN Specification V1.0.1, chapter 19.4, according
dudmuck 0:8f0d0ae0a077 733 * to the following table:
dudmuck 0:8f0d0ae0a077 734 *
dudmuck 0:8f0d0ae0a077 735 * Transmission nb | Data Rate
dudmuck 0:8f0d0ae0a077 736 * ----------------|-----------
dudmuck 0:8f0d0ae0a077 737 * 1 (first) | DR
dudmuck 0:8f0d0ae0a077 738 * 2 | DR
dudmuck 0:8f0d0ae0a077 739 * 3 | max(DR-1,0)
dudmuck 0:8f0d0ae0a077 740 * 4 | max(DR-1,0)
dudmuck 0:8f0d0ae0a077 741 * 5 | max(DR-2,0)
dudmuck 0:8f0d0ae0a077 742 * 6 | max(DR-2,0)
dudmuck 0:8f0d0ae0a077 743 * 7 | max(DR-3,0)
dudmuck 0:8f0d0ae0a077 744 * 8 | max(DR-3,0)
dudmuck 0:8f0d0ae0a077 745 *
dudmuck 0:8f0d0ae0a077 746 * Note, that if NbTrials is set to 1 or 2, the MAC will not decrease
dudmuck 0:8f0d0ae0a077 747 * the datarate, in case the LoRaMAC layer did not receive an acknowledgment
dudmuck 0:8f0d0ae0a077 748 */
dudmuck 0:8f0d0ae0a077 749 uint8_t NbTrials;
dudmuck 0:8f0d0ae0a077 750 }McpsReqConfirmed_t;
dudmuck 0:8f0d0ae0a077 751
dudmuck 0:8f0d0ae0a077 752 /*!
dudmuck 0:8f0d0ae0a077 753 * LoRaMAC MCPS-Request for a proprietary frame
dudmuck 0:8f0d0ae0a077 754 */
dudmuck 0:8f0d0ae0a077 755 typedef struct sMcpsReqProprietary
dudmuck 0:8f0d0ae0a077 756 {
dudmuck 0:8f0d0ae0a077 757 /*!
dudmuck 0:8f0d0ae0a077 758 * Pointer to the buffer of the frame payload
dudmuck 0:8f0d0ae0a077 759 */
dudmuck 0:8f0d0ae0a077 760 void *fBuffer;
dudmuck 0:8f0d0ae0a077 761 /*!
dudmuck 0:8f0d0ae0a077 762 * Size of the frame payload
dudmuck 0:8f0d0ae0a077 763 */
dudmuck 0:8f0d0ae0a077 764 uint16_t fBufferSize;
dudmuck 0:8f0d0ae0a077 765 /*!
dudmuck 0:8f0d0ae0a077 766 * Uplink datarate, if ADR is off
dudmuck 0:8f0d0ae0a077 767 */
dudmuck 0:8f0d0ae0a077 768 //int8_t Datarate;
dudmuck 0:8f0d0ae0a077 769 }McpsReqProprietary_t;
dudmuck 0:8f0d0ae0a077 770
dudmuck 0:8f0d0ae0a077 771 /*!
dudmuck 0:8f0d0ae0a077 772 * LoRaMAC MCPS-Request structure
dudmuck 0:8f0d0ae0a077 773 */
dudmuck 0:8f0d0ae0a077 774 typedef struct sMcpsReq
dudmuck 0:8f0d0ae0a077 775 {
dudmuck 0:8f0d0ae0a077 776 /*!
dudmuck 0:8f0d0ae0a077 777 * MCPS-Request type
dudmuck 0:8f0d0ae0a077 778 */
dudmuck 0:8f0d0ae0a077 779 Mcps_t Type;
dudmuck 0:8f0d0ae0a077 780
dudmuck 0:8f0d0ae0a077 781 /*!
dudmuck 0:8f0d0ae0a077 782 * MCPS-Request parameters
dudmuck 0:8f0d0ae0a077 783 */
dudmuck 0:8f0d0ae0a077 784 union uMcpsParam
dudmuck 0:8f0d0ae0a077 785 {
dudmuck 0:8f0d0ae0a077 786 /*!
dudmuck 0:8f0d0ae0a077 787 * MCPS-Request parameters for an unconfirmed frame
dudmuck 0:8f0d0ae0a077 788 */
dudmuck 0:8f0d0ae0a077 789 McpsReqUnconfirmed_t Unconfirmed;
dudmuck 0:8f0d0ae0a077 790 /*!
dudmuck 0:8f0d0ae0a077 791 * MCPS-Request parameters for a confirmed frame
dudmuck 0:8f0d0ae0a077 792 */
dudmuck 0:8f0d0ae0a077 793 McpsReqConfirmed_t Confirmed;
dudmuck 0:8f0d0ae0a077 794 /*!
dudmuck 0:8f0d0ae0a077 795 * MCPS-Request parameters for a proprietary frame
dudmuck 0:8f0d0ae0a077 796 */
dudmuck 0:8f0d0ae0a077 797 McpsReqProprietary_t Proprietary;
dudmuck 0:8f0d0ae0a077 798 }Req;
dudmuck 0:8f0d0ae0a077 799 }McpsReq_t;
dudmuck 0:8f0d0ae0a077 800
dudmuck 0:8f0d0ae0a077 801 /*!
dudmuck 0:8f0d0ae0a077 802 * LoRaMAC MCPS-Confirm
dudmuck 0:8f0d0ae0a077 803 */
dudmuck 0:8f0d0ae0a077 804 typedef struct sMcpsConfirm
dudmuck 0:8f0d0ae0a077 805 {
dudmuck 0:8f0d0ae0a077 806 /*!
dudmuck 0:8f0d0ae0a077 807 * Holds the previously performed MCPS-Request
dudmuck 0:8f0d0ae0a077 808 */
dudmuck 0:8f0d0ae0a077 809 Mcps_t McpsRequest;
dudmuck 0:8f0d0ae0a077 810 /*!
dudmuck 0:8f0d0ae0a077 811 * Status of the operation
dudmuck 0:8f0d0ae0a077 812 */
dudmuck 0:8f0d0ae0a077 813 LoRaMacEventInfoStatus_t Status;
dudmuck 0:8f0d0ae0a077 814 /*!
dudmuck 0:8f0d0ae0a077 815 * Uplink datarate
dudmuck 0:8f0d0ae0a077 816 */
dudmuck 0:8f0d0ae0a077 817 //uint8_t Datarate;
dudmuck 0:8f0d0ae0a077 818 /*!
dudmuck 0:8f0d0ae0a077 819 * Transmission power
dudmuck 0:8f0d0ae0a077 820 */
dudmuck 0:8f0d0ae0a077 821 int8_t TxPower;
dudmuck 0:8f0d0ae0a077 822 /*!
dudmuck 0:8f0d0ae0a077 823 * Set if an acknowledgement was received
dudmuck 0:8f0d0ae0a077 824 */
dudmuck 0:8f0d0ae0a077 825 bool AckReceived;
dudmuck 0:8f0d0ae0a077 826 /*!
dudmuck 0:8f0d0ae0a077 827 * Provides the number of retransmissions
dudmuck 0:8f0d0ae0a077 828 */
dudmuck 0:8f0d0ae0a077 829 //uint8_t NbRetries;
dudmuck 0:8f0d0ae0a077 830 /*!
dudmuck 0:8f0d0ae0a077 831 * The transmission time on air of the frame
dudmuck 0:8f0d0ae0a077 832 */
dudmuck 0:8f0d0ae0a077 833 //TimerTime_t TxTimeOnAir;
dudmuck 0:8f0d0ae0a077 834 uint32_t TxTimeOnAir;
dudmuck 0:8f0d0ae0a077 835 /*!
dudmuck 0:8f0d0ae0a077 836 * The uplink counter value related to the frame
dudmuck 0:8f0d0ae0a077 837 */
dudmuck 0:8f0d0ae0a077 838 uint32_t UpLinkCounter;
dudmuck 0:8f0d0ae0a077 839 /*!
dudmuck 0:8f0d0ae0a077 840 * The uplink frequency related to the frame
dudmuck 0:8f0d0ae0a077 841 */
dudmuck 0:8f0d0ae0a077 842 uint32_t UpLinkFrequency;
dudmuck 0:8f0d0ae0a077 843 }McpsConfirm_t;
dudmuck 0:8f0d0ae0a077 844
dudmuck 0:8f0d0ae0a077 845 /*!
dudmuck 0:8f0d0ae0a077 846 * LoRaMAC MCPS-Indication primitive
dudmuck 0:8f0d0ae0a077 847 */
dudmuck 0:8f0d0ae0a077 848 typedef struct sMcpsIndication
dudmuck 0:8f0d0ae0a077 849 {
dudmuck 0:8f0d0ae0a077 850 /*!
dudmuck 0:8f0d0ae0a077 851 * MCPS-Indication type
dudmuck 0:8f0d0ae0a077 852 */
dudmuck 0:8f0d0ae0a077 853 Mcps_t McpsIndication;
dudmuck 0:8f0d0ae0a077 854 /*!
dudmuck 0:8f0d0ae0a077 855 * Status of the operation
dudmuck 0:8f0d0ae0a077 856 */
dudmuck 0:8f0d0ae0a077 857 LoRaMacEventInfoStatus_t Status;
dudmuck 0:8f0d0ae0a077 858 /*!
dudmuck 0:8f0d0ae0a077 859 * Multicast
dudmuck 0:8f0d0ae0a077 860 */
dudmuck 0:8f0d0ae0a077 861 uint8_t Multicast;
dudmuck 0:8f0d0ae0a077 862 /*!
dudmuck 0:8f0d0ae0a077 863 * Application port
dudmuck 0:8f0d0ae0a077 864 */
dudmuck 0:8f0d0ae0a077 865 uint8_t Port;
dudmuck 0:8f0d0ae0a077 866 /*!
dudmuck 0:8f0d0ae0a077 867 * Downlink datarate
dudmuck 0:8f0d0ae0a077 868 */
dudmuck 0:8f0d0ae0a077 869 uint8_t RxDatarate;
dudmuck 0:8f0d0ae0a077 870 /*!
dudmuck 0:8f0d0ae0a077 871 * Frame pending status
dudmuck 0:8f0d0ae0a077 872 */
dudmuck 0:8f0d0ae0a077 873 uint8_t FramePending;
dudmuck 0:8f0d0ae0a077 874 /*!
dudmuck 0:8f0d0ae0a077 875 * Pointer to the received data stream
dudmuck 0:8f0d0ae0a077 876 */
dudmuck 0:8f0d0ae0a077 877 uint8_t *Buffer;
dudmuck 0:8f0d0ae0a077 878 /*!
dudmuck 0:8f0d0ae0a077 879 * Size of the received data stream
dudmuck 0:8f0d0ae0a077 880 */
dudmuck 0:8f0d0ae0a077 881 uint8_t BufferSize;
dudmuck 0:8f0d0ae0a077 882 /*!
dudmuck 0:8f0d0ae0a077 883 * Indicates, if data is available
dudmuck 0:8f0d0ae0a077 884 */
dudmuck 0:8f0d0ae0a077 885 bool RxData;
dudmuck 0:8f0d0ae0a077 886 /*!
dudmuck 0:8f0d0ae0a077 887 * Rssi of the received packet
dudmuck 0:8f0d0ae0a077 888 */
dudmuck 0:8f0d0ae0a077 889 int16_t Rssi;
dudmuck 0:8f0d0ae0a077 890 /*!
dudmuck 0:8f0d0ae0a077 891 * Snr of the received packet
dudmuck 0:8f0d0ae0a077 892 */
dudmuck 0:8f0d0ae0a077 893 uint8_t Snr;
dudmuck 0:8f0d0ae0a077 894 /*!
dudmuck 0:8f0d0ae0a077 895 * Receive window
dudmuck 0:8f0d0ae0a077 896 *
dudmuck 0:8f0d0ae0a077 897 * [0: Rx window 1, 1: Rx window 2]
dudmuck 0:8f0d0ae0a077 898 */
dudmuck 0:8f0d0ae0a077 899 //uint8_t RxSlot;
dudmuck 0:8f0d0ae0a077 900 /*!
dudmuck 0:8f0d0ae0a077 901 * Set if an acknowledgement was received
dudmuck 0:8f0d0ae0a077 902 */
dudmuck 0:8f0d0ae0a077 903 bool AckReceived;
dudmuck 0:8f0d0ae0a077 904 /*!
dudmuck 0:8f0d0ae0a077 905 * The downlink counter value for the received frame
dudmuck 0:8f0d0ae0a077 906 */
dudmuck 0:8f0d0ae0a077 907 uint32_t DownLinkCounter;
dudmuck 0:8f0d0ae0a077 908 }McpsIndication_t;
dudmuck 0:8f0d0ae0a077 909
dudmuck 0:8f0d0ae0a077 910 /*!
dudmuck 0:8f0d0ae0a077 911 * \brief LoRaMAC management services
dudmuck 0:8f0d0ae0a077 912 *
dudmuck 0:8f0d0ae0a077 913 * \details The following table list the primitives which are supported by the
dudmuck 0:8f0d0ae0a077 914 * specific MAC management service:
dudmuck 0:8f0d0ae0a077 915 *
dudmuck 0:8f0d0ae0a077 916 * Name | Request | Indication | Response | Confirm
dudmuck 0:8f0d0ae0a077 917 * --------------------- | :-----: | :--------: | :------: | :-----:
dudmuck 0:8f0d0ae0a077 918 * \ref MLME_JOIN | YES | NO | NO | YES
dudmuck 0:8f0d0ae0a077 919 * \ref MLME_LINK_CHECK | YES | NO | NO | YES
dudmuck 0:8f0d0ae0a077 920 * \ref MLME_TXCW | YES | NO | NO | YES
dudmuck 0:8f0d0ae0a077 921 *
dudmuck 0:8f0d0ae0a077 922 * The following table provides links to the function implementations of the
dudmuck 0:8f0d0ae0a077 923 * related MLME primitives.
dudmuck 0:8f0d0ae0a077 924 *
dudmuck 0:8f0d0ae0a077 925 * Primitive | Function
dudmuck 0:8f0d0ae0a077 926 * ---------------- | :---------------------:
dudmuck 0:8f0d0ae0a077 927 * MLME-Request | \ref LoRaMacMlmeRequest
dudmuck 0:8f0d0ae0a077 928 * MLME-Confirm | MacMlmeConfirm in \ref LoRaMacPrimitives_t
dudmuck 0:8f0d0ae0a077 929 */
dudmuck 0:8f0d0ae0a077 930 typedef enum eMlme
dudmuck 0:8f0d0ae0a077 931 {
dudmuck 0:8f0d0ae0a077 932 /*!
dudmuck 0:8f0d0ae0a077 933 * Initiates the Over-the-Air activation
dudmuck 0:8f0d0ae0a077 934 *
dudmuck 0:8f0d0ae0a077 935 * LoRaWAN Specification V1.0.1, chapter 6.2
dudmuck 0:8f0d0ae0a077 936 */
dudmuck 0:8f0d0ae0a077 937 MLME_JOIN,
dudmuck 0:8f0d0ae0a077 938 /*!
dudmuck 0:8f0d0ae0a077 939 * LinkCheckReq - Connectivity validation
dudmuck 0:8f0d0ae0a077 940 *
dudmuck 0:8f0d0ae0a077 941 * LoRaWAN Specification V1.0.1, chapter 5, table 4
dudmuck 0:8f0d0ae0a077 942 */
dudmuck 0:8f0d0ae0a077 943 MLME_LINK_CHECK,
dudmuck 0:8f0d0ae0a077 944 /*!
dudmuck 0:8f0d0ae0a077 945 * Sets Tx continuous wave mode
dudmuck 0:8f0d0ae0a077 946 *
dudmuck 0:8f0d0ae0a077 947 * LoRaWAN end-device certification
dudmuck 0:8f0d0ae0a077 948 */
dudmuck 0:8f0d0ae0a077 949 MLME_TXCW,
dudmuck 0:8f0d0ae0a077 950 /*!
dudmuck 0:8f0d0ae0a077 951 * Sets Tx continuous wave mode (new LoRa-Alliance CC definition)
dudmuck 0:8f0d0ae0a077 952 *
dudmuck 0:8f0d0ae0a077 953 * LoRaWAN end-device certification
dudmuck 0:8f0d0ae0a077 954 */
dudmuck 0:8f0d0ae0a077 955 MLME_TXCW_1,
dudmuck 10:00997daeb0c0 956
dudmuck 10:00997daeb0c0 957 MLME_TXDONE,
dudmuck 0:8f0d0ae0a077 958
dudmuck 0:8f0d0ae0a077 959 MLME_BEACON
dudmuck 0:8f0d0ae0a077 960 }Mlme_t;
dudmuck 0:8f0d0ae0a077 961
dudmuck 0:8f0d0ae0a077 962 /*!
dudmuck 0:8f0d0ae0a077 963 * LoRaMAC MLME-Request for the join service
dudmuck 0:8f0d0ae0a077 964 */
dudmuck 0:8f0d0ae0a077 965 typedef struct sMlmeReqJoin
dudmuck 0:8f0d0ae0a077 966 {
dudmuck 0:8f0d0ae0a077 967 /*!
dudmuck 0:8f0d0ae0a077 968 * Globally unique end-device identifier
dudmuck 0:8f0d0ae0a077 969 *
dudmuck 0:8f0d0ae0a077 970 * LoRaWAN Specification V1.0.1, chapter 6.2.1
dudmuck 0:8f0d0ae0a077 971 */
dudmuck 0:8f0d0ae0a077 972 uint8_t *DevEui;
dudmuck 0:8f0d0ae0a077 973 /*!
dudmuck 0:8f0d0ae0a077 974 * Application identifier
dudmuck 0:8f0d0ae0a077 975 *
dudmuck 0:8f0d0ae0a077 976 * LoRaWAN Specification V1.0.1, chapter 6.1.2
dudmuck 0:8f0d0ae0a077 977 */
dudmuck 0:8f0d0ae0a077 978 uint8_t *AppEui;
dudmuck 0:8f0d0ae0a077 979 /*!
dudmuck 0:8f0d0ae0a077 980 * AES-128 application key
dudmuck 0:8f0d0ae0a077 981 *
dudmuck 0:8f0d0ae0a077 982 * LoRaWAN Specification V1.0.1, chapter 6.2.2
dudmuck 0:8f0d0ae0a077 983 */
dudmuck 0:8f0d0ae0a077 984 uint8_t *AppKey;
dudmuck 0:8f0d0ae0a077 985 /*!
dudmuck 0:8f0d0ae0a077 986 * Number of trials for the join request.
dudmuck 0:8f0d0ae0a077 987 */
dudmuck 0:8f0d0ae0a077 988 uint8_t NbTrials;
dudmuck 0:8f0d0ae0a077 989 }MlmeReqJoin_t;
dudmuck 0:8f0d0ae0a077 990
dudmuck 0:8f0d0ae0a077 991 /*!
dudmuck 0:8f0d0ae0a077 992 * LoRaMAC MLME-Request for Tx continuous wave mode
dudmuck 0:8f0d0ae0a077 993 */
dudmuck 0:8f0d0ae0a077 994 typedef struct sMlmeReqTxCw
dudmuck 0:8f0d0ae0a077 995 {
dudmuck 0:8f0d0ae0a077 996 /*!
dudmuck 0:8f0d0ae0a077 997 * Time in seconds while the radio is kept in continuous wave mode
dudmuck 0:8f0d0ae0a077 998 */
dudmuck 0:8f0d0ae0a077 999 uint16_t Timeout;
dudmuck 0:8f0d0ae0a077 1000 /*!
dudmuck 0:8f0d0ae0a077 1001 * RF frequency to set (Only used with new way)
dudmuck 0:8f0d0ae0a077 1002 */
dudmuck 0:8f0d0ae0a077 1003 uint32_t Frequency;
dudmuck 0:8f0d0ae0a077 1004 /*!
dudmuck 0:8f0d0ae0a077 1005 * RF output power to set (Only used with new way)
dudmuck 0:8f0d0ae0a077 1006 */
dudmuck 0:8f0d0ae0a077 1007 uint8_t Power;
dudmuck 0:8f0d0ae0a077 1008 }MlmeReqTxCw_t;
dudmuck 0:8f0d0ae0a077 1009
dudmuck 0:8f0d0ae0a077 1010 /*!
dudmuck 0:8f0d0ae0a077 1011 * LoRaMAC MLME-Request structure
dudmuck 0:8f0d0ae0a077 1012 */
dudmuck 0:8f0d0ae0a077 1013 typedef struct sMlmeReq
dudmuck 0:8f0d0ae0a077 1014 {
dudmuck 0:8f0d0ae0a077 1015 /*!
dudmuck 0:8f0d0ae0a077 1016 * MLME-Request type
dudmuck 0:8f0d0ae0a077 1017 */
dudmuck 0:8f0d0ae0a077 1018 Mlme_t Type;
dudmuck 0:8f0d0ae0a077 1019
dudmuck 0:8f0d0ae0a077 1020 /*!
dudmuck 0:8f0d0ae0a077 1021 * MLME-Request parameters
dudmuck 0:8f0d0ae0a077 1022 */
dudmuck 0:8f0d0ae0a077 1023 union uMlmeParam
dudmuck 0:8f0d0ae0a077 1024 {
dudmuck 0:8f0d0ae0a077 1025 /*!
dudmuck 0:8f0d0ae0a077 1026 * MLME-Request parameters for a join request
dudmuck 0:8f0d0ae0a077 1027 */
dudmuck 0:8f0d0ae0a077 1028 MlmeReqJoin_t Join;
dudmuck 0:8f0d0ae0a077 1029 /*!
dudmuck 0:8f0d0ae0a077 1030 * MLME-Request parameters for Tx continuous mode request
dudmuck 0:8f0d0ae0a077 1031 */
dudmuck 0:8f0d0ae0a077 1032 MlmeReqTxCw_t TxCw;
dudmuck 0:8f0d0ae0a077 1033 }Req;
dudmuck 0:8f0d0ae0a077 1034 }MlmeReq_t;
dudmuck 0:8f0d0ae0a077 1035
dudmuck 0:8f0d0ae0a077 1036 /*!
dudmuck 0:8f0d0ae0a077 1037 * LoRaMAC MLME-Confirm primitive
dudmuck 0:8f0d0ae0a077 1038 */
dudmuck 0:8f0d0ae0a077 1039 typedef struct sMlmeConfirm
dudmuck 0:8f0d0ae0a077 1040 {
dudmuck 0:8f0d0ae0a077 1041 /*!
dudmuck 0:8f0d0ae0a077 1042 * Holds the previously performed MLME-Request
dudmuck 0:8f0d0ae0a077 1043 */
dudmuck 0:8f0d0ae0a077 1044 Mlme_t MlmeRequest;
dudmuck 0:8f0d0ae0a077 1045 /*!
dudmuck 0:8f0d0ae0a077 1046 * Status of the operation
dudmuck 0:8f0d0ae0a077 1047 */
dudmuck 0:8f0d0ae0a077 1048 LoRaMacEventInfoStatus_t Status;
dudmuck 0:8f0d0ae0a077 1049 /*!
dudmuck 0:8f0d0ae0a077 1050 * The transmission time on air of the frame
dudmuck 0:8f0d0ae0a077 1051 */
dudmuck 0:8f0d0ae0a077 1052 //TimerTime_t TxTimeOnAir;
dudmuck 0:8f0d0ae0a077 1053 uint32_t TxTimeOnAir;
dudmuck 0:8f0d0ae0a077 1054 /*!
dudmuck 0:8f0d0ae0a077 1055 * Demodulation margin. Contains the link margin [dB] of the last
dudmuck 0:8f0d0ae0a077 1056 * successfully received LinkCheckReq
dudmuck 0:8f0d0ae0a077 1057 */
dudmuck 0:8f0d0ae0a077 1058 uint8_t DemodMargin;
dudmuck 0:8f0d0ae0a077 1059 /*!
dudmuck 0:8f0d0ae0a077 1060 * Number of gateways which received the last LinkCheckReq
dudmuck 0:8f0d0ae0a077 1061 */
dudmuck 0:8f0d0ae0a077 1062 uint8_t NbGateways;
dudmuck 0:8f0d0ae0a077 1063 /*!
dudmuck 0:8f0d0ae0a077 1064 * Provides the number of retransmissions
dudmuck 0:8f0d0ae0a077 1065 */
dudmuck 0:8f0d0ae0a077 1066 //uint8_t NbRetries;
dudmuck 0:8f0d0ae0a077 1067 }MlmeConfirm_t;
dudmuck 0:8f0d0ae0a077 1068
dudmuck 0:8f0d0ae0a077 1069 typedef struct sMlmeIndication
dudmuck 0:8f0d0ae0a077 1070 {
dudmuck 0:8f0d0ae0a077 1071 /*!
dudmuck 0:8f0d0ae0a077 1072 * Holds the previously performed MLME-Request
dudmuck 0:8f0d0ae0a077 1073 */
dudmuck 0:8f0d0ae0a077 1074 Mlme_t MlmeIndication;
dudmuck 0:8f0d0ae0a077 1075 /*!
dudmuck 0:8f0d0ae0a077 1076 * Status of the operation
dudmuck 0:8f0d0ae0a077 1077 */
dudmuck 0:8f0d0ae0a077 1078 LoRaMacEventInfoStatus_t Status;
dudmuck 0:8f0d0ae0a077 1079
dudmuck 0:8f0d0ae0a077 1080 //BeaconInfo_t BeaconInfo;
dudmuck 0:8f0d0ae0a077 1081 }MlmeIndication_t;
dudmuck 0:8f0d0ae0a077 1082
dudmuck 0:8f0d0ae0a077 1083 /*!
dudmuck 0:8f0d0ae0a077 1084 * LoRa Mac Information Base (MIB)
dudmuck 0:8f0d0ae0a077 1085 *
dudmuck 0:8f0d0ae0a077 1086 * The following table lists the MIB parameters and the related attributes:
dudmuck 0:8f0d0ae0a077 1087 *
dudmuck 0:8f0d0ae0a077 1088 * Attribute | Get | Set
dudmuck 0:8f0d0ae0a077 1089 * --------------------------------- | :-: | :-:
dudmuck 0:8f0d0ae0a077 1090 * \ref MIB_DEVICE_CLASS | YES | YES
dudmuck 0:8f0d0ae0a077 1091 * \ref MIB_NETWORK_JOINED | YES | YES
dudmuck 0:8f0d0ae0a077 1092 * \ref MIB_ADR | YES | YES
dudmuck 0:8f0d0ae0a077 1093 * \ref MIB_NET_ID | YES | YES
dudmuck 0:8f0d0ae0a077 1094 * \ref MIB_DEV_ADDR | YES | YES
dudmuck 0:8f0d0ae0a077 1095 * \ref MIB_NWK_SKEY | YES | YES
dudmuck 0:8f0d0ae0a077 1096 * \ref MIB_APP_SKEY | YES | YES
dudmuck 0:8f0d0ae0a077 1097 * \ref MIB_PUBLIC_NETWORK | YES | YES
dudmuck 0:8f0d0ae0a077 1098 * \ref MIB_REPEATER_SUPPORT | YES | YES
dudmuck 0:8f0d0ae0a077 1099 * \ref MIB_CHANNELS | YES | NO
dudmuck 0:8f0d0ae0a077 1100 * \ref MIB_RX2_CHANNEL | YES | YES
dudmuck 0:8f0d0ae0a077 1101 * \ref MIB_CHANNELS_MASK | YES | YES
dudmuck 0:8f0d0ae0a077 1102 * \ref MIB_CHANNELS_DEFAULT_MASK | YES | YES
dudmuck 0:8f0d0ae0a077 1103 * \ref MIB_CHANNELS_NB_REP | YES | YES
dudmuck 0:8f0d0ae0a077 1104 * \ref MIB_MAX_RX_WINDOW_DURATION | YES | YES
dudmuck 0:8f0d0ae0a077 1105 * \ref MIB_RECEIVE_DELAY_1 | YES | YES
dudmuck 0:8f0d0ae0a077 1106 * \ref MIB_RECEIVE_DELAY_2 | YES | YES
dudmuck 0:8f0d0ae0a077 1107 * \ref MIB_JOIN_ACCEPT_DELAY_1 | YES | YES
dudmuck 0:8f0d0ae0a077 1108 * \ref MIB_JOIN_ACCEPT_DELAY_2 | YES | YES
dudmuck 0:8f0d0ae0a077 1109 * \ref MIB_CHANNELS_DATARATE | YES | YES
dudmuck 0:8f0d0ae0a077 1110 * \ref MIB_CHANNELS_DEFAULT_DATARATE| YES | YES
dudmuck 0:8f0d0ae0a077 1111 * \ref MIB_CHANNELS_TX_POWER | YES | YES
dudmuck 0:8f0d0ae0a077 1112 * \ref MIB_CHANNELS_DEFAULT_TX_POWER| YES | YES
dudmuck 0:8f0d0ae0a077 1113 * \ref MIB_UPLINK_COUNTER | YES | YES
dudmuck 0:8f0d0ae0a077 1114 * \ref MIB_DOWNLINK_COUNTER | YES | YES
dudmuck 0:8f0d0ae0a077 1115 * \ref MIB_MULTICAST_CHANNEL | YES | NO
dudmuck 0:8f0d0ae0a077 1116 * \ref MIB_SYSTEM_MAX_RX_ERROR | YES | YES
dudmuck 0:8f0d0ae0a077 1117 * \ref MIB_MIN_RX_SYMBOLS | YES | YES
dudmuck 0:8f0d0ae0a077 1118 *
dudmuck 0:8f0d0ae0a077 1119 * The following table provides links to the function implementations of the
dudmuck 0:8f0d0ae0a077 1120 * related MIB primitives:
dudmuck 0:8f0d0ae0a077 1121 *
dudmuck 0:8f0d0ae0a077 1122 * Primitive | Function
dudmuck 0:8f0d0ae0a077 1123 * ---------------- | :---------------------:
dudmuck 0:8f0d0ae0a077 1124 * MIB-Set | \ref LoRaMacMibSetRequestConfirm
dudmuck 0:8f0d0ae0a077 1125 * MIB-Get | \ref LoRaMacMibGetRequestConfirm
dudmuck 0:8f0d0ae0a077 1126 */
dudmuck 0:8f0d0ae0a077 1127 typedef enum eMib
dudmuck 0:8f0d0ae0a077 1128 {
dudmuck 0:8f0d0ae0a077 1129 /*!
dudmuck 0:8f0d0ae0a077 1130 * LoRaWAN device class
dudmuck 0:8f0d0ae0a077 1131 *
dudmuck 0:8f0d0ae0a077 1132 * LoRaWAN Specification V1.0.1
dudmuck 0:8f0d0ae0a077 1133 */
dudmuck 0:8f0d0ae0a077 1134 MIB_DEVICE_CLASS,
dudmuck 0:8f0d0ae0a077 1135 /*!
dudmuck 0:8f0d0ae0a077 1136 * LoRaWAN Network joined attribute
dudmuck 0:8f0d0ae0a077 1137 *
dudmuck 0:8f0d0ae0a077 1138 * LoRaWAN Specification V1.0.1
dudmuck 0:8f0d0ae0a077 1139 */
dudmuck 0:8f0d0ae0a077 1140 MIB_NETWORK_JOINED,
dudmuck 0:8f0d0ae0a077 1141 /*!
dudmuck 0:8f0d0ae0a077 1142 * Adaptive data rate
dudmuck 0:8f0d0ae0a077 1143 *
dudmuck 0:8f0d0ae0a077 1144 * LoRaWAN Specification V1.0.1, chapter 4.3.1.1
dudmuck 0:8f0d0ae0a077 1145 *
dudmuck 0:8f0d0ae0a077 1146 * [true: ADR enabled, false: ADR disabled]
dudmuck 0:8f0d0ae0a077 1147 */
dudmuck 0:8f0d0ae0a077 1148 /*!
dudmuck 0:8f0d0ae0a077 1149 * Network identifier
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_NET_ID,
dudmuck 0:8f0d0ae0a077 1154 /*!
dudmuck 0:8f0d0ae0a077 1155 * End-device address
dudmuck 0:8f0d0ae0a077 1156 *
dudmuck 0:8f0d0ae0a077 1157 * LoRaWAN Specification V1.0.1, chapter 6.1.1
dudmuck 0:8f0d0ae0a077 1158 */
dudmuck 0:8f0d0ae0a077 1159 MIB_DEV_ADDR,
dudmuck 0:8f0d0ae0a077 1160 /*!
dudmuck 0:8f0d0ae0a077 1161 * Network session key
dudmuck 0:8f0d0ae0a077 1162 *
dudmuck 0:8f0d0ae0a077 1163 * LoRaWAN Specification V1.0.1, chapter 6.1.3
dudmuck 0:8f0d0ae0a077 1164 */
dudmuck 0:8f0d0ae0a077 1165 MIB_NWK_SKEY,
dudmuck 0:8f0d0ae0a077 1166 /*!
dudmuck 0:8f0d0ae0a077 1167 * Application session key
dudmuck 0:8f0d0ae0a077 1168 *
dudmuck 0:8f0d0ae0a077 1169 * LoRaWAN Specification V1.0.1, chapter 6.1.4
dudmuck 0:8f0d0ae0a077 1170 */
dudmuck 0:8f0d0ae0a077 1171 MIB_APP_SKEY,
dudmuck 0:8f0d0ae0a077 1172 /*!
dudmuck 0:8f0d0ae0a077 1173 * Set the network type to public or private
dudmuck 0:8f0d0ae0a077 1174 *
dudmuck 0:8f0d0ae0a077 1175 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1176 *
dudmuck 0:8f0d0ae0a077 1177 * [true: public network, false: private network]
dudmuck 0:8f0d0ae0a077 1178 */
dudmuck 0:8f0d0ae0a077 1179 MIB_PUBLIC_NETWORK,
dudmuck 0:8f0d0ae0a077 1180 /*!
dudmuck 0:8f0d0ae0a077 1181 * Support the operation with repeaters
dudmuck 0:8f0d0ae0a077 1182 *
dudmuck 0:8f0d0ae0a077 1183 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1184 *
dudmuck 0:8f0d0ae0a077 1185 * [true: repeater support enabled, false: repeater support disabled]
dudmuck 0:8f0d0ae0a077 1186 */
dudmuck 0:8f0d0ae0a077 1187 //MIB_REPEATER_SUPPORT,
dudmuck 0:8f0d0ae0a077 1188 /*!
dudmuck 0:8f0d0ae0a077 1189 * Communication channels. A get request will return a
dudmuck 0:8f0d0ae0a077 1190 * pointer which references the first entry of the channel list. The
dudmuck 0:8f0d0ae0a077 1191 * list is of size LORA_MAX_NB_CHANNELS
dudmuck 0:8f0d0ae0a077 1192 *
dudmuck 0:8f0d0ae0a077 1193 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1194 */
dudmuck 0:8f0d0ae0a077 1195 //MIB_CHANNELS,
dudmuck 0:8f0d0ae0a077 1196 /*!
dudmuck 0:8f0d0ae0a077 1197 * Set receive window 2 channel
dudmuck 0:8f0d0ae0a077 1198 *
dudmuck 0:8f0d0ae0a077 1199 * LoRaWAN Specification V1.0.1, chapter 3.3.2
dudmuck 0:8f0d0ae0a077 1200 */
dudmuck 0:8f0d0ae0a077 1201 /*!
dudmuck 0:8f0d0ae0a077 1202 * Set receive window 2 channel
dudmuck 0:8f0d0ae0a077 1203 *
dudmuck 0:8f0d0ae0a077 1204 * LoRaWAN Specification V1.0.1, chapter 3.3.2
dudmuck 0:8f0d0ae0a077 1205 */
dudmuck 0:8f0d0ae0a077 1206 /*!
dudmuck 0:8f0d0ae0a077 1207 * LoRaWAN channels mask
dudmuck 0:8f0d0ae0a077 1208 *
dudmuck 0:8f0d0ae0a077 1209 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1210 */
dudmuck 0:8f0d0ae0a077 1211 /*!
dudmuck 0:8f0d0ae0a077 1212 * LoRaWAN default channels mask
dudmuck 0:8f0d0ae0a077 1213 *
dudmuck 0:8f0d0ae0a077 1214 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1215 */
dudmuck 0:8f0d0ae0a077 1216 //MIB_CHANNELS_DEFAULT_MASK,
dudmuck 0:8f0d0ae0a077 1217 /*!
dudmuck 0:8f0d0ae0a077 1218 * Set the number of repetitions on a channel
dudmuck 0:8f0d0ae0a077 1219 *
dudmuck 0:8f0d0ae0a077 1220 * LoRaWAN Specification V1.0.1, chapter 5.2
dudmuck 0:8f0d0ae0a077 1221 */
dudmuck 0:8f0d0ae0a077 1222 MIB_CHANNELS_NB_REP,
dudmuck 0:8f0d0ae0a077 1223 /*!
dudmuck 0:8f0d0ae0a077 1224 * Maximum receive window duration in [ms]
dudmuck 0:8f0d0ae0a077 1225 *
dudmuck 0:8f0d0ae0a077 1226 * LoRaWAN Specification V1.0.1, chapter 3.3.3
dudmuck 0:8f0d0ae0a077 1227 */
dudmuck 0:8f0d0ae0a077 1228 MIB_MAX_RX_WINDOW_DURATION,
dudmuck 0:8f0d0ae0a077 1229 /*!
dudmuck 0:8f0d0ae0a077 1230 * Receive delay 1 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 MIB_RECEIVE_DELAY_1,
dudmuck 0:8f0d0ae0a077 1235 /*!
dudmuck 0:8f0d0ae0a077 1236 * Receive delay 2 in [ms]
dudmuck 0:8f0d0ae0a077 1237 *
dudmuck 0:8f0d0ae0a077 1238 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1239 */
dudmuck 0:8f0d0ae0a077 1240 /*!
dudmuck 0:8f0d0ae0a077 1241 * Join accept delay 1 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 MIB_JOIN_ACCEPT_DELAY_1,
dudmuck 0:8f0d0ae0a077 1246 /*!
dudmuck 0:8f0d0ae0a077 1247 * Join accept delay 2 in [ms]
dudmuck 0:8f0d0ae0a077 1248 *
dudmuck 0:8f0d0ae0a077 1249 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1250 */
dudmuck 0:8f0d0ae0a077 1251 /*!
dudmuck 0:8f0d0ae0a077 1252 * Default Data rate of a channel
dudmuck 0:8f0d0ae0a077 1253 *
dudmuck 0:8f0d0ae0a077 1254 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1255 *
dudmuck 0:8f0d0ae0a077 1256 * EU868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]
dudmuck 0:8f0d0ae0a077 1257 *
dudmuck 0:8f0d0ae0a077 1258 * 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 1259 */
dudmuck 0:8f0d0ae0a077 1260 /*!
dudmuck 0:8f0d0ae0a077 1261 * Data rate of a channel
dudmuck 0:8f0d0ae0a077 1262 *
dudmuck 0:8f0d0ae0a077 1263 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1264 *
dudmuck 0:8f0d0ae0a077 1265 * EU868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]
dudmuck 0:8f0d0ae0a077 1266 *
dudmuck 0:8f0d0ae0a077 1267 * 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 1268 */
dudmuck 0:8f0d0ae0a077 1269 /*!
dudmuck 0:8f0d0ae0a077 1270 * Transmission power of a channel
dudmuck 0:8f0d0ae0a077 1271 *
dudmuck 0:8f0d0ae0a077 1272 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1273 *
dudmuck 0:8f0d0ae0a077 1274 * EU868 - [TX_POWER_20_DBM, TX_POWER_14_DBM, TX_POWER_11_DBM,
dudmuck 0:8f0d0ae0a077 1275 * TX_POWER_08_DBM, TX_POWER_05_DBM, TX_POWER_02_DBM]
dudmuck 0:8f0d0ae0a077 1276 *
dudmuck 0:8f0d0ae0a077 1277 * US915 - [TX_POWER_30_DBM, TX_POWER_28_DBM, TX_POWER_26_DBM,
dudmuck 0:8f0d0ae0a077 1278 * TX_POWER_24_DBM, TX_POWER_22_DBM, TX_POWER_20_DBM,
dudmuck 0:8f0d0ae0a077 1279 * TX_POWER_18_DBM, TX_POWER_14_DBM, TX_POWER_12_DBM,
dudmuck 0:8f0d0ae0a077 1280 * TX_POWER_10_DBM]
dudmuck 0:8f0d0ae0a077 1281 */
dudmuck 0:8f0d0ae0a077 1282 MIB_CHANNELS_TX_POWER,
dudmuck 0:8f0d0ae0a077 1283 /*!
dudmuck 0:8f0d0ae0a077 1284 * Transmission power of a channel
dudmuck 0:8f0d0ae0a077 1285 *
dudmuck 0:8f0d0ae0a077 1286 * LoRaWAN Specification V1.0.1, chapter 7
dudmuck 0:8f0d0ae0a077 1287 *
dudmuck 0:8f0d0ae0a077 1288 * EU868 - [TX_POWER_20_DBM, TX_POWER_14_DBM, TX_POWER_11_DBM,
dudmuck 0:8f0d0ae0a077 1289 * TX_POWER_08_DBM, TX_POWER_05_DBM, TX_POWER_02_DBM]
dudmuck 0:8f0d0ae0a077 1290 *
dudmuck 0:8f0d0ae0a077 1291 * US915 - [TX_POWER_30_DBM, TX_POWER_28_DBM, TX_POWER_26_DBM,
dudmuck 0:8f0d0ae0a077 1292 * TX_POWER_24_DBM, TX_POWER_22_DBM, TX_POWER_20_DBM,
dudmuck 0:8f0d0ae0a077 1293 * TX_POWER_18_DBM, TX_POWER_14_DBM, TX_POWER_12_DBM,
dudmuck 0:8f0d0ae0a077 1294 * TX_POWER_10_DBM]
dudmuck 0:8f0d0ae0a077 1295 */
dudmuck 0:8f0d0ae0a077 1296 MIB_CHANNELS_DEFAULT_TX_POWER,
dudmuck 0:8f0d0ae0a077 1297 /*!
dudmuck 0:8f0d0ae0a077 1298 * LoRaWAN Up-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_UPLINK_COUNTER,
dudmuck 0:8f0d0ae0a077 1303 /*!
dudmuck 0:8f0d0ae0a077 1304 * LoRaWAN Down-link counter
dudmuck 0:8f0d0ae0a077 1305 *
dudmuck 0:8f0d0ae0a077 1306 * LoRaWAN Specification V1.0.1, chapter 4.3.1.5
dudmuck 0:8f0d0ae0a077 1307 */
dudmuck 0:8f0d0ae0a077 1308 MIB_DOWNLINK_COUNTER,
dudmuck 0:8f0d0ae0a077 1309 /*!
dudmuck 0:8f0d0ae0a077 1310 * Multicast channels. A get request will return a pointer to the first
dudmuck 0:8f0d0ae0a077 1311 * entry of the multicast channel linked list. If the pointer is equal to
dudmuck 0:8f0d0ae0a077 1312 * NULL, the list is empty.
dudmuck 0:8f0d0ae0a077 1313 */
dudmuck 0:8f0d0ae0a077 1314 MIB_MULTICAST_CHANNEL,
dudmuck 0:8f0d0ae0a077 1315 /*!
dudmuck 0:8f0d0ae0a077 1316 * System overall timing error in milliseconds.
dudmuck 0:8f0d0ae0a077 1317 * [-SystemMaxRxError : +SystemMaxRxError]
dudmuck 0:8f0d0ae0a077 1318 * Default: +/-10 ms
dudmuck 0:8f0d0ae0a077 1319 */
dudmuck 0:8f0d0ae0a077 1320 MIB_SYSTEM_MAX_RX_ERROR,
dudmuck 0:8f0d0ae0a077 1321 /*!
dudmuck 0:8f0d0ae0a077 1322 * Minimum required number of symbols to detect an Rx frame
dudmuck 0:8f0d0ae0a077 1323 * Default: 6 symbols
dudmuck 0:8f0d0ae0a077 1324 */
dudmuck 0:8f0d0ae0a077 1325 MIB_MIN_RX_SYMBOLS,
dudmuck 0:8f0d0ae0a077 1326 }Mib_t;
dudmuck 0:8f0d0ae0a077 1327
dudmuck 0:8f0d0ae0a077 1328 /*!
dudmuck 0:8f0d0ae0a077 1329 * LoRaMAC MIB parameters
dudmuck 0:8f0d0ae0a077 1330 */
dudmuck 0:8f0d0ae0a077 1331 typedef union uMibParam
dudmuck 0:8f0d0ae0a077 1332 {
dudmuck 0:8f0d0ae0a077 1333 /*!
dudmuck 0:8f0d0ae0a077 1334 * LoRaWAN device class
dudmuck 0:8f0d0ae0a077 1335 *
dudmuck 0:8f0d0ae0a077 1336 * Related MIB type: \ref MIB_DEVICE_CLASS
dudmuck 0:8f0d0ae0a077 1337 */
dudmuck 0:8f0d0ae0a077 1338 DeviceClass_t Class;
dudmuck 0:8f0d0ae0a077 1339 /*!
dudmuck 0:8f0d0ae0a077 1340 * LoRaWAN network joined attribute
dudmuck 0:8f0d0ae0a077 1341 *
dudmuck 0:8f0d0ae0a077 1342 * Related MIB type: \ref MIB_NETWORK_JOINED
dudmuck 0:8f0d0ae0a077 1343 */
dudmuck 0:8f0d0ae0a077 1344 bool IsNetworkJoined;
dudmuck 0:8f0d0ae0a077 1345 /*!
dudmuck 0:8f0d0ae0a077 1346 * Activation state of ADR
dudmuck 0:8f0d0ae0a077 1347 *
dudmuck 0:8f0d0ae0a077 1348 * Related MIB type: \ref MIB_ADR
dudmuck 0:8f0d0ae0a077 1349 */
dudmuck 0:8f0d0ae0a077 1350 /*!
dudmuck 0:8f0d0ae0a077 1351 * Network identifier
dudmuck 0:8f0d0ae0a077 1352 *
dudmuck 0:8f0d0ae0a077 1353 * Related MIB type: \ref MIB_NET_ID
dudmuck 0:8f0d0ae0a077 1354 */
dudmuck 0:8f0d0ae0a077 1355 uint32_t NetID;
dudmuck 0:8f0d0ae0a077 1356 /*!
dudmuck 0:8f0d0ae0a077 1357 * End-device address
dudmuck 0:8f0d0ae0a077 1358 *
dudmuck 0:8f0d0ae0a077 1359 * Related MIB type: \ref MIB_DEV_ADDR
dudmuck 0:8f0d0ae0a077 1360 */
dudmuck 0:8f0d0ae0a077 1361 uint32_t DevAddr;
dudmuck 0:8f0d0ae0a077 1362 /*!
dudmuck 0:8f0d0ae0a077 1363 * Network session key
dudmuck 0:8f0d0ae0a077 1364 *
dudmuck 0:8f0d0ae0a077 1365 * Related MIB type: \ref MIB_NWK_SKEY
dudmuck 0:8f0d0ae0a077 1366 */
dudmuck 0:8f0d0ae0a077 1367 uint8_t *NwkSKey;
dudmuck 0:8f0d0ae0a077 1368 /*!
dudmuck 0:8f0d0ae0a077 1369 * Application session key
dudmuck 0:8f0d0ae0a077 1370 *
dudmuck 0:8f0d0ae0a077 1371 * Related MIB type: \ref MIB_APP_SKEY
dudmuck 0:8f0d0ae0a077 1372 */
dudmuck 0:8f0d0ae0a077 1373 uint8_t *AppSKey;
dudmuck 0:8f0d0ae0a077 1374 /*!
dudmuck 0:8f0d0ae0a077 1375 * Enable or disable a public network
dudmuck 0:8f0d0ae0a077 1376 *
dudmuck 0:8f0d0ae0a077 1377 * Related MIB type: \ref MIB_PUBLIC_NETWORK
dudmuck 0:8f0d0ae0a077 1378 */
dudmuck 0:8f0d0ae0a077 1379 bool EnablePublicNetwork;
dudmuck 0:8f0d0ae0a077 1380 /*!
dudmuck 0:8f0d0ae0a077 1381 * Enable or disable repeater support
dudmuck 0:8f0d0ae0a077 1382 *
dudmuck 0:8f0d0ae0a077 1383 * Related MIB type: \ref MIB_REPEATER_SUPPORT
dudmuck 0:8f0d0ae0a077 1384 */
dudmuck 0:8f0d0ae0a077 1385 //bool EnableRepeaterSupport;
dudmuck 0:8f0d0ae0a077 1386 /*!
dudmuck 0:8f0d0ae0a077 1387 * LoRaWAN Channel
dudmuck 0:8f0d0ae0a077 1388 *
dudmuck 0:8f0d0ae0a077 1389 * Related MIB type: \ref MIB_CHANNELS
dudmuck 0:8f0d0ae0a077 1390 */
dudmuck 0:8f0d0ae0a077 1391 //ChannelParams_t* ChannelList;
dudmuck 0:8f0d0ae0a077 1392 /*!
dudmuck 0:8f0d0ae0a077 1393 * Channel for the receive window 2
dudmuck 0:8f0d0ae0a077 1394 *
dudmuck 0:8f0d0ae0a077 1395 * Related MIB type: \ref MIB_RX2_CHANNEL
dudmuck 0:8f0d0ae0a077 1396 */
dudmuck 0:8f0d0ae0a077 1397 /*!
dudmuck 0:8f0d0ae0a077 1398 * Channel for the receive window 2
dudmuck 0:8f0d0ae0a077 1399 *
dudmuck 0:8f0d0ae0a077 1400 * Related MIB type: \ref MIB_RX2_DEFAULT_CHANNEL
dudmuck 0:8f0d0ae0a077 1401 */
dudmuck 0:8f0d0ae0a077 1402 //Rx2ChannelParams_t Rx2DefaultChannel;
dudmuck 0:8f0d0ae0a077 1403 /*!
dudmuck 0:8f0d0ae0a077 1404 * Channel mask
dudmuck 0:8f0d0ae0a077 1405 *
dudmuck 0:8f0d0ae0a077 1406 * Related MIB type: \ref MIB_CHANNELS_MASK
dudmuck 0:8f0d0ae0a077 1407 */
dudmuck 0:8f0d0ae0a077 1408 //uint16_t* ChannelsMask;
dudmuck 0:8f0d0ae0a077 1409 /*!
dudmuck 0:8f0d0ae0a077 1410 * Default channel mask
dudmuck 0:8f0d0ae0a077 1411 *
dudmuck 0:8f0d0ae0a077 1412 * Related MIB type: \ref MIB_CHANNELS_DEFAULT_MASK
dudmuck 0:8f0d0ae0a077 1413 */
dudmuck 0:8f0d0ae0a077 1414 //uint16_t* ChannelsDefaultMask;
dudmuck 0:8f0d0ae0a077 1415 /*!
dudmuck 0:8f0d0ae0a077 1416 * Number of frame repetitions
dudmuck 0:8f0d0ae0a077 1417 *
dudmuck 0:8f0d0ae0a077 1418 * Related MIB type: \ref MIB_CHANNELS_NB_REP
dudmuck 0:8f0d0ae0a077 1419 */
dudmuck 0:8f0d0ae0a077 1420 uint8_t ChannelNbRep;
dudmuck 0:8f0d0ae0a077 1421 /*!
dudmuck 0:8f0d0ae0a077 1422 * Maximum receive window duration
dudmuck 0:8f0d0ae0a077 1423 *
dudmuck 0:8f0d0ae0a077 1424 * Related MIB type: \ref MIB_MAX_RX_WINDOW_DURATION
dudmuck 0:8f0d0ae0a077 1425 */
dudmuck 0:8f0d0ae0a077 1426 uint32_t MaxRxWindow;
dudmuck 0:8f0d0ae0a077 1427
dudmuck 0:8f0d0ae0a077 1428 uint32_t ReceiveDelay;
dudmuck 0:8f0d0ae0a077 1429 uint32_t JoinAcceptDelay;
dudmuck 0:8f0d0ae0a077 1430
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_DEFAULT_DATARATE
dudmuck 0:8f0d0ae0a077 1435 */
dudmuck 0:8f0d0ae0a077 1436 int8_t ChannelsDefaultDatarate;
dudmuck 0:8f0d0ae0a077 1437 /*!
dudmuck 0:8f0d0ae0a077 1438 * Channels data rate
dudmuck 0:8f0d0ae0a077 1439 *
dudmuck 0:8f0d0ae0a077 1440 * Related MIB type: \ref MIB_CHANNELS_DATARATE
dudmuck 0:8f0d0ae0a077 1441 */
dudmuck 0:8f0d0ae0a077 1442 int8_t ChannelsDatarate;
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_DEFAULT_TX_POWER
dudmuck 0:8f0d0ae0a077 1447 */
dudmuck 0:8f0d0ae0a077 1448 int8_t ChannelsDefaultTxPower;
dudmuck 0:8f0d0ae0a077 1449 /*!
dudmuck 0:8f0d0ae0a077 1450 * Channels TX power
dudmuck 0:8f0d0ae0a077 1451 *
dudmuck 0:8f0d0ae0a077 1452 * Related MIB type: \ref MIB_CHANNELS_TX_POWER
dudmuck 0:8f0d0ae0a077 1453 */
dudmuck 0:8f0d0ae0a077 1454 int8_t ChannelsTxPower;
dudmuck 0:8f0d0ae0a077 1455 /*!
dudmuck 0:8f0d0ae0a077 1456 * LoRaWAN Up-link counter
dudmuck 0:8f0d0ae0a077 1457 *
dudmuck 0:8f0d0ae0a077 1458 * Related MIB type: \ref MIB_UPLINK_COUNTER
dudmuck 0:8f0d0ae0a077 1459 */
dudmuck 0:8f0d0ae0a077 1460 uint32_t UpLinkCounter;
dudmuck 0:8f0d0ae0a077 1461 /*!
dudmuck 0:8f0d0ae0a077 1462 * LoRaWAN Down-link counter
dudmuck 0:8f0d0ae0a077 1463 *
dudmuck 0:8f0d0ae0a077 1464 * Related MIB type: \ref MIB_DOWNLINK_COUNTER
dudmuck 0:8f0d0ae0a077 1465 */
dudmuck 0:8f0d0ae0a077 1466 uint32_t DownLinkCounter;
dudmuck 0:8f0d0ae0a077 1467 /*!
dudmuck 0:8f0d0ae0a077 1468 * Multicast channel
dudmuck 0:8f0d0ae0a077 1469 *
dudmuck 0:8f0d0ae0a077 1470 * Related MIB type: \ref MIB_MULTICAST_CHANNEL
dudmuck 0:8f0d0ae0a077 1471 */
dudmuck 0:8f0d0ae0a077 1472 MulticastParams_t* MulticastList;
dudmuck 0:8f0d0ae0a077 1473 /*!
dudmuck 0:8f0d0ae0a077 1474 * System overall timing error in milliseconds.
dudmuck 0:8f0d0ae0a077 1475 *
dudmuck 0:8f0d0ae0a077 1476 * Related MIB type: \ref MIB_SYSTEM_MAX_RX_ERROR
dudmuck 0:8f0d0ae0a077 1477 */
dudmuck 0:8f0d0ae0a077 1478 uint32_t SystemMaxRxError;
dudmuck 0:8f0d0ae0a077 1479 /*!
dudmuck 0:8f0d0ae0a077 1480 * Minimum required number of symbols to detect an Rx frame
dudmuck 0:8f0d0ae0a077 1481 *
dudmuck 0:8f0d0ae0a077 1482 * Related MIB type: \ref MIB_MIN_RX_SYMBOLS
dudmuck 0:8f0d0ae0a077 1483 */
dudmuck 0:8f0d0ae0a077 1484 uint8_t MinRxSymbols;
dudmuck 0:8f0d0ae0a077 1485 }MibParam_t;
dudmuck 0:8f0d0ae0a077 1486
dudmuck 0:8f0d0ae0a077 1487 /*!
dudmuck 0:8f0d0ae0a077 1488 * LoRaMAC MIB-RequestConfirm structure
dudmuck 0:8f0d0ae0a077 1489 */
dudmuck 0:8f0d0ae0a077 1490 typedef struct eMibRequestConfirm
dudmuck 0:8f0d0ae0a077 1491 {
dudmuck 0:8f0d0ae0a077 1492 /*!
dudmuck 0:8f0d0ae0a077 1493 * MIB-Request type
dudmuck 0:8f0d0ae0a077 1494 */
dudmuck 0:8f0d0ae0a077 1495 Mib_t Type;
dudmuck 0:8f0d0ae0a077 1496
dudmuck 0:8f0d0ae0a077 1497 /*!
dudmuck 0:8f0d0ae0a077 1498 * MLME-RequestConfirm parameters
dudmuck 0:8f0d0ae0a077 1499 */
dudmuck 0:8f0d0ae0a077 1500 MibParam_t Param;
dudmuck 0:8f0d0ae0a077 1501 }MibRequestConfirm_t;
dudmuck 0:8f0d0ae0a077 1502
dudmuck 0:8f0d0ae0a077 1503 /*!
dudmuck 0:8f0d0ae0a077 1504 * LoRaMAC tx information
dudmuck 0:8f0d0ae0a077 1505 */
dudmuck 0:8f0d0ae0a077 1506 typedef struct sLoRaMacTxInfo
dudmuck 0:8f0d0ae0a077 1507 {
dudmuck 0:8f0d0ae0a077 1508 /*!
dudmuck 0:8f0d0ae0a077 1509 * Defines the size of the applicative payload which can be processed
dudmuck 0:8f0d0ae0a077 1510 */
dudmuck 0:8f0d0ae0a077 1511 uint8_t MaxPossiblePayload;
dudmuck 0:8f0d0ae0a077 1512 /*!
dudmuck 0:8f0d0ae0a077 1513 * The current payload size, dependent on the current datarate
dudmuck 0:8f0d0ae0a077 1514 */
dudmuck 0:8f0d0ae0a077 1515 uint8_t CurrentPayloadSize;
dudmuck 0:8f0d0ae0a077 1516 }LoRaMacTxInfo_t;
dudmuck 0:8f0d0ae0a077 1517
dudmuck 0:8f0d0ae0a077 1518 /*!
dudmuck 0:8f0d0ae0a077 1519 * LoRaMAC Status
dudmuck 0:8f0d0ae0a077 1520 */
dudmuck 0:8f0d0ae0a077 1521 typedef enum eLoRaMacStatus
dudmuck 0:8f0d0ae0a077 1522 {
dudmuck 0:8f0d0ae0a077 1523 /*!
dudmuck 0:8f0d0ae0a077 1524 * Service started successfully
dudmuck 0:8f0d0ae0a077 1525 */
dudmuck 0:8f0d0ae0a077 1526 LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1527 /*!
dudmuck 0:8f0d0ae0a077 1528 * Service not started - LoRaMAC is busy
dudmuck 0:8f0d0ae0a077 1529 */
dudmuck 0:8f0d0ae0a077 1530 LORAMAC_STATUS_BUSY,
dudmuck 0:8f0d0ae0a077 1531 /*!
dudmuck 0:8f0d0ae0a077 1532 * Service unknown
dudmuck 0:8f0d0ae0a077 1533 */
dudmuck 0:8f0d0ae0a077 1534 LORAMAC_STATUS_SERVICE_UNKNOWN,
dudmuck 0:8f0d0ae0a077 1535 /*!
dudmuck 0:8f0d0ae0a077 1536 * Service not started - invalid parameter
dudmuck 0:8f0d0ae0a077 1537 */
dudmuck 0:8f0d0ae0a077 1538 LORAMAC_STATUS_PARAMETER_INVALID,
dudmuck 0:8f0d0ae0a077 1539 /*!
dudmuck 0:8f0d0ae0a077 1540 * Service not started - invalid frequency
dudmuck 0:8f0d0ae0a077 1541 */
dudmuck 0:8f0d0ae0a077 1542 LORAMAC_STATUS_FREQUENCY_INVALID,
dudmuck 0:8f0d0ae0a077 1543 /*!
dudmuck 0:8f0d0ae0a077 1544 * Service not started - invalid datarate
dudmuck 0:8f0d0ae0a077 1545 */
dudmuck 0:8f0d0ae0a077 1546 LORAMAC_STATUS_DATARATE_INVALID,
dudmuck 0:8f0d0ae0a077 1547 /*!
dudmuck 0:8f0d0ae0a077 1548 * Service not started - invalid frequency and datarate
dudmuck 0:8f0d0ae0a077 1549 */
dudmuck 0:8f0d0ae0a077 1550 LORAMAC_STATUS_FREQ_AND_DR_INVALID,
dudmuck 0:8f0d0ae0a077 1551 /*!
dudmuck 0:8f0d0ae0a077 1552 * Service not started - the device is not in a LoRaWAN
dudmuck 0:8f0d0ae0a077 1553 */
dudmuck 0:8f0d0ae0a077 1554 LORAMAC_STATUS_NO_NETWORK_JOINED,
dudmuck 0:8f0d0ae0a077 1555 /*!
dudmuck 0:8f0d0ae0a077 1556 * Service not started - payload lenght error
dudmuck 0:8f0d0ae0a077 1557 */
dudmuck 0:8f0d0ae0a077 1558 LORAMAC_STATUS_LENGTH_ERROR,
dudmuck 0:8f0d0ae0a077 1559 /*!
dudmuck 0:8f0d0ae0a077 1560 * Service not started - payload lenght error
dudmuck 0:8f0d0ae0a077 1561 */
dudmuck 0:8f0d0ae0a077 1562 LORAMAC_STATUS_MAC_CMD_LENGTH_ERROR,
dudmuck 0:8f0d0ae0a077 1563 /*!
dudmuck 0:8f0d0ae0a077 1564 * Service not started - the device is switched off
dudmuck 0:8f0d0ae0a077 1565 */
dudmuck 0:8f0d0ae0a077 1566 LORAMAC_STATUS_DEVICE_OFF,
dudmuck 0:8f0d0ae0a077 1567 }LoRaMacStatus_t;
dudmuck 0:8f0d0ae0a077 1568
dudmuck 0:8f0d0ae0a077 1569 /*!
dudmuck 0:8f0d0ae0a077 1570 * LoRaMAC events structure
dudmuck 0:8f0d0ae0a077 1571 * Used to notify upper layers of MAC events
dudmuck 0:8f0d0ae0a077 1572 */
dudmuck 0:8f0d0ae0a077 1573 typedef struct sLoRaMacPrimitives
dudmuck 0:8f0d0ae0a077 1574 {
dudmuck 0:8f0d0ae0a077 1575 /*!
dudmuck 0:8f0d0ae0a077 1576 * \brief MCPS-Confirm primitive
dudmuck 0:8f0d0ae0a077 1577 *
dudmuck 0:8f0d0ae0a077 1578 * \param [OUT] MCPS-Confirm parameters
dudmuck 0:8f0d0ae0a077 1579 */
dudmuck 0:8f0d0ae0a077 1580 void ( *MacMcpsConfirm )( McpsConfirm_t *McpsConfirm );
dudmuck 0:8f0d0ae0a077 1581 /*!
dudmuck 0:8f0d0ae0a077 1582 * \brief MCPS-Indication primitive
dudmuck 0:8f0d0ae0a077 1583 *
dudmuck 0:8f0d0ae0a077 1584 * \param [OUT] MCPS-Indication parameters
dudmuck 0:8f0d0ae0a077 1585 */
dudmuck 0:8f0d0ae0a077 1586 void ( *MacMcpsIndication )( McpsIndication_t *McpsIndication );
dudmuck 0:8f0d0ae0a077 1587 /*!
dudmuck 0:8f0d0ae0a077 1588 * \brief MLME-Confirm primitive
dudmuck 0:8f0d0ae0a077 1589 *
dudmuck 0:8f0d0ae0a077 1590 * \param [OUT] MLME-Confirm parameters
dudmuck 0:8f0d0ae0a077 1591 */
dudmuck 0:8f0d0ae0a077 1592 void ( *MacMlmeConfirm )( MlmeConfirm_t *MlmeConfirm );
dudmuck 0:8f0d0ae0a077 1593
dudmuck 0:8f0d0ae0a077 1594 /*!
dudmuck 0:8f0d0ae0a077 1595 * \brief MLME-Indication primitive
dudmuck 0:8f0d0ae0a077 1596 *
dudmuck 0:8f0d0ae0a077 1597 * \param [OUT] MLME-Indication parameters
dudmuck 0:8f0d0ae0a077 1598 */
dudmuck 0:8f0d0ae0a077 1599 void ( *MacMlmeIndication )( MlmeIndication_t *MlmeIndication );
dudmuck 0:8f0d0ae0a077 1600 }LoRaMacPrimitives_t;
dudmuck 0:8f0d0ae0a077 1601
dudmuck 0:8f0d0ae0a077 1602 typedef struct sLoRaMacCallback
dudmuck 0:8f0d0ae0a077 1603 {
dudmuck 0:8f0d0ae0a077 1604 /*!
dudmuck 0:8f0d0ae0a077 1605 * \brief Measures the battery level
dudmuck 0:8f0d0ae0a077 1606 *
dudmuck 0:8f0d0ae0a077 1607 * \retval Battery level [0: node is connected to an external
dudmuck 0:8f0d0ae0a077 1608 * power source, 1..254: battery level, where 1 is the minimum
dudmuck 0:8f0d0ae0a077 1609 * and 254 is the maximum value, 255: the node was not able
dudmuck 0:8f0d0ae0a077 1610 * to measure the battery level]
dudmuck 0:8f0d0ae0a077 1611 */
dudmuck 0:8f0d0ae0a077 1612 uint8_t ( *GetBatteryLevel )( void );
dudmuck 0:8f0d0ae0a077 1613 }LoRaMacCallback_t;
dudmuck 0:8f0d0ae0a077 1614
dudmuck 0:8f0d0ae0a077 1615 /*!
dudmuck 0:8f0d0ae0a077 1616 * \brief LoRaMAC layer initialization
dudmuck 0:8f0d0ae0a077 1617 *
dudmuck 0:8f0d0ae0a077 1618 * \details In addition to the initialization of the LoRaMAC layer, this
dudmuck 0:8f0d0ae0a077 1619 * function initializes the callback primitives of the MCPS and
dudmuck 0:8f0d0ae0a077 1620 * MLME services. Every data field of \ref LoRaMacPrimitives_t must be
dudmuck 0:8f0d0ae0a077 1621 * set to a valid callback function.
dudmuck 0:8f0d0ae0a077 1622 *
dudmuck 0:8f0d0ae0a077 1623 * \param [IN] events - Pointer to a structure defining the LoRaMAC
dudmuck 0:8f0d0ae0a077 1624 * event functions. Refer to \ref LoRaMacPrimitives_t.
dudmuck 0:8f0d0ae0a077 1625 *
dudmuck 0:8f0d0ae0a077 1626 * \param [IN] events - Pointer to a structure defining the LoRaMAC
dudmuck 0:8f0d0ae0a077 1627 * callback functions. Refer to \ref LoRaMacCallback_t.
dudmuck 0:8f0d0ae0a077 1628 *
dudmuck 0:8f0d0ae0a077 1629 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
dudmuck 0:8f0d0ae0a077 1630 * returns are:
dudmuck 0:8f0d0ae0a077 1631 * \ref LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1632 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
dudmuck 0:8f0d0ae0a077 1633 */
dudmuck 0:8f0d0ae0a077 1634 LoRaMacStatus_t LoRaMacInitialization( LoRaMacPrimitives_t *primitives, LoRaMacCallback_t *callbacks );
dudmuck 0:8f0d0ae0a077 1635
dudmuck 0:8f0d0ae0a077 1636 /*!
dudmuck 0:8f0d0ae0a077 1637 * \brief Queries the LoRaMAC if it is possible to send the next frame with
dudmuck 0:8f0d0ae0a077 1638 * a given payload size. The LoRaMAC takes scheduled MAC commands into
dudmuck 0:8f0d0ae0a077 1639 * account and reports, when the frame can be send or not.
dudmuck 0:8f0d0ae0a077 1640 *
dudmuck 0:8f0d0ae0a077 1641 * \param [IN] size - Size of applicative payload to be send next
dudmuck 0:8f0d0ae0a077 1642 *
dudmuck 0:8f0d0ae0a077 1643 * \param [OUT] txInfo - The structure \ref LoRaMacTxInfo_t contains
dudmuck 0:8f0d0ae0a077 1644 * information about the actual maximum payload possible
dudmuck 0:8f0d0ae0a077 1645 * ( according to the configured datarate or the next
dudmuck 0:8f0d0ae0a077 1646 * datarate according to ADR ), and the maximum frame
dudmuck 0:8f0d0ae0a077 1647 * size, taking the scheduled MAC commands into account.
dudmuck 0:8f0d0ae0a077 1648 *
dudmuck 0:8f0d0ae0a077 1649 * \retval LoRaMacStatus_t Status of the operation. When the parameters are
dudmuck 0:8f0d0ae0a077 1650 * not valid, the function returns \ref LORAMAC_STATUS_PARAMETER_INVALID.
dudmuck 0:8f0d0ae0a077 1651 * In case of a length error caused by the applicative payload size, the
dudmuck 0:8f0d0ae0a077 1652 * function returns LORAMAC_STATUS_LENGTH_ERROR. In case of a length error
dudmuck 0:8f0d0ae0a077 1653 * due to additional MAC commands in the queue, the function returns
dudmuck 0:8f0d0ae0a077 1654 * LORAMAC_STATUS_MAC_CMD_LENGTH_ERROR. In case the query is valid, and
dudmuck 0:8f0d0ae0a077 1655 * the LoRaMAC is able to send the frame, the function returns LORAMAC_STATUS_OK. *
dudmuck 0:8f0d0ae0a077 1656 */
dudmuck 0:8f0d0ae0a077 1657 LoRaMacStatus_t LoRaMacQueryTxPossible( uint8_t size, LoRaMacTxInfo_t* txInfo );
dudmuck 0:8f0d0ae0a077 1658
dudmuck 0:8f0d0ae0a077 1659 /*!
dudmuck 0:8f0d0ae0a077 1660 * \brief LoRaMAC channel add service
dudmuck 0:8f0d0ae0a077 1661 *
dudmuck 0:8f0d0ae0a077 1662 * \details Adds a new channel to the channel list and activates the id in
dudmuck 0:8f0d0ae0a077 1663 * the channel mask. For the US915 band, all channels are enabled
dudmuck 0:8f0d0ae0a077 1664 * by default. It is not possible to activate less than 6 125 kHz
dudmuck 0:8f0d0ae0a077 1665 * channels.
dudmuck 0:8f0d0ae0a077 1666 *
dudmuck 0:8f0d0ae0a077 1667 * \param [IN] id - Id of the channel. Possible values are:
dudmuck 0:8f0d0ae0a077 1668 *
dudmuck 0:8f0d0ae0a077 1669 * 0-15 for EU868
dudmuck 0:8f0d0ae0a077 1670 * 0-72 for US915
dudmuck 0:8f0d0ae0a077 1671 *
dudmuck 0:8f0d0ae0a077 1672 * \param [IN] params - Channel parameters to set.
dudmuck 0:8f0d0ae0a077 1673 *
dudmuck 0:8f0d0ae0a077 1674 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
dudmuck 0:8f0d0ae0a077 1675 * \ref LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1676 * \ref LORAMAC_STATUS_BUSY,
dudmuck 0:8f0d0ae0a077 1677 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
dudmuck 0:8f0d0ae0a077 1678 */
dudmuck 0:8f0d0ae0a077 1679 LoRaMacStatus_t LoRaMacChannelAdd( uint8_t id, ChannelParams_t params );
dudmuck 0:8f0d0ae0a077 1680
dudmuck 0:8f0d0ae0a077 1681 /*!
dudmuck 0:8f0d0ae0a077 1682 * \brief LoRaMAC channel remove service
dudmuck 0:8f0d0ae0a077 1683 *
dudmuck 0:8f0d0ae0a077 1684 * \details Deactivates the id in the channel mask.
dudmuck 0:8f0d0ae0a077 1685 *
dudmuck 0:8f0d0ae0a077 1686 * \param [IN] id - Id of the channel.
dudmuck 0:8f0d0ae0a077 1687 *
dudmuck 0:8f0d0ae0a077 1688 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
dudmuck 0:8f0d0ae0a077 1689 * \ref LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1690 * \ref LORAMAC_STATUS_BUSY,
dudmuck 0:8f0d0ae0a077 1691 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
dudmuck 0:8f0d0ae0a077 1692 */
dudmuck 0:8f0d0ae0a077 1693 LoRaMacStatus_t LoRaMacChannelRemove( uint8_t id );
dudmuck 0:8f0d0ae0a077 1694
dudmuck 0:8f0d0ae0a077 1695 /*!
dudmuck 0:8f0d0ae0a077 1696 * \brief LoRaMAC multicast channel link service
dudmuck 0:8f0d0ae0a077 1697 *
dudmuck 0:8f0d0ae0a077 1698 * \details Links a multicast channel into the linked list.
dudmuck 0:8f0d0ae0a077 1699 *
dudmuck 0:8f0d0ae0a077 1700 * \param [IN] channelParam - Multicast channel parameters to link.
dudmuck 0:8f0d0ae0a077 1701 *
dudmuck 0:8f0d0ae0a077 1702 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
dudmuck 0:8f0d0ae0a077 1703 * \ref LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1704 * \ref LORAMAC_STATUS_BUSY,
dudmuck 0:8f0d0ae0a077 1705 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
dudmuck 0:8f0d0ae0a077 1706 */
dudmuck 0:8f0d0ae0a077 1707 LoRaMacStatus_t LoRaMacMulticastChannelLink( MulticastParams_t *channelParam );
dudmuck 0:8f0d0ae0a077 1708
dudmuck 0:8f0d0ae0a077 1709 /*!
dudmuck 0:8f0d0ae0a077 1710 * \brief LoRaMAC multicast channel unlink service
dudmuck 0:8f0d0ae0a077 1711 *
dudmuck 0:8f0d0ae0a077 1712 * \details Unlinks a multicast channel from the linked list.
dudmuck 0:8f0d0ae0a077 1713 *
dudmuck 0:8f0d0ae0a077 1714 * \param [IN] channelParam - Multicast channel parameters to unlink.
dudmuck 0:8f0d0ae0a077 1715 *
dudmuck 0:8f0d0ae0a077 1716 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
dudmuck 0:8f0d0ae0a077 1717 * \ref LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1718 * \ref LORAMAC_STATUS_BUSY,
dudmuck 0:8f0d0ae0a077 1719 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
dudmuck 0:8f0d0ae0a077 1720 */
dudmuck 0:8f0d0ae0a077 1721 LoRaMacStatus_t LoRaMacMulticastChannelUnlink( MulticastParams_t *channelParam );
dudmuck 0:8f0d0ae0a077 1722
dudmuck 0:8f0d0ae0a077 1723 /*!
dudmuck 0:8f0d0ae0a077 1724 * \brief LoRaMAC MIB-Get
dudmuck 0:8f0d0ae0a077 1725 *
dudmuck 0:8f0d0ae0a077 1726 * \details The mac information base service to get attributes of the LoRaMac
dudmuck 0:8f0d0ae0a077 1727 * layer.
dudmuck 0:8f0d0ae0a077 1728 *
dudmuck 0:8f0d0ae0a077 1729 * The following code-snippet shows how to use the API to get the
dudmuck 0:8f0d0ae0a077 1730 * parameter AdrEnable, defined by the enumeration type
dudmuck 0:8f0d0ae0a077 1731 * \ref MIB_ADR.
dudmuck 0:8f0d0ae0a077 1732 * \code
dudmuck 0:8f0d0ae0a077 1733 * MibRequestConfirm_t mibReq;
dudmuck 0:8f0d0ae0a077 1734 * mibReq.Type = MIB_ADR;
dudmuck 0:8f0d0ae0a077 1735 *
dudmuck 0:8f0d0ae0a077 1736 * if( LoRaMacMibGetRequestConfirm( &mibReq ) == LORAMAC_STATUS_OK )
dudmuck 0:8f0d0ae0a077 1737 * {
dudmuck 0:8f0d0ae0a077 1738 * // LoRaMAC updated the parameter mibParam.AdrEnable
dudmuck 0:8f0d0ae0a077 1739 * }
dudmuck 0:8f0d0ae0a077 1740 * \endcode
dudmuck 0:8f0d0ae0a077 1741 *
dudmuck 0:8f0d0ae0a077 1742 * \param [IN] mibRequest - MIB-GET-Request to perform. Refer to \ref MibRequestConfirm_t.
dudmuck 0:8f0d0ae0a077 1743 *
dudmuck 0:8f0d0ae0a077 1744 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
dudmuck 0:8f0d0ae0a077 1745 * \ref LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1746 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN,
dudmuck 0:8f0d0ae0a077 1747 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
dudmuck 0:8f0d0ae0a077 1748 */
dudmuck 0:8f0d0ae0a077 1749 LoRaMacStatus_t LoRaMacMibGetRequestConfirm( MibRequestConfirm_t *mibGet );
dudmuck 0:8f0d0ae0a077 1750
dudmuck 0:8f0d0ae0a077 1751 /*!
dudmuck 0:8f0d0ae0a077 1752 * \brief LoRaMAC MIB-Set
dudmuck 0:8f0d0ae0a077 1753 *
dudmuck 0:8f0d0ae0a077 1754 * \details The mac information base service to set attributes of the LoRaMac
dudmuck 0:8f0d0ae0a077 1755 * layer.
dudmuck 0:8f0d0ae0a077 1756 *
dudmuck 0:8f0d0ae0a077 1757 * The following code-snippet shows how to use the API to set the
dudmuck 0:8f0d0ae0a077 1758 * parameter AdrEnable, defined by the enumeration type
dudmuck 0:8f0d0ae0a077 1759 * \ref MIB_ADR.
dudmuck 0:8f0d0ae0a077 1760 *
dudmuck 0:8f0d0ae0a077 1761 * \code
dudmuck 0:8f0d0ae0a077 1762 * MibRequestConfirm_t mibReq;
dudmuck 0:8f0d0ae0a077 1763 * mibReq.Type = MIB_ADR;
dudmuck 0:8f0d0ae0a077 1764 * mibReq.Param.AdrEnable = true;
dudmuck 0:8f0d0ae0a077 1765 *
dudmuck 0:8f0d0ae0a077 1766 * if( LoRaMacMibGetRequestConfirm( &mibReq ) == LORAMAC_STATUS_OK )
dudmuck 0:8f0d0ae0a077 1767 * {
dudmuck 0:8f0d0ae0a077 1768 * // LoRaMAC updated the parameter
dudmuck 0:8f0d0ae0a077 1769 * }
dudmuck 0:8f0d0ae0a077 1770 * \endcode
dudmuck 0:8f0d0ae0a077 1771 *
dudmuck 0:8f0d0ae0a077 1772 * \param [IN] mibRequest - MIB-SET-Request to perform. Refer to \ref MibRequestConfirm_t.
dudmuck 0:8f0d0ae0a077 1773 *
dudmuck 0:8f0d0ae0a077 1774 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
dudmuck 0:8f0d0ae0a077 1775 * \ref LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1776 * \ref LORAMAC_STATUS_BUSY,
dudmuck 0:8f0d0ae0a077 1777 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN,
dudmuck 0:8f0d0ae0a077 1778 * \ref LORAMAC_STATUS_PARAMETER_INVALID.
dudmuck 0:8f0d0ae0a077 1779 */
dudmuck 0:8f0d0ae0a077 1780 LoRaMacStatus_t LoRaMacMibSetRequestConfirm( MibRequestConfirm_t *mibSet );
dudmuck 0:8f0d0ae0a077 1781
dudmuck 0:8f0d0ae0a077 1782 /*!
dudmuck 0:8f0d0ae0a077 1783 * \brief LoRaMAC MLME-Request
dudmuck 0:8f0d0ae0a077 1784 *
dudmuck 0:8f0d0ae0a077 1785 * \details The Mac layer management entity handles management services. The
dudmuck 0:8f0d0ae0a077 1786 * following code-snippet shows how to use the API to perform a
dudmuck 0:8f0d0ae0a077 1787 * network join request.
dudmuck 0:8f0d0ae0a077 1788 *
dudmuck 0:8f0d0ae0a077 1789 * \code
dudmuck 0:8f0d0ae0a077 1790 * static uint8_t DevEui[] =
dudmuck 0:8f0d0ae0a077 1791 * {
dudmuck 0:8f0d0ae0a077 1792 * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
dudmuck 0:8f0d0ae0a077 1793 * };
dudmuck 0:8f0d0ae0a077 1794 * static uint8_t AppEui[] =
dudmuck 0:8f0d0ae0a077 1795 * {
dudmuck 0:8f0d0ae0a077 1796 * 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
dudmuck 0:8f0d0ae0a077 1797 * };
dudmuck 0:8f0d0ae0a077 1798 * static uint8_t AppKey[] =
dudmuck 0:8f0d0ae0a077 1799 * {
dudmuck 0:8f0d0ae0a077 1800 * 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
dudmuck 0:8f0d0ae0a077 1801 * 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
dudmuck 0:8f0d0ae0a077 1802 * };
dudmuck 0:8f0d0ae0a077 1803 *
dudmuck 0:8f0d0ae0a077 1804 * MlmeReq_t mlmeReq;
dudmuck 0:8f0d0ae0a077 1805 * mlmeReq.Type = MLME_JOIN;
dudmuck 0:8f0d0ae0a077 1806 * mlmeReq.Req.Join.DevEui = DevEui;
dudmuck 0:8f0d0ae0a077 1807 * mlmeReq.Req.Join.AppEui = AppEui;
dudmuck 0:8f0d0ae0a077 1808 * mlmeReq.Req.Join.AppKey = AppKey;
dudmuck 0:8f0d0ae0a077 1809 *
dudmuck 0:8f0d0ae0a077 1810 * if( LoRaMacMlmeRequest( &mlmeReq ) == LORAMAC_STATUS_OK )
dudmuck 0:8f0d0ae0a077 1811 * {
dudmuck 0:8f0d0ae0a077 1812 * // Service started successfully. Waiting for the Mlme-Confirm event
dudmuck 0:8f0d0ae0a077 1813 * }
dudmuck 0:8f0d0ae0a077 1814 * \endcode
dudmuck 0:8f0d0ae0a077 1815 *
dudmuck 0:8f0d0ae0a077 1816 * \param [IN] mlmeRequest - MLME-Request to perform. Refer to \ref MlmeReq_t.
dudmuck 0:8f0d0ae0a077 1817 *
dudmuck 0:8f0d0ae0a077 1818 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
dudmuck 0:8f0d0ae0a077 1819 * \ref LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1820 * \ref LORAMAC_STATUS_BUSY,
dudmuck 0:8f0d0ae0a077 1821 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN,
dudmuck 0:8f0d0ae0a077 1822 * \ref LORAMAC_STATUS_PARAMETER_INVALID,
dudmuck 0:8f0d0ae0a077 1823 * \ref LORAMAC_STATUS_NO_NETWORK_JOINED,
dudmuck 0:8f0d0ae0a077 1824 * \ref LORAMAC_STATUS_LENGTH_ERROR,
dudmuck 0:8f0d0ae0a077 1825 * \ref LORAMAC_STATUS_DEVICE_OFF.
dudmuck 0:8f0d0ae0a077 1826 */
dudmuck 0:8f0d0ae0a077 1827 LoRaMacStatus_t LoRaMacMlmeRequest( MlmeReq_t *mlmeRequest );
dudmuck 0:8f0d0ae0a077 1828
dudmuck 0:8f0d0ae0a077 1829 /*!
dudmuck 0:8f0d0ae0a077 1830 * \brief LoRaMAC MCPS-Request
dudmuck 0:8f0d0ae0a077 1831 *
dudmuck 0:8f0d0ae0a077 1832 * \details The Mac Common Part Sublayer handles data services. The following
dudmuck 0:8f0d0ae0a077 1833 * code-snippet shows how to use the API to send an unconfirmed
dudmuck 0:8f0d0ae0a077 1834 * LoRaMAC frame.
dudmuck 0:8f0d0ae0a077 1835 *
dudmuck 0:8f0d0ae0a077 1836 * \code
dudmuck 0:8f0d0ae0a077 1837 * uint8_t myBuffer[] = { 1, 2, 3 };
dudmuck 0:8f0d0ae0a077 1838 *
dudmuck 0:8f0d0ae0a077 1839 * McpsReq_t mcpsReq;
dudmuck 0:8f0d0ae0a077 1840 * mcpsReq.Type = MCPS_UNCONFIRMED;
dudmuck 0:8f0d0ae0a077 1841 * mcpsReq.Req.Unconfirmed.fPort = 1;
dudmuck 0:8f0d0ae0a077 1842 * mcpsReq.Req.Unconfirmed.fBuffer = myBuffer;
dudmuck 0:8f0d0ae0a077 1843 * mcpsReq.Req.Unconfirmed.fBufferSize = sizeof( myBuffer );
dudmuck 0:8f0d0ae0a077 1844 *
dudmuck 0:8f0d0ae0a077 1845 * if( LoRaMacMcpsRequest( &mcpsReq ) == LORAMAC_STATUS_OK )
dudmuck 0:8f0d0ae0a077 1846 * {
dudmuck 0:8f0d0ae0a077 1847 * // Service started successfully. Waiting for the MCPS-Confirm event
dudmuck 0:8f0d0ae0a077 1848 * }
dudmuck 0:8f0d0ae0a077 1849 * \endcode
dudmuck 0:8f0d0ae0a077 1850 *
dudmuck 0:8f0d0ae0a077 1851 * \param [IN] mcpsRequest - MCPS-Request to perform. Refer to \ref McpsReq_t.
dudmuck 0:8f0d0ae0a077 1852 *
dudmuck 0:8f0d0ae0a077 1853 * \retval LoRaMacStatus_t Status of the operation. Possible returns are:
dudmuck 0:8f0d0ae0a077 1854 * \ref LORAMAC_STATUS_OK,
dudmuck 0:8f0d0ae0a077 1855 * \ref LORAMAC_STATUS_BUSY,
dudmuck 0:8f0d0ae0a077 1856 * \ref LORAMAC_STATUS_SERVICE_UNKNOWN,
dudmuck 0:8f0d0ae0a077 1857 * \ref LORAMAC_STATUS_PARAMETER_INVALID,
dudmuck 0:8f0d0ae0a077 1858 * \ref LORAMAC_STATUS_NO_NETWORK_JOINED,
dudmuck 0:8f0d0ae0a077 1859 * \ref LORAMAC_STATUS_LENGTH_ERROR,
dudmuck 0:8f0d0ae0a077 1860 * \ref LORAMAC_STATUS_DEVICE_OFF.
dudmuck 0:8f0d0ae0a077 1861 */
dudmuck 0:8f0d0ae0a077 1862 LoRaMacStatus_t LoRaMacMcpsRequest( McpsReq_t *mcpsRequest );
dudmuck 0:8f0d0ae0a077 1863
dudmuck 0:8f0d0ae0a077 1864 /*! \} defgroup LORAMAC */
dudmuck 0:8f0d0ae0a077 1865
dudmuck 0:8f0d0ae0a077 1866 void loramac_print_status(void);
dudmuck 0:8f0d0ae0a077 1867
dudmuck 20:42839629a5dc 1868 void LoRaMacBottomHalf(void);
dudmuck 20:42839629a5dc 1869
dudmuck 0:8f0d0ae0a077 1870 #endif // __LORAMAC_H__