diff --git a/.gitignore b/.gitignore index 90a0967..bba68c8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ testfiles/*.bin misc frames.js .*.swp -~* - +*~ +*.rej +*.orig diff --git a/dump1090.c b/dump1090.c index 2b17a08..d2c79bb 100644 --- a/dump1090.c +++ b/dump1090.c @@ -3623,18 +3623,28 @@ char *aircraftsToJson(int *len) { p += l; buflen -= l; while(a) { int altitude = a->altitude, speed = a->speed; - + int position = 0; + int track = 0; + /* Convert units to metric if --metric was specified. */ if (Modes.metric) { altitude = (int) (altitude / 3.2828); 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, "{\"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", - 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)); p += l; buflen -= l; diff --git a/public_html/gmap.html b/public_html/gmap.html index 4f086d9..b26217b 100644 --- a/public_html/gmap.html +++ b/public_html/gmap.html @@ -10,7 +10,7 @@
- +