Updated "YSF linked to" status display

Removed the search method for reflector IDs and taken directly from the log file
This commit is contained in:
LucaMarche IZ1MLT 2018-06-03 13:54:13 +02:00 committed by GitHub
parent 35daf0e5ec
commit 9e561a757f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 30 deletions

View file

@ -46,7 +46,7 @@ if ($_GET['section'] == "ysflink") {
$reverseLogLinesYSFGateway = $logLinesYSFGateway;
rsort($reverseLogLinesYSFGateway);
$activeYSFReflectors = getActiveYSFReflectors();
$link = getYSFReflectorById(getActualLink($reverseLogLinesYSFGateway, "YSF"), $activeYSFReflectors);
$link = getActualLink($reverseLogLinesYSFGateway, "YSF");
echo $link;
}

View file

@ -662,7 +662,7 @@ function getDSTARLinks() {
$linkDest = $linx[4][0];
$linkDir = $linx[5][0];
}
$out .= "<tr>" . $linkSource . "&nbsp;" . $protocol . "-link&nbsp;to&nbsp;" . $linkDest . "&nbsp;" . $linkDir ."</tr>";
$out .= "<tr>" . $linkSource . "&nbsp;" . $protocol . "-link&nbsp;to&nbsp;" . $linkDest . "&nbsp;" . $linkDir . "</tr>";
}
}
$out .= "</table>";
@ -757,19 +757,19 @@ function getActualLink($logLines, $mode) {
foreach($logLines as $logLine) {
$to = "";
if (strpos($logLine,"Disconnect has been requested")) {
$to = -1;
return _("not linked");
}
if (strpos($logLine,"Connect to")) {
$to = substr($logLine, 38, 5);
$to = substr($logLine, 47, 16);
}
if (strpos($logLine,"Reverting connection")) {
$to = substr($logLine, 51, 5);
}
if (strpos($logLine,"The ID of this repeater is")) {
$to = -1;
}
if (strpos($logLine,"Automatic connection to")) {
$to = substr($logLine, 51, 5);
//if (strpos($logLine,"Reverting connection")) {
// $to = substr($logLine, 51, 5);
//}
//if (strpos($logLine,"The ID of this repeater is")) {
// $to = -1;
//}
if (strpos($logLine,"Automatic (re-)connection to")) {
$to = substr($logLine, 65, 16);
}
if ($to !== "") {
$fp = fopen('/tmp/YSFState.txt', 'w');
@ -779,7 +779,7 @@ function getActualLink($logLines, $mode) {
}
}
} else {
return -2;
return _("YSFGateway not running");
}
if (file_exists('/tmp/YSFState.txt')) {
$fp = fopen('/tmp/YSFState.txt', 'r');
@ -788,10 +788,10 @@ function getActualLink($logLines, $mode) {
if (count($contents)>0){
return $contents;
} else {
return -1;
return _("not linked");
}
} else {
return -1;
return _("not linked");
}
break;
}
@ -867,20 +867,6 @@ function getActiveYSFReflectors() {
return $reflectorlist;
}
function getYSFReflectorById($id, $reflectors) {
if ($id ==-1) {
return _("not linked");
} else if ($id == -2 ) {
return _("YSFGateway not running");
} else {
foreach($reflectors as $reflector) {
if ($reflector[3] === $id) {
return $reflector[0];
}
}
}
}
function getName($callsign) {
if (defined("USESQLITE")) {
return resolveNameFromDB($callsign);

View file

@ -37,7 +37,7 @@
echo"<td id=\"dstarlink\">".getActualLink($reverseLogLinesMMDVM, "D-Star")."</td>";
}
if (getEnabled("System Fusion", $mmdvmconfigs) == 1) {
echo"<td id=\"ysflink\">".getYSFReflectorById(getActualLink($reverseLogLinesYSFGateway, "YSF"), $activeYSFReflectors)."</td>";
echo"<td id=\"ysflink\">".getActualLink($reverseLogLinesYSFGateway, "YSF")."</td>";
}
if (getEnabled("DMR", $mmdvmconfigs) == 1) {
if (getConfigItem("DMR Network", "Slot1", $mmdvmconfigs) == "1") {