Loading...
Searching...
No Matches
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.
 
#define LORAWAN_JA_HDR_OPTNEG_MASK   (0x80)
 OptNeg bit mask.
 
#define LORAWAN_JA_HDR_OPTNEG_POS   (7U)
 OptNeg bit position.
 

Functions

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

Macro Definition Documentation

◆ LORAWAN_HDR_ACK_MASK

#define LORAWAN_HDR_ACK_MASK   (0x20)

ACK bit mask.

Definition at line 40 of file hdr.h.

◆ LORAWAN_HDR_ACK_POS

#define LORAWAN_HDR_ACK_POS   (5U)

ACK bit position.

Definition at line 41 of file hdr.h.

◆ LORAWAN_HDR_ADR_ACK_MASK

#define LORAWAN_HDR_ADR_ACK_MASK   (0x40)

ADR ACK bit mask.

Definition at line 38 of file hdr.h.

◆ LORAWAN_HDR_ADR_ACK_POS

#define LORAWAN_HDR_ADR_ACK_POS   (6U)

ADR ACK bit position.

Definition at line 39 of file hdr.h.

◆ LORAWAN_HDR_ADR_MASK

#define LORAWAN_HDR_ADR_MASK   (0x80)

ADR mask.

Definition at line 36 of file hdr.h.

◆ LORAWAN_HDR_ADR_POS

#define LORAWAN_HDR_ADR_POS   (7U)

ADR position.

Definition at line 37 of file hdr.h.

◆ LORAWAN_HDR_FOPTS_LEN_MASK

#define LORAWAN_HDR_FOPTS_LEN_MASK   (0x0F)

Frame options mask.

Definition at line 44 of file hdr.h.

◆ LORAWAN_HDR_FOPTS_LEN_POS

#define LORAWAN_HDR_FOPTS_LEN_POS   (0U)

Frame options position.

Definition at line 45 of file hdr.h.

◆ LORAWAN_HDR_FRAME_PENDING_MASK

#define LORAWAN_HDR_FRAME_PENDING_MASK   (0x10)

Frame pending bit mask.

Definition at line 42 of file hdr.h.

◆ LORAWAN_HDR_FRAME_PENDING_POS

#define LORAWAN_HDR_FRAME_PENDING_POS   (4U)

Frame pending bit position.

Definition at line 43 of file hdr.h.

◆ LORAWAN_HDR_MAJOR_MASK

#define LORAWAN_HDR_MAJOR_MASK   (0x03)

Major version mask.

Definition at line 34 of file hdr.h.

◆ LORAWAN_HDR_MAJOR_POS

#define LORAWAN_HDR_MAJOR_POS   (0U)

Major version position.

Definition at line 35 of file hdr.h.

◆ LORAWAN_HDR_MTYPE_MASK

#define LORAWAN_HDR_MTYPE_MASK   (0xe0)

MType mask.

Definition at line 32 of file hdr.h.

◆ LORAWAN_HDR_MTYPE_POS

#define LORAWAN_HDR_MTYPE_POS   (5U)

MType position.

Definition at line 33 of file hdr.h.

◆ LORAWAN_JA_HDR_OPTNEG_MASK

#define LORAWAN_JA_HDR_OPTNEG_MASK   (0x80)

OptNeg bit mask.

Definition at line 47 of file hdr.h.

◆ LORAWAN_JA_HDR_OPTNEG_POS

#define LORAWAN_JA_HDR_OPTNEG_POS   (7U)

OptNeg bit position.

Definition at line 48 of file hdr.h.

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 231 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 183 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 207 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 279 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 255 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 159 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 135 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 218 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 170 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 194 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 266 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 242 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 146 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 122 of file hdr.h.

◆ lorawan_ja_hdr_get_optneg()

static bool lorawan_ja_hdr_get_optneg ( lorawan_join_accept_t ja_hdr)
inlinestatic

Get LoRaWAN join accept message OptNeg bit.

Parameters
[in]ja_hdrJoin accept message header
Returns
value of the OptNeg bit

Definition at line 291 of file hdr.h.