LoRaMAC
4.6.0
Documentation of the API
|
This is the common API to access the specific regional implementations. More...
Data Structures | |
struct | BeaconFormat_t |
union | PhyParam_t |
struct | GetPhyParams_t |
struct | SetBandTxDoneParams_t |
struct | InitDefaultsParams_t |
union | VerifyParams_t |
struct | ApplyCFListParams_t |
struct | ChanMaskSetParams_t |
struct | RxConfigParams_t |
struct | TxConfigParams_t |
struct | LinkAdrReqParams_t |
struct | RxParamSetupReqParams_t |
struct | NewChannelReqParams_t |
struct | TxParamSetupReqParams_t |
struct | DlChannelReqParams_t |
struct | NextChanParams_t |
struct | ChannelAddParams_t |
struct | ChannelRemoveParams_t |
struct | RxBeaconSetup_t |
Macros | |
#define | LC(channelIndex) ( uint16_t )( 1 << ( channelIndex - 1 ) ) |
#define | REGION_VERSION 0x02010001 |
Functions | |
bool | RegionIsActive (LoRaMacRegion_t region) |
The function verifies if a region is active or not. If a region is not active, it cannot be used. More... | |
PhyParam_t | RegionGetPhyParam (LoRaMacRegion_t region, GetPhyParams_t *getPhy) |
The function gets a value of a specific phy attribute. More... | |
void | RegionSetBandTxDone (LoRaMacRegion_t region, SetBandTxDoneParams_t *txDone) |
Updates the last TX done parameters of the current channel. More... | |
void | RegionInitDefaults (LoRaMacRegion_t region, InitDefaultsParams_t *params) |
Initializes the channels masks and the channels. More... | |
bool | RegionVerify (LoRaMacRegion_t region, VerifyParams_t *verify, PhyAttribute_t phyAttribute) |
Verifies a parameter. More... | |
void | RegionApplyCFList (LoRaMacRegion_t region, ApplyCFListParams_t *applyCFList) |
The function parses the input buffer and sets up the channels of the CF list. More... | |
bool | RegionChanMaskSet (LoRaMacRegion_t region, ChanMaskSetParams_t *chanMaskSet) |
Sets a channels mask. More... | |
bool | RegionRxConfig (LoRaMacRegion_t region, RxConfigParams_t *rxConfig, int8_t *datarate) |
Configuration of the RX windows. More... | |
void | RegionComputeRxWindowParameters (LoRaMacRegion_t region, int8_t datarate, uint8_t minRxSymbols, uint32_t rxError, RxConfigParams_t *rxConfigParams) |
bool | RegionTxConfig (LoRaMacRegion_t region, TxConfigParams_t *txConfig, int8_t *txPower, TimerTime_t *txTimeOnAir) |
TX configuration. More... | |
uint8_t | RegionLinkAdrReq (LoRaMacRegion_t region, LinkAdrReqParams_t *linkAdrReq, int8_t *drOut, int8_t *txPowOut, uint8_t *nbRepOut, uint8_t *nbBytesParsed) |
The function processes a Link ADR Request. More... | |
uint8_t | RegionRxParamSetupReq (LoRaMacRegion_t region, RxParamSetupReqParams_t *rxParamSetupReq) |
The function processes a RX Parameter Setup Request. More... | |
int8_t | RegionNewChannelReq (LoRaMacRegion_t region, NewChannelReqParams_t *newChannelReq) |
The function processes a New Channel Request. More... | |
int8_t | RegionTxParamSetupReq (LoRaMacRegion_t region, TxParamSetupReqParams_t *txParamSetupReq) |
The function processes a TX ParamSetup Request. More... | |
int8_t | RegionDlChannelReq (LoRaMacRegion_t region, DlChannelReqParams_t *dlChannelReq) |
The function processes a DlChannel Request. More... | |
int8_t | RegionAlternateDr (LoRaMacRegion_t region, int8_t currentDr, AlternateDrType_t type) |
Alternates the datarate of the channel for the join request. More... | |
LoRaMacStatus_t | RegionNextChannel (LoRaMacRegion_t region, NextChanParams_t *nextChanParams, uint8_t *channel, TimerTime_t *time, TimerTime_t *aggregatedTimeOff) |
Searches and set the next random available channel. More... | |
LoRaMacStatus_t | RegionChannelAdd (LoRaMacRegion_t region, ChannelAddParams_t *channelAdd) |
Adds a channel. More... | |
bool | RegionChannelsRemove (LoRaMacRegion_t region, ChannelRemoveParams_t *channelRemove) |
Removes a channel. More... | |
uint8_t | RegionApplyDrOffset (LoRaMacRegion_t region, uint8_t downlinkDwellTime, int8_t dr, int8_t drOffset) |
Computes new datarate according to the given offset. More... | |
void | RegionRxBeaconSetup (LoRaMacRegion_t region, RxBeaconSetup_t *rxBeaconSetup, uint8_t *outDr) |
Sets the radio into beacon reception mode. More... | |
Version_t | RegionGetVersion (void) |
Gets the version of the regional parameters implementation. More... | |
This is the common API to access the specific regional implementations.
Preprocessor options:
struct BeaconFormat_t |
union PhyParam_t |
Union for the structure uGetPhyParams
Data Fields | ||
---|---|---|
uint32_t | Value |
A parameter value. |
float | fValue |
A floating point value. |
uint16_t * | ChannelsMask |
Pointer to the channels mask. |
ChannelParams_t * | Channels |
Pointer to the channels. |
BeaconFormat_t | BeaconFormat |
Beacon format |
TimerTime_t | DutyCycleTimePeriod |
Duty Cycle Period |
struct GetPhyParams_t |
Parameter structure for the function RegionGetPhyParam.
Data Fields | ||
---|---|---|
PhyAttribute_t | Attribute |
Setup the parameter to get. |
int8_t | Datarate |
Datarate. The parameter is needed for the following queries: PHY_MAX_PAYLOAD, PHY_NEXT_LOWER_TX_DR, PHY_SF_FROM_DR, PHY_BW_FROM_DR. |
uint8_t | UplinkDwellTime |
Uplink dwell time. This parameter must be set to query: PHY_MAX_PAYLOAD, PHY_MIN_TX_DR. The parameter is needed for the following queries: PHY_MIN_TX_DR, PHY_MAX_PAYLOAD, PHY_NEXT_LOWER_TX_DR. |
uint8_t | DownlinkDwellTime |
Downlink dwell time. This parameter must be set to query: PHY_MAX_PAYLOAD, PHY_MIN_RX_DR. The parameter is needed for the following queries: PHY_MIN_RX_DR, PHY_MAX_PAYLOAD. |
uint8_t | Channel |
Specification of the downlink channel. Used in Class B only. The parameter is needed for the following queries: PHY_BEACON_CHANNEL_FREQ, PHY_PING_SLOT_CHANNEL_FREQ |
struct SetBandTxDoneParams_t |
Parameter structure for the function RegionSetBandTxDone.
struct InitDefaultsParams_t |
Parameter structure for the function RegionInitDefaults.
Data Fields | ||
---|---|---|
void * | NvmGroup1 |
Pointer to region NVM group1. |
void * | NvmGroup2 |
Pointer to region NVM group2. |
void * | Bands |
Pointer to common region band storage. |
InitType_t | Type |
Sets the initialization type. |
union VerifyParams_t |
Parameter structure for the function RegionVerify.
Data Fields | ||
---|---|---|
uint32_t | Frequency |
Channel frequency to verify |
int8_t | TxPower |
TX power to verify. |
bool | DutyCycle |
Set to true, if the duty cycle is enabled, otherwise false. |
struct sDatarateParams | DatarateParams |
struct ApplyCFListParams_t |
struct ChanMaskSetParams_t |
Parameter structure for the function RegionChanMaskSet.
Data Fields | ||
---|---|---|
uint16_t * | ChannelsMaskIn |
Pointer to the channels mask which should be set. |
ChannelsMask_t | ChannelsMaskType |
Pointer to the channels mask which should be set. |
struct RxConfigParams_t |
Parameter structure for the function RegionRxConfig.
Data Fields | ||
---|---|---|
uint8_t | Channel |
The RX channel. |
int8_t | Datarate |
RX datarate. |
uint8_t | Bandwidth |
RX bandwidth. |
int8_t | DrOffset |
RX datarate offset. |
uint32_t | Frequency |
RX frequency. |
uint32_t | WindowTimeout |
RX window timeout |
int32_t | WindowOffset |
RX window offset |
uint8_t | DownlinkDwellTime |
Downlink dwell time. |
bool | RxContinuous |
Set to true, if RX should be continuous. |
LoRaMacRxSlot_t | RxSlot |
Sets the RX window. |
ActivationType_t | NetworkActivation |
LoRaWAN Network End-Device Activation ( ACTIVATION_TYPE_NONE, ACTIVATION_TYPE_ABP or ACTIVATION_TYPE_OTTA ) Related MIB type: MIB_NETWORK_ACTIVATION |
struct TxConfigParams_t |
struct LinkAdrReqParams_t |
Parameter structure for the function RegionLinkAdrReq.
struct RxParamSetupReqParams_t |
struct NewChannelReqParams_t |
Parameter structure for the function RegionNewChannelReq.
Data Fields | ||
---|---|---|
ChannelParams_t * | NewChannel |
Pointer to the new channels. |
int8_t | ChannelId |
Channel id. |
struct TxParamSetupReqParams_t |
struct DlChannelReqParams_t |
struct NextChanParams_t |
Parameter structure for the function RegionNextChannel.
struct ChannelAddParams_t |
Parameter structure for the function RegionChannelsAdd.
Data Fields | ||
---|---|---|
ChannelParams_t * | NewChannel |
Pointer to the new channel to add. |
uint8_t | ChannelId |
Channel id to add. |
struct ChannelRemoveParams_t |
struct RxBeaconSetup_t |
#define LC | ( | channelIndex | ) | ( uint16_t )( 1 << ( channelIndex - 1 ) ) |
Macro to compute bit of a channel index.
#define REGION_VERSION 0x02010001 |
Regional parameters version definition. RP002-1.0.1
enum PhyAttribute_t |
Enumeration of phy attributes.
Enumerator | |
---|---|
PHY_FREQUENCY | Frequency. It is available to perform a verification with RegionVerify(). |
PHY_MIN_RX_DR | Minimum RX datarate. |
PHY_MIN_TX_DR | Minimum TX datarate. |
PHY_MAX_RX_DR | Maximum RX datarate. |
PHY_MAX_TX_DR | Maximum TX datarate. |
PHY_TX_DR | TX datarate. This is a parameter which can't be queried. It is available to perform a verification with RegionVerify(). |
PHY_DEF_TX_DR | Default TX datarate. |
PHY_RX_DR | RX datarate. It is available to perform a verification with RegionVerify(). |
PHY_MAX_TX_POWER | Maximum TX power. |
PHY_TX_POWER | TX power. It is available to perform a verification with RegionVerify(). |
PHY_DEF_TX_POWER | Default TX power. |
PHY_DEF_ADR_ACK_LIMIT | Default ADR_ACK_LIMIT value. |
PHY_DEF_ADR_ACK_DELAY | Default ADR_ACK_DELAY value. |
PHY_MAX_PAYLOAD | Maximum payload possible. |
PHY_DUTY_CYCLE | Duty cycle. |
PHY_MAX_RX_WINDOW | Maximum receive window duration. |
PHY_RECEIVE_DELAY1 | Receive delay for window 1. |
PHY_RECEIVE_DELAY2 | Receive delay for window 2. |
PHY_JOIN_ACCEPT_DELAY1 | Join accept delay for window 1. |
PHY_JOIN_ACCEPT_DELAY2 | Join accept delay for window 2. |
PHY_RETRANSMIT_TIMEOUT | Acknowledgement time out. |
PHY_DEF_DR1_OFFSET | Default datarate offset for window 1. |
PHY_DEF_RX2_FREQUENCY | Default receive window 2 frequency. |
PHY_DEF_RX2_DR | Default receive window 2 datarate. |
PHY_CHANNELS_MASK | Channels mask. |
PHY_CHANNELS_DEFAULT_MASK | Channels default mask. |
PHY_MAX_NB_CHANNELS | Maximum number of supported channels |
PHY_CHANNELS | Channels. |
PHY_DEF_UPLINK_DWELL_TIME | Default value of the uplink dwell time. |
PHY_DEF_DOWNLINK_DWELL_TIME | Default value of the downlink dwell time. |
PHY_DEF_MAX_EIRP | Default value of the MaxEIRP. |
PHY_DEF_ANTENNA_GAIN | Default value of the antenna gain. |
PHY_NEXT_LOWER_TX_DR | Next lower datarate. |
PHY_BEACON_INTERVAL | Beacon interval in ms. |
PHY_BEACON_RESERVED | Beacon reserved time in ms. |
PHY_BEACON_GUARD | Beacon guard time in ms. |
PHY_BEACON_WINDOW | Beacon window time in ms. |
PHY_BEACON_WINDOW_SLOTS | Beacon window time in numer of slots. |
PHY_PING_SLOT_WINDOW | Ping slot length time in ms. |
PHY_BEACON_SYMBOL_TO_DEFAULT | Default symbol timeout for beacons and ping slot windows. |
PHY_BEACON_SYMBOL_TO_EXPANSION_MAX | Maximum symbol timeout for beacons. |
PHY_PING_SLOT_SYMBOL_TO_EXPANSION_MAX | Maximum symbol timeout for ping slots. |
PHY_BEACON_SYMBOL_TO_EXPANSION_FACTOR | Symbol expansion value for beacon windows in case of beacon loss in symbols. |
PHY_PING_SLOT_SYMBOL_TO_EXPANSION_FACTOR | Symbol expansion value for ping slot windows in case of beacon loss in symbols. |
PHY_MAX_BEACON_LESS_PERIOD | Maximum allowed beacon less time in ms. |
PHY_BEACON_DELAY_BEACON_TIMING_ANS | Delay time for the BeaconTimingAns in ms. |
PHY_BEACON_CHANNEL_FREQ | Beacon channel frequency. |
PHY_BEACON_FORMAT | The format of the beacon. |
PHY_BEACON_CHANNEL_DR | The beacon channel datarate. |
PHY_BEACON_NB_CHANNELS | The number of channels for the beacon reception. |
PHY_BEACON_CHANNEL_OFFSET | The static offset for the downlink channel calculation. |
PHY_PING_SLOT_CHANNEL_FREQ | Ping slot channel frequency. |
PHY_PING_SLOT_CHANNEL_DR | The datarate of a ping slot channel. |
PHY_PING_SLOT_NB_CHANNELS | The number of channels for the ping slot reception. |
PHY_SF_FROM_DR | The equivalent spreading factor value from datarate |
PHY_BW_FROM_DR | The equivalent bandwith index from datarate |
enum InitType_t |
Enumeration of initialization types.
enum ChannelsMask_t |
enum AlternateDrType_t |
bool RegionIsActive | ( | LoRaMacRegion_t | region | ) |
The function verifies if a region is active or not. If a region is not active, it cannot be used.
[IN] | region LoRaWAN region. |
Return | true, if the region is supported. |
PhyParam_t RegionGetPhyParam | ( | LoRaMacRegion_t | region, |
GetPhyParams_t * | getPhy | ||
) |
The function gets a value of a specific phy attribute.
[IN] | region LoRaWAN region. |
[IN] | getPhy Pointer to the function parameters. |
Returns | a structure containing the PHY parameter. |
void RegionSetBandTxDone | ( | LoRaMacRegion_t | region, |
SetBandTxDoneParams_t * | txDone | ||
) |
Updates the last TX done parameters of the current channel.
[IN] | region LoRaWAN region. |
[IN] | txDone Pointer to the function parameters. |
void RegionInitDefaults | ( | LoRaMacRegion_t | region, |
InitDefaultsParams_t * | params | ||
) |
Initializes the channels masks and the channels.
[IN] | region LoRaWAN region. |
[IN] | params Pointer to the function parameters. |
bool RegionVerify | ( | LoRaMacRegion_t | region, |
VerifyParams_t * | verify, | ||
PhyAttribute_t | phyAttribute | ||
) |
Verifies a parameter.
[IN] | region LoRaWAN region. |
[IN] | verify Pointer to the function parameters. |
[IN] | type Sets the initialization type. |
Returns | true, if the parameter is valid. |
void RegionApplyCFList | ( | LoRaMacRegion_t | region, |
ApplyCFListParams_t * | applyCFList | ||
) |
The function parses the input buffer and sets up the channels of the CF list.
[IN] | region LoRaWAN region. |
[IN] | applyCFList Pointer to the function parameters. |
bool RegionChanMaskSet | ( | LoRaMacRegion_t | region, |
ChanMaskSetParams_t * | chanMaskSet | ||
) |
Sets a channels mask.
[IN] | region LoRaWAN region. |
[IN] | chanMaskSet Pointer to the function parameters. |
Returns | true, if the channels mask could be set. |
bool RegionRxConfig | ( | LoRaMacRegion_t | region, |
RxConfigParams_t * | rxConfig, | ||
int8_t * | datarate | ||
) |
Configuration of the RX windows.
[IN] | region LoRaWAN region. |
[IN] | rxConfig Pointer to the function parameters. |
[OUT] | datarate The datarate index which was set. |
Returns | true, if the configuration was applied successfully. |
void RegionComputeRxWindowParameters | ( | LoRaMacRegion_t | region, |
int8_t | datarate, | ||
uint8_t | minRxSymbols, | ||
uint32_t | rxError, | ||
RxConfigParams_t * | rxConfigParams | ||
) |
Computes the Rx window timeout and offset.
[IN] | region LoRaWAN region. |
[IN] | datarate Rx window datarate index to be used |
[IN] | minRxSymbols Minimum required number of symbols to detect an Rx frame. |
[IN] | rxError System maximum timing error of the receiver. In milliseconds The receiver will turn on in a [-rxError : +rxError] ms interval around RxOffset |
[OUT]rxConfigParams | Returns updated WindowTimeout and WindowOffset fields. |
bool RegionTxConfig | ( | LoRaMacRegion_t | region, |
TxConfigParams_t * | txConfig, | ||
int8_t * | txPower, | ||
TimerTime_t * | txTimeOnAir | ||
) |
TX configuration.
[IN] | region LoRaWAN region. |
[IN] | txConfig Pointer to the function parameters. |
[OUT] | txPower The tx power index which was set. |
[OUT] | txTimeOnAir The time-on-air of the frame. |
Returns | true, if the configuration was applied successfully. |
uint8_t RegionLinkAdrReq | ( | LoRaMacRegion_t | region, |
LinkAdrReqParams_t * | linkAdrReq, | ||
int8_t * | drOut, | ||
int8_t * | txPowOut, | ||
uint8_t * | nbRepOut, | ||
uint8_t * | nbBytesParsed | ||
) |
The function processes a Link ADR Request.
[IN] | region LoRaWAN region. |
[IN] | linkAdrReq Pointer to the function parameters. |
[OUT] | drOut The datarate which was applied. |
[OUT] | txPowOut The TX power which was applied. |
[OUT] | nbRepOut The number of repetitions to apply. |
[OUT] | nbBytesParsed The number bytes which were parsed. |
Returns | the status of the operation, according to the LoRaMAC specification. |
uint8_t RegionRxParamSetupReq | ( | LoRaMacRegion_t | region, |
RxParamSetupReqParams_t * | rxParamSetupReq | ||
) |
The function processes a RX Parameter Setup Request.
[IN] | region LoRaWAN region. |
[IN] | rxParamSetupReq Pointer to the function parameters. |
Returns | the status of the operation, according to the LoRaMAC specification. |
int8_t RegionNewChannelReq | ( | LoRaMacRegion_t | region, |
NewChannelReqParams_t * | newChannelReq | ||
) |
The function processes a New Channel Request.
[IN] | region LoRaWAN region. |
[IN] | newChannelReq Pointer to the function parameters. |
Returns | the status of the operation, according to the LoRaMAC specification. |
int8_t RegionTxParamSetupReq | ( | LoRaMacRegion_t | region, |
TxParamSetupReqParams_t * | txParamSetupReq | ||
) |
The function processes a TX ParamSetup Request.
[IN] | region LoRaWAN region. |
[IN] | txParamSetupReq Pointer to the function parameters. |
Returns | the status of the operation, according to the LoRaMAC specification. Returns -1, if the functionality is not implemented. In this case, the end node shall ignore the command. |
int8_t RegionDlChannelReq | ( | LoRaMacRegion_t | region, |
DlChannelReqParams_t * | dlChannelReq | ||
) |
The function processes a DlChannel Request.
[IN] | region LoRaWAN region. |
[IN] | dlChannelReq Pointer to the function parameters. |
Returns | the status of the operation, according to the LoRaMAC specification. |
int8_t RegionAlternateDr | ( | LoRaMacRegion_t | region, |
int8_t | currentDr, | ||
AlternateDrType_t | type | ||
) |
Alternates the datarate of the channel for the join request.
[IN] | region LoRaWAN region. |
[IN] | currentDr Current datarate. |
[IN] | type Alternation type. |
Datarate | to apply. |
LoRaMacStatus_t RegionNextChannel | ( | LoRaMacRegion_t | region, |
NextChanParams_t * | nextChanParams, | ||
uint8_t * | channel, | ||
TimerTime_t * | time, | ||
TimerTime_t * | aggregatedTimeOff | ||
) |
Searches and set the next random available channel.
[IN] | region LoRaWAN region. |
[OUT] | channel Next channel to use for TX. |
[OUT] | time Time to wait for the next transmission according to the duty cycle. |
[OUT] | aggregatedTimeOff Updates the aggregated time off. |
Function | status [1: OK, 0: Unable to find a channel on the current datarate]. |
LoRaMacStatus_t RegionChannelAdd | ( | LoRaMacRegion_t | region, |
ChannelAddParams_t * | channelAdd | ||
) |
Adds a channel.
[IN] | region LoRaWAN region. |
[IN] | channelAdd Pointer to the function parameters. |
Status | of the operation. |
bool RegionChannelsRemove | ( | LoRaMacRegion_t | region, |
ChannelRemoveParams_t * | channelRemove | ||
) |
Removes a channel.
[IN] | region LoRaWAN region. |
[IN] | channelRemove Pointer to the function parameters. |
Returns | true, if the channel was removed successfully. |
uint8_t RegionApplyDrOffset | ( | LoRaMacRegion_t | region, |
uint8_t | downlinkDwellTime, | ||
int8_t | dr, | ||
int8_t | drOffset | ||
) |
Computes new datarate according to the given offset.
[IN] | downlinkDwellTime Downlink dwell time configuration. 0: No limit, 1: 400ms |
[IN] | dr Current datarate |
[IN] | drOffset Offset to be applied |
newDr | Computed datarate. |
void RegionRxBeaconSetup | ( | LoRaMacRegion_t | region, |
RxBeaconSetup_t * | rxBeaconSetup, | ||
uint8_t * | outDr | ||
) |
Sets the radio into beacon reception mode.
[IN] | rxBeaconSetup Pointer to the function parameters | |
[out] | outDr | Datarate used to receive the beacon |
Version_t RegionGetVersion | ( | void | ) |
Gets the version of the regional parameters implementation.
Version | of the regional parameters. |