LoRaWAN header file.
Copyright (c) 2019-2020 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <stdlib.h>
#include "compiler.h"
#include <stdbool.h>
#include <stddef.h>
#include <string.h>
#include "stack_common.h"
Data Structures | |
struct | _appCbParams |
union | _ChannelAttr |
struct | _ChannelParameters |
union | _DataRange |
struct | _DevTime |
Device time value in relation to GPS Epoch. More... | |
struct | _ecrConfig |
Error Coding Configuration This structure is used to override the error coding rate in RADIO layer when transmitting the packet. More... | |
struct | _GPSEpochTime |
struct | _LorawanLBTParams |
struct | _LorawanMcastAppSkey |
struct | _LorawanMcastDatarate |
struct | _LorawanMcastDevAddr |
struct | _LorawanMcastDlFreqeuncy |
struct | _LorawanMcastFcnt |
struct | _LorawanMcastNwkSkey |
struct | _LorawanMcastPeriodicity |
struct | _LorawanMcastStatus |
struct | _LorawanSendReq |
union | _LorawanStatus |
struct | _radioConfig |
struct | _ReceiveWindow2Params |
union | _StackVersion_t |
struct | _TimeOnAirParams |
struct | AppData_t |
union | LorawanMacStatus_t |
Macros | |
#define | DR0 0 |
#define | DR1 1 |
#define | DR10 10 |
#define | DR11 11 |
#define | DR12 12 |
#define | DR13 13 |
#define | DR14 14 |
#define | DR15 15 |
#define | DR2 2 |
#define | DR3 3 |
#define | DR4 4 |
#define | DR5 5 |
#define | DR6 6 |
#define | DR7 7 |
#define | DR8 8 |
#define | DR9 9 |
#define | FIRST_NIBBLE 0xF0 |
#define | INFINITE_CHANNEL_RETRY 0xFFFF |
#define | LAST_NIBBLE 0x0F |
#define | LORAWAN_SESSIONKEY_LENGTH (16) |
Functions | |
void | LORAWAN_ForceEnable (void) |
Function disables the Silent Immediately state. More... | |
StackRetStatus_t | LORAWAN_GetAttr (LorawanAttributes_t attrType, void *attrInput, void *attrOutput) |
LORAWAN Get Attributes This function is used to get the various Lorawan attributes. More... | |
void | LORAWAN_Init (AppDataCb_t appdata, JoinResponseCb_t joindata) |
LoRaWAN Initialization function This function initializes LoRaWAN stack and the radio module. More... | |
StackRetStatus_t | LORAWAN_Join (ActivationType_t activationTypeNew) |
LoRaWAN activation procedure. More... | |
uint32_t | LORAWAN_Pause (void) |
Function pauses LoRaWAN stack. More... | |
bool | LORAWAN_ReadyToSleep (bool deviceResetAfterSleep) |
This function returns the readiness of the stack for sleep This function is used for querying the readiness of the stack for sleep. More... | |
StackRetStatus_t | LORAWAN_Reset (IsmBand_t ismBand) |
This function will automatically reset the software LoRaWAN stack and initialize it with the parameters for the selected ISM band. More... | |
void | LORAWAN_Resume (void) |
Function resumes LoRaWAN stack functionality. More... | |
StackRetStatus_t | LORAWAN_Send (LorawanSendReq_t *lorasendreq) |
Bidirectional communication start. More... | |
StackRetStatus_t | LORAWAN_SetAttr (LorawanAttributes_t attrType, void *attrValue) |
LORAWAN Set Attribute This function is used to set the various Lorawan attributes. More... | |
void | LORAWAN_SetCallbackBitmask (uint32_t evtmask) |
LoRaWAN Set Callback Bit mask function. More... | |
StackRetStatus_t | LORAWAN_SetMulticastParam (LorawanAttributes_t attrType, void *attrValue) |
LORAWAN Set Multicast Param This function is used to set the various Mcast attributes specific from application. More... | |
#define DR0 0 |
#define DR1 1 |
#define DR10 10 |
#define DR11 11 |
#define DR12 12 |
#define DR13 13 |
Referenced by LORAReg_InitAU(), and LORAReg_InitNA().
#define DR14 14 |
#define DR15 15 |
#define DR2 2 |
#define DR3 3 |
#define DR4 4 |
Referenced by LORAReg_InitNA().
#define DR5 5 |
Referenced by getRx1WindowparamsType3(), and getRx1WindowparamsType4().
#define DR6 6 |
Referenced by getChBandDrT1(), and LORAReg_InitAU().
#define DR7 7 |
Referenced by getChBandDrT1(), and getChBandDrT2().
#define DR8 8 |
Referenced by LORAReg_InitAU(), and LORAReg_InitNA().
#define DR9 9 |
#define FIRST_NIBBLE 0xF0 |
Referenced by ValidateDataRange(), and ValidateDataRangeT2().
#define INFINITE_CHANNEL_RETRY 0xFFFF |
#define LAST_NIBBLE 0x0F |
Referenced by ValidateDataRange(), and ValidateDataRangeT2().
#define LORAWAN_SESSIONKEY_LENGTH (16) |
Referenced by set_multicast_params().
typedef enum _ActivationType ActivationType_t |
typedef struct _appCbParams appCbParams_t |
typedef void(* AppDataCb_t)(void *appHandle, appCbParams_t *data) |
typedef union _ChannelAttr ChannelAttr_t |
typedef uint8_t ChannelId_t |
typedef struct _ChannelParameters ChannelParameters_t |
typedef union _DataRange DataRange_t |
Device time value in relation to GPS Epoch.
This structure contains the value of GPS Epoch value and corresponding system time value when the GPS Epoch value is received by the stack
typedef struct _ecrConfig ecrConfig_t |
Error Coding Configuration This structure is used to override the error coding rate in RADIO layer when transmitting the packet.
The override variable is used to inform MAC layer to SET ecr value in the structure. In general, ecr value will not be SET for every transmission.
typedef enum _FeaturesSupported FeaturesSupported_t |
Features Supported List.
typedef uint32_t(* FHSSCallback_t)(void) |
The radio callback typedef used to declare callback functions for registering to FHSS.
typedef struct _GPSEpochTime GPSEpochTime_t |
typedef void(* JoinResponseCb_t)(StackRetStatus_t status) |
typedef enum _LorawanAttributes LorawanAttributes_t |
typedef enum _LorawanEvent LorawanEvent_t |
event indexes for application interface
typedef struct _LorawanLBTParams LorawanLBTParams_t |
typedef struct _LorawanMcastAppSkey LorawanMcastAppSkey_t |
typedef struct _LorawanMcastDatarate LorawanMcastDatarate_t |
typedef struct _LorawanMcastDevAddr LorawanMcastDevAddr_t |
typedef struct _LorawanMcastDlFreqeuncy LorawanMcastDlFreqeuncy_t |
typedef struct _LorawanMcastFcnt LorawanMcastFcnt_t |
typedef struct _LorawanMcastNwkSkey LorawanMcastNwkSkey_t |
typedef struct _LorawanMcastPeriodicity LorawanMcastPeriodicity_t |
typedef struct _LorawanMcastStatus LorawanMcastStatus_t |
typedef struct _LorawanSendReq LorawanSendReq_t |
typedef union _LorawanStatus LorawanStatus_t |
typedef enum _OpStatus OpStatus_t |
typedef struct _radioConfig radioConfig_t |
typedef struct _ReceiveWindow2Params ReceiveWindow2Params_t |
typedef union _StackVersion_t StackVersion_t |
typedef struct _TimeOnAirParams TimeOnAirParams_t |
typedef enum _TransmissionType TransmissionType_t |
enum _ActivationType |
enum _EdClass |
enum _FeaturesSupported |
enum _LorawanAttributes |
enum _LorawanEvent |
enum _OpStatus |
enum _TransmissionType |
void LORAWAN_ForceEnable | ( | void | ) |
Function disables the Silent Immediately state.
The network can issue a certain command that would require the end device to go silent immediately. This mechanism disables any further communication of the module, effectively isolating it from the network. Using this function, after this network command has been received, restores the modules connectivity by allowing it to send data. None None None
StackRetStatus_t LORAWAN_GetAttr | ( | LorawanAttributes_t | attrType, |
void * | attrInput, | ||
void * | attrOutput | ||
) |
LORAWAN Get Attributes This function is used to get the various Lorawan attributes.
None attrType - represents the attribute type; can be any of the parameters in LorawanAttributes_t attrInput - pointer to the sub-parameter/index of attribute in an array for example to get CH_PARAM_FREQUENCY, channel index is given as input attribute attrOutput - pointer containing the attribute value The error condition for getting a given attribute.
Referenced by cert_app_timer_callback(), cert_appdata_callback(), cert_joindata_callback(), demo_joindata_callback(), enddevice_cpc_execute_command(), messageGetIdByGroupAddr(), messageIsDutyCyclePending(), messageReceiveProcess(), messageSendProcess(), mote_demo_init(), MSG_IsTxPossible(), print_application_config(), processRunRestoreBand(), processRxDataAvailable(), processTransactionComplete(), and set_multicast_params().
void LORAWAN_Init | ( | AppDataCb_t | appdata, |
JoinResponseCb_t | joindata | ||
) |
LoRaWAN Initialization function This function initializes LoRaWAN stack and the radio module.
None appdata - pointer to function that gets called after the bidirectional communication ended. joindata - pointer to function that gets called after the activation procedure None
Referenced by cert_app_init(), and mote_demo_init().
StackRetStatus_t LORAWAN_Join | ( | ActivationType_t | activationTypeNew | ) |
LoRaWAN activation procedure.
This function starts LoRaWAN activation procedure. None activationTypeNew - activation type: OTAA or ABP Function returns the status of the operation (StackRetStatus_t).
Referenced by cert_app_init(), cert_handle_cert_rx_data(), cert_joindata_callback(), enddevice_cpc_fresh_join(), mote_set_parameters(), and processJoinAndSend().
uint32_t LORAWAN_Pause | ( | void | ) |
Function pauses LoRaWAN stack.
This function pauses the LoRaWAN stack functionality to allow transceiver (radio) configuration. Through the use of "mac pause", radio commands can be generated between a LoRaWAN protocol uplink application, and the LoRaWAN protocol Receive windows. This function will reply with the time interval in milliseconds that the transceiver can be used without affecting the LoRaWAN functionality. None None Returns the number in milliseconds representing how much it can be paused without affecting the functionality. Returns 0 if it cannot be paused, maximum value when in idle mode.
This function returns the readiness of the stack for sleep This function is used for querying the readiness of the stack for sleep.
This function has dependency on RADIO for corresponding readiness check function in TAL. None – 'true' means device will reset during wakeup 'false' means device does not reset during wakeup 'true' if stack is in ready state for sleep, otherwise 'false' bool status = LORAWAN_ReadyToSleep(false);
Referenced by processJoinAndSend().
StackRetStatus_t LORAWAN_Reset | ( | IsmBand_t | ismBand | ) |
This function will automatically reset the software LoRaWAN stack and initialize it with the parameters for the selected ISM band.
This command will set default values for most of the LoRaWAN parameters. Everything set prior to this command will lose its set value, being reinitialized to the default value, including setting the cryptographic keys to 0. None none The success/failure condition for the reset request
Referenced by cert_select_band(), enddevice_cpc_fresh_join(), mote_set_parameters(), processRunDemoApp(), and processRunRestoreBand().
void LORAWAN_Resume | ( | void | ) |
Function resumes LoRaWAN stack functionality.
This function resumes LoRaWAN stack functionality, in order to continue normal functionality after being paused. None None None
StackRetStatus_t LORAWAN_Send | ( | LorawanSendReq_t * | lorasendreq | ) |
Bidirectional communication start.
This function starts a bidirectional communication process. None confirmed - represents the transmission type; can be either UNCNF - unconfirmed or CNF - confirmed (TransmissionType_t) port - represents the port on which the transmission is being made; it's a number between 0 and 255 (uint8_t) buffer - a data buffer used to store the data to be sent bufferLength - the length in bytes of the data buffer (uint8_t) Function returns the status of the operation (StackRetStatus_t). uint8_t dataToSend = 45; LORAWAN_Send (UNCNF, 20, &dataToSend, sizeof(dataToSend));
Referenced by cert_app_timer_callback(), and messageSendProcess().
StackRetStatus_t LORAWAN_SetAttr | ( | LorawanAttributes_t | attrType, |
void * | attrValue | ||
) |
LORAWAN Set Attribute This function is used to set the various Lorawan attributes.
None attrType - represents the attribute type; can be any of the parameters in (LorawanAttributes_t) attrValue - pointer that is used to get the attribute value The error condition for getting a given attribute.
Referenced by cert_app_timer_callback(), cert_enable_channels(), cert_set_join_parameters(), cert_set_mac_parameters(), enddevice_cpc_execute_command(), enddevice_cpc_fresh_join(), mote_set_parameters(), processRunRestoreBand(), set_device_type(), set_join_parameters(), and set_multicast_params().
void LORAWAN_SetCallbackBitmask | ( | uint32_t | evtmask | ) |
LoRaWAN Set Callback Bit mask function.
This function is used for enabling the particular callback from MAC to application None evtmask - Bit mask of the particular callback none LORAWAN_SetCallbackBitmask(LORAWAN_EVT_RX_DATA_AVAILABLE|LORAWAN_EVT_TRANSACTION_COMPLETE);
StackRetStatus_t LORAWAN_SetMulticastParam | ( | LorawanAttributes_t | attrType, |
void * | attrValue | ||
) |
LORAWAN Set Multicast Param This function is used to set the various Mcast attributes specific from application.
None attrType - represents the attribute type; can be any of the MCAST parameters in (LorawanAttributes_t) attrValue - pointer that is used to get the attribute value The error condition for getting a given attribute.
Referenced by set_multicast_params().