Loading...
Searching...
No Matches
loramac.h File Reference

LoRaMAC header definitions. More...

Detailed Description

LoRaMAC header definitions.

Author
Alexandre Abadie alexa.nosp@m.ndre.nosp@m..abad.nosp@m.ie@i.nosp@m.nria..nosp@m.fr

Definition in file loramac.h.

#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include "modules.h"
+ Include dependency graph for loramac.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  loramac_channel_t
 A LoRaMAC network channel. More...
 

Macros

#define CONFIG_LORAMAC_DEV_EUI_DEFAULT   "0000000000000000"
 Default device EUI.
 
#define CONFIG_LORAMAC_JOIN_EUI_DEFAULT   "0000000000000000"
 Default join EUI.
 
#define CONFIG_LORAMAC_APP_EUI_DEFAULT   "0000000000000000"
 Default application EUI.
 
#define CONFIG_LORAMAC_APP_KEY_DEFAULT   "00000000000000000000000000000000"
 Default application key.
 
#define CONFIG_LORAMAC_NWK_KEY_DEFAULT   "00000000000000000000000000000000"
 Default network key.
 
#define CONFIG_LORAMAC_APP_SKEY_DEFAULT   "00000000000000000000000000000000"
 Default application session key.
 
#define CONFIG_LORAMAC_NWK_SKEY_DEFAULT   "00000000000000000000000000000000"
 Default network session key.
 
#define CONFIG_LORAMAC_FNWKSINT_KEY_DEFAULT   "00000000000000000000000000000000"
 Default network session integrity key.
 
#define CONFIG_LORAMAC_SNWKSINT_KEY_DEFAULT   "00000000000000000000000000000000"
 Default serving network session integrity key.
 
#define CONFIG_LORAMAC_NWKSENC_KEY_DEFAULT   "00000000000000000000000000000000"
 Default network session encryption key.
 
#define CONFIG_LORAMAC_DEV_ADDR_DEFAULT   "00000000"
 Default device address.
 
#define CONFIG_LORAMAC_REGION_EU_868   1
 Default LoRaWAN region.
 
#define CONFIG_LORAMAC_DEFAULT_DEVICE_CLASS   (LORAMAC_CLASS_A)
 Default device class (A, B or C)
 
#define CONFIG_LORAMAC_DEFAULT_NETID   (1U)
 Default NetID (only valid with ABP join procedure)
 
#define CONFIG_LORAMAC_DEFAULT_PRIVATE_NETWORK
 Toggle network type (public or private)
 
#define CONFIG_LORAMAC_DEFAULT_DR   (LORAMAC_DR_0)
 Default datarate index.
 
#define CONFIG_LORAMAC_DEFAULT_TX_POWER   (LORAMAC_TX_PWR_1)
 Default MAC TX power index.
 
#define CONFIG_LORAMAC_DEFAULT_TX_PORT   (2U)
 Default MAC TX port (from 1 to 223)
 
#define CONFIG_LORAMAC_DEFAULT_TX_MODE   (LORAMAC_TX_CNF)
 Default MAC TX mode (confirmable or unconfirmable)
 
#define CONFIG_LORAMAC_DEFAULT_REDUNDANCY   (0U)
 Default redundancy for unconfirmed uplink.
 
#define CONFIG_LORAMAC_DEFAULT_ADR
 Enable/disable adaptive datarate state.
 
#define CONFIG_LORAMAC_DEFAULT_RETX   (5U)
 Default uplink retransmission.
 
#define CONFIG_LORAMAC_DEFAULT_LINKCHK   (0U)
 Default link check interval (in seconds)
 
#define CONFIG_LORAMAC_DEFAULT_RX1_DELAY   (1000U)
 Default first RX window delay (in ms)
 
#define CONFIG_LORAMAC_DEFAULT_JOIN_PROCEDURE   (LORAMAC_JOIN_OTAA)
 Default second RX (RX2) window datarate index.
 
#define CONFIG_LORAMAC_DEFAULT_JOIN_DELAY1   (5U)
 Default LoRaMAC join accept delay 1 (in seconds)
 
#define CONFIG_LORAMAC_DEFAULT_JOIN_DELAY2   (6U)
 Default LoRaMAC join accept delay 2.
 
#define CONFIG_LORAMAC_DEFAULT_MAX_FCNT_GAP   (16384U)
 Default max FCNT gap.
 
#define CONFIG_LORAMAC_DEFAULT_SYSTEM_MAX_RX_ERROR   (50)
 Default maximum system overall timing error.
 
#define CONFIG_LORAMAC_DEFAULT_MIN_RX_SYMBOLS   (12)
 Default minimum RX symbols to detect a frame.
 
#define LORAMAC_DEFAULT_ADR_ACK_LIMIT   (64U)
 Default adaptive datarate ACK limit (in s)
 
#define LORAMAC_DEFAULT_ADR_ACK_DELAY   (32U)
 Default adaptive datarate ACK delay (in s)
 
#define LORAMAC_DEFAULT_ADR_TIMEOUT   (3U)
 Default adaptive datarate timeout.
 
#define LORAMAC_DEFAULT_RX2_DELAY   (1000U + CONFIG_LORAMAC_DEFAULT_RX1_DELAY)
 Default second RX window delay (in ms)
 

Functions

static uint32_t lora_time_on_air (size_t pkt_len, loramac_dr_idx_t dr, uint8_t cr)
 Compute the time on air of a LoRa packet.
 

LoRaMAC constants

#define LORAMAC_DEVEUI_LEN   (8U)
 Device EUI length in bytes.
 
#define LORAMAC_DEVADDR_LEN   (4U)
 Device address length in bytes.
 
#define LORAMAC_APPEUI_LEN   (8U)
 Application EUI length in bytes.
 
#define LORAMAC_JOINEUI_LEN   (8U)
 Join EUI length in bytes.
 
#define LORAMAC_APPKEY_LEN   (16U)
 Application key length in bytes.
 
#define LORAMAC_NWKKEY_LEN   (16U)
 Network key length in bytes.
 
#define LORAMAC_APPSKEY_LEN   (16U)
 Application session key length in bytes.
 
#define LORAMAC_NWKSKEY_LEN   (16U)
 Network session key length in bytes.
 
#define LORAMAC_FNWKSINTKEY_LEN   (16U)
 Forwarding Network session integrity key length in bytes.
 
#define LORAMAC_SNWKSINTKEY_LEN   (16U)
 Serving Network session integrity key length in bytes.
 
#define LORAMAC_NWKSENCKEY_LEN   (16U)
 Network session encryption key length in bytes.
 
#define LORAMAC_JSINTKEY_LEN   (16U)
 Join session integrity key length in bytes.
 
#define LORAMAC_JSENCKEY_LEN   (16U)
 Join session encryption key length in bytes.
 
#define LORAMAC_JSINTKEY_LEN   (16U)
 Join session integrity key length in bytes.
 
#define LORAMAC_PORT_MIN   (1U)
 Minimum port value.
 
#define LORAMAC_PORT_MAX   (223U)
 Maximum port value.
 
#define LORAMAC_APP_NONCE_LEN   (3U)
 Application Nonce length in bytes.
 
#define LORAMAC_JOIN_NONCE_LEN   (3U)
 Join nonce length in bytes.
 
#define LORAMAC_NETWORK_ID_LEN   (3U)
 Network ID length in bytes.
 
#define LORAMAC_CHANNELS_MASK_LEN   (1U)
 Channel mask length.
 

LoRaMAC parameters indexes

enum  loramac_class_t { LORAMAC_CLASS_A , LORAMAC_CLASS_B , LORAMAC_CLASS_C }
 Device class. More...
 
enum  loramac_join_mode_t { LORAMAC_JOIN_OTAA , LORAMAC_JOIN_ABP }
 LoRaMAC network join procedure type. More...
 
enum  loramac_tx_mode_t { LORAMAC_TX_CNF , LORAMAC_TX_UNCNF }
 LoRaMAC transmission mode. More...
 
enum  loramac_dr_idx_t {
  LORAMAC_DR_0 = 0 , LORAMAC_DR_1 , LORAMAC_DR_2 , LORAMAC_DR_3 ,
  LORAMAC_DR_4 , LORAMAC_DR_5 , LORAMAC_DR_6 , LORAMAC_DR_7 ,
  LORAMAC_DR_8 , LORAMAC_DR_9 , LORAMAC_DR_10 , LORAMAC_DR_11 ,
  LORAMAC_DR_12 , LORAMAC_DR_13 , LORAMAC_DR_14 , LORAMAC_DR_15
}
 LoRaMAC datarate indexes. More...
 
enum  loramac_tx_pwr_idx_t {
  LORAMAC_TX_PWR_0 = 0 , LORAMAC_TX_PWR_1 , LORAMAC_TX_PWR_2 , LORAMAC_TX_PWR_3 ,
  LORAMAC_TX_PWR_4 , LORAMAC_TX_PWR_5 , LORAMAC_TX_PWR_6 , LORAMAC_TX_PWR_7 ,
  LORAMAC_TX_PWR_8 , LORAMAC_TX_PWR_9 , LORAMAC_TX_PWR_10 , LORAMAC_TX_PWR_11 ,
  LORAMAC_TX_PWR_12 , LORAMAC_TX_PWR_13 , LORAMAC_TX_PWR_14 , LORAMAC_TX_PWR_15
}
 LoRaMAC transmission power indexes. More...