Merge pull request #214 from dg9vh/DAPNET

Initial steps for showing DAPNET-Messages
This commit is contained in:
Kim - DG9VH 2020-09-21 22:30:50 +02:00 committed by GitHub
commit 9f44b5c8fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 107 additions and 3 deletions

View file

@ -30,6 +30,15 @@ $logLinesMMDVM = getMMDVMLog();
$reverseLogLinesMMDVM = $logLinesMMDVM; $reverseLogLinesMMDVM = $logLinesMMDVM;
rsort($reverseLogLinesMMDVM); rsort($reverseLogLinesMMDVM);
if (defined("ENABLEDAPNETGATEWAY")) {
$logLinesDAPNETGateway = getDAPNETGatewayLog();
showLapTime("getDAPNETGatewayLog");
$reverseLogLinesDAPNETGateway = $logLinesDAPNETGateway;
rsort($reverseLogLinesDAPNETGateway);
showLapTime("array_multisort");
}
if ($_GET['section'] == "mode") { if ($_GET['section'] == "mode") {
$mode = getActualMode(getLastHeard($reverseLogLinesMMDVM, TRUE), $mmdvmconfigs); $mode = getActualMode(getLastHeard($reverseLogLinesMMDVM, TRUE), $mmdvmconfigs);
echo $mode; echo $mode;
@ -79,6 +88,17 @@ if ($_GET['section'] == "lastHeard") {
} }
echo '{"data": '.json_encode($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") { if ($_GET['section'] == "localTx") {
$localTXList = getHeardList($reverseLogLinesMMDVM, FALSE); $localTXList = getHeardList($reverseLogLinesMMDVM, FALSE);
$lastHeard = Array(); $lastHeard = Array();

View file

@ -264,6 +264,13 @@ function getYSFGatewayLog() {
return $logLines; 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 // 00000000001111111111222222222233333333334444444444555555555566666666667777777777888888888899999999990000000000111111111122
// 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901 // 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901
// 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 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; 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) { function getLastHeard($logLines, $onlyLast) {
//returns last heard list from log //returns last heard list from log
$lastHeard = array(); $lastHeard = array();

View file

@ -133,4 +133,19 @@ function recursive_array_search($needle,$haystack) {
} }
return false; 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;
}
?> ?>

View file

@ -218,6 +218,10 @@ if (defined("SHOWLOCALTX")) {
include "include/localtx_ajax.php"; include "include/localtx_ajax.php";
showLapTime("localtx_ajax"); showLapTime("localtx_ajax");
} }
if (defined("SHOWDAPNET")) {
include "include/dapnet_ajax.php";
showLapTime("dapnet_ajax");
}
if (defined("ENABLEYSFGATEWAY")|| defined("ENABLEDMRGATEWAY")) { if (defined("ENABLEYSFGATEWAY")|| defined("ENABLEDMRGATEWAY")) {
include "include/gatewayinfo.php"; include "include/gatewayinfo.php";
showLapTime("gatewayinfo"); showLapTime("gatewayinfo");

View file

@ -115,7 +115,7 @@ include "include/tools.php";
<h2><?php echo _("YSFGateway-Configuration"); ?></h2> <h2><?php echo _("YSFGateway-Configuration"); ?></h2>
<div class="input-group"> <div class="input-group">
<span class="input-group-addon" id="ENABLEYSFGATEWAY" style="width: 300px"><?php echo _("Enable YSFGateway"); ?></span> <span class="input-group-addon" id="ENABLEYSFGATEWAY" style="width: 300px"><?php echo _("Enable YSFGateway"); ?></span>
<div class="panel-body"><input type="checkbox" name="ENABLEGATEWAY" <?php if (defined("ENABLEYSFGATEWAY")) echo "checked" ?>></div> <div class="panel-body"><input type="checkbox" name="ENABLEYSFGATEWAY" <?php if (defined("ENABLEYSFGATEWAY")) echo "checked" ?>></div>
</div> </div>
<div class="input-group"> <div class="input-group">
<span class="input-group-addon" id="YSFGATEWAYLOGPATH" style="width: 300px"><?php echo _("Path to YSFGateway-logfile"); ?></span> <span class="input-group-addon" id="YSFGATEWAYLOGPATH" style="width: 300px"><?php echo _("Path to YSFGateway-logfile"); ?></span>
@ -165,10 +165,37 @@ include "include/tools.php";
<input type="text" value="<?php echo constant("DMRGATEWAYPATH") ?>" name="DMRGATEWAYPATH" class="form-control" placeholder="/usr/local/bin/" aria-describedby="DMRGATEWAYPATH"> <input type="text" value="<?php echo constant("DMRGATEWAYPATH") ?>" name="DMRGATEWAYPATH" class="form-control" placeholder="/usr/local/bin/" aria-describedby="DMRGATEWAYPATH">
</div> </div>
<div class="input-group"> <div class="input-group">
<span class="input-group-addon" id="YSFGATEWAYINIFILENAME" style="width: 300px"><?php echo _("DMRGateway.ini-filename"); ?></span> <span class="input-group-addon" id="DMRGATEWAYINIFILENAME" style="width: 300px"><?php echo _("DMRGateway.ini-filename"); ?></span>
<input type="text" value="<?php echo constant("DMRGATEWAYINIFILENAME") ?>" name="DMRGATEWAYINIFILENAME" class="form-control" placeholder="DMRGateway.ini" aria-describedby="DMRGATEWAYINIFILENAME"> <input type="text" value="<?php echo constant("DMRGATEWAYINIFILENAME") ?>" name="DMRGATEWAYINIFILENAME" class="form-control" placeholder="DMRGateway.ini" aria-describedby="DMRGATEWAYINIFILENAME">
</div> </div>
</div> </div>
<div class="container">
<h2><?php echo _("DAPNETGateway-Configuration"); ?></h2>
<div class="input-group">
<span class="input-group-addon" id="ENABLEDAPNETGATEWAY" style="width: 300px"><?php echo _("Enable DAPNETGateway"); ?></span>
<div class="panel-body"><input type="checkbox" name="ENABLEDAPNETGATEWAY" <?php if (defined("ENABLEDAPNETGATEWAY")) echo "checked" ?>></div>
</div>
<div class="input-group">
<span class="input-group-addon" id="DAPNETGATEWAYLOGPATH" style="width: 300px"><?php echo _("Path to DAPNETGateway-logfile"); ?></span>
<input type="text" value="<?php echo constant("DAPNETGATEWAYLOGPATH") ?>" name="DAPNETGATEWAYLOGPATH" class="form-control" placeholder="/var/log/DAPNETGateway/" aria-describedby="DAPNETGATEWAYLOGPATH">
</div>
<div class="input-group">
<span class="input-group-addon" id="DAPNETGATEWAYLOGPREFIX" style="width: 300px"><?php echo _("Logfile-prefix"); ?></span>
<input type="text" value="<?php echo constant("DAPNETGATEWAYLOGPREFIX") ?>" name="DAPNETGATEWAYLOGPREFIX" class="form-control" placeholder="DAPNETGateway" aria-describedby="DAPNETGATEWAYLOGPREFIX">
</div>
<div class="input-group">
<span class="input-group-addon" id="DAPNETGATEWAYINIPATH" style="width: 300px"><?php echo _("Path to DAPNETGateway.ini"); ?></span>
<input type="text" value="<?php echo constant("DAPNETGATEWAYINIPATH") ?>" name="DAPNETGATEWAYINIPATH" class="form-control" placeholder="/etc/DAPNETGateway/" aria-describedby="DAPNETGATEWAYINIPATH">
</div>
<div class="input-group">
<span class="input-group-addon" id="DAPNETGATEWAYPATH" style="width: 300px"><?php echo _("Path to DAPNETGateway-executable"); ?></span>
<input type="text" value="<?php echo constant("DAPNETGATEWAYPATH") ?>" name="DAPNETGATEWAYPATH" class="form-control" placeholder="/usr/local/bin/" aria-describedby="DAPNETGATEWAYPATH">
</div>
<div class="input-group">
<span class="input-group-addon" id="DAPNETGATEWAYINIFILENAME" style="width: 300px"><?php echo _("DAPNETGateway.ini-filename"); ?></span>
<input type="text" value="<?php echo constant("DAPNETGATEWAYINIFILENAME") ?>" name="DAPNETGATEWAYINIFILENAME" class="form-control" placeholder="DAPNETGateway.ini" aria-describedby="DAPNETGATEWAYINIFILENAME">
</div>
</div>
<div class="container"> <div class="container">
<h2><?php echo _("ircddbgateway-Configuration"); ?></h2> <h2><?php echo _("ircddbgateway-Configuration"); ?></h2>
<div class="input-group"> <div class="input-group">
@ -310,6 +337,10 @@ foreach ($files as $file) {
<span class="input-group-addon" id="SHOWLOCALTX" style="width: 300px"><?php echo _("Show Today's local transmissions"); ?></span> <span class="input-group-addon" id="SHOWLOCALTX" style="width: 300px"><?php echo _("Show Today's local transmissions"); ?></span>
<div class="panel-body"><input type="checkbox" name="SHOWLOCALTX" <?php if (defined("SHOWLOCALTX")) echo "checked" ?>></div> <div class="panel-body"><input type="checkbox" name="SHOWLOCALTX" <?php if (defined("SHOWLOCALTX")) echo "checked" ?>></div>
</div> </div>
<div class="input-group">
<span class="input-group-addon" id="SHOWDAPNET" style="width: 300px"><?php echo _("Show DAPNET transmissions"); ?></span>
<div class="panel-body"><input type="checkbox" name="SHOWDAPNET" <?php if (defined("SHOWDAPNET")) echo "checked" ?>></div>
</div>
<div class="input-group"> <div class="input-group">
<span class="input-group-addon" id="SHOWPROGRESSBARS" style="width: 300px"><?php echo _("Show progressbars"); ?></span> <span class="input-group-addon" id="SHOWPROGRESSBARS" style="width: 300px"><?php echo _("Show progressbars"); ?></span>
<div class="panel-body"><input type="checkbox" name="SHOWPROGRESSBARS" <?php if (defined("SHOWPROGRESSBARS")) echo "checked" ?>></div> <div class="panel-body"><input type="checkbox" name="SHOWPROGRESSBARS" <?php if (defined("SHOWPROGRESSBARS")) echo "checked" ?>></div>