diff --git a/dump1090.c b/dump1090.c index f7ddc45..c6ac2c4 100644 --- a/dump1090.c +++ b/dump1090.c @@ -428,6 +428,7 @@ void showHelp(void) { "--net-ro-rate TCP raw output memory flush rate (default: 0)\n" "--net-heartbeat TCP heartbeat rate in seconds (default: 60 sec; 0 to disable)\n" "--net-buffer TCP buffer size 64Kb * (2^n) (default: n=0, 64Kb)\n" +"--forward-mlat Allow forwarding of received mlat results to output ports\n" "--lat Reference/receiver latitude for surface posn (opt)\n" "--lon Reference/receiver longitude for surface posn (opt)\n" "--fix Enable single-bits error correction using CRC\n" @@ -736,6 +737,8 @@ int main(int argc, char **argv) { Modes.net_output_sbs_port = atoi(argv[++j]); } else if (!strcmp(argv[j],"--net-buffer") && more) { Modes.net_sndbuf_size = atoi(argv[++j]); + } else if (!strcmp(argv[j],"--forward-mlat")) { + Modes.forward_mlat = 1; } else if (!strcmp(argv[j],"--onlyaddr")) { Modes.onlyaddr = 1; } else if (!strcmp(argv[j],"--metric")) { diff --git a/dump1090.h b/dump1090.h index 15aed5b..07a1ab1 100644 --- a/dump1090.h +++ b/dump1090.h @@ -320,6 +320,7 @@ struct { // Internal state int net_fatsv_port; // FlightAware TSV port int no_rtlsdr_ok; // keep going if no RTLSDR dev found int net_sndbuf_size; // TCP output buffer size (64Kb * 2^n) + int forward_mlat; // enable forwarding of mlat to output ports int quiet; // Suppress stdout int interactive; // Interactive mode int interactive_rows; // Interactive mode: max number of rows diff --git a/interactive.c b/interactive.c index b9829c0..5f4f123 100644 --- a/interactive.c +++ b/interactive.c @@ -371,9 +371,7 @@ struct aircraft *interactiveReceiveData(struct modesMessage *mm, struct client * //If we sucessfully decoded, back copy the results to mm so that we can print them in list output if (location_ok) { mm->bFlags |= MODES_ACFLAGS_LATLON_VALID; - if (mm->timestampMsg == 0xFF004D4C4154) // Magic mlat timestamp - mm->bFlags |= MODES_ACFLAGS_MLAT; - else + if (!(mm->bFlags & MODES_ACFLAGS_MLAT)) a->bFlags &= ~MODES_ACFLAGS_MLAT; mm->fLat = a->lat; mm->fLon = a->lon; diff --git a/mode_s.c b/mode_s.c index 0f9d4dc..9525d88 100644 --- a/mode_s.c +++ b/mode_s.c @@ -838,6 +838,9 @@ void decodeModesMessage(struct modesMessage *mm, unsigned char *msg) { memcpy(mm->msg, msg, MODES_LONG_MSG_BYTES); msg = mm->msg; + if (mm->remote && mm->timestampMsg == 0xFF004D4C4154) // Magic mlat timestamp + mm->bFlags |= MODES_ACFLAGS_MLAT; + // Get the message type ASAP as other operations depend on this mm->msgtype = msg[0] >> 3; // Downlink Format mm->msgbits = modesMessageLenByType(mm->msgtype); diff --git a/net_io.c b/net_io.c index 58e0ed6..1d113d0 100644 --- a/net_io.c +++ b/net_io.c @@ -473,6 +473,9 @@ void modesSendSBSOutput(struct modesMessage *mm) { //========================================================================= // void modesQueueOutput(struct modesMessage *mm) { + if ((mm->bFlags & MODES_ACFLAGS_MLAT) && !Modes.forward_mlat) + return; + if (Modes.stat_sbs_connections) {modesSendSBSOutput(mm);} if (Modes.stat_beast_connections) {modesSendBeastOutput(mm);} if (Modes.stat_raw_connections) {modesSendRawOutput(mm);}