2018-01-04 09:13:05 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
function GreenYellowRedO($number) {
|
|
|
|
|
|
|
|
if ($number < 30) {
|
|
|
|
$r = floor(255 * ($number / 30));
|
|
|
|
$g = 105;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
$r = 105;
|
|
|
|
$g = floor(255 * ((30-$number%30) / 30));
|
|
|
|
}
|
|
|
|
$b = 0;
|
|
|
|
return sprintf("%02X%02X%02X",$r,$g,$b);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function GreenYellowRed($number) {
|
|
|
|
if($number>99) $number=99;
|
|
|
|
if ($number < 50) {
|
|
|
|
// blue to green
|
|
|
|
$g = floor(255 * ($number / 50));
|
|
|
|
$b = 120;
|
|
|
|
$r = 0;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// green to yelow
|
|
|
|
$r = 255;
|
|
|
|
$g = floor(255 * ((50-$number%50) / 50));
|
|
|
|
$b = 0;
|
|
|
|
}
|
|
|
|
return sprintf("%02X%02X%02X",$r,$g,$b);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function printSDR($fil){
|
|
|
|
if (($handle = fopen($fil, "r")) !== FALSE) {
|
|
|
|
$line = fgets($handle);
|
2018-03-03 16:37:00 +00:00
|
|
|
echo "<table width=380 cellspacing=0><tr><th bgcolor=#FFFFAA>Freq:</th><td bgcolor=#FFFFAA>".$line{2}.$line{3}.$line{4}.".".$line{5}.$line{6}.$line{7}." MHz</td>";
|
2018-01-04 09:13:05 +00:00
|
|
|
$line = fgets($handle);
|
|
|
|
echo "<th bgcolor=#AAFFAA>PPM:</th><td bgcolor=#AAFFAA>".$line{2}.$line{3}."</td>";
|
|
|
|
$line = fgets($handle);
|
|
|
|
echo "<th bgcolor=#11FFFF>Gain:</th><td bgcolor=#11FFFF>".$line{2}.$line{3}."</td></tr></table><br>";
|
|
|
|
|
2018-03-03 16:37:00 +00:00
|
|
|
echo "<table>";
|
2018-01-04 09:13:05 +00:00
|
|
|
while (($line = fgets($handle)) !== false) {
|
2018-03-03 16:37:00 +00:00
|
|
|
$arr = explode(";",$line);
|
|
|
|
echo "<tr>";
|
|
|
|
$p=ord($line{16});
|
|
|
|
echo "<th>".$line{0}.$line{1}." : ".$line{3}.$line{4}.$line{5}.".".$line{6}.$line{7}.$line{8}." MHz</td><td align=right>".intval($arr[2])."kHz</td><th> (".$p."dB)</th>";
|
2018-01-04 09:13:05 +00:00
|
|
|
for($i=0;$i<16;$i++){
|
2018-03-03 16:37:00 +00:00
|
|
|
$p=ord($line{$i+16});
|
2018-01-04 09:13:05 +00:00
|
|
|
echo '<td bgcolor="#'.GreenYellowRed($p*1.33).'"> </td>';
|
|
|
|
}
|
2018-03-03 16:37:00 +00:00
|
|
|
echo "</tr>";
|
2018-01-04 09:13:05 +00:00
|
|
|
}
|
2018-03-03 16:37:00 +00:00
|
|
|
echo "</table>";
|
2018-01-04 09:13:05 +00:00
|
|
|
}
|
|
|
|
else echo "<b>NO SDR</b>";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<table width=650 cellpadding=6><tr><th>SDR #1</th><th>SDR #2</th></tr>";
|
|
|
|
echo "<tr><td valign=top>";
|
|
|
|
printSDR("/tmp/sdr1.bin");
|
|
|
|
echo "</td><td valign=top>";
|
|
|
|
printSDR("/tmp/sdr2.bin");
|
|
|
|
echo "</td></tr><tr><td><br><br></td><td></td></tr><tr><th>SDR #3</th><th>SDR#4</th></tr><tr><td valign=top>";
|
|
|
|
printSDR("/tmp/sdr3.bin");
|
|
|
|
echo "</td><td valign=top>";
|
|
|
|
printSDR("/tmp/sdr4.bin");
|
|
|
|
echo "</td></tr></table>";
|
|
|
|
|
|
|
|
?>
|