SX126x-Arduino
Functions | Variables
LoRaMacHelper.cpp File Reference
#include "LoRaMacHelper.h"
#include "region/RegionCommon.h"
#include "system/utilities.h"

Functions

void lmh_setDevEui (uint8_t userDevEui[])
 
void lmh_setAppEui (uint8_t *userAppEui)
 Set Application IEEE EUI. More...
 
void lmh_setAppKey (uint8_t *userAppKey)
 Set Application Key AES encryption/decryption cipher application key. More...
 
void lmh_setNwkSKey (uint8_t *userNwkSKey)
 Set Network Session Key AES encryption/decryption cipher network session key. More...
 
void lmh_setAppSKey (uint8_t *userAppSKey)
 Set Application Session Key AES encryption/decryption cipher application session key. More...
 
void lmh_setDevAddr (uint32_t userDevAddr)
 Set Device address on the network (big endian) More...
 
void lmh_setSingleChannelGateway (uint8_t userSingleChannel, int8_t userDatarate)
 Disable channel hoping for connnection to single channel gateways Check the file CHANNELS.MD to find out which channel corresponds to which frequency in a specific region Check the file Region.h to find out which datarate corresponds to which SF and bandwidth in a specific region. More...
 
bool lmh_setSubBandChannels (uint8_t subBand)
 Set custom channel mask. More...
 
static bool compliance_test_tx (void)
 
static void OnComplianceTestTxNextPacketTimerEvent (void)
 Function executed on TxNextPacket Timeout event. More...
 
static void McpsConfirm (McpsConfirm_t *mcpsConfirm)
 MCPS-Confirm event function. More...
 
static void McpsIndication (McpsIndication_t *mcpsIndication)
 MCPS-Indication event function. More...
 
static void MlmeConfirm (MlmeConfirm_t *mlmeConfirm)
 MLME-Confirm event function. More...
 
lmh_error_status lmh_init (lmh_callback_t *callbacks, lmh_param_t lora_param)
 Lora Initialisation. More...
 
void lmh_datarate_set (uint8_t data_rate, uint8_t enable_adr)
 Configure data rate. More...
 
void lmh_tx_power_set (uint8_t tx_power)
 Configure tx power. More...
 
void lmh_join (void)
 Join a Lora Network in class A. More...
 
lmh_join_status lmh_join_status_get (void)
 Check whether the Device is joined to the network. More...
 
lmh_error_status lmh_send (lmh_app_data_t *app_data, lmh_confirm is_tx_confirmed)
 Send data. More...
 
lmh_error_status lmh_class_request (DeviceClass_t newClass)
 change Lora Class More...
 
void lmh_class_get (DeviceClass_t *currentClass)
 get the current Lora Class More...
 

Variables

uint16_t ChannelsMask []
 
uint16_t ChannelsDefaultMask []
 
uint16_t ChannelsMaskRemaining []
 
static uint8_t DevEui [] = LORAWAN_DEVICE_EUI
 
static uint8_t AppEui [] = LORAWAN_APPLICATION_EUI
 
static uint8_t AppKey [] = LORAWAN_APPLICATION_KEY
 
static MlmeReqJoin_t JoinParameters
 
static uint8_t NwkSKey [] = LORAWAN_NWKSKEY
 
static uint8_t AppSKey [] = LORAWAN_APPSKEY
 
static uint32_t DevAddr = LORAWAN_DEVICE_ADDRESS
 
bool singleChannelGateway = false
 
uint8_t singleChannelSelected = 0
 
int8_t singleChannelDatarate = DR_3
 
static LoRaMacPrimitives_t LoRaMacPrimitives
 
static LoRaMacCallback_t LoRaMacCallbacks
 
static MibRequestConfirm_t mibReq
 
static lmh_param_t m_param
 
static lmh_callback_tm_callbacks
 
static lmh_compliance_test_t m_compliance_test
 
static bool m_adr_enable_init
 
static TimerEvent_t ComplianceTestTxNextPacketTimer
 
static char strlog1 [64]
 
static char strlog2 [64]
 
static char strlog3 [64]
 

Function Documentation

◆ lmh_setDevEui()

void lmh_setDevEui ( uint8_t  userDevEui[])

◆ lmh_setAppEui()

void lmh_setAppEui ( uint8_t *  userAppEui)

Set Application IEEE EUI.

Parameters
[in]ApplicationIEEE EUI as uint8_t[] *

◆ lmh_setAppKey()

void lmh_setAppKey ( uint8_t *  userAppKey)

Set Application Key AES encryption/decryption cipher application key.

Parameters
[in]ApplicationKey as uint8_t[] *

◆ lmh_setNwkSKey()

void lmh_setNwkSKey ( uint8_t *  userNwkSKey)

Set Network Session Key AES encryption/decryption cipher network session key.

Parameters
[in]NetworkSession Key as uint8_t[] *

◆ lmh_setAppSKey()

void lmh_setAppSKey ( uint8_t *  userAppSKey)

Set Application Session Key AES encryption/decryption cipher application session key.

Parameters
[in]ApplicationSession Key as uint8_t[] *

◆ lmh_setDevAddr()

void lmh_setDevAddr ( uint32_t  userDevAddr)

Set Device address on the network (big endian)

Parameters
[in]Deviceaddress as uint8_t[] *

◆ lmh_setSingleChannelGateway()

void lmh_setSingleChannelGateway ( uint8_t  userSingleChannel,
int8_t  userDatarate 
)

Disable channel hoping for connnection to single channel gateways Check the file CHANNELS.MD to find out which channel corresponds to which frequency in a specific region Check the file Region.h to find out which datarate corresponds to which SF and bandwidth in a specific region.

Parameters
[in]Channelto be used
[in]Datarateto be used

◆ lmh_setSubBandChannels()

bool lmh_setSubBandChannels ( uint8_t  subBand)

Set custom channel mask.

Parameters
[in]subchannel number 1 to 8

◆ compliance_test_tx()

static bool compliance_test_tx ( void  )
static

◆ OnComplianceTestTxNextPacketTimerEvent()

static void OnComplianceTestTxNextPacketTimerEvent ( void  )
static

Function executed on TxNextPacket Timeout event.

◆ McpsConfirm()

static void McpsConfirm ( McpsConfirm_t mcpsConfirm)
static

MCPS-Confirm event function.

Parameters
[in]McpsConfirm- Pointer to the confirm structure, containing confirm attributes.

◆ McpsIndication()

static void McpsIndication ( McpsIndication_t mcpsIndication)
static

MCPS-Indication event function.

Parameters
[in]mcpsIndicationPointer to the indication structure, containing indication attributes.

◆ MlmeConfirm()

static void MlmeConfirm ( MlmeConfirm_t mlmeConfirm)
static

MLME-Confirm event function.

Parameters
[in]MlmeConfirmPointer to the confirm structure, containing confirm attributes.

◆ lmh_init()

lmh_error_status lmh_init ( lmh_callback_t callbacks,
lmh_param_t  lora_param 
)

Lora Initialisation.

Parameters
[in]callbacksPointer to structure containing the callback functions
[in]LoRaParamPointer to structure containing the parameters

◆ lmh_datarate_set()

void lmh_datarate_set ( uint8_t  data_rate,
uint8_t  enable_adr 
)

Configure data rate.

Parameters
[in]data_ratedata rate
[in]enable_adrenable adaptative data rate

◆ lmh_tx_power_set()

void lmh_tx_power_set ( uint8_t  tx_power)

Configure tx power.

Parameters
[in]tx_powertx power

◆ lmh_join()

void lmh_join ( void  )

Join a Lora Network in class A.

◆ lmh_join_status_get()

lmh_join_status lmh_join_status_get ( void  )

Check whether the Device is joined to the network.

Return values
returnsLORAMACHELPER_SET if joined

◆ lmh_send()

lmh_error_status lmh_send ( lmh_app_data_t app_data,
lmh_confirm  is_txconfirmed 
)

Send data.

Parameters
[in]app_dataPointer to data structure to be sent
[in]is_txconfirmeddo we need confirmation?
Return values
errorstatus

◆ lmh_class_request()

lmh_error_status lmh_class_request ( DeviceClass_t  newClass)

change Lora Class

@Note callback LORA_ConfirmClass informs upper layer that the change has occured @Note Only switch from class A to class B/C OR from class B/C to class A is allowed @Attention can be called only in LORA_ClassSwitchSlot or LORA_RxData callbacks

Parameters
[in]DeviceClass_tNewClass
Return values
LoraErrorStatus

◆ lmh_class_get()

void lmh_class_get ( DeviceClass_t currentClass)

get the current Lora Class

Parameters
[in]DeviceClass_tNewClass

Variable Documentation

◆ ChannelsMask

uint16_t ChannelsMask[]

◆ ChannelsDefaultMask

uint16_t ChannelsDefaultMask[]

◆ ChannelsMaskRemaining

uint16_t ChannelsMaskRemaining[]

◆ DevEui

uint8_t DevEui[] = LORAWAN_DEVICE_EUI
static

End-device identifier

◆ AppEui

uint8_t AppEui[] = LORAWAN_APPLICATION_EUI
static

Application identifier

◆ AppKey

uint8_t AppKey[] = LORAWAN_APPLICATION_KEY
static

Application key

◆ JoinParameters

MlmeReqJoin_t JoinParameters
static

◆ NwkSKey

uint8_t NwkSKey[] = LORAWAN_NWKSKEY
static

Network session key

◆ AppSKey

uint8_t AppSKey[] = LORAWAN_APPSKEY
static

Application session key

◆ DevAddr

uint32_t DevAddr = LORAWAN_DEVICE_ADDRESS
static

End-device address

◆ singleChannelGateway

bool singleChannelGateway = false

Flag if connection is to a single channel gateway

◆ singleChannelSelected

uint8_t singleChannelSelected = 0

Channel to be used to communicate with a single channel gateway

◆ singleChannelDatarate

int8_t singleChannelDatarate = DR_3

Datarate to be used to communicate with a single channel gateway

◆ LoRaMacPrimitives

LoRaMacPrimitives_t LoRaMacPrimitives
static

LoRaMAC events variable

◆ LoRaMacCallbacks

LoRaMacCallback_t LoRaMacCallbacks
static

LoRaMAC callback variable

◆ mibReq

MibRequestConfirm_t mibReq
static

LoRaMAC MIB-RequestConfirm variable

◆ m_param

lmh_param_t m_param
static

◆ m_callbacks

lmh_callback_t* m_callbacks
static

◆ m_compliance_test

lmh_compliance_test_t m_compliance_test
static

LoRaWAN compliance tests data

◆ m_adr_enable_init

bool m_adr_enable_init
static

◆ ComplianceTestTxNextPacketTimer

TimerEvent_t ComplianceTestTxNextPacketTimer
static

◆ strlog1

char strlog1[64]
static

◆ strlog2

char strlog2[64]
static

◆ strlog3

char strlog3[64]
static