Mbed OS Reference
Loading...
Searching...
No Matches
lorawan_data_structures.h File Reference

Contains common data structures used by Mbed-OS LoRaWAN mplementation. More...

#include <inttypes.h>
#include "lorawan_types.h"

Go to the source code of this file.

Data Structures

struct  band_t
 Default user application maximum data size for transmission. More...
 
struct  rx2_channel_params
 
struct  lora_mac_system_params_t
 
struct  multicast_params_s
 
union  loramac_mhdr_t
 
struct  loramac_mhdr_t::hdr_bits_s
 
union  loramac_frame_ctrl_t
 
struct  loramac_frame_ctrl_t::ctrl_bits_s
 
struct  loramac_mcps_confirm_t
 
struct  loramac_mcps_indication_t
 
struct  mlme_join_req_t
 
struct  mlme_cw_tx_mode_t
 
struct  loramac_mlme_confirm_t
 
struct  loramac_mlme_indication_t
 
struct  loramac_tx_message_t
 Stack level TX message structure. More...
 
union  rx_message_u
 lora_mac_rx_message_by_type_t union More...
 
struct  loramac_rx_message_t
 loramac_rx_message_t More...
 
struct  lorawan_session
 LoRaWAN session. More...
 
struct  rx_config_params_t
 
struct  timer_event_t
 Timer object description. More...
 
struct  loramac_keys
 
struct  lorawan_timers
 
struct  loramac_protocol_params
 

Macros

#define LORAMAC_MFR_LEN   4
 
#define LORA_MAC_FRMPAYLOAD_OVERHEAD   13
 
#define LORA_MAX_NB_CHANNELS   16
 LoRaMac maximum number of channels. More...
 
#define LORAMAC_PHY_MAXPAYLOAD   255
 Maximum PHY layer payload size for reception. More...
 

Typedefs

typedef uint32_t lorawan_time_t
 Timer time variable definition. More...
 
typedef struct multicast_params_s multicast_params_t
 
typedef enum device_states device_states_t
 End-device states. More...
 
typedef struct lorawan_session lorawan_session_t
 LoRaWAN session. More...
 

Enumerations

enum  rx_slot_t { RX_SLOT_WIN_1 , RX_SLOT_WIN_2 , RX_SLOT_WIN_CLASS_C , RX_SLOT_WIN_PING_SLOT }
 
enum  mac_frame_type_t {
  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  mote_mac_cmds_t {
  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 , MOTE_MAC_TX_PARAM_SETUP_ANS = 0x09 ,
  MOTE_MAC_DL_CHANNEL_ANS = 0x0A
}
 
enum  server_mac_cmds_t {
  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 , SRV_MAC_TX_PARAM_SETUP_REQ = 0x09 ,
  SRV_MAC_DL_CHANNEL_REQ = 0x0A
}
 
enum  device_battery_level_t { BAT_LEVEL_EXT_SRC = 0x00 , BAT_LEVEL_EMPTY = 0x01 , BAT_LEVEL_FULL = 0xFE , BAT_LEVEL_NO_MEASURE = 0xFF }
 
enum  loramac_event_info_status_t {
  LORAMAC_EVENT_INFO_STATUS_OK = 0 , LORAMAC_EVENT_INFO_STATUS_ERROR , LORAMAC_EVENT_INFO_STATUS_TX_TIMEOUT , LORAMAC_EVENT_INFO_STATUS_RX1_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_LOST , LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL ,
  LORAMAC_EVENT_INFO_STATUS_MIC_FAIL , LORAMAC_EVENT_INFO_STATUS_CRYPTO_FAIL
}
 
enum  mcps_type_t { MCPS_UNCONFIRMED , MCPS_CONFIRMED , MCPS_MULTICAST , MCPS_PROPRIETARY }
 LoRaMAC data services. More...
 
enum  mlme_type_t {
  MLME_JOIN , MLME_LINK_CHECK , MLME_TXCW , MLME_TXCW_1 ,
  MLME_SCHEDULE_UPLINK
}
 LoRaMAC management services. More...
 
enum  device_states
 End-device states. More...
 
enum  rx_msg_type { LORAMAC_RX_MLME_CONFIRM = 0 , LORAMAC_RX_MCPS_CONFIRM , LORAMAC_RX_MCPS_INDICATION }
 lora_mac_rx_message_type_t More...
 

Detailed Description

Contains common data structures used by Mbed-OS LoRaWAN mplementation.

______ _
/ _____) _ | |
( (____ _____ ____ _| |_ _____ ____| |__
\____ \| ___ | (_ _) ___ |/ ___) _ \
_____) ) ____| | | || |_| ____( (___| | | |
(______/|_____)_|_|_| \__)_____)\____)_| |_|
(C)2013 Semtech
___ _____ _ ___ _ _____ ___ ___ ___ ___
/ __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
\__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
|___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
embedded.connectivity.solutions===============

Description: LoRa PHY layer

License: Revised BSD License, see LICENSE.TXT file include in the project

Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )

Copyright (c) 2017, Arm Limited and affiliates. SPDX-License-Identifier: BSD-3-Clause

Definition in file lorawan_data_structures.h.

Macro Definition Documentation

◆ LORAMAC_MFR_LEN

#define LORAMAC_MFR_LEN   4

Sets the length of the LoRaMAC footer field. Mainly indicates the MIC field length.

Definition at line 51 of file lorawan_data_structures.h.

◆ LORA_MAC_FRMPAYLOAD_OVERHEAD

#define LORA_MAC_FRMPAYLOAD_OVERHEAD   13

The FRMPayload overhead to be used when setting the Radio.SetMaxPayloadLength in the RxWindowSetup function. The maximum PHYPayload = MaxPayloadOfDatarate/MaxPayloadOfDatarateRepeater + LORA_MAC_FRMPAYLOAD_OVERHEAD

Definition at line 58 of file lorawan_data_structures.h.

◆ LORA_MAX_NB_CHANNELS

#define LORA_MAX_NB_CHANNELS   16

LoRaMac maximum number of channels.

Definition at line 63 of file lorawan_data_structures.h.

◆ LORAMAC_PHY_MAXPAYLOAD

#define LORAMAC_PHY_MAXPAYLOAD   255

Maximum PHY layer payload size for reception.

Definition at line 68 of file lorawan_data_structures.h.

Typedef Documentation

◆ lorawan_time_t

typedef uint32_t lorawan_time_t

Timer time variable definition.

Definition at line 44 of file lorawan_data_structures.h.

◆ multicast_params_t

LoRaMAC multicast channel parameter.

◆ device_states_t

End-device states.

◆ lorawan_session_t

LoRaWAN session.

A structure for keeping session details.

Enumeration Type Documentation

◆ rx_slot_t

enum rx_slot_t

LoRaMAC receive window enumeration

Enumerator
RX_SLOT_WIN_1 

LoRaMAC receive window 1

RX_SLOT_WIN_2 

LoRaMAC receive window 2

RX_SLOT_WIN_CLASS_C 

LoRaMAC receive window 2 for class c - continuous listening

RX_SLOT_WIN_PING_SLOT 

LoRaMAC class b ping slot window

Definition at line 137 of file lorawan_data_structures.h.

◆ mac_frame_type_t

LoRaMAC frame types.

LoRaWAN Specification V1.0.2, 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 uplink frame.

FRAME_TYPE_DATA_UNCONFIRMED_DOWN 

LoRaMAC unconfirmed downlink frame.

FRAME_TYPE_DATA_CONFIRMED_UP 

LoRaMAC confirmed uplink frame.

FRAME_TYPE_DATA_CONFIRMED_DOWN 

LoRaMAC confirmed downlink frame.

FRAME_TYPE_RFU 

LoRaMAC RFU frame.

FRAME_TYPE_PROPRIETARY 

LoRaMAC proprietary frame.

Definition at line 265 of file lorawan_data_structures.h.

◆ mote_mac_cmds_t

LoRaMAC mote MAC commands.

LoRaWAN Specification V1.0.2, 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

MOTE_MAC_TX_PARAM_SETUP_ANS 

TXParamSetupAns

MOTE_MAC_DL_CHANNEL_ANS 

DlChannelAns

Definition at line 305 of file lorawan_data_structures.h.

◆ server_mac_cmds_t

LoRaMAC server MAC commands.

LoRaWAN Specification V1.0.2 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

SRV_MAC_TX_PARAM_SETUP_REQ 

NewChannelReq

SRV_MAC_DL_CHANNEL_REQ 

DlChannelReq

Definition at line 349 of file lorawan_data_structures.h.

◆ device_battery_level_t

LoRaMAC battery level indicator.

Enumerator
BAT_LEVEL_EXT_SRC 

An 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 391 of file lorawan_data_structures.h.

◆ loramac_event_info_status_t

The 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_RX1_TIMEOUT 

An RX timeout occurred on receive window 1.

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_LOST 

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.

LORAMAC_EVENT_INFO_STATUS_CRYPTO_FAIL 

Crypto methods failure

Definition at line 479 of file lorawan_data_structures.h.

◆ mcps_type_t

LoRaMAC data services.

The following table list the primitives supported by a 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
Enumerator
MCPS_UNCONFIRMED 

Unconfirmed LoRaMAC frame.

MCPS_CONFIRMED 

Confirmed LoRaMAC frame.

MCPS_MULTICAST 

Multicast LoRaMAC frame.

MCPS_PROPRIETARY 

Proprietary frame.

Definition at line 556 of file lorawan_data_structures.h.

◆ mlme_type_t

LoRaMAC management services.

The following table list the primitives supported by a 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
MLME_SCHEDULE_UPLINK NO YES NO NO
Enumerator
MLME_JOIN 

Initiates the Over-the-Air activation.

LoRaWAN Specification V1.0.2, chapter 6.2.

MLME_LINK_CHECK 

LinkCheckReq - Connectivity validation.

LoRaWAN Specification V1.0.2, 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.

MLME_SCHEDULE_UPLINK 

Indicates that the application shall perform an uplink as soon as possible.

Definition at line 708 of file lorawan_data_structures.h.

◆ device_states

End-device states.

Definition at line 837 of file lorawan_data_structures.h.

◆ rx_msg_type

lora_mac_rx_message_type_t

An enum representing a structure for RX messages.

Enumerator
LORAMAC_RX_MLME_CONFIRM 

lora_mac_mlme_confirm_t

LORAMAC_RX_MCPS_CONFIRM 

lora_mac_mcps_confirm_t

LORAMAC_RX_MCPS_INDICATION 

lora_mac_mcps_indication_t

Definition at line 939 of file lorawan_data_structures.h.