From a1a48e4ec789601195ffb4cdb086b2d6c19ea984 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 1 Mar 2017 09:08:15 +0100 Subject: [PATCH 1/8] add ZVEI1 support in BOSWatch --- boswatch.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/boswatch.py b/boswatch.py index 6b644f5..6a99b39 100755 --- a/boswatch.py +++ b/boswatch.py @@ -50,7 +50,7 @@ try: parser.add_argument("-f", "--freq", help="Frequency you want to listen to", required=True) parser.add_argument("-d", "--device", help="Device you want to use (check with rtl_test)", type=int, default=0) parser.add_argument("-e", "--error", help="Frequency-error of your device in PPM", default=0) - parser.add_argument("-a", "--demod", help="Demodulation functions", choices=['FMS', 'ZVEI', 'POC512', 'POC1200', 'POC2400'], required=True, nargs="+") + parser.add_argument("-a", "--demod", help="Demodulation functions", choices=['FMS', 'ZVEI1', 'ZVEI2', 'POC512', 'POC1200', 'POC2400'], required=True, nargs="+") parser.add_argument("-s", "--squelch", help="Level of squelch", type=int, default=0) parser.add_argument("-g", "--gain", help="Level of gain", type=int, default=100) parser.add_argument("-u", "--usevarlog", help="Use '/var/log/boswatch' for logfiles instead of subdir 'log' in BOSWatch directory", action="store_true") @@ -177,9 +177,12 @@ try: if "FMS" in args.demod: demodulation += "-a FMSFSK " logging.debug(" - Demod: FMS") - if "ZVEI" in args.demod: + if "ZVEI1" in args.demod: + demodulation += "-a ZVEI1 " + logging.debug(" - Demod: ZVEI1") + if "ZVEI2" in args.demod: demodulation += "-a ZVEI2 " - logging.debug(" - Demod: ZVEI") + logging.debug(" - Demod: ZVEI2") if "POC512" in args.demod: demodulation += "-a POCSAG512 " logging.debug(" - Demod: POC512") From 81e83e4c2e6099e683173759487bb7f9796af211 Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 1 Mar 2017 09:08:15 +0100 Subject: [PATCH 2/8] Revert "add ZVEI1 support in BOSWatch" This reverts commit a1a48e4ec789601195ffb4cdb086b2d6c19ea984. --- boswatch.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/boswatch.py b/boswatch.py index 6a99b39..6b644f5 100755 --- a/boswatch.py +++ b/boswatch.py @@ -50,7 +50,7 @@ try: parser.add_argument("-f", "--freq", help="Frequency you want to listen to", required=True) parser.add_argument("-d", "--device", help="Device you want to use (check with rtl_test)", type=int, default=0) parser.add_argument("-e", "--error", help="Frequency-error of your device in PPM", default=0) - parser.add_argument("-a", "--demod", help="Demodulation functions", choices=['FMS', 'ZVEI1', 'ZVEI2', 'POC512', 'POC1200', 'POC2400'], required=True, nargs="+") + parser.add_argument("-a", "--demod", help="Demodulation functions", choices=['FMS', 'ZVEI', 'POC512', 'POC1200', 'POC2400'], required=True, nargs="+") parser.add_argument("-s", "--squelch", help="Level of squelch", type=int, default=0) parser.add_argument("-g", "--gain", help="Level of gain", type=int, default=100) parser.add_argument("-u", "--usevarlog", help="Use '/var/log/boswatch' for logfiles instead of subdir 'log' in BOSWatch directory", action="store_true") @@ -177,12 +177,9 @@ try: if "FMS" in args.demod: demodulation += "-a FMSFSK " logging.debug(" - Demod: FMS") - if "ZVEI1" in args.demod: - demodulation += "-a ZVEI1 " - logging.debug(" - Demod: ZVEI1") - if "ZVEI2" in args.demod: + if "ZVEI" in args.demod: demodulation += "-a ZVEI2 " - logging.debug(" - Demod: ZVEI2") + logging.debug(" - Demod: ZVEI") if "POC512" in args.demod: demodulation += "-a POCSAG512 " logging.debug(" - Demod: POC512") From 98b50110a083b3569300b9f25426b3bfd340e0df Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Sun, 5 Mar 2017 20:21:16 +0100 Subject: [PATCH 3/8] change from ZVEI2 to ZVEI1 --- boswatch.py | 2 +- includes/decoder.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/boswatch.py b/boswatch.py index 6b644f5..e8b7b3a 100755 --- a/boswatch.py +++ b/boswatch.py @@ -178,7 +178,7 @@ try: demodulation += "-a FMSFSK " logging.debug(" - Demod: FMS") if "ZVEI" in args.demod: - demodulation += "-a ZVEI2 " + demodulation += "-a ZVEI1 " logging.debug(" - Demod: ZVEI") if "POC512" in args.demod: demodulation += "-a POCSAG512 " diff --git a/includes/decoder.py b/includes/decoder.py index 26c8ba4..9c979d3 100644 --- a/includes/decoder.py +++ b/includes/decoder.py @@ -33,7 +33,7 @@ def decode(freq, decoded): # ZVEI Decoder Section # check ZVEI: -> validate -> check double alarm -> log - elif "ZVEI2:" in decoded: + elif "ZVEI1:" in decoded: logging.debug("received ZVEI") from includes.decoders import zvei zvei.decode(freq, decoded) From 88a4ae57ce55fe7e766ddb31454c60a2ffb4d1bc Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 6 Mar 2017 22:36:38 +0100 Subject: [PATCH 4/8] Adaption for changes in ZVEI Due to changes from ZVEI2 to ZVEI1 there were 2 major changes: - String from multimon-ng contains more information, so l. 60 had to be adapted - Repeated tone signal is changed from F to E --- includes/decoders/zvei.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/includes/decoders/zvei.py b/includes/decoders/zvei.py index ac747da..c29863a 100644 --- a/includes/decoders/zvei.py +++ b/includes/decoders/zvei.py @@ -17,24 +17,24 @@ from includes import doubleFilter # double alarm filter ## # -# Local function to remove the 'F' +# Local function to remove the 'E' # -def removeF(zvei): +def removeE(zvei): """ - Resolve the F from the repeat Tone + Resolve the E from the repeat Tone @type zvei: string @param zvei: ZVEI Information - @return: ZVEI without F + @return: ZVEI without E @exception: none """ - if "F" in zvei: + if "E" in zvei: zvei_old = zvei for i in range(1, len(zvei_old)): - if zvei[i] == "F": - zvei = zvei.replace("F",zvei[i-1],1) - logging.debug("resolve F: %s -> %s", zvei_old, zvei) + if zvei[i] == "E": + zvei = zvei.replace("E",zvei[i-1],1) + logging.debug("remove E: %s -> %s", zvei_old, zvei) return zvei ## @@ -57,8 +57,8 @@ def decode(freq, decoded): @exception: Exception if ZVEI decode failed """ try: - zvei_id = decoded[7:12] # ZVEI Code - zvei_id = removeF(zvei_id) # resolve F + zvei_id = decoded[14:19] # ZVEI Code + zvei_id = removeE(zvei_id) # remove E (repeated tone) if re.search("[0-9]{5}", zvei_id): # if ZVEI is valid # check for double alarm if doubleFilter.checkID("ZVEI", zvei_id): From a29a4412bca1f44b6ca87bab615aabf80b77cdee Mon Sep 17 00:00:00 2001 From: Florian Date: Tue, 7 Mar 2017 23:22:35 +0100 Subject: [PATCH 5/8] Fixing string-search for ZVEI1 fixing location of zvei tones --- includes/decoders/zvei.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/decoders/zvei.py b/includes/decoders/zvei.py index c29863a..cabe68c 100644 --- a/includes/decoders/zvei.py +++ b/includes/decoders/zvei.py @@ -57,7 +57,7 @@ def decode(freq, decoded): @exception: Exception if ZVEI decode failed """ try: - zvei_id = decoded[14:19] # ZVEI Code + zvei_id = decoded[7:12] # ZVEI Code zvei_id = removeE(zvei_id) # remove E (repeated tone) if re.search("[0-9]{5}", zvei_id): # if ZVEI is valid # check for double alarm From e0887fa0fb96cba6581345a48ceaa5f35073907b Mon Sep 17 00:00:00 2001 From: Bastian Schroll Date: Wed, 8 Mar 2017 06:36:21 +0100 Subject: [PATCH 6/8] testdata ZVEI2 to ZVEI1 for citest --- citest/testdata.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/citest/testdata.txt b/citest/testdata.txt index 58e5a5e..e4ac22e 100644 --- a/citest/testdata.txt +++ b/citest/testdata.txt @@ -106,15 +106,15 @@ FMS: 43f314170000 (9=Rotkreuz 3=Bayern 1 Ort 0x25=037FZG 7141Stat # #with csv description -ZVEI2: 12345 +ZVEI1: 12345 #without csv description -ZVEI2: 56789 +ZVEI1: 56789 #duplicate -ZVEI2: 56789 +ZVEI1: 56789 #with repeat Tone -ZVEI2: 1F2F3 +ZVEI1: 1F2F3 #in case of invalid id -ZVEI2: 135 +ZVEI1: 135 #in case of a double-tone for siren n-'D's are sended -ZVEI2: DDD -ZVEI2: DDDDD +ZVEI1: DDD +ZVEI1: DDDDD From e2d20fed96b48cf5a6a03fb5ed55b5786acc6822 Mon Sep 17 00:00:00 2001 From: Smith-fms Date: Wed, 15 Mar 2017 17:00:01 +0100 Subject: [PATCH 7/8] BUG: dir-val false --- service/boswatch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/boswatch.sh b/service/boswatch.sh index 1779e1b..70263b4 100755 --- a/service/boswatch.sh +++ b/service/boswatch.sh @@ -11,7 +11,7 @@ ### END INIT INFO # Change the next 3 lines to suit where you install your script and what you want to call it -DIR=/opt/boswatch/BOSWatch +DIR=/opt/boswatch DAEMON=$DIR/boswatch.py DAEMON_NAME=boswatch From d4c6a85b4fa9e290a3312db34dda178a25ee10a3 Mon Sep 17 00:00:00 2001 From: Florian Date: Sat, 25 Mar 2017 00:13:14 +0100 Subject: [PATCH 8/8] Check for old installation / copy config - check for old version (existing boswatch.py in two different folders) and copy it via /tmp to boswatchpath/old - copy config.template.ini to config.ini to enable boswatch starting after installation --- install.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/install.sh b/install.sh index 71b5b93..5c251ea 100644 --- a/install.sh +++ b/install.sh @@ -45,6 +45,27 @@ echo "So you have to make up manually if you want to use MySQL support" boswatchpath=/opt/boswatch reboot=false +didBackup=false + +# check for old version (for the old ones...) +if [ -f $boswatchpath/BOSWatch/boswatch.py ]; then + echo "Old installation found!" + echo "A backup will be copied to $boswatchpath/old" + + mkdir /tmp/boswatch + mv $boswatchpath/BOSWatch/* /tmp/boswatch/ + didBackup=true +fi + +#and the future... +if [ -f $boswatchpath/boswatch.py ]; then + echo "Old installation found!" + echo "A backup will be copied to $boswatchpath/old" + + mkdir /tmp/boswatch + mv $boswatchpath/* /tmp/boswatch/ + didBackup=true +fi for (( i=1; i<=$#; i=$i+2 )); do t=$((i + 1)) @@ -206,6 +227,16 @@ rm $boswatchpath/install/ -R mv $boswatchpath/BOSWatch/* $boswatchpath/ rm $boswatchpath/BOSWatch -R +#copy the template config to run boswatch +cp $boswatchpath/config/config.template.ini $boswatchpath/config/config.ini + + +#replay the backup +if [ $didBackup = "true" ]; then + mkdir $boswatchpath/old/ + mv /tmp/boswatch/* $boswatchpath/old/ +fi + if [ $reboot = "true" ]; then /sbin/reboot fi