diff --git a/.travis.yml b/.travis.yml index eee9e74..d1103be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,15 +13,15 @@ before_script: - sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty main" - sudo apt-get update -qq - sudo apt-get install -qq wget python2.7 -# - wget https://raw.githubusercontent.com/thejockel/BOSWatch/develop/install.sh - - wget https://raw.githubusercontent.com/Schrolli91/BOSWatch/master/install.sh + + - wget https://raw.githubusercontent.com/Schrolli91/BOSWatch/${TRAVIS_BRANCH}/install.sh - chmod +x install.sh - cat /etc/os-release - echo ${TRAVIS_BRANCH} - - sudo ./install.sh -b ${TRAVIS_BRANCH} -r no + - sudo ./install.sh -b ${TRAVIS_BRANCH} env: - - module=bash + - module=base - module=mysql - module=httpRequest diff --git a/Konzept.md b/Konzept.md new file mode 100644 index 0000000..6e3a5b1 --- /dev/null +++ b/Konzept.md @@ -0,0 +1,118 @@ +# BOSWatch 3.0 +============ + + +Verpacken der Funktionalitäten in Klassen um OOP-Grundsätze zu erreichen. + + + +## Dekodierung und Auswertung trennen. + +### Client: + - reine Dekodierung mittels rtl-fm und multimon + - Keine Filter usw. nur die Dekoder, Daten verpacken, verschicken + - per TCP Socket an den Server + + ### Server: + - Empfängt die TCP Socket Pakete der einzelnen Clients + - Durch doubleFiltering fallen doppelt eingehende Alarme der Clienten sowieso raus + - Danach Filterung usw. dann call an die plugins + + + +## Konfiguration: +- Alle Einstellungen in INI File +- Einziges Argument beim Start des Clienten ist der Name der INI (-v -q -t sollen auch bleiben) +- So werden mehrere Sticks auf einem Rechner einfach möglich ohne BOSWatch Ordner kopieren zu müssen + +### Client: + +``` +[Server] +IP = 127.0.0.1 +PORT = 23 + +[Client] +Name = BOSWatch Client 1 +LogDir = log/ + +[Stick] +device = 0 +Frequency = 85...M +PPMError = 0 +Squelch = 0 +gain = 100 + +[Decoder] +FMS = 0 +ZVEI = 0 +POC512 = 0 +POC1200 = 1 +POC2400 = 0 +``` + +### Server: +``` +[Server] +PORT = 23 + +[Filter] +... + +[Plugins] +MySQL = 1 +template = 0 +... +``` + +### Plugin: +- Konfigurations Datei für Plugin mit in den Plugin Ordner +- Plugin läd bei Bedarf seine Config selbst, die geht BOSWatch ja nichts an +- Aktuell wird eine ewig lange Config geladen, obwohl 90% der Plugins nicht genutzt werden + + + +## Filterung +Ein Vernünftiges Filterkonzept sollte aufgestellt werden, welches bei POC, FMS und ZVEI gleichermaßen funktioniert +und daher nicht 3 mal implementiert erden muss. + + + +## Versions Überprüfung + +über die LIB sched.py - https://docs.python.org/3/library/sched.html - können Zeitgesteuerte Events gestartet werden. +Dies kann zur Überprüfung einer neuen Software version verwendet werden. +information des Nutzers muss noch überlegt werden - evtl als "Alarm" absetzen über normalen Plugin weg. + + + +## Code Dokumentation +Dokumentiert werden sollten alle Funktion und Klassen in Doxygen gerechter Notation. +Genaue Erklärung und Bennenung der Tags in der Doxygen Hilfe +``` +class Hello: + ## @brief Short description. + # Longer description. + # + # @param self + # @param name Another Parameter + # @return value Returns a Value + + def __init__(self, name): + ## @brief Constructor + # Longer description optinal. + # + # @param self + # @param name Another Parameter + dosomething(12) + + def dosomething(self, x): + ## @brief Do something + # Longer description for do something. + # + # @param self + # @param x Another Parameter + # @return value Returns a 0 + dosomethingelse + return 0 +``` diff --git a/README.md b/README.md index 7c32c1c..c08f805 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ |beta|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/beta.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=4213030)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=beta)](https://travis-ci.org/Schrolli91/BOSWatch)| |develop|[![Codacy Badge](https://img.shields.io/codacy/grade/d512976554354a199555bd34ed179bb1/develop.svg)](https://www.codacy.com/app/Schrolli91/BOSWatch/dashboard?bid=3763820)|[![Build Status](https://travis-ci.org/Schrolli91/BOSWatch.svg?branch=develop)](https://travis-ci.org/Schrolli91/BOSWatch)| + **Unterstützung gesucht** Zur Weiterentwicklung des Programms benötigen wir Deine Mithilfe - bitte melde dich per Issue, wenn du Anwender in einem verschlüsselten POCSAG-Netz und im (legalen) Besitz des dazugehörigen Schlüssels bist. diff --git a/boswatch.py b/boswatch.py index aa4dd21..6b644f5 100755 --- a/boswatch.py +++ b/boswatch.py @@ -377,13 +377,13 @@ try: rawMmOut.close() else: logging.debug("start testing") - testFile = open(globalVars.script_path+"/testdata/testdata.txt","r") + testFile = open(globalVars.script_path+"/citest/testdata.txt","r") for testData in testFile: if (len(testData.rstrip(' \t\n\r')) > 1) and ("#" not in testData[0]): logging.info("Testdata: %s", testData.rstrip(' \t\n\r')) from includes import decoder decoder.decode(freqConverter.freqToHz(args.freq), testData) - time.sleep(1) + #time.sleep(1) logging.debug("test finished") except KeyboardInterrupt: diff --git a/citest/test.sh b/citest/test.sh index 2e3d21e..616544d 100644 --- a/citest/test.sh +++ b/citest/test.sh @@ -1,5 +1,6 @@ #!/bin/bash -bospath=/opt/boswatch/ +bospath=/opt/boswatch + echo $module # ---------------------------------------------------------------------------------------------------------------------------------- # base Tests diff --git a/testdata/testdata.txt b/citest/testdata.txt similarity index 100% rename from testdata/testdata.txt rename to citest/testdata.txt diff --git a/includes/globalVars.py b/includes/globalVars.py index 736deed..bd0cd55 100644 --- a/includes/globalVars.py +++ b/includes/globalVars.py @@ -9,8 +9,8 @@ Global variables """ # version info -versionNr = "2.1" -buildDate = "2016/11/20" +versionNr = "2.2-beta" +buildDate = "2016/02/23" # Global variables config = 0 diff --git a/install.sh b/install.sh index 5f42d75..71b5b93 100644 --- a/install.sh +++ b/install.sh @@ -6,11 +6,17 @@ function exitcodefunction { module=$3 if [ $errorcode -ne "0" ]; then + echo "Action: $action on $module failed." >> $boswatchpath/install/setup_log.txt + echo "Exitcode: $errorcode" >> $boswatchpath/install/setup_log.txt + echo "" echo "Action: $action on $module failed." echo "Exitcode: $errorcode" + echo "" + echo " -> If you want to open an Issue at https://github.com/Schrolli91/BOSWatch/issues" + echo " please post the logfile, located at $boswatchpath/install/setup_log.txt" exit 1 else - echo "Action: $action on $module ok." + echo "Action: $action on $module ok." >> $boswatchpath/install/setup_log.txt fi } @@ -38,7 +44,6 @@ echo "Caution, script does not install a webserver with PHP and MySQL" echo "So you have to make up manually if you want to use MySQL support" boswatchpath=/opt/boswatch -mkdir -p $boswatchpath reboot=false for (( i=1; i<=$#; i=$i+2 )); do @@ -47,24 +52,22 @@ for (( i=1; i<=$#; i=$i+2 )); do eval arg2=\$$t case $arg in - -r|--reboot) - case $arg2 in - y|yes) reboot=true ;; - n|no) reboot=false ;; - *) echo "Please use y/yes or n/no for reboot" ; exit 1 ;; - esac ;; + -r|--reboot) reboot=true ;; -b|--branch) case $arg2 in - dev|develop) echo " !!! WARNING: you are using the DEV BRANCH !!! "; branch=dev ;; - beta) echo " !!! WARNING: you are using the BETA BRANCH !!! "; branch=beta ;; + dev|develop) echo " !!! WARNING: you are using the DEV BRANCH !!! "; branch=dev ;; + beta) echo " !!! WARNING: you are using the BETA BRANCH !!! "; branch=beta ;; *) branch=master ;; esac ;; + -p|--path) echo " !!! WARNING: you install BOSWATCH to alternative path !!! "; boswatchpath=$arg2 ;; + *) echo "Internal error!" ; exit 1 ;; esac done +mkdir -p $boswatchpath mkdir -p $boswatchpath/install echo "" diff --git a/service/README.md b/service/README.md index c5c8cac..3057ee4 100644 --- a/service/README.md +++ b/service/README.md @@ -18,6 +18,7 @@ To actually use this script, put BOSWatch where you want (recommend `/usr/local/ and make sure it is executable (e.g. `sudo chmod 755 boswatch.py`). Edit the init script accordingly. Copy it into /etc/init.d using e.g. `sudo cp boswatch.sh /etc/init.d`. Make sure the script is executable (chmod again) and make sure that it has UNIX line-endings. +After creating this new daemon it's neccessary to do a `sudo systemctl daemon-reload` in order to make it findable. At this point you should be able to start BOSWatchcd ~/srt using the command `sudo /etc/init.d/boswatch.sh start`, check its status with the `sudo /etc/init.d/boswatch.sh status` argument and stop it with `sudo /etc/init.d/boswatch.sh stop`. diff --git a/service/boswatch.sh b/service/boswatch.sh index bbfacba..1779e1b 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=/usr/local/bin/BOSWatch +DIR=/opt/boswatch/BOSWatch DAEMON=$DIR/boswatch.py DAEMON_NAME=boswatch diff --git a/testdata/rt_fm errors.txt b/testdata/rt_fm errors.txt deleted file mode 100644 index 3b3705e..0000000 --- a/testdata/rt_fm errors.txt +++ /dev/null @@ -1,7 +0,0 @@ -Error Messages from RTL_FM - -fprintf(stderr, "Signal caught, exiting!\n"); -fprintf(stderr, "Failed to open rtlsdr device #%d.\n", dongle.dev_index); -fprintf(stderr, "Failed to open %s\n", output.filename); -fprintf(stderr, "\nUser cancel, exiting...\n"); -fprintf(stderr, "\nLibrary error %d, exiting...\n", r);