simple Web Frontend

First simple Web Frontend and Database restruction
This commit is contained in:
Bastian Schroll 2015-04-03 20:38:23 +02:00
parent 7d160dbd43
commit 5bb86ceaa0
5 changed files with 160 additions and 5 deletions

View file

@ -8,12 +8,13 @@ Python Script to Recive and Decode BOS Information with rtl_fm ans multimon-NG
- ZVEI validation (plausibility test)
- MySQL Database Support for FMS and ZVEI
- All configurations in seperate File "config.ini"
- simple Web Frontend
#####Fetaures for the Future:
- extensive filtering options
- POCSAG 512,1200,2400 support
- automatic Audio recording at alarm
- Web Frontend
- Web Frontend with configuration
### Usage
`sudo python boswatch.py -f 85.235M -a FMS ZVEI -s 50`

72
boswatch.sql Normal file
View file

@ -0,0 +1,72 @@
-- phpMyAdmin SQL Dump
-- version 3.4.11.1deb2+deb7u1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Erstellungszeit: 03. Apr 2015 um 11:16
-- Server Version: 5.5.41
-- PHP-Version: 5.4.39-0+deb7u1
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Datenbank: `boswatch`
--
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `bos_fms`
--
CREATE TABLE IF NOT EXISTS `bos_fms` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL,
`service` varchar(1) NOT NULL,
`country` varchar(2) NOT NULL,
`location` varchar(2) NOT NULL,
`vehicle` varchar(4) NOT NULL,
`status` varchar(1) NOT NULL,
`direction` varchar(1) NOT NULL,
`tsi` varchar(3) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `bos_pocsag`
--
CREATE TABLE IF NOT EXISTS `bos_pocsag` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL,
`ric` varchar(7) NOT NULL DEFAULT '0',
`funktion` int(1) NOT NULL,
`text` text NOT NULL,
KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `bos_zvei`
--
CREATE TABLE IF NOT EXISTS `bos_zvei` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`time` datetime NOT NULL,
`zvei` varchar(5) NOT NULL DEFAULT '0',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View file

@ -7,11 +7,11 @@
dbserver = localhost
dbuser = root
dbpassword = root
database = raspoc
database = boswatch
tableFMS = ras_fms_hist
tableZVEI = ras_zvei_hist
tablePOC = ras_pocsag_hist
tableFMS = bos_fms
tableZVEI = bos_zvei
tablePOC = bos_pocsag
[FMS]
#time to ignore same alarm in a row in seconds

12
www/config.php Normal file
View file

@ -0,0 +1,12 @@
<?php
$dbhost = "localhost";
$dbuser = "root";
$dbpassword = "root";
$database = "boswatch";
$tableFMS = "bos_fms";
$tableZVEI = "bos_zvei";
$tablePOC = "bos_pocsag";
?>

70
www/index.php Normal file
View file

@ -0,0 +1,70 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?php
require_once ("config.php");
$db_link = mysqli_connect ($dbhost, $dbuser, $dbpassword, $database);
?>
<html>
<head>
<title>BOSWatch</title>
</head>
<body>
<div style="text-align: center; width: 1050px; margin: 0px auto;">
<h1>BOSWatch</h1>
Last alarms for FMS and ZVEI (max. 50)<br><br>
<div style="float: left; width: 600px;">
<b>Last FMS alarms</b>
<?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: 600px;">';
while ($data = mysqli_fetch_array( $db_erg, MYSQL_ASSOC))
{
echo "<tr>";
echo "<td>". $data['id'] . "</td>";
echo "<td>". $data['time'] . "</td>";
echo "<td>". $data['service'] . "</td>";
echo "<td>". $data['country'] . "</td>";
echo "<td>". $data['location'] . "</td>";
echo "<td>". $data['vehicle'] . "</td>";
echo "<td>". $data['status'] . "</td>";
echo "<td>". $data['direction'] . "</td>";
echo "<td>". $data['tsi'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</div>
<div style="float: right; width: 400px;">
<b>Last ZVEI alarms</b>
<?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))
{
echo "<tr>";
echo "<td>". $data['id'] . "</td>";
echo "<td>". $data['time'] . "</td>";
echo "<td>". $data['zvei'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
</div>
</div>
</body>
</html>