Merge pull request #2 from Schrolli91/develop

Develop
This commit is contained in:
Schrolli91 2015-04-08 14:08:28 +02:00
commit b49d5ee9aa
4 changed files with 120 additions and 25 deletions

View file

@ -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.

View file

@ -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 #####

View file

@ -16,16 +16,26 @@ $db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database);
<div style="text-align: center; width: 1250px; margin: 0px auto;">
<img src="gfx/logo.png" alt="BOSWatch"><br>
Last alarms for FMS and ZVEI (max. 50)<br><br>
<div style="float: left; width: 800px;">
<b>Last FMS alarms</b>
<table border="1" style="width: 800px;">
<tr style="font-weight: bold;">
<td>ID</td>
<td>Datum - Zeit</td>
<td>BOS</td>
<td>Bundesland</td>
<td>Ort</td>
<td>Fahrzeug</td>
<td>Stat.</td>
<td>Richt.</td>
<td>TKI</td>
</tr>
<?php
$sql = "SELECT id, time, service, country, location, vehicle, status, direction, tsi FROM ".$tableFMS." ORDER BY id DESC LIMIT 50";
$db_erg = mysqli_query( $db_link, $sql );
echo '<table border="1" style="width: 800px;">';
while ($data = mysqli_fetch_array( $db_erg, MYSQL_ASSOC))
{
@ -38,24 +48,29 @@ $db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database);
echo "<td>". $time . "</td>";
echo "<td>". parse("service",$fms_id) . "</td>";
echo "<td>". parse("country",$fms_id) . "</td>";
echo "<td>". $data['location'] . "</td>";
echo "<td>". $data['vehicle'] . "</td>";
echo "<td>". parse("location",$fms_id) . "</td>";
echo "<td>". parse("vehicle",$fms_id) . "</td>";
echo "<td>". $data['status'] . "</td>";
echo "<td>". parse("direction",$fms_id) . "</td>";
echo "<td>". $data['tsi'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</table>
</div>
<div style="float: right; width: 400px;">
<b>Last ZVEI alarms</b>
<table border="1" style="width: 400px;">
<tr style="font-weight: bold;">
<td>ID</td>
<td>Datum - Zeit</td>
<td>Schleife</td>
</tr>
<?php
$sql = "SELECT id, time, zvei FROM ".$tableZVEI." ORDER BY id DESC LIMIT 50";
$db_erg = mysqli_query( $db_link, $sql );
echo '<table border="1" style="width: 400px;">';
while ($data = mysqli_fetch_array( $db_erg, MYSQL_ASSOC))
{
@ -65,14 +80,14 @@ $db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database);
echo "<tr>";
echo "<td>". $data['id'] . "</td>";
echo "<td>". $time . "</td>";
echo "<td>". $data['zvei'] . "</td>";
echo "<td>". parse('zvei',$data['zvei']) . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</table>
</div>
</div>
</body>
</html>

View file

@ -1,8 +1,7 @@
<?php
//Data from TRBOS-FMS http://www.lfs-bw.de/Fachthemen/Digitalfunk-Funk/Documents/Pruefstelle/TRBOS-FMS.pdf
function parse($mode, $fms)
function parse($mode, $data)
{
//Data for Service Parsing
$service = array(
@ -24,7 +23,7 @@
"f" => "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;