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 
26 #include "gnrc_lorawan_internal.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
45 #ifndef CONFIG_GNRC_LORAWAN_TIMER_DRIFT
46 #define CONFIG_GNRC_LORAWAN_TIMER_DRIFT 10
47 #endif
48 
52 #ifndef CONFIG_GNRC_LORAWAN_MIN_SYMBOLS_TIMEOUT
53 #define CONFIG_GNRC_LORAWAN_MIN_SYMBOLS_TIMEOUT 30
54 #endif
55 
57 #define GNRC_LORAWAN_REQ_STATUS_SUCCESS (0)
58 #define GNRC_LORAWAN_REQ_STATUS_DEFERRED (1)
63 typedef enum {
66 } mcps_event_t;
67 
71 typedef enum {
76 
80 typedef enum {
85 
89 typedef enum {
96 } mlme_type_t;
97 
101 typedef enum {
104 } mcps_type_t;
105 
109 typedef struct {
111  union {
113  void *dev_addr;
114  uint8_t rx2_dr;
115  };
116 } mlme_mib_t;
117 
121 typedef struct {
122  union {
125  };
128 
132 typedef struct {
133  union {
135  };
138 
142 typedef struct {
143  int16_t status;
145  union {
148  };
150 
154 typedef struct {
155  int16_t status;
159 
163 typedef struct {
165  union {
167  };
169 
173 typedef struct {
176 
183 
190 
198 void gnrc_lorawan_init(gnrc_lorawan_t *mac, uint8_t *nwkskey, uint8_t *appskey);
199 
211  const mlme_request_t *mlme_request,
212  mlme_confirm_t *mlme_confirm);
213 
225  const mcps_request_t *mcps_request,
226  mcps_confirm_t *mcps_confirm);
227 
238 void gnrc_lorawan_radio_rx_done_cb(gnrc_lorawan_t *mac, uint8_t *data,
239  size_t size);
240 
249 
258 
267 
276 
286 
287 #ifdef __cplusplus
288 }
289 #endif
290 
291 #endif /* NET_GNRC_LORAWAN_H */
292 
MCPS_CONFIRMED
@ MCPS_CONFIRMED
confirmed data
Definition: lorawan.h:102
MCPS_EVENT_NO_RX
@ MCPS_EVENT_NO_RX
MCPS no RX event.
Definition: lorawan.h:65
gnrc_lorawan_internal.h
GNRC LoRaWAN internal header.
MLME_RESET
@ MLME_RESET
reset the MAC layer
Definition: lorawan.h:92
MIB_ACTIVATION_METHOD
@ MIB_ACTIVATION_METHOD
type is activation method
Definition: lorawan.h:81
mcps_confirm_t::status
int16_t status
status of the MCPS confirm
Definition: lorawan.h:155
gnrc_lorawan_mcps_indication
void gnrc_lorawan_mcps_indication(gnrc_lorawan_t *mac, mcps_indication_t *ind)
MCPS indication callback.
gnrc_lorawan_mlme_request
void gnrc_lorawan_mlme_request(gnrc_lorawan_t *mac, const mlme_request_t *mlme_request, mlme_confirm_t *mlme_confirm)
Perform a MLME request.
MLME_SET
@ MLME_SET
set the MIB
Definition: lorawan.h:93
mlme_request_t
MAC (sub) Layer Management Entity (MLME) request representation.
Definition: lorawan.h:121
mlme_activation_t
mlme_activation_t
LoRaWAN activation mechanism.
Definition: lorawan.h:71
MCPS_UNCONFIRMED
@ MCPS_UNCONFIRMED
unconfirmed data
Definition: lorawan.h:103
gnrc_lorawan_t
GNRC LoRaWAN mac descriptor.
Definition: gnrc_lorawan_internal.h:178
MLME_GET
@ MLME_GET
get the MIB
Definition: lorawan.h:94
mlme_confirm_t::link_req
mlme_link_req_confirm_t link_req
Link Check confirmation data.
Definition: lorawan.h:146
mlme_request_t::mib
mlme_mib_t mib
MIB holder.
Definition: lorawan.h:124
MLME_JOIN
@ MLME_JOIN
join a LoRaWAN network
Definition: lorawan.h:90
mlme_mib_t::type
mlme_mib_type_t type
MIB attribute identifier.
Definition: lorawan.h:110
mcps_confirm_t::msdu
iolist_t * msdu
pointer to the msdu
Definition: lorawan.h:157
mcps_type_t
mcps_type_t
MCPS primitive types.
Definition: lorawan.h:101
mcps_event_t
mcps_event_t
MCPS events.
Definition: lorawan.h:63
mcps_confirm_t
Mac Common Part Sublayer (MCPS) confirm representation.
Definition: lorawan.h:154
mlme_lorawan_join_t
MLME Join Request data.
Definition: gnrc_lorawan_internal.h:125
MLME_SCHEDULE_UPLINK
@ MLME_SCHEDULE_UPLINK
schedule uplink indication
Definition: lorawan.h:95
gnrc_lorawan_mcps_confirm
void gnrc_lorawan_mcps_confirm(gnrc_lorawan_t *mac, mcps_confirm_t *confirm)
MCPS Confirm callback.
mcps_indication_t::type
mcps_type_t type
type of the MCPS indication
Definition: lorawan.h:164
mcps_request_t::data
mcps_data_t data
MCPS data holder.
Definition: lorawan.h:134
mcps_indication_t
Mac Common Part Sublayer (MCPS) indication representation.
Definition: lorawan.h:163
mlme_confirm_t::type
mlme_type_t type
type of the MLME confirm
Definition: lorawan.h:144
gnrc_lorawan_mlme_confirm
void gnrc_lorawan_mlme_confirm(gnrc_lorawan_t *mac, mlme_confirm_t *confirm)
MLME confirm callback.
mlme_request_t::join
mlme_lorawan_join_t join
Join Data holder.
Definition: lorawan.h:123
MIB_DEV_ADDR
@ MIB_DEV_ADDR
type is dev addr
Definition: lorawan.h:82
iolist
iolist structure definition
Definition: iolist.h:39
mlme_confirm_t
MAC (sub) Layer Management Entity (MLME) confirm representation.
Definition: lorawan.h:142
mcps_indication_t::data
mcps_data_t data
MCPS Data holder.
Definition: lorawan.h:166
mlme_confirm_t::status
int16_t status
status of the MLME confirm
Definition: lorawan.h:143
MLME_LINK_CHECK
@ MLME_LINK_CHECK
perform a Link Check
Definition: lorawan.h:91
mcps_request_t
Mac Common Part Sublayer (MCPS) request representation.
Definition: lorawan.h:132
netdev
Structure to hold driver state.
Definition: netdev.h:302
mlme_mib_t::activation
mlme_activation_t activation
holds activation mechanism
Definition: lorawan.h:112
MLME_ACTIVATION_OTAA
@ MLME_ACTIVATION_OTAA
MAC layer activated by OTAA.
Definition: lorawan.h:74
gnrc_lorawan_radio_rx_timeout_cb
void gnrc_lorawan_radio_rx_timeout_cb(gnrc_lorawan_t *mac)
Indicate the MAC layer there was a timeout event.
mlme_indication_t::type
mlme_type_t type
type of the MLME indication
Definition: lorawan.h:174
MLME_ACTIVATION_ABP
@ MLME_ACTIVATION_ABP
MAC layer activated by ABP.
Definition: lorawan.h:73
mlme_confirm_t::mib
mlme_mib_t mib
MIB confirmation data.
Definition: lorawan.h:147
MCPS_EVENT_RX
@ MCPS_EVENT_RX
MCPS RX event.
Definition: lorawan.h:64
gnrc_lorawan_get_netdev
netdev_t * gnrc_lorawan_get_netdev(gnrc_lorawan_t *mac)
Get netdev pointer from mac descriptor.
gnrc_lorawan_mlme_indication
void gnrc_lorawan_mlme_indication(gnrc_lorawan_t *mac, mlme_indication_t *ind)
MLME indication callback.
mcps_request_t::type
mcps_type_t type
type of the MCPS request
Definition: lorawan.h:136
gnrc_lorawan_init
void gnrc_lorawan_init(gnrc_lorawan_t *mac, uint8_t *nwkskey, uint8_t *appskey)
Init GNRC LoRaWAN.
mlme_indication_t
MAC (sub) Layer Management Entity (MLME) indication representation.
Definition: lorawan.h:173
mlme_mib_t
MAC Information Base descriptor for MLME Request-Confirm.
Definition: lorawan.h:109
MIB_RX2_DR
@ MIB_RX2_DR
type is rx2 DR
Definition: lorawan.h:83
MLME_ACTIVATION_NONE
@ MLME_ACTIVATION_NONE
MAC layer is not activated.
Definition: lorawan.h:72
mlme_request_t::type
mlme_type_t type
type of the MLME request
Definition: lorawan.h:126
mlme_type_t
mlme_type_t
MLME primitive types.
Definition: lorawan.h:89
gnrc_lorawan_radio_rx_done_cb
void gnrc_lorawan_radio_rx_done_cb(gnrc_lorawan_t *mac, uint8_t *data, size_t size)
Fetch a LoRaWAN packet from the radio.
gnrc_lorawan_radio_tx_done_cb
void gnrc_lorawan_radio_tx_done_cb(gnrc_lorawan_t *mac)
Indicate the MAC layer when the transmission finished.
mlme_mib_type_t
mlme_mib_type_t
MAC Information Base attributes.
Definition: lorawan.h:80
mlme_mib_t::dev_addr
void * dev_addr
pointer to the dev_addr
Definition: lorawan.h:113
gnrc_lorawan_mcps_request
void gnrc_lorawan_mcps_request(gnrc_lorawan_t *mac, const mcps_request_t *mcps_request, mcps_confirm_t *mcps_confirm)
Perform a MCPS request.
mcps_data_t
MCPS data.
Definition: gnrc_lorawan_internal.h:143
mcps_confirm_t::type
mcps_type_t type
type of the MCPS confirm
Definition: lorawan.h:156