summaryrefslogtreecommitdiff
path: root/recipes-connectivity/lora/lora-packet-forwarder
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2015-07-16 16:51:38 -0500
committerJason Reiss <jreiss@multitech.com>2015-07-16 16:51:38 -0500
commit491c5a5896d082653e9b2f54cd8ce463e2f51814 (patch)
treedc608d572ec6c3c422c0def99e4b89ec5ebbe7ba /recipes-connectivity/lora/lora-packet-forwarder
parent974eb67a7552eac9389edfda32683031bb639df3 (diff)
downloadmeta-mlinux-491c5a5896d082653e9b2f54cd8ce463e2f51814.tar.gz
meta-mlinux-491c5a5896d082653e9b2f54cd8ce463e2f51814.tar.bz2
meta-mlinux-491c5a5896d082653e9b2f54cd8ce463e2f51814.zip
lora: patch gateway and basic packet forwarder to allow config of sync word
Diffstat (limited to 'recipes-connectivity/lora/lora-packet-forwarder')
-rw-r--r--recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch30
-rw-r--r--recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-synch-word.patch41
2 files changed, 71 insertions, 0 deletions
diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch
new file mode 100644
index 0000000..ca8d106
--- /dev/null
+++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-add-no-header-option.patch
@@ -0,0 +1,30 @@
+From 03c697f2bcf538407ca6a0821dbbb65ab7679aff Mon Sep 17 00:00:00 2001
+From: Jason Reiss <jreiss@multitech.com>
+Date: Thu, 16 Jul 2015 13:31:20 -0500
+Subject: [PATCH] feature: add option to send packets with no header
+
+---
+ basic_pkt_fwd/src/basic_pkt_fwd.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/basic_pkt_fwd/src/basic_pkt_fwd.c b/basic_pkt_fwd/src/basic_pkt_fwd.c
+index e20dfc1..2223b4a 100644
+--- a/basic_pkt_fwd/src/basic_pkt_fwd.c
++++ b/basic_pkt_fwd/src/basic_pkt_fwd.c
+@@ -1276,6 +1276,13 @@ void thread_down(void) {
+ if (val != NULL) {
+ txpkt.no_crc = (bool)json_value_get_boolean(val);
+ }
++
++ /* Parse "No Header" flag (optional field) */
++ val = json_object_get_value(txpk_obj,"nhdr");
++ if (val != NULL) {
++ txpkt.no_header = (bool)json_value_get_boolean(val);
++ }
++
+
+ /* parse target frequency (mandatory) */
+ val = json_object_get_value(txpk_obj,"freq");
+--
+1.7.10.4
+
diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-synch-word.patch b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-synch-word.patch
new file mode 100644
index 0000000..8da6273
--- /dev/null
+++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder-synch-word.patch
@@ -0,0 +1,41 @@
+
+diff --git a/basic_pkt_fwd/src/basic_pkt_fwd.c b/basic_pkt_fwd/src/basic_pkt_fwd.c
+index 2223b4a..2db6e26 100644
+--- a/basic_pkt_fwd/src/basic_pkt_fwd.c
++++ b/basic_pkt_fwd/src/basic_pkt_fwd.c
+@@ -103,7 +104,8 @@ static bool fwd_error_pkt = false; /* packets with PAYLOAD CRC ERROR are NOT for
+ static bool fwd_nocrc_pkt = false; /* packets with NO PAYLOAD CRC are NOT forwarded */
+
+ /* network configuration variables */
++static uint8_t synch_word = 0x12;
+ static uint64_t lgwm = 0; /* Lora gateway MAC address */
+ static char serv_addr[64] = STR(DEFAULT_SERVER); /* address of the server (host name or IPv4/IPv6) */
+ static char serv_port_up[8] = STR(DEFAULT_PORT_UP); /* server port for upstream traffic */
+ static char serv_port_down[8] = STR(DEFAULT_PORT_DW); /* server port for downstream traffic */
+@@ -404,7 +415,14 @@ static int parse_gateway_configuration(const char * conf_file) {
+ snprintf(serv_port_down, sizeof serv_port_down, "%u", (uint16_t)json_value_get_number(val));
+ MSG("INFO: downstream port is configured to \"%s\"\n", serv_port_down);
+ }
+-
++
++ val = json_object_get_value(conf_obj, "synch_word");
++ if (val != NULL) {
++ synch_word = (uint8_t)json_value_get_number(val);
++ MSG("INFO: synch word is configured to %02x\n", synch_word);
++ }
++
++
+ /* get keep-alive interval (in seconds) for downstream (optional) */
+ val = json_object_get_value(conf_obj, "keepalive_interval");
+ if (val != NULL) {
+@@ -637,7 +721,9 @@ int main(void)
+ MSG("ERROR: [main] failed to start the concentrator\n");
+ exit(EXIT_FAILURE);
+ }
+-
++
++ lgw_conf_lora_synch_word(synch_word);
++
+ /* spawn threads to manage upstream and downstream */
+ i = pthread_create( &thrid_up, NULL, (void * (*)(void *))thread_up, NULL);
+ if (i != 0) {