| SX126x-Arduino 2.0.1

Macros | Enumerations | Functions | Variables
LoRaMac.cpp File Reference
`#include "boards/mcu/board.h"`
`#include "system/utilities.h"`
`#include "LoRaMac.h"`
`#include "region/Region.h"`
`#include "LoRaMacCrypto.h"`
`#include "LoRaMacTest.h"`

## Macros
#define | LORAMAC_PHY_MAXPAYLOAD 255
#define | LORA_MAC_COMMAND_MAX_LENGTH 128
#define | LORA_MAC_COMMAND_MAX_FOPTS_LENGTH 15
#define | BACKOFF_DC_1_HOUR 100
#define | BACKOFF_DC_10_HOURS 1000
#define | BACKOFF_DC_24_HOURS 10000

## Enumerations
enum | eLoRaMacState { LORAMAC_IDLE = 0x00000000, LORAMAC_TX_RUNNING = 0x00000001, LORAMAC_RX = 0x00000002, LORAMAC_ACK_REQ = 0x00000004, LORAMAC_ACK_RETRY = 0x00000008, LORAMAC_TX_DELAYED = 0x00000010, LORAMAC_TX_CONFIG = 0x00000020, LORAMAC_RX_ABORT = 0x00000040 }

## Functions
static void | OnRadioTxDone (void)
| Function to be executed on Radio Tx Done event. More...
static void | PrepareRxDoneAbort (void)
| This function prepares the MAC to abort the execution of function OnRadioRxDone in case of a reception error. More...
static void | OnRadioRxDone (uint8_t *payload, uint16_t size, int16_t rssi, int8_t snr)
| Function to be executed on Radio Rx Done event. More...
static void | OnRadioTxTimeout (void)
| Function executed on Radio Tx Timeout event. More...
static void | OnRadioRxError (void)
| Function executed on Radio Rx error event. More...
static void | OnRadioRxTimeout (void)
| Function executed on Radio Rx Timeout event. More...
static void | OnMacStateCheckTimerEvent (void)
| Function executed on Resend Frame timer event. More...
static void | OnTxDelayedTimerEvent (void)
| Function executed on duty cycle delayed Tx timer event. More...
static void | OnRxWindow1TimerEvent (void)
| Function executed on first Rx window timer event. More...
static void | OnRxWindow2TimerEvent (void)
| Function executed on second Rx window timer event. More...
static void | OnAckTimeoutTimerEvent (void)
| Function executed on AckTimeout timer event. More...
static void | RxWindowSetup (bool rxContinuous, uint32_t maxRxWindow)
| Initializes and opens the reception window. More...
static LoRaMacStatus_t | AddMacCommand (uint8_t cmd, uint8_t p1, uint8_t p2)
| Adds a new MAC command to be sent. More...
static uint8_t | ParseMacCommandsToRepeat (uint8_t *cmdBufIn, uint8_t length, uint8_t *cmdBufOut)
| Parses the MAC commands which must be repeated. More...
static bool | ValidatePayloadLength (uint8_t lenN, int8_t datarate, uint8_t fOptsLen)
| Validates if the payload fits into the frame, taking the datarate into account. More...
static void | ProcessMacCommands (uint8_t *payload, uint8_t macIndex, uint8_t commandsSize, uint8_t snr)
| Decodes MAC commands in the fOpts field and in the payload. More...
LoRaMacStatus_t | Send (LoRaMacHeader_t *macHdr, uint8_t fPort, void *fBuffer, uint16_t fBufferSize)
| LoRaMAC layer generic send frame. More...
LoRaMacStatus_t | PrepareFrame (LoRaMacHeader_t *macHdr, LoRaMacFrameCtrl_t *fCtrl, uint8_t fPort, void *fBuffer, uint16_t fBufferSize)
| LoRaMAC layer frame buffer initialization. More...
static LoRaMacStatus_t | ScheduleTx (void)
static void | CalculateBackOff (uint8_t channel)
LoRaMacStatus_t | SendFrameOnChannel (uint8_t channel)
| LoRaMAC layer prepared frame buffer transmission with channel specification. More...
LoRaMacStatus_t | SetTxContinuousWave (uint16_t timeout)
| Sets the radio in continuous transmission mode. More...
LoRaMacStatus_t | SetTxContinuousWave1 (uint16_t timeout, uint32_t frequency, uint8_t power)
| Sets the radio in continuous transmission mode. More...
static void | ResetMacParameters (void)
| Resets MAC specific parameters to default. More...
LoRaMacStatus_t | LoRaMacInitialization (LoRaMacPrimitives_t *primitives, LoRaMacCallback_t *callbacks, LoRaMacRegion_t region, eDeviceClass nodeClass)
| LoRaMAC layer initialization. More...
LoRaMacStatus_t | LoRaMacQueryTxPossible (uint8_t size, LoRaMacTxInfo_t *txInfo)
| Queries the LoRaMAC if it is possible to send the next frame with a given payload size. The LoRaMAC takes scheduled MAC commands into account and reports, when the frame can be send or not. More...
LoRaMacStatus_t | LoRaMacMibGetRequestConfirm (MibRequestConfirm_t *mibGet)
| LoRaMAC MIB-Get. More...
LoRaMacStatus_t | LoRaMacMibSetRequestConfirm (MibRequestConfirm_t *mibSet)
| LoRaMAC MIB-Set. More...
LoRaMacStatus_t | LoRaMacChannelAdd (uint8_t id, ChannelParams_t params)
| LoRaMAC channel add service. More...
LoRaMacStatus_t | LoRaMacChannelRemove (uint8_t id)
| LoRaMAC channel remove service. More...
LoRaMacStatus_t | LoRaMacMulticastChannelLink (MulticastParams_t *channelParam)
| LoRaMAC multicast channel link service. More...
LoRaMacStatus_t | LoRaMacMulticastChannelUnlink (MulticastParams_t *channelParam)
| LoRaMAC multicast channel unlink service. More...
LoRaMacStatus_t | LoRaMacMlmeRequest (MlmeReq_t *mlmeRequest)
| LoRaMAC MLME-Request. More...
LoRaMacStatus_t | LoRaMacMcpsRequest (McpsReq_t *mcpsRequest)
| LoRaMAC MCPS-Request. More...
void | LoRaMacTestRxWindowsOn (bool enable)
| Enabled or disables the reception windows. More...
void | LoRaMacTestSetMic (uint16_t txPacketCounter)
| Enables the MIC field test. More...
void | LoRaMacTestSetDutyCycleOn (bool enable)
| Enabled or disables the duty cycle. More...
void | LoRaMacTestSetChannel (uint8_t channel)
| Sets the channel index. More...
uint32_t | LoRaMacGetOTAADevId (void)
| Returns the Device Address set by the LoRaWan server after OTAA join was successful. More...

## Variables
bool | lmh_mac_is_busy
LoRaMacRegion_t | LoRaMacRegion
bool | singleChannelGateway
uint8_t | singleChannelSelected
int8_t | singleChannelDatarate
static uint8_t * | LoRaMacDevEui
static uint8_t * | LoRaMacAppEui
static uint8_t * | LoRaMacAppKey
static uint8_t | LoRaMacNwkSKey []
static uint8_t | LoRaMacAppSKey []
static uint16_t | LoRaMacDevNonce
static uint32_t | LoRaMacNetID
static uint32_t | LoRaMacDevAddr
static MulticastParams_t * | MulticastChannels = NULL
static DeviceClass_t | LoRaMacDeviceClass
static bool | PublicNetwork
static bool | RepeaterSupport
static uint8_t | LoRaMacBuffer [LORAMAC_PHY_MAXPAYLOAD]
static uint16_t | LoRaMacBufferPktLen = 0
static uint8_t | LoRaMacTxPayloadLen = 0
static uint8_t | LoRaMacRxPayload [LORAMAC_PHY_MAXPAYLOAD]
static uint32_t | UpLinkCounter = 0
static uint32_t | DownLinkCounter = 0
static bool | IsUpLinkCounterFixed = false
static bool | IsRxWindowsEnabled = true
eJoinStatus_t | IsLoRaMacNetworkJoined = JOIN_NOT_START
static bool | AdrCtrlOn = false
static uint32_t | AdrAckCounter = 0
static bool | NodeAckRequested = false
static bool | SrvAckRequested = false
static bool | MacCommandsInNextTx = false
static uint8_t | MacCommandsBufferIndex = 0
static uint8_t | MacCommandsBufferToRepeatIndex = 0
static uint8_t | MacCommandsBuffer [LORA_MAC_COMMAND_MAX_LENGTH]
static uint8_t | MacCommandsBufferToRepeat [LORA_MAC_COMMAND_MAX_LENGTH]
LoRaMacParams_t | LoRaMacParams
LoRaMacParams_t | LoRaMacParamsDefaults
static uint8_t | ChannelsNbRepCounter = 0
static uint8_t | MaxDCycle = 0
static uint16_t | AggregatedDCycle
static TimerTime_t | AggregatedLastTxDoneTime
static TimerTime_t | AggregatedTimeOff
static bool | DutyCycleOn
static uint8_t | Channel
static uint8_t | LastTxChannel
static bool | LastTxIsJoinRequest
static TimerTime_t | LoRaMacInitializationTime = 0
uint32_t | LoRaMacState = LORAMAC_IDLE
static TimerEvent_t | MacStateCheckTimer
static LoRaMacPrimitives_t * | LoRaMacPrimitives
static LoRaMacCallback_t * | LoRaMacCallbacks
static RadioEvents_t | RadioEvents
static TimerEvent_t | TxDelayedTimer
static TimerEvent_t | RxWindowTimer1
static TimerEvent_t | RxWindowTimer2
static uint32_t | RxWindow1Delay
static uint32_t | RxWindow2Delay
static RxConfigParams_t | RxWindow1Config
static RxConfigParams_t | RxWindow2Config
static TimerEvent_t | AckTimeoutTimer
static uint8_t | AckTimeoutRetries = 1
static uint8_t | AckTimeoutRetriesCounter = 1
static bool | AckTimeoutRetry = false
TimerTime_t | TxTimeOnAir = 0
static uint8_t | JoinRequestTrials
static uint8_t | MaxJoinRequestTrials
static McpsIndication_t | McpsIndication
static McpsConfirm_t | McpsConfirm
static MlmeConfirm_t | MlmeConfirm
static uint8_t | RxSlot = 0
LoRaMacFlags_t | LoRaMacFlags

## Macro Definition Documentation

## ◆ LORAMAC_PHY_MAXPAYLOAD

#define LORAMAC_PHY_MAXPAYLOAD 255

Maximum PHY layer payload size

## ◆ LORA_MAC_COMMAND_MAX_LENGTH

#define LORA_MAC_COMMAND_MAX_LENGTH 128

Maximum MAC commands buffer size

## ◆ LORA_MAC_COMMAND_MAX_FOPTS_LENGTH

#define LORA_MAC_COMMAND_MAX_FOPTS_LENGTH 15

Maximum length of the fOpts field

## ◆ BACKOFF_DC_1_HOUR

#define BACKOFF_DC_1_HOUR 100

LoRaMac duty cycle for the back-off procedure during the first hour.

## ◆ BACKOFF_DC_10_HOURS

#define BACKOFF_DC_10_HOURS 1000

LoRaMac duty cycle for the back-off procedure during the next 10 hours.

## ◆ BACKOFF_DC_24_HOURS

#define BACKOFF_DC_24_HOURS 10000

LoRaMac duty cycle for the back-off procedure during the next 24 hours.

## Enumeration Type Documentation

## ◆ eLoRaMacState

enum eLoRaMacState

LoRaMac internal states

Enumerator
LORAMAC_IDLE |
LORAMAC_TX_RUNNING |
LORAMAC_RX |
LORAMAC_ACK_REQ |
LORAMAC_ACK_RETRY |
LORAMAC_TX_DELAYED |
LORAMAC_TX_CONFIG |
LORAMAC_RX_ABORT |

## Function Documentation

## ◆ OnRadioTxDone()

static void OnRadioTxDone | ( | void |  | ) |
| static

Function to be executed on Radio Tx Done event.

## ◆ PrepareRxDoneAbort()

static void PrepareRxDoneAbort | ( | void |  | ) |
| static

This function prepares the MAC to abort the execution of function OnRadioRxDone in case of a reception error.

## ◆ OnRadioRxDone()

static void OnRadioRxDone | ( | uint8_t * | payload,
|  | uint16_t | size,
|  | int16_t | rssi,
|  | int8_t | snr
| ) |  |
| static

Function to be executed on Radio Rx Done event.

Todo:
  need callback for confirmed down

## ◆ OnRadioTxTimeout()

static void OnRadioTxTimeout | ( | void |  | ) |
| static

Function executed on Radio Tx Timeout event.

## ◆ OnRadioRxError()

static void OnRadioRxError | ( | void |  | ) |
| static

Function executed on Radio Rx error event.

## ◆ OnRadioRxTimeout()

static void OnRadioRxTimeout | ( | void |  | ) |
| static

Function executed on Radio Rx Timeout event.

## ◆ OnMacStateCheckTimerEvent()

static void OnMacStateCheckTimerEvent | ( | void |  | ) |
| static

Function executed on Resend Frame timer event.

## ◆ OnTxDelayedTimerEvent()

static void OnTxDelayedTimerEvent | ( | void |  | ) |
| static

Function executed on duty cycle delayed Tx timer event.

## ◆ OnRxWindow1TimerEvent()

static void OnRxWindow1TimerEvent | ( | void |  | ) |
| static

Function executed on first Rx window timer event.

## ◆ OnRxWindow2TimerEvent()

static void OnRxWindow2TimerEvent | ( | void |  | ) |
| static

Function executed on second Rx window timer event.

## ◆ OnAckTimeoutTimerEvent()

static void OnAckTimeoutTimerEvent | ( | void |  | ) |
| static

Function executed on AckTimeout timer event.

## ◆ RxWindowSetup()

static void RxWindowSetup | ( | bool | rxContinuous,
|  | uint32_t | maxRxWindow
| ) |  |
| static

Initializes and opens the reception window.

Parameters

  rxContinuous | Set to true, if the RX is in continuous mode
  maxRxWindow | Maximum RX window timeout

## ◆ AddMacCommand()

static LoRaMacStatus_t AddMacCommand | ( | uint8_t | cmd,
|  | uint8_t | p1,
|  | uint8_t | p2
| ) |  |
| static

Adds a new MAC command to be sent.

Remarks
  MAC layer internal function

Parameters

  cmd | MAC command to be added [MOTE_MAC_LINK_CHECK_REQ, MOTE_MAC_LINK_ADR_ANS, MOTE_MAC_DUTY_CYCLE_ANS, MOTE_MAC_RX2_PARAM_SET_ANS, MOTE_MAC_DEV_STATUS_ANS MOTE_MAC_NEW_CHANNEL_ANS]
  p1 | 1st parameter ( optional depends on the command )
  p2 | 2nd parameter ( optional depends on the command )

Return values

  status | Function status [0: OK, 1: Unknown command, 2: Buffer full]

## ◆ ParseMacCommandsToRepeat()

static uint8_t ParseMacCommandsToRepeat | ( | uint8_t * | cmdBufIn,
|  | uint8_t | length,
|  | uint8_t * | cmdBufOut
| ) |  |
| static

Parses the MAC commands which must be repeated.

Remarks
  MAC layer internal function

Parameters

  cmdBufIn | Buffer which stores the MAC commands to send
  length | Length of the input buffer to parse
  cmdBufOut | Buffer which stores the MAC commands which must be repeated.

Return values

  Size | of the MAC commands to repeat.

## ◆ ValidatePayloadLength()

static bool ValidatePayloadLength | ( | uint8_t | lenN,
|  | int8_t | datarate,
|  | uint8_t | fOptsLen
| ) |  |
| static

Validates if the payload fits into the frame, taking the datarate into account.

Refer to chapter 4.3.2 of the LoRaWAN specification, v1.0

Parameters

  lenN | Length of the application payload. The length depends on the datarate and is region specific
  datarate | Current datarate
  fOptsLen | Length of the fOpts field

Return values

  [false | payload does not fit into the frame, true: payload fits into the frame]

## ◆ ProcessMacCommands()

static void ProcessMacCommands | ( | uint8_t * | payload,
|  | uint8_t | macIndex,
|  | uint8_t | commandsSize,
|  | uint8_t | snr
| ) |  |
| static

Decodes MAC commands in the fOpts field and in the payload.

## ◆ Send()

LoRaMacStatus_t Send | ( | LoRaMacHeader_t * | macHdr,
|  | uint8_t | fPort,
|  | void * | fBuffer,
|  | uint16_t | fBufferSize
| ) |  |

LoRaMAC layer generic send frame.

Parameters

  macHdr | MAC header field
  fPort | MAC payload port
  fBuffer | MAC data buffer to be sent
  fBufferSize | MAC data buffer size

Return values

  status | Status of the operation.

## ◆ PrepareFrame()

LoRaMacStatus_t PrepareFrame | ( | LoRaMacHeader_t * | macHdr,
|  | LoRaMacFrameCtrl_t * | fCtrl,
|  | uint8_t | fPort,
|  | void * | fBuffer,
|  | uint16_t | fBufferSize
| ) |  |

LoRaMAC layer frame buffer initialization.

Parameters

  macHdr | MAC header field
  fCtrl | MAC frame control field
  fPort | MAC payload port
  fBuffer | MAC data buffer to be sent
  fBufferSize | MAC data buffer size

Return values

  status | Status of the operation.

## ◆ ScheduleTx()

static LoRaMacStatus_t ScheduleTx | ( | void |  | ) |
| static

## ◆ CalculateBackOff()

static void CalculateBackOff | ( | uint8_t | channel | ) |
| static

## ◆ SendFrameOnChannel()

LoRaMacStatus_t SendFrameOnChannel | ( | uint8_t | channel | ) |

LoRaMAC layer prepared frame buffer transmission with channel specification.

Remarks
  PrepareFrame must be called at least once before calling this function.

Parameters

  channel | Channel to transmit on

Return values

  status | Status of the operation.

## ◆ SetTxContinuousWave()

LoRaMacStatus_t SetTxContinuousWave | ( | uint16_t | timeout | ) |

Sets the radio in continuous transmission mode.

Remarks
  Uses the radio parameters set on the previous transmission.

Parameters

  timeout | Time in seconds while the radio is kept in continuous wave mode

Return values

  status | Status of the operation.

## ◆ SetTxContinuousWave1()

LoRaMacStatus_t SetTxContinuousWave1 | ( | uint16_t | timeout,
|  | uint32_t | frequency,
|  | uint8_t | power
| ) |  |

Sets the radio in continuous transmission mode.

Remarks
  Uses the radio parameters set on the previous transmission.

Parameters

  timeout | Time in seconds while the radio is kept in continuous wave mode
  frequency | RF frequency to be set.
  power | RF output power to be set.

Return values

  status | Status of the operation.

## ◆ ResetMacParameters()

static void ResetMacParameters | ( | void |  | ) |
| static

Resets MAC specific parameters to default.

## Variable Documentation

## ◆ lmh_mac_is_busy

bool lmh_mac_is_busy

## ◆ singleChannelGateway

bool singleChannelGateway

Flag if connection is to a single channel gateway

## ◆ singleChannelSelected

uint8_t singleChannelSelected

Channel to be used to communicate with a single channel gateway

## ◆ singleChannelDatarate

int8_t singleChannelDatarate

Datarate to be used to communicate with a single channel gateway

## ◆ LoRaMacDevEui

uint8_t* LoRaMacDevEui
| static

Device IEEE EUI

## ◆ LoRaMacAppEui

uint8_t* LoRaMacAppEui
| static

Application IEEE EUI

## ◆ LoRaMacAppKey

uint8_t* LoRaMacAppKey
| static

AES encryption/decryption cipher application key

## ◆ LoRaMacNwkSKey

uint8_t LoRaMacNwkSKey[]
| static

Initial value:
=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

AES encryption/decryption cipher network session key

## ◆ LoRaMacAppSKey

uint8_t LoRaMacAppSKey[]
| static

Initial value:
=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

AES encryption/decryption cipher application session key

## ◆ LoRaMacDevNonce

uint16_t LoRaMacDevNonce
| static

Device nonce is a random value extracted by issuing a sequence of RSSI measurements

## ◆ LoRaMacNetID

uint32_t LoRaMacNetID
| static

Network ID ( 3 bytes )

## ◆ LoRaMacDevAddr

uint32_t LoRaMacDevAddr
| static

Mote Address

## ◆ MulticastChannels

MulticastParams_t* MulticastChannels = NULL
| static

Multicast channels linked list

## ◆ LoRaMacDeviceClass

DeviceClass_t LoRaMacDeviceClass
| static

Actual device class

## ◆ PublicNetwork

bool PublicNetwork
| static

Indicates if the node is connected to a private or public network

## ◆ RepeaterSupport

bool RepeaterSupport
| static

Indicates if the node supports repeaters

## ◆ LoRaMacBuffer

uint8_t LoRaMacBuffer[LORAMAC_PHY_MAXPAYLOAD]
| static

Buffer containing the data to be sent or received.

## ◆ LoRaMacBufferPktLen

uint16_t LoRaMacBufferPktLen = 0
| static

Length of packet in LoRaMacBuffer

## ◆ LoRaMacTxPayloadLen

uint8_t LoRaMacTxPayloadLen = 0
| static

Length of the payload in LoRaMacBuffer

## ◆ LoRaMacRxPayload

uint8_t LoRaMacRxPayload[LORAMAC_PHY_MAXPAYLOAD]
| static

Buffer containing the upper layer data.

## ◆ UpLinkCounter

uint32_t UpLinkCounter = 0
| static

LoRaMAC frame counter. Each time a packet is sent the counter is incremented. Only the 16 LSB bits are sent

## ◆ DownLinkCounter

uint32_t DownLinkCounter = 0
| static

LoRaMAC frame counter. Each time a packet is received the counter is incremented. Only the 16 LSB bits are received

## ◆ IsUpLinkCounterFixed

bool IsUpLinkCounterFixed = false
| static

IsPacketCounterFixed enables the MIC field tests by fixing the UpLinkCounter value

## ◆ IsRxWindowsEnabled

bool IsRxWindowsEnabled = true
| static

Used for test purposes. Disables the opening of the reception windows.

## ◆ IsLoRaMacNetworkJoined

eJoinStatus_t IsLoRaMacNetworkJoined = JOIN_NOT_START

Indicates if the MAC layer has already joined a network.

## ◆ AdrCtrlOn

bool AdrCtrlOn = false
| static

LoRaMac ADR control status

## ◆ AdrAckCounter

uint32_t AdrAckCounter = 0
| static

Counts the number of missed ADR acknowledgements

## ◆ NodeAckRequested

bool NodeAckRequested = false
| static

If the node has sent a FRAME_TYPE_DATA_CONFIRMED_UP this variable indicates if the nodes needs to manage the server acknowledgement.

## ◆ SrvAckRequested

bool SrvAckRequested = false
| static

If the server has sent a FRAME_TYPE_DATA_CONFIRMED_DOWN this variable indicates if the ACK bit must be set for the next transmission

## ◆ MacCommandsInNextTx

bool MacCommandsInNextTx = false
| static

Indicates if the MAC layer wants to send MAC commands

## ◆ MacCommandsBufferIndex

uint8_t MacCommandsBufferIndex = 0
| static

Contains the current MacCommandsBuffer index

## ◆ MacCommandsBufferToRepeatIndex

uint8_t MacCommandsBufferToRepeatIndex = 0
| static

Contains the current MacCommandsBuffer index for MAC commands to repeat

## ◆ MacCommandsBuffer

uint8_t MacCommandsBuffer[LORA_MAC_COMMAND_MAX_LENGTH]
| static

Buffer containing the MAC layer commands

## ◆ MacCommandsBufferToRepeat

uint8_t MacCommandsBufferToRepeat[LORA_MAC_COMMAND_MAX_LENGTH]
| static

Buffer containing the MAC layer commands which must be repeated

## ◆ LoRaMacParams

LoRaMacParams_t LoRaMacParams

LoRaMac parameters

## ◆ LoRaMacParamsDefaults

LoRaMacParams_t LoRaMacParamsDefaults

LoRaMac default parameters

## ◆ ChannelsNbRepCounter

uint8_t ChannelsNbRepCounter = 0
| static

Uplink messages repetitions counter

## ◆ MaxDCycle

uint8_t MaxDCycle = 0
| static

Maximum duty cycle

Remarks
  Possibility to shutdown the device.

## ◆ AggregatedDCycle

uint16_t AggregatedDCycle
| static

Aggregated duty cycle management

## ◆ AggregatedLastTxDoneTime

TimerTime_t AggregatedLastTxDoneTime
| static

## ◆ AggregatedTimeOff

TimerTime_t AggregatedTimeOff
| static

## ◆ DutyCycleOn

bool DutyCycleOn
| static

Enables/Disables duty cycle management (Test only)

## ◆ Channel

uint8_t Channel
| static

Current channel index

## ◆ LastTxChannel

uint8_t LastTxChannel
| static

Current channel index

## ◆ LastTxIsJoinRequest

bool LastTxIsJoinRequest
| static

Set to true, if the last uplink was a join request

## ◆ LoRaMacInitializationTime

TimerTime_t LoRaMacInitializationTime = 0
| static

Stores the time at LoRaMac initialization.

Remarks
  Used for the BACKOFF_DC computation.

## ◆ LoRaMacState

uint32_t LoRaMacState = LORAMAC_IDLE

LoRaMac internal state

## ◆ MacStateCheckTimer

TimerEvent_t MacStateCheckTimer
| static

LoRaMac timer used to check the LoRaMacState (runs every second)

## ◆ LoRaMacPrimitives

LoRaMacPrimitives_t* LoRaMacPrimitives
| static

LoRaMac upper layer event functions

## ◆ LoRaMacCallbacks

LoRaMacCallback_t* LoRaMacCallbacks
| static

LoRaMac upper layer callback functions

## ◆ RadioEvents

RadioEvents_t RadioEvents
| static

Radio events function pointer

Examples
  Sensor-Gateway-Deepsleep\LoRa-Gateway\src\main.cpp, and Sensor-Gateway-Deepsleep\LoRa-TempSensor\src\main.cpp.

## ◆ TxDelayedTimer

TimerEvent_t TxDelayedTimer
| static

LoRaMac duty cycle delayed Tx timer

## ◆ RxWindowTimer1

TimerEvent_t RxWindowTimer1
| static

LoRaMac reception windows timers

## ◆ RxWindowTimer2

TimerEvent_t RxWindowTimer2
| static

## ◆ RxWindow1Delay

uint32_t RxWindow1Delay
| static

LoRaMac reception windows delay

Remarks
  normal frame: RxWindowXDelay = ReceiveDelayX - RADIO_WAKEUP_TIME join frame : RxWindowXDelay = JoinAcceptDelayX - RADIO_WAKEUP_TIME

## ◆ RxWindow2Delay

uint32_t RxWindow2Delay
| static

## ◆ RxWindow1Config

RxConfigParams_t RxWindow1Config
| static

LoRaMac Rx windows configuration

## ◆ RxWindow2Config

RxConfigParams_t RxWindow2Config
| static

## ◆ AckTimeoutTimer

TimerEvent_t AckTimeoutTimer
| static

Acknowledge timeout timer. Used for packet retransmissions.

## ◆ AckTimeoutRetries

uint8_t AckTimeoutRetries = 1
| static

Number of trials to get a frame acknowledged

## ◆ AckTimeoutRetriesCounter

uint8_t AckTimeoutRetriesCounter = 1
| static

Number of trials to get a frame acknowledged

## ◆ AckTimeoutRetry

bool AckTimeoutRetry = false
| static

Indicates if the AckTimeout timer has expired or not

## ◆ TxTimeOnAir

TimerTime_t TxTimeOnAir = 0

Last transmission time on air

## ◆ JoinRequestTrials

uint8_t JoinRequestTrials
| static

Number of trials for the Join Request

## ◆ MaxJoinRequestTrials

uint8_t MaxJoinRequestTrials
| static

Maximum number of trials for the Join Request

## ◆ McpsIndication

McpsIndication_t McpsIndication
| static

Structure to hold an MCPS indication data.

## ◆ McpsConfirm

McpsConfirm_t McpsConfirm
| static

Structure to hold MCPS confirm data.

## ◆ MlmeConfirm

MlmeConfirm_t MlmeConfirm
| static

Structure to hold MLME confirm data.

## ◆ RxSlot

uint8_t RxSlot = 0
| static

Holds the current rx window slot

## ◆ LoRaMacFlags

LoRaMacFlags_t LoRaMacFlags

LoRaMac tx/rx operation state