Merge branch 'antirez:master' into master
This commit is contained in:
commit
17416856d1
29
dump1090.c
29
dump1090.c
@ -158,6 +158,7 @@ struct {
|
|||||||
|
|
||||||
/* Configuration */
|
/* Configuration */
|
||||||
char *filename; /* Input form file, --ifile option. */
|
char *filename; /* Input form file, --ifile option. */
|
||||||
|
int loop; /* Read input file again and again. */
|
||||||
int fix_errors; /* Single bit error correction if true. */
|
int fix_errors; /* Single bit error correction if true. */
|
||||||
int check_crc; /* Only display messages with good CRC. */
|
int check_crc; /* Only display messages with good CRC. */
|
||||||
int raw; /* Raw output format. */
|
int raw; /* Raw output format. */
|
||||||
@ -277,6 +278,7 @@ void modesInitConfig(void) {
|
|||||||
Modes.interactive_ttl = MODES_INTERACTIVE_TTL;
|
Modes.interactive_ttl = MODES_INTERACTIVE_TTL;
|
||||||
Modes.aggressive = 0;
|
Modes.aggressive = 0;
|
||||||
Modes.interactive_rows = getTermRows();
|
Modes.interactive_rows = getTermRows();
|
||||||
|
Modes.loop = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void modesInit(void) {
|
void modesInit(void) {
|
||||||
@ -436,6 +438,16 @@ void readDataFromFile(void) {
|
|||||||
p = Modes.data+(MODES_FULL_LEN-1)*4;
|
p = Modes.data+(MODES_FULL_LEN-1)*4;
|
||||||
while(toread) {
|
while(toread) {
|
||||||
nread = read(Modes.fd, p, toread);
|
nread = read(Modes.fd, p, toread);
|
||||||
|
/* In --file mode, seek the file again from the start
|
||||||
|
* and re-play it if --loop was given. */
|
||||||
|
if (nread == 0 &&
|
||||||
|
Modes.filename != NULL &&
|
||||||
|
Modes.fd != STDIN_FILENO &&
|
||||||
|
Modes.loop)
|
||||||
|
{
|
||||||
|
if (lseek(Modes.fd,0,SEEK_SET) != -1) continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (nread <= 0) {
|
if (nread <= 0) {
|
||||||
Modes.exit = 1; /* Signal the other thread to exit. */
|
Modes.exit = 1; /* Signal the other thread to exit. */
|
||||||
break;
|
break;
|
||||||
@ -493,10 +505,18 @@ void dumpMagnitudeBar(int index, int magnitude) {
|
|||||||
buf[div] = set[rem];
|
buf[div] = set[rem];
|
||||||
buf[div+1] = '\0';
|
buf[div+1] = '\0';
|
||||||
|
|
||||||
if (index >= 0)
|
if (index >= 0) {
|
||||||
printf("[%.3d] |%-66s %d\n", index, buf, magnitude);
|
int markchar = ']';
|
||||||
else
|
|
||||||
|
/* preamble peaks are marked with ">" */
|
||||||
|
if (index == 0 || index == 2 || index == 7 || index == 9)
|
||||||
|
markchar = '>';
|
||||||
|
/* Data peaks are marked to distinguish pairs of bits. */
|
||||||
|
if (index >= 16) markchar = ((index-16)/2 & 1) ? '|' : ')';
|
||||||
|
printf("[%.3d%c |%-66s %d\n", index, markchar, buf, magnitude);
|
||||||
|
} else {
|
||||||
printf("[%.2d] |%-66s %d\n", index, buf, magnitude);
|
printf("[%.2d] |%-66s %d\n", index, buf, magnitude);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display an ASCII-art alike graphical representation of the undecoded
|
/* Display an ASCII-art alike graphical representation of the undecoded
|
||||||
@ -2413,6 +2433,7 @@ void showHelp(void) {
|
|||||||
"--enable-agc Enable the Automatic Gain Control (default: off).\n"
|
"--enable-agc Enable the Automatic Gain Control (default: off).\n"
|
||||||
"--freq <hz> Set frequency (default: 1090 Mhz).\n"
|
"--freq <hz> Set frequency (default: 1090 Mhz).\n"
|
||||||
"--ifile <filename> Read data from file (use '-' for stdin).\n"
|
"--ifile <filename> Read data from file (use '-' for stdin).\n"
|
||||||
|
"--loop With --ifile, read the same file in a loop.\n"
|
||||||
"--interactive Interactive mode refreshing data on screen.\n"
|
"--interactive Interactive mode refreshing data on screen.\n"
|
||||||
"--interactive-rows <num> Max number of rows in interactive mode (default: 15).\n"
|
"--interactive-rows <num> Max number of rows in interactive mode (default: 15).\n"
|
||||||
"--interactive-ttl <sec> Remove from list if idle for <sec> (default: 60).\n"
|
"--interactive-ttl <sec> Remove from list if idle for <sec> (default: 60).\n"
|
||||||
@ -2484,6 +2505,8 @@ int main(int argc, char **argv) {
|
|||||||
Modes.freq = strtoll(argv[++j],NULL,10);
|
Modes.freq = strtoll(argv[++j],NULL,10);
|
||||||
} else if (!strcmp(argv[j],"--ifile") && more) {
|
} else if (!strcmp(argv[j],"--ifile") && more) {
|
||||||
Modes.filename = strdup(argv[++j]);
|
Modes.filename = strdup(argv[++j]);
|
||||||
|
} else if (!strcmp(argv[j],"--loop")) {
|
||||||
|
Modes.loop = 1;
|
||||||
} else if (!strcmp(argv[j],"--no-fix")) {
|
} else if (!strcmp(argv[j],"--no-fix")) {
|
||||||
Modes.fix_errors = 0;
|
Modes.fix_errors = 0;
|
||||||
} else if (!strcmp(argv[j],"--no-crc-check")) {
|
} else if (!strcmp(argv[j],"--no-crc-check")) {
|
||||||
|
97
gmap.html
97
gmap.html
@ -3,9 +3,14 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
||||||
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
html { height: 100% }
|
html { height: 100% }
|
||||||
body { height: 100%; margin: 0; padding: 0 }
|
body { height: 100%; margin: 0; padding: 0 }
|
||||||
|
.plane-icon {
|
||||||
|
padding:0px;
|
||||||
|
margin:0px;
|
||||||
|
}
|
||||||
#map_canvas { height: 100% }
|
#map_canvas { height: 100% }
|
||||||
#info {
|
#info {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -32,11 +37,8 @@
|
|||||||
color:#333;
|
color:#333;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
||||||
</script>
|
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>
|
||||||
<script type="text/javascript"
|
|
||||||
src="https://maps.googleapis.com/maps/api/js?sensor=true">
|
|
||||||
</script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
Map=null;
|
Map=null;
|
||||||
CenterLat=45.0;
|
CenterLat=45.0;
|
||||||
@ -53,20 +55,31 @@
|
|||||||
|
|
||||||
if (invalt < 0) invalt = 0;
|
if (invalt < 0) invalt = 0;
|
||||||
b = parseInt(255/maxalt*invalt);
|
b = parseInt(255/maxalt*invalt);
|
||||||
return {
|
|
||||||
strokeWeight: (selected ? 2 : 1),
|
/* As Icon we use the plane emoji, this is a simple solution but
|
||||||
path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
|
is definitely a compromise: we expect the icon to be rotated
|
||||||
scale: 5,
|
45 degrees facing north-east by default, this is true in most
|
||||||
fillColor: 'rgb('+r+','+g+','+b+')',
|
systems but not all. */
|
||||||
fillOpacity: 0.9,
|
var he = document.createElement("P");
|
||||||
rotation: plane.track
|
he.innerHTML = '>';
|
||||||
};
|
var rotation = 45+360-plane.track;
|
||||||
|
var selhtml = '';
|
||||||
|
|
||||||
|
/* Give a border to the selected plane. */
|
||||||
|
if (Selected == plane.hex) {
|
||||||
|
selhtml = 'border:1px dotted #0000aa; border-radius:10px;';
|
||||||
|
} else {
|
||||||
|
selhtml = '';
|
||||||
|
}
|
||||||
|
he = '<div style="transform: rotate(-'+rotation+'deg); '+selhtml+'">✈️</div>';
|
||||||
|
var icon = L.divIcon({html: he, className: 'plane-icon'});
|
||||||
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectPlane() {
|
function selectPlane(planehex) {
|
||||||
if (!Planes[this.planehex]) return;
|
if (!Planes[planehex]) return;
|
||||||
var old = Selected;
|
var old = Selected;
|
||||||
Selected = this.planehex;
|
Selected = planehex;
|
||||||
if (Planes[old]) {
|
if (Planes[old]) {
|
||||||
/* Remove the highlight in the previously selected plane. */
|
/* Remove the highlight in the previously selected plane. */
|
||||||
Planes[old].marker.setIcon(getIconForPlane(Planes[old]));
|
Planes[old].marker.setIcon(getIconForPlane(Planes[old]));
|
||||||
@ -75,6 +88,14 @@
|
|||||||
refreshSelectedInfo();
|
refreshSelectedInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return a closure to caputure the 'hex' argument. This way we don't
|
||||||
|
have to care about how Leaflet passes the object to the callback. */
|
||||||
|
function selectPlaneCallback(hex) {
|
||||||
|
return function() {
|
||||||
|
return selectPlane(hex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function refreshGeneralInfo() {
|
function refreshGeneralInfo() {
|
||||||
var i = document.getElementById('geninfo');
|
var i = document.getElementById('geninfo');
|
||||||
|
|
||||||
@ -108,9 +129,7 @@
|
|||||||
if (Planes[plane.hex]) {
|
if (Planes[plane.hex]) {
|
||||||
var myplane = Planes[plane.hex];
|
var myplane = Planes[plane.hex];
|
||||||
marker = myplane.marker;
|
marker = myplane.marker;
|
||||||
var icon = marker.getIcon();
|
marker.setLatLng([plane.lat,plane.lon]);
|
||||||
var newpos = new google.maps.LatLng(plane.lat, plane.lon);
|
|
||||||
marker.setPosition(newpos);
|
|
||||||
marker.setIcon(getIconForPlane(plane));
|
marker.setIcon(getIconForPlane(plane));
|
||||||
myplane.altitude = plane.altitude;
|
myplane.altitude = plane.altitude;
|
||||||
myplane.speed = plane.speed;
|
myplane.speed = plane.speed;
|
||||||
@ -121,29 +140,27 @@
|
|||||||
if (myplane.hex == Selected)
|
if (myplane.hex == Selected)
|
||||||
refreshSelectedInfo();
|
refreshSelectedInfo();
|
||||||
} else {
|
} else {
|
||||||
marker = new google.maps.Marker({
|
var icon = getIconForPlane(plane);
|
||||||
position: new google.maps.LatLng(plane.lat, plane.lon),
|
var marker = L.marker([plane.lat, plane.lon], {icon: icon}).addTo(Map);
|
||||||
map: Map,
|
var hex = plane.hex;
|
||||||
icon: getIconForPlane(plane)
|
marker.on('click',selectPlaneCallback(plane.hex));
|
||||||
});
|
|
||||||
plane.marker = marker;
|
plane.marker = marker;
|
||||||
marker.planehex = plane.hex;
|
marker.planehex = plane.hex;
|
||||||
Planes[plane.hex] = plane;
|
Planes[plane.hex] = plane;
|
||||||
|
|
||||||
/* Trap clicks for this marker. */
|
|
||||||
google.maps.event.addListener(marker, 'click', selectPlane);
|
|
||||||
}
|
}
|
||||||
if (plane.flight.length == 0)
|
|
||||||
marker.setTitle(plane.hex)
|
// FIXME: Set the title
|
||||||
else
|
// if (plane.flight.length == 0)
|
||||||
marker.setTitle(plane.flight+' ('+plane.hex+')')
|
// marker.setTitle(plane.hex)
|
||||||
|
// else
|
||||||
|
// marker.setTitle(plane.flight+' ('+plane.hex+')')
|
||||||
}
|
}
|
||||||
NumPlanes = data.length;
|
NumPlanes = data.length;
|
||||||
|
|
||||||
/* Remove idle planes. */
|
/* Remove idle planes. */
|
||||||
for (var p in Planes) {
|
for (var p in Planes) {
|
||||||
if (!stillhere[p]) {
|
if (!stillhere[p]) {
|
||||||
Planes[p].marker.setMap(null);
|
Map.removeLayer(Planes[p].marker);
|
||||||
delete Planes[p];
|
delete Planes[p];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,18 +168,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
var mapOptions = {
|
Map = L.map('map_canvas').setView([37.0, 13.0], 8);
|
||||||
center: new google.maps.LatLng(CenterLat, CenterLon),
|
|
||||||
zoom: 5,
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
mapTypeId: google.maps.MapTypeId.ROADMAP
|
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
|
||||||
};
|
maxZoom: 18,
|
||||||
Map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
|
id: 'mapbox/streets-v11',
|
||||||
|
accessToken: 'your.mapbox.access.token'
|
||||||
|
}).addTo(Map);
|
||||||
|
|
||||||
/* Setup our timer to poll from the server. */
|
/* Setup our timer to poll from the server. */
|
||||||
window.setInterval(function() {
|
window.setInterval(function() {
|
||||||
fetchData();
|
fetchData();
|
||||||
refreshGeneralInfo();
|
refreshGeneralInfo();
|
||||||
}, 1000);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user