20171208

Fork of LoRaWAN-lib by Semtech

Embed: (wiki syntax)

« Back to documentation index

LoRa MAC layer implementation

LoRa MAC layer implementation

Data Structures

union  uDrRange
struct  sBand
struct  sChannelParams
struct  sRx2ChannelParams
struct  sLoRaMacParams
struct  sMulticastParams
union  uLoRaMacHeader
union  uLoRaMacFrameCtrl
union  eLoRaMacFlags_t
struct  sMcpsReqUnconfirmed
struct  sMcpsReqConfirmed
struct  sMcpsReqProprietary
struct  sMcpsReq
struct  sMcpsConfirm
struct  sMcpsIndication
struct  sMlmeReqJoin
struct  sMlmeReqTxCw
struct  sMlmeReq
struct  sMlmeConfirm
union  uMibParam
struct  eMibRequestConfirm
struct  sLoRaMacTxInfo
struct  sLoRaMacPrimitives

Typedefs

typedef enum eDeviceClass DeviceClass_t
typedef union uDrRange DrRange_t
typedef struct sBand Band_t
typedef struct sChannelParams ChannelParams_t
typedef struct sRx2ChannelParams Rx2ChannelParams_t
typedef struct sLoRaMacParams LoRaMacParams_t
typedef struct sMulticastParams MulticastParams_t
typedef enum eLoRaMacFrameType LoRaMacFrameType_t
typedef enum eLoRaMacMoteCmd LoRaMacMoteCmd_t
typedef enum eLoRaMacSrvCmd LoRaMacSrvCmd_t
typedef enum eLoRaMacBatteryLevel LoRaMacBatteryLevel_t
typedef union uLoRaMacHeader LoRaMacHeader_t
typedef union uLoRaMacFrameCtrl LoRaMacFrameCtrl_t
typedef enum
eLoRaMacEventInfoStatus 
LoRaMacEventInfoStatus_t
typedef union eLoRaMacFlags_t LoRaMacFlags_t
typedef enum eMcps Mcps_t
 LoRaMAC data services.
typedef struct sMcpsReqUnconfirmed McpsReqUnconfirmed_t
typedef struct sMcpsReqConfirmed McpsReqConfirmed_t
typedef struct sMcpsReqProprietary McpsReqProprietary_t
typedef struct sMcpsReq McpsReq_t
typedef struct sMcpsConfirm McpsConfirm_t
typedef struct sMcpsIndication McpsIndication_t
typedef enum eMlme Mlme_t
 LoRaMAC management services.
typedef struct sMlmeReqJoin MlmeReqJoin_t
typedef struct sMlmeReqTxCw MlmeReqTxCw_t
typedef struct sMlmeReq MlmeReq_t
typedef struct sMlmeConfirm MlmeConfirm_t
typedef enum eMib Mib_t
typedef union uMibParam MibParam_t
typedef struct eMibRequestConfirm MibRequestConfirm_t
typedef struct sLoRaMacTxInfo LoRaMacTxInfo_t
typedef enum eLoRaMacStatus LoRaMacStatus_t
typedef struct sLoRaMacPrimitives LoRaMacPrimitives_t

Enumerations

enum  eDeviceClass { CLASS_A, CLASS_B, CLASS_C }
enum  eLoRaMacFrameType {
  FRAME_TYPE_JOIN_REQ = 0x00, FRAME_TYPE_JOIN_ACCEPT = 0x01, FRAME_TYPE_DATA_UNCONFIRMED_UP = 0x02, FRAME_TYPE_DATA_UNCONFIRMED_DOWN = 0x03,
  FRAME_TYPE_DATA_CONFIRMED_UP = 0x04, FRAME_TYPE_DATA_CONFIRMED_DOWN = 0x05, FRAME_TYPE_RFU = 0x06, FRAME_TYPE_PROPRIETARY = 0x07
}
enum  eLoRaMacMoteCmd {
  MOTE_MAC_LINK_CHECK_REQ = 0x02, MOTE_MAC_LINK_ADR_ANS = 0x03, MOTE_MAC_DUTY_CYCLE_ANS = 0x04, MOTE_MAC_RX_PARAM_SETUP_ANS = 0x05,
  MOTE_MAC_DEV_STATUS_ANS = 0x06, MOTE_MAC_NEW_CHANNEL_ANS = 0x07, MOTE_MAC_RX_TIMING_SETUP_ANS = 0x08
}
enum  eLoRaMacSrvCmd {
  SRV_MAC_LINK_CHECK_ANS = 0x02, SRV_MAC_LINK_ADR_REQ = 0x03, SRV_MAC_DUTY_CYCLE_REQ = 0x04, SRV_MAC_RX_PARAM_SETUP_REQ = 0x05,
  SRV_MAC_DEV_STATUS_REQ = 0x06, SRV_MAC_NEW_CHANNEL_REQ = 0x07, SRV_MAC_RX_TIMING_SETUP_REQ = 0x08
}
enum  eLoRaMacBatteryLevel { BAT_LEVEL_EXT_SRC = 0x00, BAT_LEVEL_EMPTY = 0x01, BAT_LEVEL_FULL = 0xFE, BAT_LEVEL_NO_MEASURE = 0xFF }
enum  eLoRaMacEventInfoStatus {
  LORAMAC_EVENT_INFO_STATUS_OK = 0, LORAMAC_EVENT_INFO_STATUS_ERROR, LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT, LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT,
  LORAMAC_EVENT_INFO_STATUS_RX1_ERROR, LORAMAC_EVENT_INFO_STATUS_RX2_ERROR, LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL, LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED,
  LORAMAC_EVENT_INFO_STATUS_TX_DR_PAYLOAD_SIZE_ERROR, LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOSS, LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL, LORAMAC_EVENT_INFO_STATUS_MIC_FAIL
}
enum  eMcps { MCPS_UNCONFIRMED, MCPS_CONFIRMED, MCPS_MULTICAST, MCPS_PROPRIETARY }
 

LoRaMAC data services.

More...
enum  eMlme { MLME_JOIN, MLME_LINK_CHECK, MLME_TXCW, MLME_TXCW_1 }
 

LoRaMAC management services.

More...
enum  eMib {
  MIB_DEVICE_CLASS, MIB_NETWORK_JOINED, MIB_ADR, MIB_NET_ID,
  MIB_DEV_ADDR, MIB_NWK_SKEY, MIB_APP_SKEY, MIB_PUBLIC_NETWORK,
  MIB_REPEATER_SUPPORT, MIB_CHANNELS, MIB_RX2_CHANNEL, MIB_RX2_DEFAULT_CHANNEL,
  MIB_CHANNELS_MASK, MIB_CHANNELS_DEFAULT_MASK, MIB_CHANNELS_NB_REP, MIB_MAX_RX_WINDOW_DURATION,
  MIB_RECEIVE_DELAY_1, MIB_RECEIVE_DELAY_2, MIB_JOIN_ACCEPT_DELAY_1, MIB_JOIN_ACCEPT_DELAY_2,
  MIB_CHANNELS_DEFAULT_DATARATE, MIB_CHANNELS_DATARATE, MIB_CHANNELS_TX_POWER, MIB_CHANNELS_DEFAULT_TX_POWER,
  MIB_UPLINK_COUNTER, MIB_DOWNLINK_COUNTER, MIB_MULTICAST_CHANNEL, MIB_SYSTEM_MAX_RX_ERROR,
  MIB_MIN_RX_SYMBOLS
}
enum  eLoRaMacStatus {
  LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID,
  LORAMAC_STATUS_FREQUENCY_INVALID, LORAMAC_STATUS_DATARATE_INVALID, LORAMAC_STATUS_FREQ_AND_DR_INVALID, LORAMAC_STATUS_NO_NETWORK_JOINED,
  LORAMAC_STATUS_LENGTH_ERROR, LORAMAC_STATUS_MAC_CMD_LENGTH_ERROR, LORAMAC_STATUS_DEVICE_OFF
}

Functions

LoRaMacStatus_t LoRaMacInitialization (LoRaMacPrimitives_t *primitives, LoRaMacCallback_t *callbacks)
 LoRaMAC layer initialization.
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.
LoRaMacStatus_t LoRaMacChannelAdd (uint8_t id, ChannelParams_t params)
 LoRaMAC channel add service.
LoRaMacStatus_t LoRaMacChannelRemove (uint8_t id)
 LoRaMAC channel remove service.
LoRaMacStatus_t LoRaMacMulticastChannelLink (MulticastParams_t *channelParam)
 LoRaMAC multicast channel link service.
LoRaMacStatus_t LoRaMacMulticastChannelUnlink (MulticastParams_t *channelParam)
 LoRaMAC multicast channel unlink service.
LoRaMacStatus_t LoRaMacMibGetRequestConfirm (MibRequestConfirm_t *mibGet)
 LoRaMAC MIB-Get.
LoRaMacStatus_t LoRaMacMibSetRequestConfirm (MibRequestConfirm_t *mibSet)
 LoRaMAC MIB-Set.
LoRaMacStatus_t LoRaMacMlmeRequest (MlmeReq_t *mlmeRequest)
 LoRaMAC MLME-Request.
LoRaMacStatus_t LoRaMacMcpsRequest (McpsReq_t *mcpsRequest)
 LoRaMAC MCPS-Request.

Detailed Description

This module specifies the API implementation of the LoRaMAC layer. This is a placeholder for a detailed description of the LoRaMac layer and the supported features.


Typedef Documentation

typedef struct sBand Band_t

LoRaMAC band parameters definition

LoRaMAC channel definition

LoRaWAN devices classes definition

typedef union uDrRange DrRange_t

LoRaMAC channels parameters definition

LoRaMAC Battery level indicator

Enumeration containing the status of the operation of a MAC service

LoRaMac tx/rx operation state

LoRaMAC frame control field definition (FCtrl)

LoRaWAN Specification V1.0.1, chapter 4.3.1

LoRaMAC frame types

LoRaWAN Specification V1.0.1, chapter 4.2.1, table 1

LoRaMAC header field definition (MHDR field)

LoRaWAN Specification V1.0.1, chapter 4.2

LoRaMAC mote MAC commands

LoRaWAN Specification V1.0.1, chapter 5, table 4

Global MAC layer parameters

LoRaMAC events structure Used to notify upper layers of MAC events

LoRaMAC server MAC commands

LoRaWAN Specification V1.0.1 chapter 5, table 4

LoRaMAC Status

LoRaMAC tx information

typedef enum eMcps Mcps_t

LoRaMAC data services.

The following table list the primitives which are supported by the specific MAC data service:

Name | Request | Indication | Response | Confirm --------------------- | :-----: | :--------: | :------: | :-----: MCPS_UNCONFIRMED | YES | YES | NO | YES MCPS_CONFIRMED | YES | YES | NO | YES MCPS_MULTICAST | NO | YES | NO | NO MCPS_PROPRIETARY | YES | YES | NO | YES

The following table provides links to the function implementations of the related MCPS primitives:

Primitive | Function ---------------- | :---------------------: MCPS-Request | LoRaMacMlmeRequest MCPS-Confirm | MacMcpsConfirm in LoRaMacPrimitives_t MCPS-Indication | MacMcpsIndication in LoRaMacPrimitives_t

typedef struct sMcpsConfirm McpsConfirm_t

LoRaMAC MCPS-Confirm

LoRaMAC MCPS-Indication primitive

typedef struct sMcpsReq McpsReq_t

LoRaMAC MCPS-Request structure

LoRaMAC MCPS-Request for a confirmed frame

LoRaMAC MCPS-Request for a proprietary frame

LoRaMAC MCPS-Request for an unconfirmed frame

typedef enum eMib Mib_t

LoRa Mac Information Base (MIB)

The following table lists the MIB parameters and the related attributes:

Attribute | Get | Set --------------------------------- | :-: | :-: MIB_DEVICE_CLASS | YES | YES MIB_NETWORK_JOINED | YES | YES MIB_ADR | YES | YES MIB_NET_ID | YES | YES MIB_DEV_ADDR | YES | YES MIB_NWK_SKEY | YES | YES MIB_APP_SKEY | YES | YES MIB_PUBLIC_NETWORK | YES | YES MIB_REPEATER_SUPPORT | YES | YES MIB_CHANNELS | YES | NO MIB_RX2_CHANNEL | YES | YES MIB_CHANNELS_MASK | YES | YES MIB_CHANNELS_DEFAULT_MASK | YES | YES MIB_CHANNELS_NB_REP | YES | YES MIB_MAX_RX_WINDOW_DURATION | YES | YES MIB_RECEIVE_DELAY_1 | YES | YES MIB_RECEIVE_DELAY_2 | YES | YES MIB_JOIN_ACCEPT_DELAY_1 | YES | YES MIB_JOIN_ACCEPT_DELAY_2 | YES | YES MIB_CHANNELS_DATARATE | YES | YES MIB_CHANNELS_DEFAULT_DATARATE| YES | YES MIB_CHANNELS_TX_POWER | YES | YES MIB_CHANNELS_DEFAULT_TX_POWER| YES | YES MIB_UPLINK_COUNTER | YES | YES MIB_DOWNLINK_COUNTER | YES | YES MIB_MULTICAST_CHANNEL | YES | NO MIB_SYSTEM_MAX_RX_ERROR | YES | YES MIB_MIN_RX_SYMBOLS | YES | YES

The following table provides links to the function implementations of the related MIB primitives:

Primitive | Function ---------------- | :---------------------: MIB-Set | LoRaMacMibSetRequestConfirm MIB-Get | LoRaMacMibGetRequestConfirm

typedef union uMibParam MibParam_t

LoRaMAC MIB parameters

LoRaMAC MIB-RequestConfirm structure

typedef enum eMlme Mlme_t

LoRaMAC management services.

The following table list the primitives which are supported by the specific MAC management service:

Name | Request | Indication | Response | Confirm --------------------- | :-----: | :--------: | :------: | :-----: MLME_JOIN | YES | NO | NO | YES MLME_LINK_CHECK | YES | NO | NO | YES MLME_TXCW | YES | NO | NO | YES

The following table provides links to the function implementations of the related MLME primitives.

Primitive | Function ---------------- | :---------------------: MLME-Request | LoRaMacMlmeRequest MLME-Confirm | MacMlmeConfirm in LoRaMacPrimitives_t

typedef struct sMlmeConfirm MlmeConfirm_t

LoRaMAC MLME-Confirm primitive

typedef struct sMlmeReq MlmeReq_t

LoRaMAC MLME-Request structure

typedef struct sMlmeReqJoin MlmeReqJoin_t

LoRaMAC MLME-Request for the join service

typedef struct sMlmeReqTxCw MlmeReqTxCw_t

LoRaMAC MLME-Request for Tx continuous wave mode

LoRaMAC multicast channel parameter

LoRaMAC receive window 2 channel parameters


Enumeration Type Documentation

LoRaWAN devices classes definition

Enumerator:
CLASS_A 

LoRaWAN device class A

LoRaWAN Specification V1.0.1, chapter 3ff

CLASS_B 

LoRaWAN device class B

LoRaWAN Specification V1.0.1, chapter 8ff

CLASS_C 

LoRaWAN device class C

LoRaWAN Specification V1.0.1, chapter 17ff

Definition at line 145 of file LoRaMac.h.

LoRaMAC Battery level indicator

Enumerator:
BAT_LEVEL_EXT_SRC 

External power source

BAT_LEVEL_EMPTY 

Battery level empty

BAT_LEVEL_FULL 

Battery level full

BAT_LEVEL_NO_MEASURE 

Battery level - no measurement available

Definition at line 468 of file LoRaMac.h.

Enumeration containing the status of the operation of a MAC service

Enumerator:
LORAMAC_EVENT_INFO_STATUS_OK 

Service performed successfully

LORAMAC_EVENT_INFO_STATUS_ERROR 

An error occurred during the execution of the service

LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT 

A Tx timeout occurred

LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT 

An Rx timeout occurred on receive window 2

LORAMAC_EVENT_INFO_STATUS_RX1_ERROR 

An Rx error occurred on receive window 1

LORAMAC_EVENT_INFO_STATUS_RX2_ERROR 

An Rx error occurred on receive window 2

LORAMAC_EVENT_INFO_STATUS_JOIN_FAIL 

An error occurred in the join procedure

LORAMAC_EVENT_INFO_STATUS_DOWNLINK_REPEATED 

A frame with an invalid downlink counter was received. The downlink counter of the frame was equal to the local copy of the downlink counter of the node.

LORAMAC_EVENT_INFO_STATUS_TX_DR_PAYLOAD_SIZE_ERROR 

The MAC could not retransmit a frame since the MAC decreased the datarate. The payload size is not applicable for the datarate.

LORAMAC_EVENT_INFO_STATUS_DOWNLINK_TOO_MANY_FRAMES_LOSS 

The node has lost MAX_FCNT_GAP or more frames.

LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL 

An address error occurred

LORAMAC_EVENT_INFO_STATUS_MIC_FAIL 

message integrity check failure

Definition at line 561 of file LoRaMac.h.

LoRaMAC frame types

LoRaWAN Specification V1.0.1, chapter 4.2.1, table 1

Enumerator:
FRAME_TYPE_JOIN_REQ 

LoRaMAC join request frame

FRAME_TYPE_JOIN_ACCEPT 

LoRaMAC join accept frame

FRAME_TYPE_DATA_UNCONFIRMED_UP 

LoRaMAC unconfirmed up-link frame

FRAME_TYPE_DATA_UNCONFIRMED_DOWN 

LoRaMAC unconfirmed down-link frame

FRAME_TYPE_DATA_CONFIRMED_UP 

LoRaMAC confirmed up-link frame

FRAME_TYPE_DATA_CONFIRMED_DOWN 

LoRaMAC confirmed down-link frame

FRAME_TYPE_RFU 

LoRaMAC RFU frame

FRAME_TYPE_PROPRIETARY 

LoRaMAC proprietary frame

Definition at line 355 of file LoRaMac.h.

LoRaMAC mote MAC commands

LoRaWAN Specification V1.0.1, chapter 5, table 4

Enumerator:
MOTE_MAC_LINK_CHECK_REQ 

LinkCheckReq

MOTE_MAC_LINK_ADR_ANS 

LinkADRAns

MOTE_MAC_DUTY_CYCLE_ANS 

DutyCycleAns

MOTE_MAC_RX_PARAM_SETUP_ANS 

RXParamSetupAns

MOTE_MAC_DEV_STATUS_ANS 

DevStatusAns

MOTE_MAC_NEW_CHANNEL_ANS 

NewChannelAns

MOTE_MAC_RX_TIMING_SETUP_ANS 

RXTimingSetupAns

Definition at line 396 of file LoRaMac.h.

LoRaMAC server MAC commands

LoRaWAN Specification V1.0.1 chapter 5, table 4

Enumerator:
SRV_MAC_LINK_CHECK_ANS 

LinkCheckAns

SRV_MAC_LINK_ADR_REQ 

LinkADRReq

SRV_MAC_DUTY_CYCLE_REQ 

DutyCycleReq

SRV_MAC_RX_PARAM_SETUP_REQ 

RXParamSetupReq

SRV_MAC_DEV_STATUS_REQ 

DevStatusReq

SRV_MAC_NEW_CHANNEL_REQ 

NewChannelReq

SRV_MAC_RX_TIMING_SETUP_REQ 

RXTimingSetupReq

Definition at line 433 of file LoRaMac.h.

LoRaMAC Status

Enumerator:
LORAMAC_STATUS_OK 

Service started successfully

LORAMAC_STATUS_BUSY 

Service not started - LoRaMAC is busy

LORAMAC_STATUS_SERVICE_UNKNOWN 

Service unknown

LORAMAC_STATUS_PARAMETER_INVALID 

Service not started - invalid parameter

LORAMAC_STATUS_FREQUENCY_INVALID 

Service not started - invalid frequency

LORAMAC_STATUS_DATARATE_INVALID 

Service not started - invalid datarate

LORAMAC_STATUS_FREQ_AND_DR_INVALID 

Service not started - invalid frequency and datarate

LORAMAC_STATUS_NO_NETWORK_JOINED 

Service not started - the device is not in a LoRaWAN

LORAMAC_STATUS_LENGTH_ERROR 

Service not started - payload lenght error

LORAMAC_STATUS_MAC_CMD_LENGTH_ERROR 

Service not started - payload lenght error

LORAMAC_STATUS_DEVICE_OFF 

Service not started - the device is switched off

Definition at line 1548 of file LoRaMac.h.

enum eMcps

LoRaMAC data services.

The following table list the primitives which are supported by the specific MAC data service:

Name | Request | Indication | Response | Confirm --------------------- | :-----: | :--------: | :------: | :-----: MCPS_UNCONFIRMED | YES | YES | NO | YES MCPS_CONFIRMED | YES | YES | NO | YES MCPS_MULTICAST | NO | YES | NO | NO MCPS_PROPRIETARY | YES | YES | NO | YES

The following table provides links to the function implementations of the related MCPS primitives:

Primitive | Function ---------------- | :---------------------: MCPS-Request | LoRaMacMlmeRequest MCPS-Confirm | MacMcpsConfirm in LoRaMacPrimitives_t MCPS-Indication | MacMcpsIndication in LoRaMacPrimitives_t

Enumerator:
MCPS_UNCONFIRMED 

Unconfirmed LoRaMAC frame

MCPS_CONFIRMED 

Confirmed LoRaMAC frame

MCPS_MULTICAST 

Multicast LoRaMAC frame

MCPS_PROPRIETARY 

Proprietary frame

Definition at line 676 of file LoRaMac.h.

enum eMib

LoRa Mac Information Base (MIB)

The following table lists the MIB parameters and the related attributes:

Attribute | Get | Set --------------------------------- | :-: | :-: MIB_DEVICE_CLASS | YES | YES MIB_NETWORK_JOINED | YES | YES MIB_ADR | YES | YES MIB_NET_ID | YES | YES MIB_DEV_ADDR | YES | YES MIB_NWK_SKEY | YES | YES MIB_APP_SKEY | YES | YES MIB_PUBLIC_NETWORK | YES | YES MIB_REPEATER_SUPPORT | YES | YES MIB_CHANNELS | YES | NO MIB_RX2_CHANNEL | YES | YES MIB_CHANNELS_MASK | YES | YES MIB_CHANNELS_DEFAULT_MASK | YES | YES MIB_CHANNELS_NB_REP | YES | YES MIB_MAX_RX_WINDOW_DURATION | YES | YES MIB_RECEIVE_DELAY_1 | YES | YES MIB_RECEIVE_DELAY_2 | YES | YES MIB_JOIN_ACCEPT_DELAY_1 | YES | YES MIB_JOIN_ACCEPT_DELAY_2 | YES | YES MIB_CHANNELS_DATARATE | YES | YES MIB_CHANNELS_DEFAULT_DATARATE| YES | YES MIB_CHANNELS_TX_POWER | YES | YES MIB_CHANNELS_DEFAULT_TX_POWER| YES | YES MIB_UPLINK_COUNTER | YES | YES MIB_DOWNLINK_COUNTER | YES | YES MIB_MULTICAST_CHANNEL | YES | NO MIB_SYSTEM_MAX_RX_ERROR | YES | YES MIB_MIN_RX_SYMBOLS | YES | YES

The following table provides links to the function implementations of the related MIB primitives:

Primitive | Function ---------------- | :---------------------: MIB-Set | LoRaMacMibSetRequestConfirm MIB-Get | LoRaMacMibGetRequestConfirm

Enumerator:
MIB_DEVICE_CLASS 

LoRaWAN device class

LoRaWAN Specification V1.0.1

MIB_NETWORK_JOINED 

LoRaWAN Network joined attribute

LoRaWAN Specification V1.0.1

MIB_ADR 

Adaptive data rate

LoRaWAN Specification V1.0.1, chapter 4.3.1.1

[true: ADR enabled, false: ADR disabled]

MIB_NET_ID 

Network identifier

LoRaWAN Specification V1.0.1, chapter 6.1.1

MIB_DEV_ADDR 

End-device address

LoRaWAN Specification V1.0.1, chapter 6.1.1

MIB_NWK_SKEY 

Network session key

LoRaWAN Specification V1.0.1, chapter 6.1.3

MIB_APP_SKEY 

Application session key

LoRaWAN Specification V1.0.1, chapter 6.1.4

MIB_PUBLIC_NETWORK 

Set the network type to public or private

LoRaWAN Specification V1.0.1, chapter 7

[true: public network, false: private network]

MIB_REPEATER_SUPPORT 

Support the operation with repeaters

LoRaWAN Specification V1.0.1, chapter 7

[true: repeater support enabled, false: repeater support disabled]

MIB_CHANNELS 

Communication channels. A get request will return a pointer which references the first entry of the channel list. The list is of size LORA_MAX_NB_CHANNELS

LoRaWAN Specification V1.0.1, chapter 7

MIB_RX2_CHANNEL 

Set receive window 2 channel

LoRaWAN Specification V1.0.1, chapter 3.3.2

MIB_RX2_DEFAULT_CHANNEL 

Set receive window 2 channel

LoRaWAN Specification V1.0.1, chapter 3.3.2

MIB_CHANNELS_MASK 

LoRaWAN channels mask

LoRaWAN Specification V1.0.1, chapter 7

MIB_CHANNELS_DEFAULT_MASK 

LoRaWAN default channels mask

LoRaWAN Specification V1.0.1, chapter 7

MIB_CHANNELS_NB_REP 

Set the number of repetitions on a channel

LoRaWAN Specification V1.0.1, chapter 5.2

MIB_MAX_RX_WINDOW_DURATION 

Maximum receive window duration in [ms]

LoRaWAN Specification V1.0.1, chapter 3.3.3

MIB_RECEIVE_DELAY_1 

Receive delay 1 in [ms]

LoRaWAN Specification V1.0.1, chapter 7

MIB_RECEIVE_DELAY_2 

Receive delay 2 in [ms]

LoRaWAN Specification V1.0.1, chapter 7

MIB_JOIN_ACCEPT_DELAY_1 

Join accept delay 1 in [ms]

LoRaWAN Specification V1.0.1, chapter 7

MIB_JOIN_ACCEPT_DELAY_2 

Join accept delay 2 in [ms]

LoRaWAN Specification V1.0.1, chapter 7

MIB_CHANNELS_DEFAULT_DATARATE 

Default Data rate of a channel

LoRaWAN Specification V1.0.1, chapter 7

EU868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]

US915 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_8, DR_9, DR_10, DR_11, DR_12, DR_13]

MIB_CHANNELS_DATARATE 

Data rate of a channel

LoRaWAN Specification V1.0.1, chapter 7

EU868 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_5, DR_6, DR_7]

US915 - [DR_0, DR_1, DR_2, DR_3, DR_4, DR_8, DR_9, DR_10, DR_11, DR_12, DR_13]

MIB_CHANNELS_TX_POWER 

Transmission power of a channel

LoRaWAN Specification V1.0.1, chapter 7

EU868 - [TX_POWER_20_DBM, TX_POWER_14_DBM, TX_POWER_11_DBM, TX_POWER_08_DBM, TX_POWER_05_DBM, TX_POWER_02_DBM]

US915 - [TX_POWER_30_DBM, TX_POWER_28_DBM, TX_POWER_26_DBM, TX_POWER_24_DBM, TX_POWER_22_DBM, TX_POWER_20_DBM, TX_POWER_18_DBM, TX_POWER_14_DBM, TX_POWER_12_DBM, TX_POWER_10_DBM]

MIB_CHANNELS_DEFAULT_TX_POWER 

Transmission power of a channel

LoRaWAN Specification V1.0.1, chapter 7

EU868 - [TX_POWER_20_DBM, TX_POWER_14_DBM, TX_POWER_11_DBM, TX_POWER_08_DBM, TX_POWER_05_DBM, TX_POWER_02_DBM]

US915 - [TX_POWER_30_DBM, TX_POWER_28_DBM, TX_POWER_26_DBM, TX_POWER_24_DBM, TX_POWER_22_DBM, TX_POWER_20_DBM, TX_POWER_18_DBM, TX_POWER_14_DBM, TX_POWER_12_DBM, TX_POWER_10_DBM]

MIB_UPLINK_COUNTER 

LoRaWAN Up-link counter

LoRaWAN Specification V1.0.1, chapter 4.3.1.5

MIB_DOWNLINK_COUNTER 

LoRaWAN Down-link counter

LoRaWAN Specification V1.0.1, chapter 4.3.1.5

MIB_MULTICAST_CHANNEL 

Multicast channels. A get request will return a pointer to the first entry of the multicast channel linked list. If the pointer is equal to NULL, the list is empty.

MIB_SYSTEM_MAX_RX_ERROR 

System overall timing error in milliseconds. [-SystemMaxRxError : +SystemMaxRxError] Default: +/-10 ms

MIB_MIN_RX_SYMBOLS 

Minimum required number of symbols to detect an Rx frame Default: 6 symbols

Definition at line 1124 of file LoRaMac.h.

enum eMlme

LoRaMAC management services.

The following table list the primitives which are supported by the specific MAC management service:

Name | Request | Indication | Response | Confirm --------------------- | :-----: | :--------: | :------: | :-----: MLME_JOIN | YES | NO | NO | YES MLME_LINK_CHECK | YES | NO | NO | YES MLME_TXCW | YES | NO | NO | YES

The following table provides links to the function implementations of the related MLME primitives.

Primitive | Function ---------------- | :---------------------: MLME-Request | LoRaMacMlmeRequest MLME-Confirm | MacMlmeConfirm in LoRaMacPrimitives_t

Enumerator:
MLME_JOIN 

Initiates the Over-the-Air activation

LoRaWAN Specification V1.0.1, chapter 6.2

MLME_LINK_CHECK 

LinkCheckReq - Connectivity validation

LoRaWAN Specification V1.0.1, chapter 5, table 4

MLME_TXCW 

Sets Tx continuous wave mode

LoRaWAN end-device certification

MLME_TXCW_1 

Sets Tx continuous wave mode (new LoRa-Alliance CC definition)

LoRaWAN end-device certification

Definition at line 946 of file LoRaMac.h.


Function Documentation

LoRaMacStatus_t LoRaMacChannelAdd ( uint8_t  id,
ChannelParams_t  params 
)

LoRaMAC channel add service.

Adds a new channel to the channel list and activates the id in the channel mask. For the US915 band, all channels are enabled by default. It is not possible to activate less than 6 125 kHz channels.

Parameters:
[IN]id - Id of the channel. Possible values are:

0-15 for EU868 0-72 for US915

Parameters:
[IN]params - Channel parameters to set.
Return values:
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_PARAMETER_INVALID.

Definition at line 4052 of file LoRaMac.cpp.

LoRaMacStatus_t LoRaMacChannelRemove ( uint8_t  id )

LoRaMAC channel remove service.

Deactivates the id in the channel mask.

Parameters:
[IN]id - Id of the channel.
Return values:
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_PARAMETER_INVALID.

Definition at line 4164 of file LoRaMac.cpp.

LoRaMacStatus_t LoRaMacInitialization ( LoRaMacPrimitives_t primitives,
LoRaMacCallback_t *  callbacks 
)

LoRaMAC layer initialization.

In addition to the initialization of the LoRaMAC layer, this function initializes the callback primitives of the MCPS and MLME services. Every data field of LoRaMacPrimitives_t must be set to a valid callback function.

Parameters:
[IN]events - Pointer to a structure defining the LoRaMAC event functions. Refer to LoRaMacPrimitives_t.
[IN]events - Pointer to a structure defining the LoRaMAC callback functions. Refer to LoRaMacCallback_t.
Return values:
LoRaMacStatus_tStatus of the operation. Possible returns are: returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_PARAMETER_INVALID.

Definition at line 3357 of file LoRaMac.cpp.

LoRaMacStatus_t LoRaMacMcpsRequest ( McpsReq_t mcpsRequest )

LoRaMAC MCPS-Request.

The Mac Common Part Sublayer handles data services. The following code-snippet shows how to use the API to send an unconfirmed LoRaMAC frame.

 uint8_t myBuffer[] = { 1, 2, 3 };

 McpsReq_t  mcpsReq;
 mcpsReq.Type  = MCPS_UNCONFIRMED ;
 mcpsReq.Req.Unconfirmed .fPort  = 1;
 mcpsReq.Req.Unconfirmed .fBuffer  = myBuffer;
 mcpsReq.Req.Unconfirmed .fBufferSize  = sizeof( myBuffer );

 if( LoRaMacMcpsRequest( &mcpsReq ) == LORAMAC_STATUS_OK  )
 {
   // Service started successfully. Waiting for the MCPS-Confirm event
 }
Parameters:
[IN]mcpsRequest - MCPS-Request to perform. Refer to McpsReq_t.
Return values:
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID, LORAMAC_STATUS_NO_NETWORK_JOINED, LORAMAC_STATUS_LENGTH_ERROR, LORAMAC_STATUS_DEVICE_OFF.

Definition at line 4378 of file LoRaMac.cpp.

LoRaMacStatus_t LoRaMacMibGetRequestConfirm ( MibRequestConfirm_t mibGet )

LoRaMAC MIB-Get.

The mac information base service to get attributes of the LoRaMac layer.

The following code-snippet shows how to use the API to get the parameter AdrEnable, defined by the enumeration type MIB_ADR.

 MibRequestConfirm_t  mibReq;
 mibReq.Type  = MIB_ADR ;

 if( LoRaMacMibGetRequestConfirm( &mibReq ) == LORAMAC_STATUS_OK  )
 {
   // LoRaMAC updated the parameter mibParam.AdrEnable
 }
Parameters:
[IN]mibRequest - MIB-GET-Request to perform. Refer to MibRequestConfirm_t.
Return values:
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID.

Definition at line 3563 of file LoRaMac.cpp.

LoRaMacStatus_t LoRaMacMibSetRequestConfirm ( MibRequestConfirm_t mibSet )

LoRaMAC MIB-Set.

The mac information base service to set attributes of the LoRaMac layer.

The following code-snippet shows how to use the API to set the parameter AdrEnable, defined by the enumeration type MIB_ADR.

 MibRequestConfirm_t  mibReq;
 mibReq.Type  = MIB_ADR ;
 mibReq.Param .AdrEnable  = true;

 if( LoRaMacMibGetRequestConfirm( &mibReq ) == LORAMAC_STATUS_OK  )
 {
   // LoRaMAC updated the parameter
 }
Parameters:
[IN]mibRequest - MIB-SET-Request to perform. Refer to MibRequestConfirm_t.
Return values:
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID.

Definition at line 3727 of file LoRaMac.cpp.

LoRaMacStatus_t LoRaMacMlmeRequest ( MlmeReq_t mlmeRequest )

LoRaMAC MLME-Request.

The Mac layer management entity handles management services. The following code-snippet shows how to use the API to perform a network join request.

 static uint8_t DevEui[] =
 {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 static uint8_t AppEui[] =
 {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 static uint8_t AppKey[] =
 {
   0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
   0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
 };

 MlmeReq_t  mlmeReq;
 mlmeReq.Type  = MLME_JOIN ;
 mlmeReq.Req.Join .DevEui  = DevEui;
 mlmeReq.Req.Join .AppEui  = AppEui;
 mlmeReq.Req.Join .AppKey  = AppKey;

 if( LoRaMacMlmeRequest( &mlmeReq ) == LORAMAC_STATUS_OK  )
 {
   // Service started successfully. Waiting for the Mlme-Confirm event
 }
Parameters:
[IN]mlmeRequest - MLME-Request to perform. Refer to MlmeReq_t.
Return values:
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_SERVICE_UNKNOWN, LORAMAC_STATUS_PARAMETER_INVALID, LORAMAC_STATUS_NO_NETWORK_JOINED, LORAMAC_STATUS_LENGTH_ERROR, LORAMAC_STATUS_DEVICE_OFF.

Definition at line 4270 of file LoRaMac.cpp.

LoRaMacStatus_t LoRaMacMulticastChannelLink ( MulticastParams_t channelParam )

LoRaMAC multicast channel link service.

Links a multicast channel into the linked list.

Parameters:
[IN]channelParam - Multicast channel parameters to link.
Return values:
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_PARAMETER_INVALID.

Definition at line 4196 of file LoRaMac.cpp.

LoRaMacStatus_t LoRaMacMulticastChannelUnlink ( MulticastParams_t channelParam )

LoRaMAC multicast channel unlink service.

Unlinks a multicast channel from the linked list.

Parameters:
[IN]channelParam - Multicast channel parameters to unlink.
Return values:
LoRaMacStatus_tStatus of the operation. Possible returns are: LORAMAC_STATUS_OK, LORAMAC_STATUS_BUSY, LORAMAC_STATUS_PARAMETER_INVALID.

Definition at line 4231 of file LoRaMac.cpp.

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.

Parameters:
[IN]size - Size of applicative payload to be send next
[OUT]txInfo - The structure LoRaMacTxInfo_t contains information about the actual maximum payload possible ( according to the configured datarate or the next datarate according to ADR ), and the maximum frame size, taking the scheduled MAC commands into account.
Return values:
LoRaMacStatus_tStatus of the operation. When the parameters are not valid, the function returns LORAMAC_STATUS_PARAMETER_INVALID. In case of a length error caused by the applicative payload size, the function returns LORAMAC_STATUS_LENGTH_ERROR. In case of a length error due to additional MAC commands in the queue, the function returns LORAMAC_STATUS_MAC_CMD_LENGTH_ERROR. In case the query is valid, and the LoRaMAC is able to send the frame, the function returns LORAMAC_STATUS_OK. *

Definition at line 3520 of file LoRaMac.cpp.