diff --git a/sys/include/net/gnrc/netif/lorawan.h b/sys/include/net/gnrc/netif/lorawan.h new file mode 100644 index 0000000000..e823ef1e32 --- /dev/null +++ b/sys/include/net/gnrc/netif/lorawan.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2019 HAW Hamburg + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup net_gnrc_netif + * @{ + * + * @file + * @brief LoRaWAN adaption for @ref net_gnrc_netif + * + * @author Jose Ignacio Alamos + */ +#ifndef NET_GNRC_NETIF_LORAWAN_H +#define NET_GNRC_NETIF_LORAWAN_H + +#include "net/gnrc/lorawan.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief A Link Check request was scheduled + */ +#define GNRC_NETIF_LORAWAN_FLAGS_LINK_CHECK (0x1U) + +/** + * @brief GNRC LoRaWAN interface descriptor + */ +typedef struct { + uint8_t nwkskey[LORAMAC_NWKSKEY_LEN]; /**< network SKey buffer */ + uint8_t appskey[LORAMAC_APPSKEY_LEN]; /**< App SKey buffer */ + uint8_t appkey[LORAMAC_APPKEY_LEN]; /**< App Key buffer */ + uint8_t deveui[LORAMAC_DEVEUI_LEN]; /**< Device EUI buffer */ + uint8_t appeui[LORAMAC_APPEUI_LEN]; /**< App EUI buffer */ + gnrc_lorawan_t mac; /**< gnrc lorawan mac descriptor */ + uint8_t flags; /**< flags for the LoRaWAN interface */ + uint8_t demod_margin; /**< value of last demodulation margin */ + uint8_t num_gateways; /**< number of gateways of last link check */ + uint8_t datarate; /**< LoRaWAN datarate for the next transmission */ + uint8_t port; /**< LoRaWAN port for the next transmission */ + uint8_t ack_req; /**< Request ACK in the next transmission */ + uint8_t otaa; /**< wether the next transmission is OTAA or not */ +} gnrc_netif_lorawan_t; + +#ifdef __cplusplus +} +#endif + +#endif /* NET_GNRC_NETIF_LORAWAN_H */ +/** @} */ diff --git a/sys/include/net/gnrc/netif/lorawan_base.h b/sys/include/net/gnrc/netif/lorawan_base.h new file mode 100644 index 0000000000..4e0abaf173 --- /dev/null +++ b/sys/include/net/gnrc/netif/lorawan_base.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2019 HAW Hamburg + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup net_gnrc_netif + * @{ + * + * @file + * @brief LoRaWAN base @ref net_gnrc_netif header + * + * @author Jose Ignacio Alamos + */ +#ifndef NET_GNRC_NETIF_LORAWAN_BASE_H +#define NET_GNRC_NETIF_LORAWAN_BASE_H + +#include "net/gnrc/netif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Creates a raw network interface + * + * @param[in] stack The stack for the network interface's thread. + * @param[in] stacksize Size of @p stack. + * @param[in] priority Priority for the network interface's thread. + * @param[in] name Name for the network interface. May be NULL. + * @param[in] dev Device for the interface. + * + * @see @ref gnrc_netif_create() + * + * @return The network interface on success. + * @return NULL, on error. + */ +gnrc_netif_t *gnrc_netif_lorawan_create(char *stack, int stacksize, char priority, + char *name, netdev_t *dev); + +#ifdef __cplusplus +} +#endif + +#endif /* NET_GNRC_NETIF_LORAWAN_BASE_H */ +/** @} */