Track the "best" addrtype we ever saw for an aircraft.
This commit is contained in:
parent
2a4aa29f03
commit
8d8443f3dc
15
dump1090.h
15
dump1090.h
|
@ -149,16 +149,21 @@ typedef enum {
|
||||||
SOURCE_ADSB, /* data from a ADS-B extended squitter message */
|
SOURCE_ADSB, /* data from a ADS-B extended squitter message */
|
||||||
} datasource_t;
|
} datasource_t;
|
||||||
|
|
||||||
/* What sort of address is this and who sent it? */
|
/* What sort of address is this and who sent it?
|
||||||
|
* (Earlier values are higher priority)
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ADDR_ADSB_ICAO, /* ADS-B, ICAO address, transponder sourced */
|
ADDR_ADSB_ICAO, /* ADS-B, ICAO address, transponder sourced */
|
||||||
ADDR_ADSB_ICAO_NT, /* ADS-B, ICAO address, non-transponder */
|
ADDR_ADSB_ICAO_NT, /* ADS-B, ICAO address, non-transponder */
|
||||||
ADDR_ADSB_OTHER, /* ADS-B, other address format, non-transponder */
|
|
||||||
ADDR_TISB_ICAO, /* TIS-B, ICAO address */
|
|
||||||
ADDR_TISB_OTHER, /* TIS-B, other address format */
|
|
||||||
ADDR_TISB_ANON, /* ADS-R/TIS-B, anonymized address */
|
|
||||||
ADDR_ADSR_ICAO, /* ADS-R, ICAO address */
|
ADDR_ADSR_ICAO, /* ADS-R, ICAO address */
|
||||||
|
ADDR_TISB_ICAO, /* TIS-B, ICAO address */
|
||||||
|
|
||||||
|
ADDR_ADSB_OTHER, /* ADS-B, other address format, non-transponder */
|
||||||
ADDR_ADSR_OTHER, /* ADS-R, other address format */
|
ADDR_ADSR_OTHER, /* ADS-R, other address format */
|
||||||
|
ADDR_TISB_OTHER, /* TIS-B, other address format */
|
||||||
|
|
||||||
|
ADDR_TISB_ANON, /* ADS-R/TIS-B, anonymized address */
|
||||||
|
|
||||||
ADDR_UNKNOWN /* unknown address format */
|
ADDR_UNKNOWN /* unknown address format */
|
||||||
} addrtype_t;
|
} addrtype_t;
|
||||||
|
|
||||||
|
|
5
track.c
5
track.c
|
@ -66,6 +66,7 @@ struct aircraft *trackCreateAircraft(struct modesMessage *mm) {
|
||||||
|
|
||||||
// Now initialise things that should not be 0/NULL to their defaults
|
// Now initialise things that should not be 0/NULL to their defaults
|
||||||
a->addr = mm->addr;
|
a->addr = mm->addr;
|
||||||
|
a->addrtype = mm->addrtype;
|
||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
a->signalLevel[i] = 1e-5;
|
a->signalLevel[i] = 1e-5;
|
||||||
a->signalNext = 0;
|
a->signalNext = 0;
|
||||||
|
@ -534,6 +535,10 @@ struct aircraft *trackUpdateFromMessage(struct modesMessage *mm)
|
||||||
a->seen = now;
|
a->seen = now;
|
||||||
a->messages++;
|
a->messages++;
|
||||||
|
|
||||||
|
// update addrtype, we only ever go towards "more direct" types
|
||||||
|
if (mm->addrtype < a->addrtype)
|
||||||
|
a->addrtype = mm->addrtype;
|
||||||
|
|
||||||
if (mm->altitude_valid && mm->altitude_source == ALTITUDE_BARO && accept_data(&a->altitude_valid, mm->source, now)) {
|
if (mm->altitude_valid && mm->altitude_source == ALTITUDE_BARO && accept_data(&a->altitude_valid, mm->source, now)) {
|
||||||
unsigned modeC = (a->altitude + 49) / 100;
|
unsigned modeC = (a->altitude + 49) / 100;
|
||||||
if (modeC != a->altitude_modeC) {
|
if (modeC != a->altitude_modeC) {
|
||||||
|
|
1
track.h
1
track.h
|
@ -69,6 +69,7 @@ typedef struct {
|
||||||
/* Structure used to describe the state of one tracked aircraft */
|
/* Structure used to describe the state of one tracked aircraft */
|
||||||
struct aircraft {
|
struct aircraft {
|
||||||
uint32_t addr; // ICAO address
|
uint32_t addr; // ICAO address
|
||||||
|
addrtype_t addrtype; // highest priority address type seen for this aircraft
|
||||||
|
|
||||||
uint64_t seen; // Time (millis) at which the last packet was received
|
uint64_t seen; // Time (millis) at which the last packet was received
|
||||||
long messages; // Number of Mode S messages received
|
long messages; // Number of Mode S messages received
|
||||||
|
|
Loading…
Reference in a new issue