Default to not forwarding mlat messages. Add --forward-mlat option to enable it.

This commit is contained in:
Oliver Jowett 2015-07-03 22:06:35 +01:00
parent 5ef9bdd6f3
commit e3cd88e24a
5 changed files with 11 additions and 3 deletions

View File

@ -428,6 +428,7 @@ void showHelp(void) {
"--net-ro-rate <rate> TCP raw output memory flush rate (default: 0)\n" "--net-ro-rate <rate> TCP raw output memory flush rate (default: 0)\n"
"--net-heartbeat <rate> TCP heartbeat rate in seconds (default: 60 sec; 0 to disable)\n" "--net-heartbeat <rate> TCP heartbeat rate in seconds (default: 60 sec; 0 to disable)\n"
"--net-buffer <n> TCP buffer size 64Kb * (2^n) (default: n=0, 64Kb)\n" "--net-buffer <n> TCP buffer size 64Kb * (2^n) (default: n=0, 64Kb)\n"
"--forward-mlat Allow forwarding of received mlat results to output ports\n"
"--lat <latitude> Reference/receiver latitude for surface posn (opt)\n" "--lat <latitude> Reference/receiver latitude for surface posn (opt)\n"
"--lon <longitude> Reference/receiver longitude for surface posn (opt)\n" "--lon <longitude> Reference/receiver longitude for surface posn (opt)\n"
"--fix Enable single-bits error correction using CRC\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]); Modes.net_output_sbs_port = atoi(argv[++j]);
} else if (!strcmp(argv[j],"--net-buffer") && more) { } else if (!strcmp(argv[j],"--net-buffer") && more) {
Modes.net_sndbuf_size = atoi(argv[++j]); Modes.net_sndbuf_size = atoi(argv[++j]);
} else if (!strcmp(argv[j],"--forward-mlat")) {
Modes.forward_mlat = 1;
} else if (!strcmp(argv[j],"--onlyaddr")) { } else if (!strcmp(argv[j],"--onlyaddr")) {
Modes.onlyaddr = 1; Modes.onlyaddr = 1;
} else if (!strcmp(argv[j],"--metric")) { } else if (!strcmp(argv[j],"--metric")) {

View File

@ -320,6 +320,7 @@ struct { // Internal state
int net_fatsv_port; // FlightAware TSV port int net_fatsv_port; // FlightAware TSV port
int no_rtlsdr_ok; // keep going if no RTLSDR dev found int no_rtlsdr_ok; // keep going if no RTLSDR dev found
int net_sndbuf_size; // TCP output buffer size (64Kb * 2^n) 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 quiet; // Suppress stdout
int interactive; // Interactive mode int interactive; // Interactive mode
int interactive_rows; // Interactive mode: max number of rows int interactive_rows; // Interactive mode: max number of rows

View File

@ -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 we sucessfully decoded, back copy the results to mm so that we can print them in list output
if (location_ok) { if (location_ok) {
mm->bFlags |= MODES_ACFLAGS_LATLON_VALID; mm->bFlags |= MODES_ACFLAGS_LATLON_VALID;
if (mm->timestampMsg == 0xFF004D4C4154) // Magic mlat timestamp if (!(mm->bFlags & MODES_ACFLAGS_MLAT))
mm->bFlags |= MODES_ACFLAGS_MLAT;
else
a->bFlags &= ~MODES_ACFLAGS_MLAT; a->bFlags &= ~MODES_ACFLAGS_MLAT;
mm->fLat = a->lat; mm->fLat = a->lat;
mm->fLon = a->lon; mm->fLon = a->lon;

View File

@ -838,6 +838,9 @@ void decodeModesMessage(struct modesMessage *mm, unsigned char *msg) {
memcpy(mm->msg, msg, MODES_LONG_MSG_BYTES); memcpy(mm->msg, msg, MODES_LONG_MSG_BYTES);
msg = mm->msg; 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 // Get the message type ASAP as other operations depend on this
mm->msgtype = msg[0] >> 3; // Downlink Format mm->msgtype = msg[0] >> 3; // Downlink Format
mm->msgbits = modesMessageLenByType(mm->msgtype); mm->msgbits = modesMessageLenByType(mm->msgtype);

View File

@ -473,6 +473,9 @@ void modesSendSBSOutput(struct modesMessage *mm) {
//========================================================================= //=========================================================================
// //
void modesQueueOutput(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_sbs_connections) {modesSendSBSOutput(mm);}
if (Modes.stat_beast_connections) {modesSendBeastOutput(mm);} if (Modes.stat_beast_connections) {modesSendBeastOutput(mm);}
if (Modes.stat_raw_connections) {modesSendRawOutput(mm);} if (Modes.stat_raw_connections) {modesSendRawOutput(mm);}