From cb599986841533006621f89563f37ab5f346391f Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:33:30 -0400 Subject: [PATCH 01/21] Adding UDP output to serial logger --- Makefile | 23 ++++++++++++++++------- scripts/serial-logger2.py | 17 +++++++++++++++++ 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 524abf4..ee476dd 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,6 @@ default: @echo @echo " WARNING: this Makefile is for the maintainer. See INSTALL" -# @echo " trac - Open the TRAC wiki and bug system" # @echo " wikipedia - Open the wikipedia entry on ${PKG}" #PYFILES_ALL := ${shell ls *.py} @@ -44,12 +43,6 @@ variables: wikipedia: open http://en.wikipedia.org/wiki/Automatic_Identification_System -#.PHONY: trac -#trac: -# @echo "These only work inside of ccom. sorry..." -# open https://albatross.ccom.nh/GeoZui4D/wiki/DevArea/${PKG}Info -# open https://albatross.ccom.nh/GeoZui4D - .PHONY: help help: @echo This only works on Mac OSX @@ -96,6 +89,22 @@ check: # pylint # pychecker ${PKG} scripts +build: test + @echo + @echo Building locally... + @echo + (cd ais;make) + (cd ais/sls;make) + (cd ais/ris;make) + -find . -name \*.pyc | xargs rm + rm -f MANIFEST + ./setup.py build + +install-home: build + @echo + @echo Installing in home area... + @echo + ./setup.py install --prefix ${HOME} # Why does MANIFEST get correctly rebuilt? sdist: test diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index b09cc6b..c1d5d26 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -27,6 +27,7 @@ import logging from lockfile import LockFailed from logger_handlers import MidnightRotatingFileHandler, PassThroughServerHandler +import socket class SerialLoggerFormatter: def __init__(self, uscgFormat=True, mark=True, stationId=None): @@ -84,6 +85,16 @@ def run(options): ptsh.setFormatter(formatter) logger.addHandler(ptsh) + if options.udpTarget != '' and ':' in option.udpTarget: + uaddr,uport = options.udpTarget.split(':',1) + uport = int(uport) + uaddr = (uaddr,uport) + udpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + udpSocket.connect(uaddr) + else: + udpSocket = None + + if not options.daemonMode: ch = logging.StreamHandler() ch.setFormatter(formatter) @@ -95,6 +106,9 @@ def run(options): # logger.info("hello") line = ser.readline().strip() logger.info(line) + if udpSocket is not None: + udpSocket.send(line+'\r\n') + def parseOptions(): from optparse import OptionParser @@ -144,6 +158,9 @@ def parseOptions(): default=os.path.abspath(os.path.curdir), help='daemon working directory [default: %default]') + #################### UDP + parser.add_option('--udp', dest='udpTarget', type='string', default=None, help='Send to address:port via UDP.') + #################### pts parser.add_option('--enable-tcp-out', dest='tcpOutput', default=False, action='store_true', help='Create a server that clients can connect to and receive data') From 201b74bfa4b4a78c2ac073264599e073d8fbcf66 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:38:59 -0400 Subject: [PATCH 02/21] Adding test udp port to init script --- init.d/logais | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.d/logais b/init.d/logais index b5fe086..c657aa3 100755 --- a/init.d/logais +++ b/init.d/logais @@ -20,6 +20,7 @@ RUNASUSER=data DAEMON=/home/$RUNASUSER/bin/serial-logger PIDDIR=/var/run/data PIDFILE=$PIDDIR/logais.pid +UDPOUT=localhost:2000 test -x $DAEMON || echo "ERROR: can not find logger daemon: $DAEMON" @@ -44,7 +45,7 @@ case $1 in fi # FIX: make this read through a list of loggers to run with parameters # How to control all of the loggers in batch or one at a time? - start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/projects/data/${SUBDIR}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m + start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/projects/data/${SUBDIR}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} log_end_msg $? ;; stop) From 7049ffbaefd6e14e2d6aad68017780641c195166 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:46:41 -0400 Subject: [PATCH 03/21] updated chdir --- init.d/logais | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.d/logais b/init.d/logais index c657aa3..28034d1 100755 --- a/init.d/logais +++ b/init.d/logais @@ -45,7 +45,7 @@ case $1 in fi # FIX: make this read through a list of loggers to run with parameters # How to control all of the loggers in batch or one at a time? - start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/projects/data/${SUBDIR}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} + start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} log_end_msg $? ;; stop) From eac655594f9d0028594941602ea4333036063981 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:50:15 -0400 Subject: [PATCH 04/21] updated serial port --- init.d/logais | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.d/logais b/init.d/logais index 28034d1..e8e6cc7 100755 --- a/init.d/logais +++ b/init.d/logais @@ -45,7 +45,7 @@ case $1 in fi # FIX: make this read through a list of loggers to run with parameters # How to control all of the loggers in batch or one at a time? - start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} + start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS4 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} log_end_msg $? ;; stop) From 85b1fdbbf820d0bbae81ed8602215b011b4573aa Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:55:20 -0400 Subject: [PATCH 05/21] bug fix --- scripts/serial-logger2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index c1d5d26..e1cb5e9 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -85,7 +85,7 @@ def run(options): ptsh.setFormatter(formatter) logger.addHandler(ptsh) - if options.udpTarget != '' and ':' in option.udpTarget: + if options.udpTarget != '' and ':' in options.udpTarget: uaddr,uport = options.udpTarget.split(':',1) uport = int(uport) uaddr = (uaddr,uport) From ec687f307d45191c3889c86498d40712e764e168 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:57:39 -0400 Subject: [PATCH 06/21] bug fix --- scripts/serial-logger2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index e1cb5e9..012872d 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -85,7 +85,7 @@ def run(options): ptsh.setFormatter(formatter) logger.addHandler(ptsh) - if options.udpTarget != '' and ':' in options.udpTarget: + if options.udpTarget is not None and ':' in options.udpTarget: uaddr,uport = options.udpTarget.split(':',1) uport = int(uport) uaddr = (uaddr,uport) From 5591f9c1984b995011b211f735bf0fa70a7a44b7 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 16:08:01 -0400 Subject: [PATCH 07/21] more fixes for tide3, this needs to be organized better --- init.d/logais | 4 ++-- scripts/serial-logger2.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/init.d/logais b/init.d/logais index e8e6cc7..d2e3c0a 100755 --- a/init.d/logais +++ b/init.d/logais @@ -27,7 +27,7 @@ test -x $DAEMON || echo "ERROR: can not find logger daemon: $DAEMON" test -x $DAEMON || exit 5 UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true -STATION=nhjel +STATION=nhcml SUBDIR=$STATION @@ -45,7 +45,7 @@ case $1 in fi # FIX: make this read through a list of loggers to run with parameters # How to control all of the loggers in batch or one at a time? - start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS4 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} + start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais -p /dev/ttyS4 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} log_end_msg $? ;; stop) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index 012872d..6639460 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -91,6 +91,7 @@ def run(options): uaddr = (uaddr,uport) udpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udpSocket.connect(uaddr) + udpSocket.send("hello\n") else: udpSocket = None From 3e96df7e8932adc048c1acc734194a7ddfda3ab2 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 16:09:59 -0400 Subject: [PATCH 08/21] removed debuging send --- scripts/serial-logger2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index 6639460..012872d 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -91,7 +91,6 @@ def run(options): uaddr = (uaddr,uport) udpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udpSocket.connect(uaddr) - udpSocket.send("hello\n") else: udpSocket = None From ef499a389e88335cbd8ebd60add0bec4a6f09ce9 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 16:37:50 -0400 Subject: [PATCH 09/21] trying to make udp out more robust --- scripts/serial-logger2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index 012872d..63e9df9 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -107,7 +107,10 @@ def run(options): line = ser.readline().strip() logger.info(line) if udpSocket is not None: - udpSocket.send(line+'\r\n') + try: + udpSocket.send(line+'\r\n') + except: + pass def parseOptions(): From 22b1df072a6bf916866389a307dd1073a220d784 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:33:30 -0400 Subject: [PATCH 10/21] Adding UDP output to serial logger --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++ scripts/serial-logger2.py | 17 ++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/Makefile b/Makefile index d27262a..25ab2aa 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,28 @@ default: @echo @echo " WARNING: this Makefile is for the maintainer. See INSTALL" +# @echo " wikipedia - Open the wikipedia entry on ${PKG}" + +#PYFILES_ALL := ${shell ls *.py} +#PYFILES := ${shell ls *.py | grep -v version} + +.PHONY: variables +variables: + @echo ${PKG}-py version: ${VERSION} + @echo PYTHONPATH $$PYTHONPATH + @echo SHELL ${SHELL} +# @echo PYFILES_ALL ${PYFILES_ALL} +# @echo PYFILES ${PYFILES} + +.PHONY: wikipedia +wikipedia: + open http://en.wikipedia.org/wiki/Automatic_Identification_System + +.PHONY: help +help: + @echo This only works on Mac OSX + open html/index.html + .PHONY: clean clean: rm -f ${PKG}-py.info MANIFEST @@ -48,6 +70,25 @@ check: @echo pychecker ${PKG} find . -name \*.py | xargs egrep '@(todo|bug)' +# pylint +# pychecker ${PKG} scripts + +build: test + @echo + @echo Building locally... + @echo + (cd ais;make) + (cd ais/sls;make) + (cd ais/ris;make) + -find . -name \*.pyc | xargs rm + rm -f MANIFEST + ./setup.py build + +install-home: build + @echo + @echo Installing in home area... + @echo + ./setup.py install --prefix ${HOME} sdist: test @echo diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index f610ec5..6fba848 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -23,6 +23,7 @@ import logging from lockfile import LockFailed from logger_handlers import MidnightRotatingFileHandler, PassThroughServerHandler +import socket class SerialLoggerFormatter: def __init__(self, uscgFormat=True, mark=True, stationId=None): @@ -80,6 +81,16 @@ def run(options): ptsh.setFormatter(formatter) logger.addHandler(ptsh) + if options.udpTarget != '' and ':' in option.udpTarget: + uaddr,uport = options.udpTarget.split(':',1) + uport = int(uport) + uaddr = (uaddr,uport) + udpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + udpSocket.connect(uaddr) + else: + udpSocket = None + + if not options.daemonMode: ch = logging.StreamHandler() ch.setFormatter(formatter) @@ -91,6 +102,9 @@ def run(options): # logger.info("hello") line = ser.readline().strip() logger.info(line) + if udpSocket is not None: + udpSocket.send(line+'\r\n') + def parseOptions(): from optparse import OptionParser @@ -140,6 +154,9 @@ def parseOptions(): default=os.path.abspath(os.path.curdir), help='daemon working directory [default: %default]') + #################### UDP + parser.add_option('--udp', dest='udpTarget', type='string', default=None, help='Send to address:port via UDP.') + #################### pts parser.add_option('--enable-tcp-out', dest='tcpOutput', default=False, action='store_true', help='Create a server that clients can connect to and receive data') From b1bfc95ff49c338f9adac3416d1f831fc7a39bdf Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:38:59 -0400 Subject: [PATCH 11/21] Adding test udp port to init script --- init.d/logais | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.d/logais b/init.d/logais index b5fe086..c657aa3 100755 --- a/init.d/logais +++ b/init.d/logais @@ -20,6 +20,7 @@ RUNASUSER=data DAEMON=/home/$RUNASUSER/bin/serial-logger PIDDIR=/var/run/data PIDFILE=$PIDDIR/logais.pid +UDPOUT=localhost:2000 test -x $DAEMON || echo "ERROR: can not find logger daemon: $DAEMON" @@ -44,7 +45,7 @@ case $1 in fi # FIX: make this read through a list of loggers to run with parameters # How to control all of the loggers in batch or one at a time? - start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/projects/data/${SUBDIR}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m + start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/projects/data/${SUBDIR}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} log_end_msg $? ;; stop) From 5afb054af269b6c2b33af53dfd6a56da1e1223dc Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:46:41 -0400 Subject: [PATCH 12/21] updated chdir --- init.d/logais | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.d/logais b/init.d/logais index c657aa3..28034d1 100755 --- a/init.d/logais +++ b/init.d/logais @@ -45,7 +45,7 @@ case $1 in fi # FIX: make this read through a list of loggers to run with parameters # How to control all of the loggers in batch or one at a time? - start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/projects/data/${SUBDIR}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} + start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} log_end_msg $? ;; stop) From 45567eecf7d4622fafc3bafb1affe26f4c9fea49 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:50:15 -0400 Subject: [PATCH 13/21] updated serial port --- init.d/logais | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.d/logais b/init.d/logais index 28034d1..e8e6cc7 100755 --- a/init.d/logais +++ b/init.d/logais @@ -45,7 +45,7 @@ case $1 in fi # FIX: make this read through a list of loggers to run with parameters # How to control all of the loggers in batch or one at a time? - start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS2 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} + start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS4 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} log_end_msg $? ;; stop) From 30d8315454f64dea14c7077ac6a38364ae177104 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:55:20 -0400 Subject: [PATCH 14/21] bug fix --- scripts/serial-logger2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index 6fba848..ca9a829 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -81,7 +81,7 @@ def run(options): ptsh.setFormatter(formatter) logger.addHandler(ptsh) - if options.udpTarget != '' and ':' in option.udpTarget: + if options.udpTarget != '' and ':' in options.udpTarget: uaddr,uport = options.udpTarget.split(':',1) uport = int(uport) uaddr = (uaddr,uport) From 24a84b701fbac13ea5eb4df5032c81bfc42fa268 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 15:57:39 -0400 Subject: [PATCH 15/21] bug fix --- scripts/serial-logger2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index ca9a829..12eae8a 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -81,7 +81,7 @@ def run(options): ptsh.setFormatter(formatter) logger.addHandler(ptsh) - if options.udpTarget != '' and ':' in options.udpTarget: + if options.udpTarget is not None and ':' in options.udpTarget: uaddr,uport = options.udpTarget.split(':',1) uport = int(uport) uaddr = (uaddr,uport) From 528f859c2712341b477b08e5a9513c5585ebf0c6 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 16:08:01 -0400 Subject: [PATCH 16/21] more fixes for tide3, this needs to be organized better --- init.d/logais | 4 ++-- scripts/serial-logger2.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/init.d/logais b/init.d/logais index e8e6cc7..d2e3c0a 100755 --- a/init.d/logais +++ b/init.d/logais @@ -27,7 +27,7 @@ test -x $DAEMON || echo "ERROR: can not find logger daemon: $DAEMON" test -x $DAEMON || exit 5 UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true -STATION=nhjel +STATION=nhcml SUBDIR=$STATION @@ -45,7 +45,7 @@ case $1 in fi # FIX: make this read through a list of loggers to run with parameters # How to control all of the loggers in batch or one at a time? - start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais- -p /dev/ttyS4 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} + start-stop-daemon --start --quiet --oknodo --chdir /home/${RUNASUSER}/ais --pidfile $PIDFILE --startas $DAEMON -c $RUNASUSER -- --pid-file $PIDFILE -l ais -p /dev/ttyS4 --daemon --enable-tcp-out --timeout=300 --uscg-format --station-id=${STATION} -m --udp ${UDPOUT} log_end_msg $? ;; stop) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index 12eae8a..eba4a85 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -87,6 +87,7 @@ def run(options): uaddr = (uaddr,uport) udpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udpSocket.connect(uaddr) + udpSocket.send("hello\n") else: udpSocket = None From 599032079c436d8f8b1a89b1634c30fc5f6efefa Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 16:09:59 -0400 Subject: [PATCH 17/21] removed debuging send --- scripts/serial-logger2.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index eba4a85..12eae8a 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -87,7 +87,6 @@ def run(options): uaddr = (uaddr,uport) udpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udpSocket.connect(uaddr) - udpSocket.send("hello\n") else: udpSocket = None From 8f2dcaab1bcb1b0907df111f06b9e9868678052f Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Mon, 19 Mar 2012 16:37:50 -0400 Subject: [PATCH 18/21] trying to make udp out more robust --- scripts/serial-logger2.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/serial-logger2.py b/scripts/serial-logger2.py index 12eae8a..1eee822 100755 --- a/scripts/serial-logger2.py +++ b/scripts/serial-logger2.py @@ -103,7 +103,10 @@ def run(options): line = ser.readline().strip() logger.info(line) if udpSocket is not None: - udpSocket.send(line+'\r\n') + try: + udpSocket.send(line+'\r\n') + except: + pass def parseOptions(): From a57b1aed9bd8785db125f7a5cc0e5c28cf8fc51f Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Wed, 22 Jun 2016 11:41:00 -0400 Subject: [PATCH 19/21] Exception handling --- aisutils/uscg.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aisutils/uscg.py b/aisutils/uscg.py index 5ddd9ca..54af408 100755 --- a/aisutils/uscg.py +++ b/aisutils/uscg.py @@ -192,7 +192,10 @@ def __init__(self,nmeaStr=None): pass continue if c == 'S': - self.slotNumber = int(f[1:]) + try: + self.slotNumber = int(f[1:]) + except: + self.slotNumber = None continue if c == 'x': # I don't know what x is From 0db98191ec63bad1da1a9f9faa3ad4adf6f0c0fb Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Wed, 22 Jun 2016 12:24:54 -0400 Subject: [PATCH 20/21] Oops, unsaved file from merge/rebase --- Makefile | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/Makefile b/Makefile index 073ae10..25ab2aa 100644 --- a/Makefile +++ b/Makefile @@ -74,27 +74,6 @@ check: # pychecker ${PKG} scripts build: test -<<<<<<< HEAD -======= - @echo - @echo Building locally... - @echo - (cd ais;make) - (cd ais/sls;make) - (cd ais/ris;make) - -find . -name \*.pyc | xargs rm - rm -f MANIFEST - ./setup.py build - -install-home: build - @echo - @echo Installing in home area... - @echo - ./setup.py install --prefix ${HOME} - -# Why does MANIFEST get correctly rebuilt? -sdist: test ->>>>>>> ef499a389e88335cbd8ebd60add0bec4a6f09ce9 @echo @echo Building locally... @echo From 052a4b7d634e0a3a92a348b543e5db536ae24f02 Mon Sep 17 00:00:00 2001 From: Roland Arsenault Date: Wed, 22 Jun 2016 12:40:41 -0400 Subject: [PATCH 21/21] Fixed indent error. --- aisutils/binary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aisutils/binary.py b/aisutils/binary.py index c6b2d55..723c924 100755 --- a/aisutils/binary.py +++ b/aisutils/binary.py @@ -63,7 +63,7 @@ def float2bitvec(floatval): # FIX: make this go in one step now that bitvector 1.3 is out. bvList = [] for i in range(4): - bv1 = setBitVectorSize(BitVector(intVal=ord(s[i])),8) + bv1 = setBitVectorSize(BitVector(intVal=ord(s[i])),8) #bv2 = BitVector(intVal=ord(s[i]),size=8) bvList.append(bv1) return joinBV(bvList)