added duration, loss, ber to LH

This commit is contained in:
dg9vh 2016-05-03 21:36:47 +02:00
parent 86e9466e92
commit 5434e9c3f3
2 changed files with 26 additions and 2 deletions

View file

@ -17,7 +17,11 @@ function getLog() {
// 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
function getHeardList($logLines) {
array_multisort($logLines,SORT_DESC);
$heardList = array();
$duration = "";
$loss = "";
$ber = "";
foreach ($logLines as $logLine) {
//removing invalid lines
if(strpos($logLine,"BS_Dwn_Act")) {
@ -26,6 +30,18 @@ function getHeardList($logLines) {
continue;
}
if(strpos($logLine,"end of")) {
$lineTokens = explode(", ",$logLine);
$duration = strtok($lineTokens[2], " ");
$loss = $lineTokens[3];
if (startsWith($loss,"BER")) {
$ber = substr($loss, 5);
$loss = "";
} else {
$loss = strtok($loss, " ");
$ber = substr($lineTokens[4], 5);
}
}
$timestamp = substr($logLine, 3, 19);
$mode = substr($logLine, 27, strpos($logLine,",") - 27);
$callsign2 = substr($logLine, strpos($logLine,"from") + 5, strpos($logLine,"to") - strpos($logLine,"from") - 6);
@ -45,7 +61,10 @@ function getHeardList($logLines) {
}
if ( strlen($callsign) < 7 ) {
array_push($heardList, array($timestamp, $mode, $callsign, $id, $target, $source));
array_push($heardList, array($timestamp, $mode, $callsign, $id, $target, $source, $duration, $loss, $ber));
$duration = "";
$loss ="";
$ber = "";
}
}
return $heardList;
@ -55,7 +74,6 @@ function getLastHeard($logLines) {
$lastHeard = array();
$heardCalls = array();
$heardList = getHeardList($logLines);
array_multisort($heardList,SORT_DESC);
foreach ($heardList as $listElem) {
if ( ($listElem[1] == "D-Star") || (startsWith($listElem[1], "DMR")) ) {
if(!(array_search($listElem[2]."#".$listElem[1].$listElem[3], $heardCalls) > -1)) {

View file

@ -17,6 +17,9 @@ $lastHeard = getLastHeard($logLines);
<th>DSTAR-ID</th>
<th>Target</th>
<th>Source</th>
<th>Duration (s)</th>
<th>Loss</th>
<th>BER</th>
</tr>
<?php
for ($i = 0; ($i < LHLINES) AND ($i < count($lastHeard)); $i++) {
@ -29,6 +32,9 @@ for ($i = 0; ($i < LHLINES) AND ($i < count($lastHeard)); $i++) {
echo"<td>$listElem[3]</td>";
echo"<td>$listElem[4]</td>";
echo"<td>$listElem[5]</td>";
echo"<td>$listElem[6]</td>";
echo"<td>$listElem[7]</td>";
echo"<td>$listElem[8]</td>";
echo"</tr>\n";
}