diff --git a/README.md b/README.md index 20c64b4..d113932 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![# BOSWatch](/www/gfx/logo.png) -Python Script to Recive and Decode German BOS Information with rtl_fm and multimon-NG +Python Script to receive and decode German BOS Information with rtl_fm and multimon-NG #### Note: **This software is for illustrative purposes only and may be used only by authorized persons.** @@ -19,9 +19,10 @@ unless you are developer you can use the develop-Branch - may be unstable! - FMS and ZVEI validation (plausibility test) - MySQL Database Support for FMS and ZVEI - simple HTTP request at alarm to URL you want -- All configurations in seperate File "config.ini" +- All configurations in seperate config File - simple Web Frontend with Data Parsing - Logfiles for better Troubleshooting +- verbose/quiet Mode for more/none information ##### Features for the Future: - extensive filtering options @@ -41,11 +42,11 @@ For the other Functions see "Usage" below. ##### Web Frontend Put the Files in Folder /wwww/ into your local Webserver Folder (/var/www/). Now you must edit the "config.php" with your Userdata to your local Database. +For the Parsing Functions take a look into the parser.php ### Usage -`sudo python boswatch.py -f 85.235M -a FMS ZVEI -s 50` +`sudo python boswatch.py -f 85.235M -a FMS ZVEI` Starts boswatch at Frequency 85.235 MHz with the Demodulation Functions FMS and ZVEI. -Squelch level is set to 50 Help to all usable Parameters with `sudo python boswatch.py -h` @@ -77,7 +78,7 @@ You can easy install BOSWatch with the install.sh Script. - And use the script `sudo sh install.sh` Now the script downloads and compile all needed data. -At the end you can find the Programm in `~/bos/BOSWatch` +At the end you can find BOSWatch in `~/bos/BOSWatch/` Caution, script don't install a Webserver with PHP and MySQL. So you have to make up manually if you want to use MySQL support. diff --git a/boswatch.py b/boswatch.py index 04242cf..42326cc 100644 --- a/boswatch.py +++ b/boswatch.py @@ -4,7 +4,7 @@ ##### Info ##### # BOSWatch # Autor: Bastian Schroll -# Python Script to Recive and Decode German BOS Information with rtl_fm and multimon-NG +# Python Script to receive and decode German BOS Information with rtl_fm and multimon-NG # For more Information see the README.md ##### Info ##### diff --git a/www/index.php b/www/index.php index b962b07..c0495ba 100644 --- a/www/index.php +++ b/www/index.php @@ -16,16 +16,26 @@ $db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database);
BOSWatch
- Last alarms for FMS and ZVEI (max. 50)

Last FMS alarms + + + + + + + + + + + + '; + while ($data = mysqli_fetch_array( $db_erg, MYSQL_ASSOC)) { @@ -38,24 +48,29 @@ $db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database); echo ""; echo ""; echo ""; - echo ""; - echo ""; + echo ""; + echo ""; echo ""; echo ""; echo ""; echo ""; } - echo "
IDDatum - ZeitBOSBundeslandOrtFahrzeugStat.Richt.TKI
". $time . "". parse("service",$fms_id) . "". parse("country",$fms_id) . "". $data['location'] . "". $data['vehicle'] . "". parse("location",$fms_id) . "". parse("vehicle",$fms_id) . "". $data['status'] . "". parse("direction",$fms_id) . "". $data['tsi'] . "
"; ?> +
Last ZVEI alarms + + + + + + '; + while ($data = mysqli_fetch_array( $db_erg, MYSQL_ASSOC)) { @@ -65,14 +80,14 @@ $db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database); echo ""; echo ""; echo ""; - echo ""; + echo ""; echo ""; } - echo "
IDDatum - ZeitSchleife
". $data['id'] . "". $time . "". $data['zvei'] . "". parse('zvei',$data['zvei']) . "
"; ?> +
- + \ No newline at end of file diff --git a/www/parser.php b/www/parser.php index e1242ad..4393f95 100644 --- a/www/parser.php +++ b/www/parser.php @@ -1,8 +1,7 @@ "Fernwirktelegramm", ); - //Data for Country Parsing + //Data for Country Parsing $country = array( "0" => "Sachsen", "1" => "Bund", @@ -43,21 +42,101 @@ "e" => "Meck-Pom/Sachsen-Anhalt", "f" => "Brandenburg/Thüringen", ); + + //Data for Location Parsing + $location = array( + "11" => "testLoc", + "22" => "testLoc", + "33" => "testLoc" + ); + + //Data for Vehicle Parsing + $vehicle = array( + "1111" => "testVeh", + "2222" => "testVeh", + "3333" => "testVeh" + ); + + + //Data for ZVEI Parsing + $zvei = array( + "12345" => "testZvei", + "23456" => "testZvei", + "34567" => "testZvei", + ); + switch ($mode) { + //Parse Service case "service": - return $service[substr($fms,0,1)]; + $data = substr($data,0,1); + if (array_key_exists($data, $service)) + { + return $service[$data]; + }else + { + return $data; + } break; - + + //Parse Country case "country": - return $country[substr($fms,1,1)]; + $data = substr($data,1,1); + if (array_key_exists($data, $country)) + { + return $country[$data]; + }else + { + return $data; + } break; + //Parse Location + case "location": + $data = substr($data,2,2); + if (array_key_exists($data, $location)) + { + return $location[$data]; + }else + { + return $data; + } + break; + + //Parse Vehicle + case "vehicle": + $data = substr($data,4,4); + if (array_key_exists($data, $vehicle)) + { + return $vehicle[$data]; + }else + { + return $data; + } + break; + + //Parse direction case "direction": - if(substr($fms,9,1) == 1){ + if (substr($data,9,1) == 1) + { return "L->F"; - }elseif(substr($fms,9,1) == 0){ + }elseif (substr($data,9,1) == 0) + { return "F->L"; + }else + { + return "ERR!"; + } + break; + + //Parse Zvei + case "zvei": + if (array_key_exists($data, $zvei)) + { + return $data ." - ". $zvei[$data]; + }else + { + return $data; } break;