diff --git a/ajax.php b/ajax.php index 9272889..199a61d 100644 --- a/ajax.php +++ b/ajax.php @@ -30,6 +30,15 @@ $logLinesMMDVM = getMMDVMLog(); $reverseLogLinesMMDVM = $logLinesMMDVM; rsort($reverseLogLinesMMDVM); + +if (defined("ENABLEDAPNETGATEWAY")) { + $logLinesDAPNETGateway = getDAPNETGatewayLog(); + showLapTime("getDAPNETGatewayLog"); + $reverseLogLinesDAPNETGateway = $logLinesDAPNETGateway; + rsort($reverseLogLinesDAPNETGateway); + showLapTime("array_multisort"); +} + if ($_GET['section'] == "mode") { $mode = getActualMode(getLastHeard($reverseLogLinesMMDVM, TRUE), $mmdvmconfigs); echo $mode; @@ -79,6 +88,17 @@ if ($_GET['section'] == "lastHeard") { } echo '{"data": '.json_encode($lastHeard)."}"; } + +if ($_GET['section'] == "DAPNETTx") { + $DAPNETTxList = getDAPNETTxList($reverseLogLinesDAPNETGateway); + $DAPNETTx = Array(); + for ($i = 0; $i < count($DAPNETTxList); $i++) { + $listElem = $DAPNETTxList[$i]; + array_push($DAPNETTx, $listElem); + } + echo '{"data": '.json_encode($DAPNETTx)."}"; +} + if ($_GET['section'] == "localTx") { $localTXList = getHeardList($reverseLogLinesMMDVM, FALSE); $lastHeard = Array(); diff --git a/include/functions.php b/include/functions.php index f4900a7..b2e18f2 100644 --- a/include/functions.php +++ b/include/functions.php @@ -264,6 +264,13 @@ function getYSFGatewayLog() { return $logLines; } +function getDAPNETGatewayLog() { + // Open Logfile and copy loglines into LogLines-Array() + $logPath = DAPNETGATEWAYLOGPATH."/".DAPNETGATEWAYLOGPREFIX."-".date("Y-m-d").".log"; + $logLines = explode("\n", `egrep -h "Sending" $logPath`); + return $logLines; +} + // 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122 // 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 // M: 2016-04-29 00:15:00.013 D-Star, received network header from DG9VH /ZEIT to CQCQCQ via DCS002 S @@ -590,6 +597,33 @@ function getHeardList($logLines, $onlyLast) { return $heardList; } +// 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122 +// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 +// D: 2020-09-21 18:16:12.814 Messages in Queue 0002 +// M: 2020-09-21 18:16:12.824 Sending message in slot 13 to 0000216, type 6, func Alphanumeric: "YYYYMMDDHHMMSS200921181600" +// D: 2020-09-21 18:16:12.825 Messages in Queue 0001 +// D: 2020-09-21 18:17:00.036 Queueing message to 0000208, type 6, func Alphanumeric: "XTIME=2017210920XTIME=2017210920" +function getDAPNETTxList($logLines) { + $DAPNETTxList = array(); + foreach ($logLines as $logLine) { + if (strpos($logLine,"Sending")) { + $timestamp = substr($logLine, 3, 23); + $slot = substr($logLine,51, 2); + if ($slot[1] == " ") { + $target = substr($logLine,56, 7); + } else { + $target = substr($logLine,57, 7); + } + $message = substr($logLine,strpos($logLine, "\"")); + $message = substr($message,1 , -1); + if ($target == "0004520") + $message = rot1($message); + array_push($DAPNETTxList, array(convertTimezone($timestamp), $slot, $target, $message)); + } + } + return $DAPNETTxList; +} + function getLastHeard($logLines, $onlyLast) { //returns last heard list from log $lastHeard = array(); @@ -601,7 +635,7 @@ 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) + //remove suffix used sometimes in YSF (es: -FT2 , -991) if (strpos($call_canon,"-")!=false) { $call_canon = substr($call_canon, 0, strpos($call_canon, "-")); } diff --git a/include/tools.php b/include/tools.php index 42308ab..6db5931 100644 --- a/include/tools.php +++ b/include/tools.php @@ -133,4 +133,19 @@ function recursive_array_search($needle,$haystack) { } return false; } + +function rot1($text) { + $ric = 0; + $slot = 0; + $out = ""; + for ($i = 0; $i < strlen($text); $i++) { + if ($i == 0) + $ric = ord($text[$i])-31; + if ($i == 1) + $slot = ord($text[$i])-32; + if ($i > 1) + $out .= chr(ord($text[$i])-1); + } + return "Skyper-Rubric-No.: ".$ric.", Slot: ".$slot.", message: ".$out; +} ?> diff --git a/index.php b/index.php index 06a4fab..e809837 100644 --- a/index.php +++ b/index.php @@ -218,6 +218,10 @@ if (defined("SHOWLOCALTX")) { include "include/localtx_ajax.php"; showLapTime("localtx_ajax"); } +if (defined("SHOWDAPNET")) { + include "include/dapnet_ajax.php"; + showLapTime("dapnet_ajax"); +} if (defined("ENABLEYSFGATEWAY")|| defined("ENABLEDMRGATEWAY")) { include "include/gatewayinfo.php"; showLapTime("gatewayinfo"); diff --git a/setup.php b/setup.php index 255b129..d70ddb6 100644 --- a/setup.php +++ b/setup.php @@ -115,7 +115,7 @@ include "include/tools.php";