From 451553b874cbda255132dfaee6f1d11cc63b0092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kim=20H=C3=BCbel?= Date: Tue, 22 Sep 2020 19:25:44 +0100 Subject: [PATCH] Adding POCSAG to current Mode - view. --- include/functions.php | 23 +++++++++++++++++++---- txinfo.php | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/functions.php b/include/functions.php index b2e18f2..2600930 100644 --- a/include/functions.php +++ b/include/functions.php @@ -246,7 +246,7 @@ function showMode($mode, $mmdvmconfigs) { function getMMDVMLog() { // Open Logfile and copy loglines into LogLines-Array() $logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; - $logLines = explode("\n", `egrep -h "from|end|watchdog|lost" $logPath`); + $logLines = explode("\n", `egrep -h "from|end|watchdog|lost|POCSAG" $logPath`); return $logLines; } @@ -572,6 +572,18 @@ function getHeardList($logLines, $onlyLast) { $ber = $nxdnber; $rssi = $nxdnrssi; break; + case "POCSAG": + $callsign = "POCSAG"; + $name = ""; + $id = ""; + $target = ""; + $source = ""; + $duration = ""; + $loss = ""; + $ber = ""; + $rssi = ""; + $alias = ""; + break; } // Callsign or ID should be less than 11 chars long, otherwise it could be errorneous if ( strlen($callsign) < 11 ) { @@ -631,7 +643,7 @@ function getLastHeard($logLines, $onlyLast) { $heardList = getHeardList($logLines, $onlyLast); $counter = 0; foreach ($heardList as $listElem) { - if ( ($listElem[1] == "D-Star") || ($listElem[1] == "YSF") || ($listElem[1] == "P25") || ($listElem[1] == "NXDN") || (startsWith($listElem[1], "DMR")) ) { + if ( ($listElem[1] == "D-Star") || ($listElem[1] == "YSF") || ($listElem[1] == "P25") || ($listElem[1] == "NXDN") || ($listElem[1] == "POCSAG") || (startsWith($listElem[1], "DMR")) ) { if(!(array_search($listElem[2]."#".$listElem[1].$listElem[4], $heardCalls) > -1)) { // Generate a canonicalized call for QRZ and name lookups $call_canon = preg_replace('/\s+\w$/', '', $listElem[2]); @@ -672,14 +684,17 @@ function getActualMode($metaLastHeard, $mmdvmconfigs) { // returns mode of repeater actual working in $listElem = $metaLastHeard[0]; $timestamp = new DateTime($listElem[0],new DateTimeZone(TIMEZONE)); + $timestamp2 = $timestamp; + $timestamp2->add(new DateInterval('PT3S')); $mode = $listElem[1]; if (startsWith($mode, "DMR")) { $mode = "DMR"; } - if (defined("ENABLEXTDLOOKUP") && $listElem[7] == null || !defined("ENABLEXTDLOOKUP") && $listElem[6] == null) { + $now = new DateTime('NOW',new DateTimeZone(TIMEZONE)); + if (defined("ENABLEXTDLOOKUP") && $listElem[7] == null && $mode != "POCSAG" || !defined("ENABLEXTDLOOKUP") && $listElem[6] == null && $mode != "POCSAG" || $mode == "POCSAG" && $now->format('U') <= $timestamp2->format('U') ) { return "".$mode.""; } else { - $now = new DateTime('NOW',new DateTimeZone(TIMEZONE)); + $hangtime = getConfigItem("General", "ModeHang", $mmdvmconfigs); if ($hangtime != "") { diff --git a/txinfo.php b/txinfo.php index 5b56a90..72ea550 100644 --- a/txinfo.php +++ b/txinfo.php @@ -26,7 +26,7 @@ foreach ($lastHeard as $listElem) { // echo""; - if (defined("ENABLEXTDLOOKUP") && $listElem[7] == null || !defined("ENABLEXTDLOOKUP") && $listElem[6] == null) { + if (defined("ENABLEXTDLOOKUP") && $listElem[7] == null && $listElem[1] != "POCSAG" || !defined("ENABLEXTDLOOKUP") && $listElem[6] == null && $listElem[1] != "POCSAG" ) { echo ""; echo"$listElem[0]"; echo"$listElem[1]";