LoRaWAN header

LoRaWAN header types and helper functions. More...

Detailed Description

LoRaWAN header types and helper functions.

Files

file  hdr.h
 LoRaWAN header type and helper function definitions.
 

Data Structures

struct  lorawan_hdr_t
 Data type to represent a LoRaWAN packet header. More...
 
struct  lorawan_join_request_t
 Join request packet representation. More...
 
struct  lorawan_join_accept_t
 Join accept packet representation. More...
 

Macros

#define LORAWAN_HDR_MTYPE_MASK   (0xe0)
 MType mask.
 
#define LORAWAN_HDR_MTYPE_POS   (5U)
 MType position.
 
#define LORAWAN_HDR_MAJOR_MASK   (0x03)
 Major version mask.
 
#define LORAWAN_HDR_MAJOR_POS   (0U)
 Major version position.
 
#define LORAWAN_HDR_ADR_MASK   (0x80)
 ADR mask.
 
#define LORAWAN_HDR_ADR_POS   (7U)
 ADR position.
 
#define LORAWAN_HDR_ADR_ACK_MASK   (0x40)
 ADR ACK bit mask.
 
#define LORAWAN_HDR_ADR_ACK_POS   (6U)
 ADR ACK bit position.
 
#define LORAWAN_HDR_ACK_MASK   (0x20)
 ACK bit mask.
 
#define LORAWAN_HDR_ACK_POS   (5U)
 ACK bit position.
 
#define LORAWAN_HDR_FRAME_PENDING_MASK   (0x10)
 Frame pending bit mask.
 
#define LORAWAN_HDR_FRAME_PENDING_POS   (4U)
 Frame pending bit position.
 
#define LORAWAN_HDR_FOPTS_LEN_MASK   (0x0F)
 Frame options mask.
 
#define LORAWAN_HDR_FOPTS_LEN_POS   (0U)
 Frame options position.
 

Functions

static void lorawan_hdr_set_mtype (lorawan_hdr_t *hdr, uint8_t mtype)
 Set LoRaWAN header MType. More...
 
static uint8_t lorawan_hdr_get_mtype (lorawan_hdr_t *hdr)
 Get LoRaWAN header MType. More...
 
static void lorawan_hdr_set_maj (lorawan_hdr_t *hdr, uint8_t maj)
 Set LoRaWAN major version. More...
 
static uint8_t lorawan_hdr_get_maj (lorawan_hdr_t *hdr)
 Get LoRaWAN major version. More...
 
static void lorawan_hdr_set_adr (lorawan_hdr_t *hdr, bool adr)
 Set LoRaWAN header Adaptive Data Rate bit. More...
 
static bool lorawan_hdr_get_adr (lorawan_hdr_t *hdr)
 Get LoRaWAN header Adaptive Data Rate bit. More...
 
static void lorawan_hdr_set_adr_ack_req (lorawan_hdr_t *hdr, bool adr_ack_req)
 Set LoRaWAN header ADR ACK request bit. More...
 
static bool lorawan_hdr_get_adr_ack_req (lorawan_hdr_t *hdr)
 Get LoRaWAN header ADR ACK request bit. More...
 
static void lorawan_hdr_set_ack (lorawan_hdr_t *hdr, bool ack)
 Set LoRaWAN header ACK bit. More...
 
static bool lorawan_hdr_get_ack (lorawan_hdr_t *hdr)
 Get LoRaWAN header ACK bit. More...
 
static void lorawan_hdr_set_frame_pending (lorawan_hdr_t *hdr, bool frame_pending)
 Set LoRaWAN header frame pending bit. More...
 
static bool lorawan_hdr_get_frame_pending (lorawan_hdr_t *hdr)
 Get LoRaWAN header frame pending bit. More...
 
static void lorawan_hdr_set_frame_opts_len (lorawan_hdr_t *hdr, uint8_t len)
 Set LoRaWAN header FOpts length. More...
 
static uint8_t lorawan_hdr_get_frame_opts_len (lorawan_hdr_t *hdr)
 Get LoRaWAN header FOps length. More...
 

Function Documentation

◆ lorawan_hdr_get_ack()

static bool lorawan_hdr_get_ack ( lorawan_hdr_t hdr)
inlinestatic

Get LoRaWAN header ACK bit.

Parameters
[in]hdrLoRaWAN header
Returns
value of the ACK bit

Definition at line 228 of file hdr.h.

◆ lorawan_hdr_get_adr()

static bool lorawan_hdr_get_adr ( lorawan_hdr_t hdr)
inlinestatic

Get LoRaWAN header Adaptive Data Rate bit.

Parameters
[in]hdrLoRaWAN header
Returns
the value of the ADR bit

Definition at line 180 of file hdr.h.

◆ lorawan_hdr_get_adr_ack_req()

static bool lorawan_hdr_get_adr_ack_req ( lorawan_hdr_t hdr)
inlinestatic

Get LoRaWAN header ADR ACK request bit.

Parameters
[in]hdrLoRaWAN header
Returns
the value of ADR ACK request bit

Definition at line 204 of file hdr.h.

◆ lorawan_hdr_get_frame_opts_len()

static uint8_t lorawan_hdr_get_frame_opts_len ( lorawan_hdr_t hdr)
inlinestatic

Get LoRaWAN header FOps length.

Parameters
[in]hdrLoRaWAN header
Returns
length of piggybacked FOpts

Definition at line 276 of file hdr.h.

◆ lorawan_hdr_get_frame_pending()

static bool lorawan_hdr_get_frame_pending ( lorawan_hdr_t hdr)
inlinestatic

Get LoRaWAN header frame pending bit.

Parameters
[in]hdrLoRaWAN header
Returns
value of the frame pending bit

Definition at line 252 of file hdr.h.

◆ lorawan_hdr_get_maj()

static uint8_t lorawan_hdr_get_maj ( lorawan_hdr_t hdr)
inlinestatic

Get LoRaWAN major version.

Parameters
[in]hdrLoRaWAN header
Returns
major version of the packet

Definition at line 156 of file hdr.h.

◆ lorawan_hdr_get_mtype()

static uint8_t lorawan_hdr_get_mtype ( lorawan_hdr_t hdr)
inlinestatic

Get LoRaWAN header MType.

Parameters
[in]hdrLoRaWAN hdr
Returns
mtype of the packet

Definition at line 132 of file hdr.h.

◆ lorawan_hdr_set_ack()

static void lorawan_hdr_set_ack ( lorawan_hdr_t hdr,
bool  ack 
)
inlinestatic

Set LoRaWAN header ACK bit.

Parameters
[in]hdrLoRaWAN header
[in]ackvalue of the ACK bit

Definition at line 215 of file hdr.h.

◆ lorawan_hdr_set_adr()

static void lorawan_hdr_set_adr ( lorawan_hdr_t hdr,
bool  adr 
)
inlinestatic

Set LoRaWAN header Adaptive Data Rate bit.

Parameters
[in]hdrLoRaWAN header
[in]adrvalue of the ADR bit

Definition at line 167 of file hdr.h.

◆ lorawan_hdr_set_adr_ack_req()

static void lorawan_hdr_set_adr_ack_req ( lorawan_hdr_t hdr,
bool  adr_ack_req 
)
inlinestatic

Set LoRaWAN header ADR ACK request bit.

Parameters
[in]hdrLoRaWAN header
[in]adr_ack_reqvalue of the ADR ACK request bit

Definition at line 191 of file hdr.h.

◆ lorawan_hdr_set_frame_opts_len()

static void lorawan_hdr_set_frame_opts_len ( lorawan_hdr_t hdr,
uint8_t  len 
)
inlinestatic

Set LoRaWAN header FOpts length.

Parameters
[in]hdrLoRaWAN header
[in]lenlength of the piggybacked FOpts

Definition at line 263 of file hdr.h.

◆ lorawan_hdr_set_frame_pending()

static void lorawan_hdr_set_frame_pending ( lorawan_hdr_t hdr,
bool  frame_pending 
)
inlinestatic

Set LoRaWAN header frame pending bit.

Parameters
[in]hdrLoRaWAN header
[in]frame_pendingvalue of the frame pending bit

Definition at line 239 of file hdr.h.

◆ lorawan_hdr_set_maj()

static void lorawan_hdr_set_maj ( lorawan_hdr_t hdr,
uint8_t  maj 
)
inlinestatic

Set LoRaWAN major version.

Parameters
[in]hdrLoRaWAN header
[in]majmajor version

Definition at line 143 of file hdr.h.

◆ lorawan_hdr_set_mtype()

static void lorawan_hdr_set_mtype ( lorawan_hdr_t hdr,
uint8_t  mtype 
)
inlinestatic

Set LoRaWAN header MType.

Parameters
[in]hdrLoRaWAN hdr
[in]mtypedesired MType

Definition at line 119 of file hdr.h.