Correct Headline \(Repeater or Hotspot\), better \'last linked to\' for DMR, now shows also TGs, Config for MMDVM.ini-Filename, TNX to Tony Corbett

This commit is contained in:
dg9vh 2016-05-14 18:51:40 +00:00
parent 5b55fa135d
commit 26b8b15d2b
4 changed files with 45 additions and 17 deletions

View file

@ -4,6 +4,7 @@ define("MMDVMLOGPATH", "/mnt/ramdisk/"); // hint: add trailing / !!!
define("MMDVMLOGPREFIX", "MMDVM");
define("MMDVMLOGFILE", MMDVMLOGPATH . MMDVMLOGPREFIX . "-" . date("Y-m-d") . ".log");
define("MMDVMINIPATH", "/etc/mmdvm/"); // hint: add trailing / !!!
define("MMDVMINIFILENAME", "MMDVM.ini");
define("MMDVMHOSTPATH", "/usr/local/bin/"); // hint: add trailing / !!!
// enter exact path to your log files.

View file

@ -22,7 +22,7 @@ function isProcessRunning($processname) {
function getMMDVMConfig() {
// loads MMDVM.ini into array for further use
$mmdvmconfigs = array();
if ($configs = fopen(MMDVMINIPATH."MMDVM.ini", 'r')) {
if ($configs = fopen(MMDVMINIPATH."/".MMDVMINIFILENAME, 'r')) {
while ($config = fgets($configs)) {
array_push($mmdvmconfigs, trim ( $config, " \t\n\r\0\x0B"));
}
@ -337,13 +337,12 @@ function getActualLink($logLines, $mode) {
case "DMR Slot 1":
foreach ($logLines as $logLine) {
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 1") {
$from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6);
if (strlen($from) == 4 && startsWith($from,"4")) {
if ($from == "4000") {
return "not linked";
} else {
return $from;
$to = "";
if (strpos($logLine,"to")) {
$to = trim(substr($logLine, strpos($logLine,"to") + 3));
}
if ($to !== "") {
return $to;
}
}
}
@ -352,13 +351,12 @@ function getActualLink($logLines, $mode) {
case "DMR Slot 2":
foreach ($logLines as $logLine) {
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") {
$from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6);
if (strlen($from) == 4 && startsWith($from,"4")) {
if ($from == "4000") {
return "not linked";
} else {
return $from;
$to = "";
if (strpos($logLine,"to")) {
$to = trim(substr($logLine, strpos($logLine,"to") + 3));
}
if ($to !== "") {
return $to;
}
}
}
@ -368,6 +366,29 @@ function getActualLink($logLines, $mode) {
return "something went wrong!";
}
function getActualReflector($logLines, $mode) {
// returns actual link state of specific mode
//M: 2016-05-02 07:04:10.504 D-Star link status set to "Verlinkt zu DCS002 S"
//M: 2016-04-03 16:16:18.638 DMR Slot 2, received network voice header from 4000 to 2625094
//M: 2016-04-03 19:30:03.099 DMR Slot 2, received network voice header from 4020 to 2625094
array_multisort($logLines,SORT_DESC);
foreach ($logLines as $logLine) {
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") {
$from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6);
if (strlen($from) == 4 && startsWith($from,"4")) {
if ($from == "4000") {
return "Reflector not linked";
} else {
return "Reflector ".$from;
}
}
}
}
return "Reflector not linked";
}
//Some basic inits
$mmdvmconfigs = getMMDVMConfig();
$logLines = getLog();

View file

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

View file

@ -26,7 +26,13 @@ include "include/functions.php";
</head>
<body>
<div class="page-header">
<h1><small>MMDVM-Dashboard by DG9VH for Repeater:</small> <?php echo getCallsign($mmdvmconfigs) ?></h1>
<h1><small>MMDVM-Dashboard by DG9VH for <?php
if (getConfigItem("General", "Duplex", $mmdvmconfigs) == "1") {
echo "Repeater";
} else {
echo "Hotspot";
}
?>:</small> <?php echo getCallsign($mmdvmconfigs) ?></h1>
<h4>MMDVMHost v<?php echo getMMDVMHostVersion() ?> by G4KLX</h4>
</div>
<?php