diff --git a/func.php b/func.php index c5d1836..aef78f9 100644 --- a/func.php +++ b/func.php @@ -41,7 +41,10 @@ function getUptime() { function linkCallsign( $callsign ) { $tmp = explode( "-", $callsign ); $call = $tmp[0]; - $suffix = $tmp[1]; + $suffix = ( !empty( $tmp[1] )) + ? "-$tmp[1]" + : ""; + if( !empty( $suffix )) { $suffix="-$suffix"; } @@ -71,7 +74,7 @@ function rssiCalc( $val ) { return "$rssi ($val dBm)"; } -function printTable( $time, $callsign, $dgid, $duration, $repeater, $loss = "---", $ber = "---" ) { +function printTable( $time, $callsign, $slot, $tg, $duration, $loss = "---", $ber = "---" ) { if( $duration >= 60 ) { $min = str_pad( intval( $duration / 60 ), 2, "0", STR_PAD_LEFT ); $sec = str_pad( $duration % 60, 2, "0", STR_PAD_LEFT ); @@ -82,8 +85,8 @@ function printTable( $time, $callsign, $dgid, $duration, $repeater, $loss = "--- echo "
$tg
";
+ //$new_time = strtotime( date( "Y-m-d H:i:s", strtotime( substr( $oldline, 3, 23 )." UTC" )));
// echo "\$callsign: $callsign at \$dgid: $dgid\n\$old_time: ".date("Y-m-d H:i:s", $old_time ).
// "\n\$new_time: ".date("Y-m-d H:i:s", $new_time )."
\n";
// $duration = intval(( $new_time - $old_time )) . ".0";
- $duration = intval(( $new_time - $old_time ));
- $repeater = substr( $oldline, strpos( $oldline, "at " ) + 3, strpos( $oldline, " ", strpos( $oldline, "at " ) + 3) - strpos( $oldline, "at " ) + 3 );
- $loss = substr( $line, 75, strpos( $line, "%", 75 ) - 74 );
- if( $loss == "0%" ) {
+ //$duration = intval(( $new_time - $old_time ));
+ //$repeater = substr( $oldline, strpos( $oldline, "at " ) + 3, strpos( $oldline, " ", strpos( $oldline, "at " ) + 3) - strpos( $oldline, "at " ) + 3 );
+ $loss = substr(
+ $line,
+ strpos( $line, "seconds, " ) + 9,
+ strpos( $line, " packet loss" ) - strpos( $line, "seconds, " ) - 9
+ );
+ /*if( $loss == "0%" ) {
$loss = "-x-";
- }
- $ber = substr( $line, 96, strpos( $line, "%", 96 ) - 95 );
- if( $ber == "0.0%" ) $ber = "-x-";
+ }*/
+ $ber = substr( $line, strpos( $line, "BER: " ) + 5, strpos( $line, "%", strpos( $line, "BER: ")) - strpos( $line, "BER: " ));
+ //if( $ber == "0.0%" ) $ber = "-x-";
} else {
continue;
}
@@ -162,9 +182,10 @@ function getLastHeard($limit = MAXENTRIES) {
$tmp = [];
$tmp['time'] = $time;
$tmp['callsign'] = $callsign;
- $tmp['dgid'] = $dgid;
- $tmp['duration'] = $duration;
- $tmp['repeater'] = $repeater;
+ $tmp['slot'] = $slot;
+ $tmp['tg'] = $tg;
+ $tmp['duration'] = round( $duration, 0, PHP_ROUND_HALF_UP );
+ //$tmp['repeater'] = $repeater;
$tmp['loss'] = $loss;
$tmp['ber'] = $ber;
array_unshift( $printLines, $tmp );
@@ -180,9 +201,9 @@ function getLastHeard($limit = MAXENTRIES) {
printTable(
$line['time'],
$line['callsign'],
- $line['dgid'],
+ $line['slot'],
+ $line['tg'],
$line['duration'],
- $line['repeater'],
$line['loss'],
$line['ber']
);