[riot-notifications] [RIOT-OS/RIOT] gnrc_lorawan: add initial support for GNRC based LoRaWAN stack (v2) (#11022)

Francisco notifications at github.com
Tue Mar 19 13:17:47 CET 2019


fjmolinas commented on this pull request.



> +#include "net/lora.h"
+#include "net/gnrc/lorawan/lorawan.h"
+#include "errno.h"
+#include "net/gnrc/pktbuf.h"
+
+#include "net/lorawan/hdr.h"
+#include "net/gnrc/lorawan/region.h"
+
+#define ENABLE_DEBUG    (0)
+#include "debug.h"
+
+#define _DRIFT_FACTOR (1000000 * 100 / (100 + CONFIG_GNRC_LORAWAN_TIMER_DRIFT))
+
+static inline void _set_rx2_dr(gnrc_lorawan_t *mac, uint8_t rx2_dr)
+{
+    mac->dl_settings &= 0xF0;

Maybe provide these values as defines instead of hardcoded values.

> +{
+    /* This is the longest key */
+    uint8_t key[LORAMAC_APPKEY_LEN];
+
+    size_t key_len = fmt_hex_bytes(key, key_str);
+    size_t expected_len;
+    switch(opt) {
+        case NETOPT_APPKEY:
+        case NETOPT_APPSKEY:
+        case NETOPT_NWKSKEY:
+            /* All keys have the same length as the APP KEY */
+            expected_len = LORAMAC_APPKEY_LEN;
+            break;
+        default:
+            /* Same rationale here */
+            expected_len = LORAMAC_DEVEUI_LEN;

Got it!

> +#CFLAGS += -DLORAMAC_DEV_ADDR_DEFAULT=\{0x00\,0x00\,0x00\,0x00\}
+#CFLAGS += -DLORAMAC_NWK_SKEY_DEFAULT=\{0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\}
+#CFLAGS += -DLORAMAC_APP_SKEY_DEFAULT=\{0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\,0x00\}
+
+# Comment/uncomment as necessary
+CFLAGS += -DLORAMAC_DEFAULT_JOIN_PROCEDURE=LORAMAC_JOIN_OTAA
+#CFLAGS += -DLORAMAC_DEFAULT_JOIN_PROCEDURE=LORAMAC_JOIN_ABP
+
+# Set to the highest DR for the EU868 in order to maximize the throughput
+CFLAGS += -DLORAMAC_DEFAULT_DR=LORAMAC_DR_5
+
+# Set the default RX2 datarate to DR3 (used by The Things Network)
+CFLAGS += -DLORAMAC_DEFAULT_RX2_DR=LORAMAC_DR_3
+
+# Set default messages to unconfirmable
+CFLAGS += -DLORAMAC_DEFAULT_TX_MODE=LORAMAC_TX_UNCNF

Got it. My comment goes more to the fact that since it is a test application (not an example application), the test should by default be as complete as possible, therefore test confirmed messages (which have the downlink factor). But this can get overwritten anyway, so I don't mind with the budget limit info taken into account.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11022#pullrequestreview-214223584
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190319/4ea05b1f/attachment.html>


More information about the notifications mailing list