Add --show-only for extracting messages from a single plane.

This commit is contained in:
Oliver Jowett 2015-02-22 23:01:54 +00:00
parent b804359077
commit e1d262d992
3 changed files with 8 additions and 1 deletions

View file

@ -264,6 +264,9 @@ void modesInit(void) {
// Prepare error correction tables // Prepare error correction tables
modesChecksumInit(Modes.nfix_crc); modesChecksumInit(Modes.nfix_crc);
icaoFilterInit(); icaoFilterInit();
if (Modes.show_only)
icaoFilterAdd(Modes.show_only);
} }
// //
// =============================== RTLSDR handling ========================== // =============================== RTLSDR handling ==========================
@ -603,6 +606,7 @@ void showHelp(void) {
"--snip <level> Strip IQ file removing samples < level\n" "--snip <level> Strip IQ file removing samples < level\n"
"--debug <flags> Debug mode (verbose), see README for details\n" "--debug <flags> Debug mode (verbose), see README for details\n"
"--quiet Disable output to stdout. Use for daemon applications\n" "--quiet Disable output to stdout. Use for daemon applications\n"
"--show-only <addr> Show only messages from the given ICAO on stdout\n"
"--ppm <error> Set receiver error in parts per million (default 0)\n" "--ppm <error> Set receiver error in parts per million (default 0)\n"
"--no-decode Don't decode the message contents beyond the minimum necessary\n" "--no-decode Don't decode the message contents beyond the minimum necessary\n"
"--write-json <dir> Periodically write json output to <dir> (for serving by a separate webserver)\n" "--write-json <dir> Periodically write json output to <dir> (for serving by a separate webserver)\n"
@ -918,6 +922,8 @@ int main(int argc, char **argv) {
Modes.ppm_error = atoi(argv[++j]); Modes.ppm_error = atoi(argv[++j]);
} else if (!strcmp(argv[j],"--quiet")) { } else if (!strcmp(argv[j],"--quiet")) {
Modes.quiet = 1; 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")) { } else if (!strcmp(argv[j],"--mlat")) {
Modes.mlat = 1; Modes.mlat = 1;
} else if (!strcmp(argv[j],"--interactive-rtl1090")) { } else if (!strcmp(argv[j],"--interactive-rtl1090")) {

View file

@ -315,6 +315,7 @@ struct { // Internal state
int net_sndbuf_size; // TCP output buffer size (64Kb * 2^n) 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 net_verbatim; // if true, send the original message, not the CRC-corrected one
int quiet; // Suppress stdout int quiet; // Suppress stdout
uint32_t show_only; // Only show messages from this ICAO
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
uint64_t interactive_display_ttl;// Interactive mode: TTL display uint64_t interactive_display_ttl;// Interactive mode: TTL display

View file

@ -1231,7 +1231,7 @@ void useModesMessage(struct modesMessage *mm) {
a = trackUpdateFromMessage(mm); a = trackUpdateFromMessage(mm);
// In non-interactive non-quiet mode, display messages on standard output // 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); displayModesMessage(mm);
} }