added YSFGatewayinfo and active YSFReflectors-List

This commit is contained in:
dg9vh 2016-06-11 20:30:40 +00:00
parent 77893ce5a9
commit 6790c2ac76
6 changed files with 143 additions and 12 deletions

View file

@ -21,14 +21,26 @@ function getMMDVMHostFileVersion() {
function getMMDVMConfig() {
// loads MMDVM.ini into array for further use
$mmdvmconfigs = array();
$conf = array();
if ($configs = fopen(MMDVMINIPATH."/".MMDVMINIFILENAME, 'r')) {
while ($config = fgets($configs)) {
array_push($mmdvmconfigs, trim ( $config, " \t\n\r\0\x0B"));
array_push($conf, trim ( $config, " \t\n\r\0\x0B"));
}
fclose($configs);
}
return $mmdvmconfigs;
return $conf;
}
function getYSFGatewayConfig() {
// loads MMDVM.ini into array for further use
$conf = array();
if ($configs = fopen(YSFGATEWAYINIPATH."/".YSFGATEWAYINIFILENAME, 'r')) {
while ($config = fgets($configs)) {
array_push($conf, trim ( $config, " \t\n\r\0\x0B"));
}
fclose($configs);
}
return $conf;
}
function getCallsign($mmdvmconfigs) {
@ -82,7 +94,7 @@ function showMode($mode, $mmdvmconfigs) {
<?php
}
function getLog() {
function getMMDVMLog() {
// Open Logfile and copy loglines into LogLines-Array()
$logLines = array();
if ($log = fopen(MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log", 'r')) {
@ -96,6 +108,20 @@ function getLog() {
return $logLines;
}
function getYSFGatewayLog() {
// Open Logfile and copy loglines into LogLines-Array()
$logLines = array();
if ($log = fopen(YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date("Y-m-d").".log", 'r')) {
while ($logLine = fgets($log)) {
// if (!strpos($logLine, "Debug") && !strpos($logLine,"Received a NAK") && !startsWith($logLine,"I:")) {
array_push($logLines, $logLine);
// }
}
fclose($log);
}
return $logLines;
}
// 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122
// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
// M: 2016-04-29 00:15:00.013 D-Star, received network header from DG9VH /ZEIT to CQCQCQ via DCS002 S
@ -402,10 +428,38 @@ function getActualReflector($logLines, $mode) {
return "Reflector not linked";
}
function getActiveYSFReflectors($logLines) {
// 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122
// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
// D: 2016-06-11 19:09:31.371 Have reflector status reply from 89164/FUSIONBE2 /FusionBelgium /002
$reflectors = Array();
$reflectorlist = Array();
foreach ($logLines as $logLine) {
if (strpos($logLine, "Have reflector status reply from")) {
$timestamp = substr($logLine, 3, 19);
$str = substr($logLine, 60);
$id = strtok($str, "/");
$name = strtok("/");
$description = strtok("/");
$concount = strtok("/");
if(!(array_search($name, $reflectors) > -1)) {
array_push($reflectors,$name);
array_push($reflectorlist, array($name, $description, $id, $concount, $timestamp));
}
}
}
array_multisort($reflectorlist);
return $reflectorlist;
}
//Some basic inits
$mmdvmconfigs = getMMDVMConfig();
$logLines = getLog();
$reverseLogLines = $logLines;
array_multisort($reverseLogLines,SORT_DESC);
$lastHeard = getLastHeard($reverseLogLines);
$logLinesMMDVM = getMMDVMLog();
$reverseLogLinesMMDVM = $logLinesMMDVM;
array_multisort($reverseLogLinesMMDVM,SORT_DESC);
$lastHeard = getLastHeard($reverseLogLinesMMDVM);
$YSFGatewayconfigs = getYSFGatewayConfig();
$logLinesYSFGateway = getYSFGatewayLog();
$reverseLogLinesYSFGateway = $logLinesYSFGateway;
array_multisort($reverseLogLinesYSFGateway,SORT_DESC);
?>

View file

@ -1,6 +1,6 @@
<?php
$localTXList = getHeardList($reverseLogLines);
$localTXList = getHeardList($reverseLogLinesMMDVM);
//array_multisort($localTXList,SORT_DESC);
?>

View file

@ -13,9 +13,9 @@
<?php
echo"<tr>";
echo"<td>".getActualMode($lastHeard, $mmdvmconfigs)."</td>";
echo"<td>".getActualLink($reverseLogLines, "D-Star")."</td>";
echo"<td>".getActualLink($reverseLogLines, "DMR Slot 1")."</td>";
echo"<td>".getActualLink($reverseLogLines, "DMR Slot 2")."/". getActualReflector($logLines, "DMR Slot 2") ."</td>";
echo"<td>".getActualLink($reverseLogLinesMMDVM, "D-Star")."</td>";
echo"<td>".getActualLink($reverseLogLinesMMDVM, "DMR Slot 1")."</td>";
echo"<td>".getActualLink($reverseLogLinesMMDVM, "DMR Slot 2")."/". getActualReflector($reverseLogLinesMMDVM, "DMR Slot 2") ."</td>";
echo"</tr>\n";
?>
<tr>

View file

@ -0,0 +1,50 @@
<?php
?>
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">YSFGateway-Infos</div>
<!-- Tabelle -->
<table class="table">
<tr>
<td><span class="label <?php
if (isProcessRunning("YSFGateway")) {
echo "label-success";
?>">YSFGateway Process is running</span></td><?php
} else {
echo "label-danger\" title=\"YSFGateway is down!";
?>">YSFGateway Process is down!</span></td><?php
}
?>
</tr>
</table>
</div>
<div class="panel panel-default">
<!-- Standard-Panel-Inhalt -->
<div class="panel-heading">Reflectors-Info</div>
<!-- Tabelle -->
<table class="table">
<?php
$activeYSFReflectors = getActiveYSFReflectors($reverseLogLinesYSFGateway);
if (count($activeYSFReflectors) > 0) {
?>
<tr>
<th>Name</th>
<th>Description</th>
<th>ID</th>
<th>Connections</th>
<th>Last info of</th>
</tr>
<?php
foreach ($activeYSFReflectors as $reflector) {
echo "<tr>";
for ($i = 0; $i < 5; $i++) {
echo"<td>$reflector[$i]</td>";
}
echo "</tr>";
}
}
?>
</table>
</div>

View file

@ -43,6 +43,9 @@ include "include/repeaterinfo.php";
include "include/modes.php";
include "include/lh.php";
include "include/localtx.php";
if (defined("SHOWPROGRESSBARS")) {
include "include/ysfgatewayinfo.php";
}
?>
<div class="panel panel-info">
<?php

View file

@ -73,6 +73,30 @@ include "include/tools.php";
<input type="text" name="MMDVMHOSTPATH" class="form-control" placeholder="/usr/local/bin/" aria-describedby="MMDVMHOSTPATH" required data-fv-notempty-message="Value is required">
</div>
</div>
<div class="container">
<h2>YSFGateway-Configuration</h2>
<div class="input-group">
<span class="input-group-addon" id="ENABLEYSFGATEWAY" style="width: 300px">Enable YSFGateway</span>
<div class="panel-body"><input type="checkbox" name="ENABLEYSFGATEWAY"></div>
</div>
<div class="input-group">
<span class="input-group-addon" id="YSFGATEWAYLOGPATH" style="width: 300px">Path to YSFGateway-logfile</span>
<input type="text" name="YSFGATEWAYLOGPATH" class="form-control" placeholder="/var/log/YSFGateway/" aria-describedby="YSFGATEWAYLOGPATH" required data-fv-notempty-message="Value is required">
</div>
<div class="input-group">
<span class="input-group-addon" id="YSFGATEWAYLOGPREFIX" style="width: 300px">Logfile-prefix</span>
<input type="text" name="YSFGATEWAYLOGPREFIX" class="form-control" placeholder="YSFGateway" aria-describedby="YSFGATEWAYLOGPREFIX" required data-fv-notempty-message="Value is required">
</div>
<div class="input-group">
<span class="input-group-addon" id="YSFGATEWAYINIPATH" style="width: 300px">Path to YSFGateway.ini</span>
<input type="text" name="YSFGATEWAYINIPATH" class="form-control" placeholder="/etc/YSFGateway/" aria-describedby="YSFGATEWAYINIPATH" required data-fv-notempty-message="Value is required">
</div>
<div class="input-group">
<span class="input-group-addon" id="YSFGATEWAYINIFILENAME" style="width: 300px">YSFGateway.ini-filename</span>
<input type="text" name="YSFGATEWAYINIFILENAME" class="form-control" placeholder="YSFGateway.ini" aria-describedby="YSFGATEWAYINIFILENAME" required data-fv-notempty-message="Value is required">
</div>
</div>
<div class="container">
<h2>ircddbgateway-Configuration</h2>
<div class="input-group">