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; $reverseLogLinesYSFGateway = $logLinesYSFGateway;
rsort($reverseLogLinesYSFGateway); rsort($reverseLogLinesYSFGateway);
$activeYSFReflectors = getActiveYSFReflectors(); $activeYSFReflectors = getActiveYSFReflectors();
$link = getYSFReflectorById(getActualLink($reverseLogLinesYSFGateway, "YSF"), $activeYSFReflectors); $link = getActualLink($reverseLogLinesYSFGateway, "YSF");
echo $link; echo $link;
} }

View file

@ -757,19 +757,19 @@ function getActualLink($logLines, $mode) {
foreach($logLines as $logLine) { foreach($logLines as $logLine) {
$to = ""; $to = "";
if (strpos($logLine,"Disconnect has been requested")) { if (strpos($logLine,"Disconnect has been requested")) {
$to = -1; return _("not linked");
} }
if (strpos($logLine,"Connect to")) { if (strpos($logLine,"Connect to")) {
$to = substr($logLine, 38, 5); $to = substr($logLine, 47, 16);
} }
if (strpos($logLine,"Reverting connection")) { //if (strpos($logLine,"Reverting connection")) {
$to = substr($logLine, 51, 5); // $to = substr($logLine, 51, 5);
} //}
if (strpos($logLine,"The ID of this repeater is")) { //if (strpos($logLine,"The ID of this repeater is")) {
$to = -1; // $to = -1;
} //}
if (strpos($logLine,"Automatic connection to")) { if (strpos($logLine,"Automatic (re-)connection to")) {
$to = substr($logLine, 51, 5); $to = substr($logLine, 65, 16);
} }
if ($to !== "") { if ($to !== "") {
$fp = fopen('/tmp/YSFState.txt', 'w'); $fp = fopen('/tmp/YSFState.txt', 'w');
@ -779,7 +779,7 @@ function getActualLink($logLines, $mode) {
} }
} }
} else { } else {
return -2; return _("YSFGateway not running");
} }
if (file_exists('/tmp/YSFState.txt')) { if (file_exists('/tmp/YSFState.txt')) {
$fp = fopen('/tmp/YSFState.txt', 'r'); $fp = fopen('/tmp/YSFState.txt', 'r');
@ -788,10 +788,10 @@ function getActualLink($logLines, $mode) {
if (count($contents)>0){ if (count($contents)>0){
return $contents; return $contents;
} else { } else {
return -1; return _("not linked");
} }
} else { } else {
return -1; return _("not linked");
} }
break; break;
} }
@ -867,20 +867,6 @@ function getActiveYSFReflectors() {
return $reflectorlist; 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) { function getName($callsign) {
if (defined("USESQLITE")) { if (defined("USESQLITE")) {
return resolveNameFromDB($callsign); return resolveNameFromDB($callsign);

View file

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