diff --git a/ajax.php b/ajax.php index 6cf9890..9272889 100644 --- a/ajax.php +++ b/ajax.php @@ -86,6 +86,10 @@ if ($_GET['section'] == "localTx") { $listElem = $localTXList[$i]; // Generate a canonicalized call for QRZ and name lookups $call_canon = preg_replace('/\s+\w$/', '', $listElem[2]); + //remove suffix used sometimes in YSF (es: -FT2 , -991) + if (strpos($call_canon,"-")!=false) { + $call_canon = substr($call_canon, 0, strpos($call_canon, "-")); + } if (defined("ENABLEXTDLOOKUP")) { $listElem[11] =""; if ($listElem[6] == "RF" && ($listElem[1]=="D-Star" || startsWith($listElem[1], "DMR") || $listElem[1]=="YSF" || $listElem[1]=="P25" || $listElem[1]=="NXDN")) { @@ -219,11 +223,11 @@ if ($_GET['section'] == "sysinfo") { showLapTime("cpuusage"); $output = shell_exec('grep -c processor /proc/cpuinfo'); - $cpucores = $output; + $cpucores = intval($output); $output = shell_exec('cat /proc/uptime'); $uptime = format_time(substr($output,0,strpos($output," "))); - $idletime = format_time((substr($output,strpos($output," ")))/$cpucores); + $idletime = format_time(doubleval((substr($output,strpos($output," "))))/$cpucores); showLapTime("idletime"); if (defined("SHOWPOWERSTATE")) { diff --git a/database/callsigns.db b/database/callsigns.db index ff32d1a..5335876 100644 Binary files a/database/callsigns.db and b/database/callsigns.db differ diff --git a/include/functions.php b/include/functions.php index 870d104..4595521 100644 --- a/include/functions.php +++ b/include/functions.php @@ -58,7 +58,9 @@ function getFirmwareVersion() { $firmware = "n/a"; if (count($logLines) >= 2) { $firmware = substr($logLines[count($logLines)-2], strpos($logLines[count($logLines)-2], "description")+13, strlen($logLines[count($logLines)-2])-strpos($logLines[count($logLines)-2], "description")+13); - if (0 === strpos($firmware, 'MMDVM')) { + if (0 === strpos($firmware, 'MMDVM_HS_Dual_Hat')) { + $firmware = preg_replace('/GitID #([0-9A-Fa-f]{7})/', 'GitID #$1', $firmware); + } else if (0 === strpos($firmware, 'MMDVM')) { $firmware = preg_replace('/GitID #([0-9A-Fa-f]{7})/', 'GitID #$1', $firmware); } else if (0 === strpos($firmware, 'ZUMspot')) { $firmware = preg_replace('/GitID #([0-9A-Fa-f]{7})/', 'GitID #$1', $firmware); @@ -163,6 +165,7 @@ function getDMRId ($mmdvmconfigs) { // returns DMRId from MMDVM-Config return getConfigItem("General", "Id", $mmdvmconfigs); } + function getConfigItem($section, $key, $configs) { // retrieves the corresponding config-entry within a [section] $sectionpos = array_search("[" . $section . "]", $configs) + 1; @@ -226,7 +229,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 "end|watchdog|lost" $logPath`); return $logLines; } @@ -249,6 +252,7 @@ function getYSFGatewayLog() { // M: 2016-04-29 00:15:00.013 D-Star, received network header from DG9VH /ZEIT to CQCQCQ via DCS002 S // M: 2016-04-29 19:43:21.839 DMR Slot 2, received network voice header from DL1ESZ to TG 9 // M: 2016-04-30 14:57:43.072 DMR Slot 2, received RF voice header from DG9VH to 5000 +// M: 2019-12-09 18:56:46.947 DMR Slot 1, received RF voice header from 2625094 to TG 26266 // M: 2016-09-16 09:14:12.886 P25, received RF from DF2ET to TG10100 // M: 2017-02-13 15:53:30.990 DMR Slot 2, Embedded Talker Alias Header // M: 2017-02-13 15:53:30.991 0000: 04 00 5E 49 57 38 44 59 94 *..^IW8DY.* @@ -359,39 +363,65 @@ function getHeardList($logLines, $onlyLast) { $rssi = $rssiVal; } } - $ber = substr($loss, 5); - $loss = ""; - } else { - $loss = strtok($loss, " "); - if (array_key_exists(4,$lineTokens)) { - $ber = substr($lineTokens[4], 5); - } - if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") { - $rssiString = substr($lineTokens[5], 6); - if (constant("RSSI") == "min") $rssiVal = preg_replace('/(-\d+)\/-\d+\/-\d+ dBm/', "\\1", $rssiString); - else if (constant("RSSI") == "max") $rssiVal = preg_replace('/-\d+\/(-\d+)\/-\d+ dBm/', "\\1", $rssiString); - else if (constant("RSSI") == "avg") $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); - else if (constant("RSSI") == "all") $rssiVal = $rssiString; - else $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); - if (constant("RSSI") != "all") { - if ($rssiVal > "-53") $rssi = "
S9 +40dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-63") $rssi = "
S9 +30dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-73") $rssi = "
S9 +20dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-83") $rssi = "
S9 +10dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-93") $rssi = "
S9 ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-99") $rssi = "
S8 ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-105") $rssi = "
S7 ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-111") $rssi = "
S6 ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-117") $rssi = "
S5 ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-123") $rssi = "
S4 ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-129") $rssi = "
S3 ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-135") $rssi = "
S2 ($rssiVal dBm)(min/max/avg)
$rssiString
"; - else if ($rssiVal > "-141") $rssi = "
S1 ($rssiVal dBm)(min/max/avg)
$rssiString
"; - } else { - $rssi = $rssiVal; - } - } - } + $ber = substr($loss, 5); + $loss = ""; + } else if (startsWith($loss,"RSSI:")) { //for short RF packets and "X" button requests, BER sometimes in not showed. RSSI is in BER position + $loss=""; + $ber = ""; + $rssiString = substr($lineTokens[3], 6); + if (constant("RSSI") == "min") $rssiVal = preg_replace('/(-\d+)\/-\d+\/-\d+ dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "max") $rssiVal = preg_replace('/-\d+\/(-\d+)\/-\d+ dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "avg") $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "all") $rssiVal = $rssiString; + else $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + if (constant("RSSI") != "all") { + if ($rssiVal > "-53") $rssi = "
S9 +40dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-63") $rssi = "
S9 +30dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-73") $rssi = "
S9 +20dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-83") $rssi = "
S9 +10dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-93") $rssi = "
S9 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-99") $rssi = "
S8 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-105") $rssi = "
S7 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-111") $rssi = "
S6 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-117") $rssi = "
S5 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-123") $rssi = "
S4 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-129") $rssi = "
S3 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-135") $rssi = "
S2 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-141") $rssi = "
S1 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + } else { + $rssi = $rssiVal; + } + } else { + $loss = strtok($loss, " "); + if (array_key_exists(4,$lineTokens)) { + $ber = substr($lineTokens[4], 5); + } + if (array_key_exists(5,$lineTokens) && substr($lineTokens[5], 6) != "-0/-0/-0 dBm") { + $rssiString = substr($lineTokens[5], 6); + if (constant("RSSI") == "min") $rssiVal = preg_replace('/(-\d+)\/-\d+\/-\d+ dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "max") $rssiVal = preg_replace('/-\d+\/(-\d+)\/-\d+ dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "avg") $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + else if (constant("RSSI") == "all") $rssiVal = $rssiString; + else $rssiVal = preg_replace('/-\d+\/-\d+\/(-\d+) dBm/', "\\1", $rssiString); + if (constant("RSSI") != "all") { + if ($rssiVal > "-53") $rssi = "
S9 +40dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-63") $rssi = "
S9 +30dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-73") $rssi = "
S9 +20dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-83") $rssi = "
S9 +10dB ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-93") $rssi = "
S9 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-99") $rssi = "
S8 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-105") $rssi = "
S7 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-111") $rssi = "
S6 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-117") $rssi = "
S5 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-123") $rssi = "
S4 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-129") $rssi = "
S3 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-135") $rssi = "
S2 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + else if ($rssiVal > "-141") $rssi = "
S1 ($rssiVal dBm)(min/max/avg)
$rssiString
"; + } else { + $rssi = $rssiVal; + } + } + } if (strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) { switch (substr($logLine, 27, strpos($logLine,",") - 27)) { @@ -467,14 +497,15 @@ function getHeardList($logLines, $onlyLast) { if(!$id) $id=""; } - - + $target = substr($logLine, $topos + 3); + if (strpos($target,",") > 0) + $target = substr($target, 0, strpos($target,",")); $target = preg_replace('/\s/', ' ', $target); if (defined("RESOLVETGS")) { $target = $target." ".getTGName($target); } - + $source = "RF"; if (strpos($logLine,"network") > 0 ) { $source = "Net"; @@ -553,6 +584,10 @@ function getLastHeard($logLines, $onlyLast) { 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]); + //remove suffix used sometimes in YSF (es: -FT2 , -991) + if (strpos($call_canon,"-")!=false) { + $call_canon = substr($call_canon, 0, strpos($call_canon, "-")); + } array_push($heardCalls, $listElem[2]."#".$listElem[1].$listElem[4]); if (defined("ENABLEXTDLOOKUP")) { if ($listElem[2] !== "??????????") { @@ -693,6 +728,7 @@ function getActualLink($logLines, $mode) { $to = ""; if (strpos($logLine,"to")) { $to = trim(substr($logLine, strpos($logLine,"to") + 3)); + $to = substr($to, 0, strpos($to,",")); } if ($to !== "") { $fp = fopen('/tmp/DMR1State.txt', 'w'); @@ -723,6 +759,9 @@ function getActualLink($logLines, $mode) { $to = ""; if (strpos($logLine,"to")) { $to = trim(substr($logLine, strpos($logLine,"to") + 3)); + $to = trim(substr($logLine, strpos($logLine,"to") + 3)); + $to = substr($to, 0, strpos($to,",")); + } if ($to !== "") { $fp = fopen('/tmp/DMR2State.txt', 'w'); @@ -751,8 +790,7 @@ function getActualLink($logLines, $mode) { // 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 //I: 2018-06-04 11:04:22.190 The ID of this repeater is 50735 //M: 2018-06-04 11:04:22.202 No connection startup -//M: 2018-06-04 11:04:24.005 Linked to IT C4FM Piemonte - +//M: 2018-06-04 11:04:24.005 Linked to IT C4FM Piemonte if (isProcessRunning("YSFGateway")) { foreach($logLines as $logLine) { @@ -773,7 +811,27 @@ function getActualLink($logLines, $mode) { return $to; } } - } else { + + if ( ($to == "") && file_exists('/tmp/YSFState.txt')) { // reflector is in yesterday's log + $logPath2 = YSFGATEWAYLOGPATH."/".YSFGATEWAYLOGPREFIX."-".date('Y-m-d',strtotime(date('Y-m-d').' -1 day')).".log"; //open yesterday's log + $logLines2 = explode("\n", `egrep -h "Linked to" $logPath2`); + $to = ""; + foreach($logLines2 as $logLine) { + if ($logLine!=='') { + $to = substr($logLine, 37, 16); + if ($to == "MMDVM" ) + continue; + } + } + if ($to !== "") { + $fp = fopen('/tmp/YSFState.txt', 'w'); + fwrite($fp, $to); + fclose($fp); + return $to; + } + } + + } else { return _("YSFGateway not running"); } if (file_exists('/tmp/YSFState.txt')) { @@ -805,7 +863,7 @@ function getActualReflector($logLines, $mode) { return $to; } } - + if (file_exists('/tmp/DMR2RefState.txt')) { $fp = fopen('/tmp/DMR2RefState.txt', 'r'); $contents = fread($fp, filesize("/tmp/DMR2RefState.txt")); diff --git a/include/lh_ajax.php b/include/lh_ajax.php index 19b6765..d22f52b 100644 --- a/include/lh_ajax.php +++ b/include/lh_ajax.php @@ -47,7 +47,7 @@ $(document).ready(function(){ var lastHeardT = $('#lastHeard').dataTable( { "language": , "aaSorting": [[0,'desc']], - 0) { $request = substr($request,0,strpos($request,"index.php")); } diff --git a/include/localtx_ajax.php b/include/localtx_ajax.php index a04d19b..24a1a33 100644 --- a/include/localtx_ajax.php +++ b/include/localtx_ajax.php @@ -45,7 +45,7 @@ $(document).ready(function(){ "language": , "aaSorting": [[0,'desc']], - 0) { $request = substr($request,0,strpos($request,"index.php")); } diff --git a/include/tools.php b/include/tools.php index 204436f..42308ab 100644 --- a/include/tools.php +++ b/include/tools.php @@ -73,17 +73,10 @@ function getSize($filesize, $precision = 2) { function checkSetup() { $el = error_reporting(); error_reporting(E_ERROR | E_WARNING | E_PARSE); - if (defined(DISTRIBUTION)) { -?> - - sudo apt-get install php7.0-common php7.0-cgi php + >sudo apt-get install php7.3-common php7.3-cgi php if you want to use the sqlite3-database based resolving of the operator-names you need following, too Raspian Wheezy and Raspbian Jessie: diff --git a/txinfo.php b/txinfo.php index 36e63b3..5b56a90 100644 --- a/txinfo.php +++ b/txinfo.php @@ -14,15 +14,18 @@ if (!defined("MMDVMLOGPREFIX")) if (!defined("TIMEZONE")) define("TIMEZONE", "UTC"); $logLinesMMDVM = getShortMMDVMLog(); +// echo""; $reverseLogLinesMMDVM = $logLinesMMDVM; array_multisort($reverseLogLinesMMDVM,SORT_DESC); $lastHeard = getLastHeard($reverseLogLinesMMDVM, True); $counter = 0; foreach ($lastHeard as $listElem) { $counter +=1; - echo""; +// echo""; if (defined("ENABLEXTDLOOKUP") && $listElem[7] == null || !defined("ENABLEXTDLOOKUP") && $listElem[6] == null) { echo ""; echo"$listElem[0]"; diff --git a/version.php b/version.php index 7374d30..ff5fdec 100644 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@