From e1d262d99278223e50d30583f8dbe448ec32222c Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Sun, 22 Feb 2015 23:01:54 +0000 Subject: [PATCH] Add --show-only for extracting messages from a single plane. --- dump1090.c | 6 ++++++ dump1090.h | 1 + mode_s.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dump1090.c b/dump1090.c index 1f5c324..b5989af 100644 --- a/dump1090.c +++ b/dump1090.c @@ -264,6 +264,9 @@ void modesInit(void) { // Prepare error correction tables modesChecksumInit(Modes.nfix_crc); icaoFilterInit(); + + if (Modes.show_only) + icaoFilterAdd(Modes.show_only); } // // =============================== RTLSDR handling ========================== @@ -603,6 +606,7 @@ void showHelp(void) { "--snip Strip IQ file removing samples < level\n" "--debug Debug mode (verbose), see README for details\n" "--quiet Disable output to stdout. Use for daemon applications\n" +"--show-only Show only messages from the given ICAO on stdout\n" "--ppm Set receiver error in parts per million (default 0)\n" "--no-decode Don't decode the message contents beyond the minimum necessary\n" "--write-json Periodically write json output to (for serving by a separate webserver)\n" @@ -918,6 +922,8 @@ int main(int argc, char **argv) { Modes.ppm_error = atoi(argv[++j]); } else if (!strcmp(argv[j],"--quiet")) { Modes.quiet = 1; + } else if (!strcmp(argv[j],"--show-only") && more) { + Modes.show_only = (uint32_t) strtoul(argv[++j], NULL, 16); } else if (!strcmp(argv[j],"--mlat")) { Modes.mlat = 1; } else if (!strcmp(argv[j],"--interactive-rtl1090")) { diff --git a/dump1090.h b/dump1090.h index 26abdae..482d2d5 100644 --- a/dump1090.h +++ b/dump1090.h @@ -315,6 +315,7 @@ struct { // Internal state int net_sndbuf_size; // TCP output buffer size (64Kb * 2^n) int net_verbatim; // if true, send the original message, not the CRC-corrected one int quiet; // Suppress stdout + uint32_t show_only; // Only show messages from this ICAO int interactive; // Interactive mode int interactive_rows; // Interactive mode: max number of rows uint64_t interactive_display_ttl;// Interactive mode: TTL display diff --git a/mode_s.c b/mode_s.c index cd37b01..d6f4e13 100644 --- a/mode_s.c +++ b/mode_s.c @@ -1231,7 +1231,7 @@ void useModesMessage(struct modesMessage *mm) { a = trackUpdateFromMessage(mm); // In non-interactive non-quiet mode, display messages on standard output - if (!Modes.interactive && !Modes.quiet) { + if (!Modes.interactive && !Modes.quiet && (!Modes.show_only || mm->addr == Modes.show_only)) { displayModesMessage(mm); }