Flag non-ICAO addresses, display them differently in interactive mode.

This commit is contained in:
Oliver Jowett 2015-01-22 11:14:22 +00:00
parent 34ae2c7349
commit 9a91507583
4 changed files with 9 additions and 3 deletions

View file

@ -164,6 +164,7 @@
#define MODES_ACFLAGS_NSEWSPD_VALID (1<<14) // Aircraft EW and NS Speed is known #define MODES_ACFLAGS_NSEWSPD_VALID (1<<14) // Aircraft EW and NS Speed is known
#define MODES_ACFLAGS_LATLON_REL_OK (1<<15) // Indicates it's OK to do a relative CPR #define MODES_ACFLAGS_LATLON_REL_OK (1<<15) // Indicates it's OK to do a relative CPR
#define MODES_ACFLAGS_REL_CPR_USED (1<<16) // Lat/lon derived from relative CPR #define MODES_ACFLAGS_REL_CPR_USED (1<<16) // Lat/lon derived from relative CPR
#define MODES_ACFLAGS_NON_ICAO (1<<17) // Address is not ICAO-format
#define MODES_ACFLAGS_LLEITHER_VALID (MODES_ACFLAGS_LLEVEN_VALID | MODES_ACFLAGS_LLODD_VALID) #define MODES_ACFLAGS_LLEITHER_VALID (MODES_ACFLAGS_LLEVEN_VALID | MODES_ACFLAGS_LLODD_VALID)
#define MODES_ACFLAGS_LLBOTH_VALID (MODES_ACFLAGS_LLEVEN_VALID | MODES_ACFLAGS_LLODD_VALID) #define MODES_ACFLAGS_LLBOTH_VALID (MODES_ACFLAGS_LLEVEN_VALID | MODES_ACFLAGS_LLODD_VALID)

View file

@ -601,8 +601,9 @@ void interactiveShowData(void) {
snprintf(strFl, 6, "%5d", altitude); snprintf(strFl, 6, "%5d", altitude);
} }
printf("%06X %-4s %-4s %-8s %5s %3s %3s %7s %8s %5.1f %5d %2d\n", printf("%06X%s %-4s %-4s %-8s %5s %3s %3s %7s %8s %5.1f %5d %2d\n",
a->addr, strMode, strSquawk, a->flight, strFl, strGs, strTt, a->addr, (a->bFlags & MODES_ACFLAGS_NON_ICAO) ? "~" : " ",
strMode, strSquawk, a->flight, strFl, strGs, strTt,
strLat, strLon, 10 * log10(signalAverage), msgs, (int)(now - a->seen)); strLat, strLon, 10 * log10(signalAverage), msgs, (int)(now - a->seen));
} }
count++; count++;

View file

@ -371,6 +371,7 @@ void decodeModeAMessage(struct modesMessage *mm, int ModeA)
// Set the Identity field to ModeA // Set the Identity field to ModeA
mm->modeA = ModeA & 0x7777; mm->modeA = ModeA & 0x7777;
mm->bFlags |= MODES_ACFLAGS_SQUAWK_VALID; mm->bFlags |= MODES_ACFLAGS_SQUAWK_VALID;
mm->bFlags |= MODES_ACFLAGS_NON_ICAO;
// Flag ident in flight status // Flag ident in flight status
mm->fs = ModeA & 0x0080; mm->fs = ModeA & 0x0080;

View file

@ -543,7 +543,10 @@ int decodeModesMessage(struct modesMessage *mm, unsigned char *msg)
// AA (Address announced) // AA (Address announced)
if (mm->msgtype == 11 || mm->msgtype == 17 || mm->msgtype == 18) { if (mm->msgtype == 11 || mm->msgtype == 17 || mm->msgtype == 18) {
mm->addr = (msg[1] << 16) | (msg[2] << 8) | (msg[3]); mm->addr = (msg[1] << 16) | (msg[2] << 8) | (msg[3]);
if (!mm->correctedbits && (mm->msgtype != 11 || mm->iid == 0)) {
if (mm->msgtype == 18 && (mm->cf != 0 && mm->cf != 6))
mm->bFlags |= MODES_ACFLAGS_NON_ICAO; // DF 18 message not using ICAO addressing
else if (!mm->correctedbits && (mm->msgtype != 11 || mm->iid == 0)) {
// No CRC errors seen, and either it was an DF17/18 extended squitter // No CRC errors seen, and either it was an DF17/18 extended squitter
// or a DF11 acquisition squitter with II = 0. We probably have the right address. // or a DF11 acquisition squitter with II = 0. We probably have the right address.