Added flags to json for valid position and heading
As MalcolmRobb suggested. modified: dump1090.c modified: public_html/script.js
This commit is contained in:
parent
ebadf90a57
commit
e65e873c13
14
dump1090.c
14
dump1090.c
|
@ -3323,6 +3323,8 @@ char *aircraftsToJson(int *len) {
|
||||||
p += l; buflen -= l;
|
p += l; buflen -= l;
|
||||||
while(a) {
|
while(a) {
|
||||||
int altitude = a->altitude, speed = a->speed;
|
int altitude = a->altitude, speed = a->speed;
|
||||||
|
int position = 0;
|
||||||
|
int track = 0;
|
||||||
|
|
||||||
/* Convert units to metric if --metric was specified. */
|
/* Convert units to metric if --metric was specified. */
|
||||||
if (Modes.metric) {
|
if (Modes.metric) {
|
||||||
|
@ -3330,11 +3332,19 @@ char *aircraftsToJson(int *len) {
|
||||||
speed = (int) (speed * 1.852);
|
speed = (int) (speed * 1.852);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (a->bFlags & MODES_ACFLAGS_LATLON_VALID) {
|
||||||
|
position = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a->bFlags & MODES_ACFLAGS_HEADING_VALID) {
|
||||||
|
track = 1;
|
||||||
|
}
|
||||||
|
|
||||||
l = snprintf(p,buflen,
|
l = snprintf(p,buflen,
|
||||||
"{\"hex\":\"%06x\", \"squawk\":\"%04x\", \"flight\":\"%s\", \"lat\":%f, "
|
"{\"hex\":\"%06x\", \"squawk\":\"%04x\", \"flight\":\"%s\", \"lat\":%f, "
|
||||||
"\"lon\":%f, \"altitude\":%d, \"track\":%d, "
|
"\"lon\":%f, \"validposition\":%d, \"altitude\":%d, \"track\":%d, \"validtrack\":%d,"
|
||||||
"\"speed\":%d, \"messages\":%ld, \"seen\":%d},\n",
|
"\"speed\":%d, \"messages\":%ld, \"seen\":%d},\n",
|
||||||
a->addr, a->modeA, a->flight, a->lat, a->lon, a->altitude, a->track,
|
a->addr, a->modeA, a->flight, a->lat, a->lon, position, a->altitude, a->track, track,
|
||||||
a->speed, a->messages, (int)(now - a->seen));
|
a->speed, a->messages, (int)(now - a->seen));
|
||||||
p += l; buflen -= l;
|
p += l; buflen -= l;
|
||||||
|
|
||||||
|
|
|
@ -118,8 +118,8 @@ function fetchData() {
|
||||||
stillhere[plane.hex] = true;
|
stillhere[plane.hex] = true;
|
||||||
plane.flight = $.trim(plane.flight);
|
plane.flight = $.trim(plane.flight);
|
||||||
|
|
||||||
if (plane.lat != 0 && plane.lon != 0) {
|
|
||||||
// Show only planes with position
|
// Show only planes with position
|
||||||
|
if (plane.validposition == 1) {
|
||||||
var marker = null;
|
var marker = null;
|
||||||
PlanesOnMap++;
|
PlanesOnMap++;
|
||||||
|
|
||||||
|
@ -175,7 +175,8 @@ function fetchData() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshTableInfo() ;
|
refreshTableInfo();
|
||||||
|
refreshSelectedInfo();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue