Loading...
Searching...
No Matches
lorawan.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 FundaciĆ³n Inria Chile
3 * Copyright (C) 2019 HAW Hamburg
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
23#ifndef NET_GNRC_LORAWAN_H
24#define NET_GNRC_LORAWAN_H
25
27#include "assert.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
41#ifndef CONFIG_GNRC_LORAWAN_MIN_SYMBOLS_TIMEOUT
42#define CONFIG_GNRC_LORAWAN_MIN_SYMBOLS_TIMEOUT 30
43#endif
46#define GNRC_LORAWAN_REQ_STATUS_SUCCESS (0)
47#define GNRC_LORAWAN_REQ_STATUS_DEFERRED (1)
56
65
74
86
94
98typedef struct {
100 union {
102 void *dev_addr;
103 uint8_t rx2_dr;
104 };
105} mlme_mib_t;
106
117
121typedef struct {
122 union {
124 };
127
139
148
152typedef struct {
154 union {
156 };
158
162typedef struct {
165
172
179
186{
187 /* The failed reception is seen by the MAC layer as an RX timeout */
189}
190
197
205void gnrc_lorawan_init(gnrc_lorawan_t *mac, uint8_t *joineui, const gnrc_lorawan_key_ctx_t *ctx);
206
218 const mlme_request_t *mlme_request,
219 mlme_confirm_t *mlme_confirm);
220
232 const mcps_request_t *mcps_request,
233 mcps_confirm_t *mcps_confirm);
234
247 size_t size);
248
257
266
275
284
294
305int gnrc_lorawan_phy_set_channel_mask(gnrc_lorawan_t *mac, uint16_t channel_mask);
306
315
323
333 uint8_t redundancy)
334{
335 assert(redundancy <= (0xF - 1));
336 mac->mcps.redundancy = redundancy;
337}
338
339#ifdef __cplusplus
340}
341#endif
342
343#endif /* NET_GNRC_LORAWAN_H */
POSIX.1-2008 compliant version of the assert macro.
#define assert(cond)
abort the program if assertion is false
Definition assert.h:136
GNRC LoRaWAN internal header.
void gnrc_lorawan_timeout_cb(gnrc_lorawan_t *mac)
Indicate the MAC layer that the timer was fired.
void gnrc_lorawan_mlme_indication(gnrc_lorawan_t *mac, mlme_indication_t *ind)
MLME indication callback.
mcps_event_t
MCPS events.
Definition lorawan.h:52
mlme_activation_t
LoRaWAN activation mechanism.
Definition lorawan.h:60
static void gnrc_lorawan_radio_rx_error_cb(gnrc_lorawan_t *mac)
Indicate the MAC layer reception of a frame went wrong.
Definition lorawan.h:185
mlme_type_t
MLME primitive types.
Definition lorawan.h:78
void gnrc_lorawan_mlme_request(gnrc_lorawan_t *mac, const mlme_request_t *mlme_request, mlme_confirm_t *mlme_confirm)
Perform a MLME request.
void gnrc_lorawan_mcps_confirm(gnrc_lorawan_t *mac, mcps_confirm_t *confirm)
MCPS Confirm callback.
static void gnrc_lorawan_set_uncnf_redundancy(gnrc_lorawan_t *mac, uint8_t redundancy)
Set unconfirmed uplink redundancy.
Definition lorawan.h:332
void gnrc_lorawan_set_timer(gnrc_lorawan_t *mac, uint32_t us)
Set a timer with the given time.
void gnrc_lorawan_mcps_request(gnrc_lorawan_t *mac, const mcps_request_t *mcps_request, mcps_confirm_t *mcps_confirm)
Perform a MCPS request.
void gnrc_lorawan_mcps_indication(gnrc_lorawan_t *mac, mcps_indication_t *ind)
MCPS indication callback.
void gnrc_lorawan_radio_rx_timeout_cb(gnrc_lorawan_t *mac)
Indicate the MAC layer there was a timeout event.
mcps_type_t
MCPS primitive types.
Definition lorawan.h:90
netdev_t * gnrc_lorawan_get_netdev(gnrc_lorawan_t *mac)
Get netdev pointer from mac descriptor.
void gnrc_lorawan_mlme_confirm(gnrc_lorawan_t *mac, mlme_confirm_t *confirm)
MLME confirm callback.
void gnrc_lorawan_radio_tx_done_cb(gnrc_lorawan_t *mac)
Indicate the MAC layer when the transmission finished.
void gnrc_lorawan_remove_timer(gnrc_lorawan_t *mac)
Remove the current timer.
int gnrc_lorawan_phy_set_channel_mask(gnrc_lorawan_t *mac, uint16_t channel_mask)
Set the channel mask in order to enable or disable LoRaWAN channels.
mlme_mib_type_t
MAC Information Base attributes.
Definition lorawan.h:69
void gnrc_lorawan_radio_rx_done_cb(gnrc_lorawan_t *mac, uint8_t *data, size_t size)
Fetch a LoRaWAN packet from the radio.
void gnrc_lorawan_init(gnrc_lorawan_t *mac, uint8_t *joineui, const gnrc_lorawan_key_ctx_t *ctx)
Init GNRC LoRaWAN.
@ MCPS_EVENT_RX
MCPS RX event.
Definition lorawan.h:53
@ MCPS_EVENT_NO_RX
MCPS no RX event.
Definition lorawan.h:54
@ MLME_ACTIVATION_NONE
MAC layer is not activated.
Definition lorawan.h:61
@ MLME_ACTIVATION_ABP
MAC layer activated by ABP.
Definition lorawan.h:62
@ MLME_ACTIVATION_OTAA
MAC layer activated by OTAA.
Definition lorawan.h:63
@ MLME_GET
get the MIB
Definition lorawan.h:83
@ MLME_JOIN
join a LoRaWAN network
Definition lorawan.h:79
@ MLME_LINK_CHECK
perform a Link Check
Definition lorawan.h:80
@ MLME_SET
set the MIB
Definition lorawan.h:82
@ MLME_RESET
reset the MAC layer
Definition lorawan.h:81
@ MLME_SCHEDULE_UPLINK
schedule uplink indication
Definition lorawan.h:84
@ MCPS_UNCONFIRMED
unconfirmed data
Definition lorawan.h:92
@ MCPS_CONFIRMED
confirmed data
Definition lorawan.h:91
@ MIB_ACTIVATION_METHOD
type is activation method
Definition lorawan.h:70
@ MIB_RX2_DR
type is rx2 DR
Definition lorawan.h:72
@ MIB_DEV_ADDR
type is dev addr
Definition lorawan.h:71
GNRC LoRaWAN key context struct.
uint8_t redundancy
unconfirmed uplink redundancy
GNRC LoRaWAN mac descriptor.
gnrc_lorawan_mcps_t mcps
MCPS descriptor.
iolist structure definition
Definition iolist.h:39
Mac Common Part Sublayer (MCPS) confirm representation.
Definition lorawan.h:143
int16_t status
status of the MCPS confirm
Definition lorawan.h:144
iolist_t * msdu
pointer to the msdu
Definition lorawan.h:146
mcps_type_t type
type of the MCPS confirm
Definition lorawan.h:145
Mac Common Part Sublayer (MCPS) indication representation.
Definition lorawan.h:152
mcps_data_t data
MCPS Data holder.
Definition lorawan.h:155
mcps_type_t type
type of the MCPS indication
Definition lorawan.h:153
Mac Common Part Sublayer (MCPS) request representation.
Definition lorawan.h:121
mcps_data_t data
MCPS data holder.
Definition lorawan.h:123
mcps_type_t type
type of the MCPS request
Definition lorawan.h:125
MAC (sub) Layer Management Entity (MLME) confirm representation.
Definition lorawan.h:131
mlme_type_t type
type of the MLME confirm
Definition lorawan.h:133
mlme_mib_t mib
MIB confirmation data.
Definition lorawan.h:136
int16_t status
status of the MLME confirm
Definition lorawan.h:132
mlme_link_req_confirm_t link_req
Link Check confirmation data.
Definition lorawan.h:135
MAC (sub) Layer Management Entity (MLME) indication representation.
Definition lorawan.h:162
mlme_type_t type
type of the MLME indication
Definition lorawan.h:163
MLME Join Request data.
MAC Information Base descriptor for MLME Request-Confirm.
Definition lorawan.h:98
mlme_mib_type_t type
MIB attribute identifier.
Definition lorawan.h:99
void * dev_addr
pointer to the dev_addr
Definition lorawan.h:102
mlme_activation_t activation
holds activation mechanism
Definition lorawan.h:101
MAC (sub) Layer Management Entity (MLME) request representation.
Definition lorawan.h:110
mlme_mib_t mib
MIB holder.
Definition lorawan.h:113
mlme_lorawan_join_t join
Join Data holder.
Definition lorawan.h:112
mlme_type_t type
type of the MLME request
Definition lorawan.h:115
Structure to hold driver state.
Definition netdev.h:363