Adding POCSAG to current Mode - view.

This commit is contained in:
Kim Hübel 2020-09-22 19:25:44 +01:00
parent 39bf202eac
commit 451553b874
2 changed files with 20 additions and 5 deletions

View file

@ -246,7 +246,7 @@ function showMode($mode, $mmdvmconfigs) {
function getMMDVMLog() { function getMMDVMLog() {
// Open Logfile and copy loglines into LogLines-Array() // Open Logfile and copy loglines into LogLines-Array()
$logPath = MMDVMLOGPATH."/".MMDVMLOGPREFIX."-".date("Y-m-d").".log"; $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; return $logLines;
} }
@ -572,6 +572,18 @@ function getHeardList($logLines, $onlyLast) {
$ber = $nxdnber; $ber = $nxdnber;
$rssi = $nxdnrssi; $rssi = $nxdnrssi;
break; 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 // Callsign or ID should be less than 11 chars long, otherwise it could be errorneous
if ( strlen($callsign) < 11 ) { if ( strlen($callsign) < 11 ) {
@ -631,7 +643,7 @@ function getLastHeard($logLines, $onlyLast) {
$heardList = getHeardList($logLines, $onlyLast); $heardList = getHeardList($logLines, $onlyLast);
$counter = 0; $counter = 0;
foreach ($heardList as $listElem) { 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)) { if(!(array_search($listElem[2]."#".$listElem[1].$listElem[4], $heardCalls) > -1)) {
// Generate a canonicalized call for QRZ and name lookups // Generate a canonicalized call for QRZ and name lookups
$call_canon = preg_replace('/\s+\w$/', '', $listElem[2]); $call_canon = preg_replace('/\s+\w$/', '', $listElem[2]);
@ -672,14 +684,17 @@ function getActualMode($metaLastHeard, $mmdvmconfigs) {
// returns mode of repeater actual working in // returns mode of repeater actual working in
$listElem = $metaLastHeard[0]; $listElem = $metaLastHeard[0];
$timestamp = new DateTime($listElem[0],new DateTimeZone(TIMEZONE)); $timestamp = new DateTime($listElem[0],new DateTimeZone(TIMEZONE));
$timestamp2 = $timestamp;
$timestamp2->add(new DateInterval('PT3S'));
$mode = $listElem[1]; $mode = $listElem[1];
if (startsWith($mode, "DMR")) { if (startsWith($mode, "DMR")) {
$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 "<span class=\"badge badge-danger\">".$mode."</span>"; return "<span class=\"badge badge-danger\">".$mode."</span>";
} else { } else {
$now = new DateTime('NOW',new DateTimeZone(TIMEZONE));
$hangtime = getConfigItem("General", "ModeHang", $mmdvmconfigs); $hangtime = getConfigItem("General", "ModeHang", $mmdvmconfigs);
if ($hangtime != "") { if ($hangtime != "") {

View file

@ -26,7 +26,7 @@ foreach ($lastHeard as $listElem) {
// echo"<!--"; // echo"<!--";
// var_dump($listElem); // var_dump($listElem);
// echo"-->"; // 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 "<tr>"; echo "<tr>";
echo"<td nowrap>$listElem[0]</td>"; echo"<td nowrap>$listElem[0]</td>";
echo"<td nowrap>$listElem[1]</td>"; echo"<td nowrap>$listElem[1]</td>";