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:
parent
5b55fa135d
commit
26b8b15d2b
4 changed files with 45 additions and 17 deletions
|
@ -4,6 +4,7 @@ define("MMDVMLOGPATH", "/mnt/ramdisk/"); // hint: add trailing / !!!
|
||||||
define("MMDVMLOGPREFIX", "MMDVM");
|
define("MMDVMLOGPREFIX", "MMDVM");
|
||||||
define("MMDVMLOGFILE", MMDVMLOGPATH . MMDVMLOGPREFIX . "-" . date("Y-m-d") . ".log");
|
define("MMDVMLOGFILE", MMDVMLOGPATH . MMDVMLOGPREFIX . "-" . date("Y-m-d") . ".log");
|
||||||
define("MMDVMINIPATH", "/etc/mmdvm/"); // hint: add trailing / !!!
|
define("MMDVMINIPATH", "/etc/mmdvm/"); // hint: add trailing / !!!
|
||||||
|
define("MMDVMINIFILENAME", "MMDVM.ini");
|
||||||
define("MMDVMHOSTPATH", "/usr/local/bin/"); // hint: add trailing / !!!
|
define("MMDVMHOSTPATH", "/usr/local/bin/"); // hint: add trailing / !!!
|
||||||
|
|
||||||
// enter exact path to your log files.
|
// enter exact path to your log files.
|
||||||
|
|
|
@ -22,7 +22,7 @@ function isProcessRunning($processname) {
|
||||||
function getMMDVMConfig() {
|
function getMMDVMConfig() {
|
||||||
// loads MMDVM.ini into array for further use
|
// loads MMDVM.ini into array for further use
|
||||||
$mmdvmconfigs = array();
|
$mmdvmconfigs = array();
|
||||||
if ($configs = fopen(MMDVMINIPATH."MMDVM.ini", 'r')) {
|
if ($configs = fopen(MMDVMINIPATH."/".MMDVMINIFILENAME, 'r')) {
|
||||||
while ($config = fgets($configs)) {
|
while ($config = fgets($configs)) {
|
||||||
array_push($mmdvmconfigs, trim ( $config, " \t\n\r\0\x0B"));
|
array_push($mmdvmconfigs, trim ( $config, " \t\n\r\0\x0B"));
|
||||||
}
|
}
|
||||||
|
@ -337,13 +337,12 @@ function getActualLink($logLines, $mode) {
|
||||||
case "DMR Slot 1":
|
case "DMR Slot 1":
|
||||||
foreach ($logLines as $logLine) {
|
foreach ($logLines as $logLine) {
|
||||||
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 1") {
|
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 1") {
|
||||||
$from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6);
|
$to = "";
|
||||||
if (strlen($from) == 4 && startsWith($from,"4")) {
|
if (strpos($logLine,"to")) {
|
||||||
if ($from == "4000") {
|
$to = trim(substr($logLine, strpos($logLine,"to") + 3));
|
||||||
return "not linked";
|
}
|
||||||
} else {
|
if ($to !== "") {
|
||||||
return $from;
|
return $to;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -352,13 +351,12 @@ function getActualLink($logLines, $mode) {
|
||||||
case "DMR Slot 2":
|
case "DMR Slot 2":
|
||||||
foreach ($logLines as $logLine) {
|
foreach ($logLines as $logLine) {
|
||||||
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") {
|
if(substr($logLine, 27, strpos($logLine,",") - 27) == "DMR Slot 2") {
|
||||||
$from = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6);
|
$to = "";
|
||||||
if (strlen($from) == 4 && startsWith($from,"4")) {
|
if (strpos($logLine,"to")) {
|
||||||
if ($from == "4000") {
|
$to = trim(substr($logLine, strpos($logLine,"to") + 3));
|
||||||
return "not linked";
|
}
|
||||||
} else {
|
if ($to !== "") {
|
||||||
return $from;
|
return $to;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -368,6 +366,29 @@ function getActualLink($logLines, $mode) {
|
||||||
return "something went wrong!";
|
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
|
//Some basic inits
|
||||||
$mmdvmconfigs = getMMDVMConfig();
|
$mmdvmconfigs = getMMDVMConfig();
|
||||||
$logLines = getLog();
|
$logLines = getLog();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
echo"<td>".getActualMode($lastHeard, $mmdvmconfigs)."</td>";
|
echo"<td>".getActualMode($lastHeard, $mmdvmconfigs)."</td>";
|
||||||
echo"<td>".getActualLink($logLines, "D-Star")."</td>";
|
echo"<td>".getActualLink($logLines, "D-Star")."</td>";
|
||||||
echo"<td>".getActualLink($logLines, "DMR Slot 1")."</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";
|
echo"</tr>\n";
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -26,7 +26,13 @@ include "include/functions.php";
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="page-header">
|
<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>
|
<h4>MMDVMHost v<?php echo getMMDVMHostVersion() ?> by G4KLX</h4>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in a new issue