Add RSSI support

This commit is contained in:
phl0 2017-01-06 14:47:38 +01:00
parent e7b73a9f3b
commit 3fb4cb49bb
No known key found for this signature in database
GPG key ID: 48EA1E640798CA9A
3 changed files with 28 additions and 2 deletions

View file

@ -207,19 +207,24 @@ function getHeardList($logLines, $onlyLast) {
$ts1duration = ""; $ts1duration = "";
$ts1loss = ""; $ts1loss = "";
$ts1ber = ""; $ts1ber = "";
$ts1rssi = "";
$ts2duration = ""; $ts2duration = "";
$ts2loss = ""; $ts2loss = "";
$ts2ber = ""; $ts2ber = "";
$ts2rssi = "";
$dstarduration = ""; $dstarduration = "";
$dstarloss = ""; $dstarloss = "";
$dstarber = ""; $dstarber = "";
$dstarrssi = "";
$ysfduration = ""; $ysfduration = "";
$ysfloss = ""; $ysfloss = "";
$ysfber = ""; $ysfber = "";
$ysfrssi = "";
foreach ($logLines as $logLine) { foreach ($logLines as $logLine) {
$duration = ""; $duration = "";
$loss = ""; $loss = "";
$ber = ""; $ber = "";
$rssi = "";
//removing invalid lines //removing invalid lines
if(strpos($logLine,"BS_Dwn_Act")) { if(strpos($logLine,"BS_Dwn_Act")) {
continue; continue;
@ -243,9 +248,14 @@ function getHeardList($logLines, $onlyLast) {
if (array_key_exists(3,$lineTokens)) { if (array_key_exists(3,$lineTokens)) {
$loss = $lineTokens[3]; $loss = $lineTokens[3];
} }
if (array_key_exists(4,$lineTokens)) {
$ber = $lineTokens[4];
}
// if RF-Packet, no LOSS would be reported, so BER is in LOSS position // if RF-Packet, no LOSS would be reported, so BER is in LOSS position
// and RSSI in BER position
if (startsWith($loss,"BER")) { if (startsWith($loss,"BER")) {
$rssi = substr($ber, 5);
$ber = substr($loss, 5); $ber = substr($loss, 5);
$loss = ""; $loss = "";
} else { } else {
@ -253,6 +263,9 @@ function getHeardList($logLines, $onlyLast) {
if (array_key_exists(4,$lineTokens)) { if (array_key_exists(4,$lineTokens)) {
$ber = substr($lineTokens[4], 5); $ber = substr($lineTokens[4], 5);
} }
if (array_key_exists(5,$lineTokens)) {
$rssi = substr($lineTokens[5], 6);
}
} }
if (strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) { if (strpos($logLine,"ended RF data") || strpos($logLine,"ended network")) {
@ -270,26 +283,31 @@ function getHeardList($logLines, $onlyLast) {
$dstarduration = $duration; $dstarduration = $duration;
$dstarloss = $loss; $dstarloss = $loss;
$dstarber = $ber; $dstarber = $ber;
$dstarrssi = $rssi;
break; break;
case "DMR Slot 1": case "DMR Slot 1":
$ts1duration = $duration; $ts1duration = $duration;
$ts1loss = $loss; $ts1loss = $loss;
$ts1ber = $ber; $ts1ber = $ber;
$ts1rssi = $rssi;
break; break;
case "DMR Slot 2": case "DMR Slot 2":
$ts2duration = $duration; $ts2duration = $duration;
$ts2loss = $loss; $ts2loss = $loss;
$ts2ber = $ber; $ts2ber = $ber;
$ts2rssi = $rssi;
break; break;
case "YSF": case "YSF":
$ysfduration = $duration; $ysfduration = $duration;
$ysfloss = $loss; $ysfloss = $loss;
$ysfber = $ber; $ysfber = $ber;
$ysfrssi = $rssi;
break; break;
case "P25": case "P25":
$p25duration = $duration; $p25duration = $duration;
$p25loss = $loss; $p25loss = $loss;
$p25ber = $ber; $p25ber = $ber;
$p25rssi = $rssi;
break; break;
} }
} }
@ -320,26 +338,31 @@ function getHeardList($logLines, $onlyLast) {
$duration = $dstarduration; $duration = $dstarduration;
$loss = $dstarloss; $loss = $dstarloss;
$ber = $dstarber; $ber = $dstarber;
$rssi = $dstarrssi;
break; break;
case "DMR Slot 1": case "DMR Slot 1":
$duration = $ts1duration; $duration = $ts1duration;
$loss = $ts1loss; $loss = $ts1loss;
$ber = $ts1ber; $ber = $ts1ber;
$rssi = $ts1rssi;
break; break;
case "DMR Slot 2": case "DMR Slot 2":
$duration = $ts2duration; $duration = $ts2duration;
$loss = $ts2loss; $loss = $ts2loss;
$ber = $ts2ber; $ber = $ts2ber;
$rssi = $ts2rssi;
break; break;
case "YSF": case "YSF":
$duration = $ysfduration; $duration = $ysfduration;
$loss = $ysfloss; $loss = $ysfloss;
$ber = $ysfber; $ber = $ysfber;
$rssi = $ysfrssi;
break; break;
case "P25": case "P25":
$duration = $p25duration; $duration = $p25duration;
$loss = $p25loss; $loss = $p25loss;
$ber = $p25ber; $ber = $p25ber;
$rssi = $p25rssi;
break; break;
} }
@ -347,13 +370,14 @@ function getHeardList($logLines, $onlyLast) {
if ( strlen($callsign) < 11 ) { if ( strlen($callsign) < 11 ) {
$name = ""; $name = "";
if (defined("ENABLEXTDLOOKUP")) { if (defined("ENABLEXTDLOOKUP")) {
array_push($heardList, array(convertTimezone($timestamp), $mode, $callsign, $name, $id, $target, $source, $duration, $loss, $ber)); array_push($heardList, array(convertTimezone($timestamp), $mode, $callsign, $name, $id, $target, $source, $duration, $loss, $ber, $rssi));
} else { } else {
array_push($heardList, array(convertTimezone($timestamp), $mode, $callsign, $id, $target, $source, $duration, $loss, $ber)); array_push($heardList, array(convertTimezone($timestamp), $mode, $callsign, $id, $target, $source, $duration, $loss, $ber, $rssi));
} }
$duration = ""; $duration = "";
$loss =""; $loss ="";
$ber = ""; $ber = "";
$rssi = "";
if ($onlyLast && count($heardList )> 4) { if ($onlyLast && count($heardList )> 4) {
return $heardList; return $heardList;
} }

View file

@ -28,6 +28,7 @@ $localTXList = getHeardList($reverseLogLinesMMDVM, FALSE);
<th>Dur (s)</th> <th>Dur (s)</th>
<th>Loss</th> <th>Loss</th>
<th>BER</th> <th>BER</th>
<th>RSSI (min/max/avg)</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View file

@ -25,6 +25,7 @@ $totalLH = count($lastHeard);
<th>Dur (s)</th> <th>Dur (s)</th>
<th>Loss</th> <th>Loss</th>
<th>BER</th> <th>BER</th>
<th>RSSI (min/max/avg)</th>
</tr> </tr>
</thead> </thead>
</table> </table>