Emit adsb version in json & faup1090. Show it in skyview.

This commit is contained in:
Oliver Jowett 2017-06-15 23:42:05 +01:00
parent 17c8265ce8
commit e3c8c91852
4 changed files with 38 additions and 3 deletions

View file

@ -1187,6 +1187,8 @@ char *generateAircraftJson(const char *url_path, int *len) {
p += snprintf(p, end-p, "\n {\"hex\":\"%s%06x\"", (a->addr & MODES_NON_ICAO_ADDRESS) ? "~" : "", a->addr & 0xFFFFFF); p += snprintf(p, end-p, "\n {\"hex\":\"%s%06x\"", (a->addr & MODES_NON_ICAO_ADDRESS) ? "~" : "", a->addr & 0xFFFFFF);
if (a->addrtype != ADDR_ADSB_ICAO) if (a->addrtype != ADDR_ADSB_ICAO)
p += snprintf(p, end-p, ",\"type\":\"%s\"", addrtype_short_string(a->addrtype)); p += snprintf(p, end-p, ",\"type\":\"%s\"", addrtype_short_string(a->addrtype));
if (a->adsb_version >= 0)
p += snprintf(p, end-p, ",\"version\":%d", a->adsb_version);
if (trackDataValid(&a->squawk_valid)) if (trackDataValid(&a->squawk_valid))
p += snprintf(p, end-p, ",\"squawk\":\"%04x\"", a->squawk); p += snprintf(p, end-p, ",\"squawk\":\"%04x\"", a->squawk);
if (trackDataValid(&a->callsign_valid)) if (trackDataValid(&a->callsign_valid))
@ -2055,6 +2057,10 @@ static void writeFATSV()
p += snprintf(p, bufsize(p, end), "\taddrtype\t%s", addrtype_short_string(a->addrtype)); p += snprintf(p, bufsize(p, end), "\taddrtype\t%s", addrtype_short_string(a->addrtype));
} }
if (a->adsb_version >= 0) {
p += snprintf(p, bufsize(p, end), "\tadsb_version\t%d", a->adsb_version);
}
if (trackDataValidEx(&a->callsign_valid, now, 35000, SOURCE_MODE_S) && strcmp(a->callsign, " ") != 0 && a->callsign_valid.updated > a->fatsv_last_emitted) { if (trackDataValidEx(&a->callsign_valid, now, 35000, SOURCE_MODE_S) && strcmp(a->callsign, " ") != 0 && a->callsign_valid.updated > a->fatsv_last_emitted) {
p += snprintf(p, bufsize(p,end), "\tident\t%s", a->callsign); p += snprintf(p, bufsize(p,end), "\tident\t%s", a->callsign);
memcpy(a->fatsv_emitted_callsign, a->callsign, sizeof(a->fatsv_emitted_callsign)); memcpy(a->fatsv_emitted_callsign, a->callsign, sizeof(a->fatsv_emitted_callsign));

View file

@ -219,6 +219,8 @@
<div> <div>
<div class="infoHeading infoRowFluid fourColumnSection1">Alt setting:</div> <div class="infoHeading infoRowFluid fourColumnSection1">Alt setting:</div>
<div class="infoData infoRowFluid fourColumnSection2"><span id="selected_alt_setting"/></div> <div class="infoData infoRowFluid fourColumnSection2"><span id="selected_alt_setting"/></div>
<div class="infoHeading infoRowFluid fourColumnSection1">ADS-B:</div>
<div class="infoData infoRowFluid fourColumnSection2"><span id="selected_version"/></div>
</div> </div>
</div> </div>

View file

@ -26,6 +26,7 @@ function PlaneObject(icao) {
this.alt_setting = null; this.alt_setting = null;
this.baro_rate = null; this.baro_rate = null;
this.geom_rate = null; this.geom_rate = null;
this.version = null;
this.prev_position = null; this.prev_position = null;
this.position = null; this.position = null;
@ -468,6 +469,8 @@ PlaneObject.prototype.updateData = function(receiver_timestamp, data) {
this.squawk = data.squawk; this.squawk = data.squawk;
if (typeof data.category !== "undefined") if (typeof data.category !== "undefined")
this.category = data.category; this.category = data.category;
if (typeof data.version !== "undefined")
this.version = data.version;
if (typeof data.lat !== "undefined") { if (typeof data.lat !== "undefined") {
this.position = [data.lon, data.lat]; this.position = [data.lon, data.lat];

View file

@ -939,9 +939,21 @@ function refreshSelected() {
$('#selected_true_heading').text(format_track_long(selected.true_heading)); $('#selected_true_heading').text(format_track_long(selected.true_heading));
$('#selected_ias').text(format_speed_long(selected.ias, DisplayUnits)); $('#selected_ias').text(format_speed_long(selected.ias, DisplayUnits));
$('#selected_tas').text(format_speed_long(selected.tas, DisplayUnits)); $('#selected_tas').text(format_speed_long(selected.tas, DisplayUnits));
$('#selected_mach').text(selected.mach.toFixed(3)); if (selected.mach == null) {
$('#selected_roll').text(selected.roll.toFixed(2)); $('#selected_mach').text('n/a');
$('#selected_track_rate').text(selected.track_rate.toFixed(2)); } else {
$('#selected_mach').text(selected.mach.toFixed(3));
}
if (selected.roll == null) {
$('#selected_roll').text('n/a');
} else {
$('#selected_roll').text(selected.roll.toFixed(1));
}
if (selected.track_rate == null) {
$('#selected_track_rate').text('n/a');
} else {
$('#selected_track_rate').text(selected.track_rate.toFixed(2));
}
$('#selected_geom_rate').text(format_vert_rate_long(selected.geom_rate, DisplayUnits)); $('#selected_geom_rate').text(format_vert_rate_long(selected.geom_rate, DisplayUnits));
if (selected.alt_setting == null) { if (selected.alt_setting == null) {
$('#selected_alt_setting').text("n/a"); $('#selected_alt_setting').text("n/a");
@ -950,6 +962,18 @@ function refreshSelected() {
} }
$('#selected_intent_alt').text(format_altitude_long(selected.intent_alt, 0, DisplayUnits)); $('#selected_intent_alt').text(format_altitude_long(selected.intent_alt, 0, DisplayUnits));
$('#selected_intent_heading').text(format_track_long(selected.intent_heading)) $('#selected_intent_heading').text(format_track_long(selected.intent_heading))
if (selected.version == null) {
$('#selected_version').text('none');
} else if (selected.version == 0) {
$('#selected_version').text('v0 (DO-260)');
} else if (selected.version == 1) {
$('#selected_version').text('v1 (DO-260A)');
} else if (selected.version == 2) {
$('#selected_version').text('v2 (DO-260B)');
} else {
$('#selected_version').text('v' + selected.version);
}
} }
function refreshHighlighted() { function refreshHighlighted() {