diff options
author | Jason Reiss <jreiss@multitech.com> | 2016-11-10 12:58:37 -0600 |
---|---|---|
committer | Jason Reiss <jreiss@multitech.com> | 2016-11-10 12:58:37 -0600 |
commit | e093123ceafca8eb6d8d041e0ad09f67d1202c73 (patch) | |
tree | 009fbbbb4c6ece6b88f5006d78a8d2ab85a835f4 /recipes-connectivity/lora/lora-network-server-mtcap | |
parent | 75fd65e9f52aeea9ab27b4af85c1fa8b093e5be3 (diff) | |
parent | 38ded95350a89cae973df774242e3c35e98784d8 (diff) | |
download | meta-mlinux-e093123ceafca8eb6d8d041e0ad09f67d1202c73.tar.gz meta-mlinux-e093123ceafca8eb6d8d041e0ad09f67d1202c73.tar.bz2 meta-mlinux-e093123ceafca8eb6d8d041e0ad09f67d1202c73.zip |
merge: Conduit_0.1 changes into master
lora: update lora-network-server to 1.0.16
Diffstat (limited to 'recipes-connectivity/lora/lora-network-server-mtcap')
5 files changed, 132 insertions, 0 deletions
diff --git a/recipes-connectivity/lora/lora-network-server-mtcap/local_conf.json b/recipes-connectivity/lora/lora-network-server-mtcap/local_conf.json new file mode 100644 index 0000000..3c2af80 --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtcap/local_conf.json @@ -0,0 +1,7 @@ +{ + "gateway_conf": { + "server_address": "localhost", + "serv_port_up": 1780, + "serv_port_down": 1782 + } +} diff --git a/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.conf b/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.conf new file mode 100644 index 0000000..448b3db --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.conf @@ -0,0 +1,36 @@ +{ + "lora": { + "netID": "010203", /* netID for beacon packets */ + "frequencyBand": "868", /* US="915", EU="868" */ + "rx1DatarateOffset": 0, /* Datarate offset for mote rx window 1 sent in join response (0-3) */ + "rx2Datarate": 12, /* Datarate for mote rx window 2 sent in join response (7-12) */ + "maxTxPower": 26, /* Max Tx power (dBm), -6 to 26 */ + "frequencyEU": 867500000, /* center freq for extra EU channels (Hz) */ + "antennaGain": 0 + }, + "udp": { + "appPortUp": 1784, /* port for user-developed application use */ + "appPortDown": 1786, /* port for user-developed application use */ + "upstreamPort": 1780, /* ports for LoRa network communication */ + "downstreamPort": 1782 /* ports for LoRa network communication */ + }, + "addressRange": { + "start": "00:00:00:01", /* address range used for mDots */ + "end": "FF:FF:FF:FE" + }, + "network": { + "public": true, /* set to false for private LoRa network with mDots + Conduit */ + "leasetime": 0, /* time until mDot join expires (minutes) or 0 for no expiration */ + "name": "YOUR-NETWORK-NAME", /* configure network security */ + "passphrase": "YOUR-NETWORK-PASSPHRASE" + }, + "log" : { + "console" : true, + "syslog" : false, + "level" : 30, /* error=10, warn=20, info=30, debug=50, trace=60, max=100 */ + "path": "/var/log/lora-network-server.log" + }, + "mqtt": { + "enabled": true + } +} diff --git a/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.default b/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.default new file mode 100644 index 0000000..be7dcd5 --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.default @@ -0,0 +1,2 @@ +# set to "yes" or "no" to control starting on boot +ENABLED="yes" diff --git a/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.init b/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.init new file mode 100755 index 0000000..86d731b --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.init @@ -0,0 +1,80 @@ +#!/bin/bash + +NAME="lora-network-server" +ENABLED="yes" + +START_STOP_DAEMON="/usr/sbin/start-stop-daemon" + +[ -f /etc/default/$NAME ] && source /etc/default/$NAME + +run_dir=/var/run/lora +conf_dir=/var/config/lora +conf_file=/opt/lora/lora-network-server.conf +conf_db=$conf_dir/lora-network-server.db + +net_server=/opt/lora/lora-network-server +net_server_log=/var/log/lora-network-server.log +net_server_pidfile=$run_dir/$NAME.pid + +pkt_fwd=/opt/lora/lora_pkt_fwd +pkt_fwd_pidfile=$run_dir/lora-pkt-fwd-1.pid + +do_start() { + if ! [ -f $conf_file ]; then + echo "$0: $conf_file missing" + exit 1 + fi + + echo -n "Starting $NAME: " + mkdir -p $run_dir/1 + # start network server + $START_STOP_DAEMON --start --background --make-pidfile \ + --pidfile $net_server_pidfile --startas /bin/bash \ + --chdir "/opt/lora" -- -c "exec $net_server \ + -c $conf_file --lora-path $run_dir --db $conf_db \ + --noconsole -l $net_server_log >> $net_server_log 2>&1" + sleep 2 + # start packet forwarder + $START_STOP_DAEMON --start --background --make-pidfile \ + --pidfile $pkt_fwd_pidfile --exec $pkt_fwd --chdir "/opt/lora/" + + renice -n -20 -p $(pgrep lora-network-se) + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + + echo "OK" +} + +do_stop() { + echo -n "Stopping $NAME: " + $START_STOP_DAEMON --stop --quiet --oknodo --pidfile $net_server_pidfile --retry 15 + $START_STOP_DAEMON --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 + rm -f $net_server_pidfile $pkt_fwd_pidfile + echo "OK" +} + +if [ "$ENABLED" != "yes" ]; then + echo "$NAME: disabled in /etc/default" + exit +fi + +case "$1" in + "start") + do_start + ;; + "stop") + do_stop + ;; + "restart") + ## Stop the service and regardless of whether it was + ## running or not, start it again. + do_stop + do_start + ;; + *) + ## If no parameters are given, print which are avaiable. + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + + diff --git a/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.logrotate.conf b/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.logrotate.conf new file mode 100644 index 0000000..d2b6c9a --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtcap/lora-network-server.logrotate.conf @@ -0,0 +1,7 @@ +/var/log/lora-pkt-fwd*.log /var/log/lora-network-server.log { + size 512k + rotate 4 + compress + copytruncate + missingok +} |