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);
echo "
Freq: | ".$line{2}.$line{3}.$line{4}.".".$line{5}.$line{6}.$line{7}." MHz | ";
$line = fgets($handle);
echo "PPM: | ".$line{2}.$line{3}." | ";
$line = fgets($handle);
echo "Gain: | ".$line{2}.$line{3}." |
---|
";
echo "";
while (($line = fgets($handle)) !== false) {
$arr = explode(";",$line);
echo "";
$p=ord($line{16});
echo "".$line{0}.$line{1}." : ".$line{3}.$line{4}.$line{5}.".".$line{6}.$line{7}.$line{8}." MHz | ".intval($arr[2])."kHz | (".$p."dB) | ";
for($i=0;$i<16;$i++){
$p=ord($line{$i+16});
echo ' | ';
}
echo "
";
}
echo "
";
}
else echo "NO SDR";
}
echo "SDR #1 | SDR #2 |
";
echo "";
printSDR("/tmp/sdr1.bin");
echo " | ";
printSDR("/tmp/sdr2.bin");
echo " |
| |
SDR #3 | SDR#4 |
---|
";
printSDR("/tmp/sdr3.bin");
echo " | ";
printSDR("/tmp/sdr4.bin");
echo " |
";
?>