parent
8fabfcb94f
commit
8f3be2cd79
|
@ -157,6 +157,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_CATEGORY_VALID (1<<17) // Aircraft category is known
|
||||||
|
|
||||||
#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)
|
||||||
|
@ -385,6 +386,7 @@ struct modesMessage {
|
||||||
int ns_velocity; // N/S velocity.
|
int ns_velocity; // N/S velocity.
|
||||||
int vert_rate; // Vertical rate.
|
int vert_rate; // Vertical rate.
|
||||||
int velocity; // Reported by aircraft, or computed from from EW and NS velocity
|
int velocity; // Reported by aircraft, or computed from from EW and NS velocity
|
||||||
|
unsigned category; // A0 - D7 encoded as a single hex byte
|
||||||
|
|
||||||
// DF 18
|
// DF 18
|
||||||
int cf; // Control Field
|
int cf; // Control Field
|
||||||
|
|
7
mode_s.c
7
mode_s.c
|
@ -753,6 +753,9 @@ static void decodeExtendedSquitter(struct modesMessage *mm)
|
||||||
mm->flight[8] = '\0';
|
mm->flight[8] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mm->category = ((0x0E - metype) << 4) | mesub;
|
||||||
|
mm->bFlags |= MODES_ACFLAGS_CATEGORY_VALID;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -973,8 +976,8 @@ static void displayExtendedSquitter(struct modesMessage *mm) {
|
||||||
|
|
||||||
// Decode the extended squitter message
|
// Decode the extended squitter message
|
||||||
if (mm->metype >= 1 && mm->metype <= 4) { // Aircraft identification
|
if (mm->metype >= 1 && mm->metype <= 4) { // Aircraft identification
|
||||||
printf(" Aircraft Type : %c%d\n", ('A' + 4 - mm->metype), mm->mesub);
|
printf(" Aircraft Type : %02X\n", mm->category);
|
||||||
printf(" Identification : %s\n", mm->flight);
|
printf(" Identification : %s\n", (mm->bFlags & MODES_ACFLAGS_CALLSIGN_VALID) ? mm->flight : "invalid");
|
||||||
} else if (mm->metype == 19) { // Airborne Velocity
|
} else if (mm->metype == 19) { // Airborne Velocity
|
||||||
if (mm->mesub == 1 || mm->mesub == 2) {
|
if (mm->mesub == 1 || mm->mesub == 2) {
|
||||||
printf(" EW status : %s\n", (mm->bFlags & MODES_ACFLAGS_EWSPEED_VALID) ? "Valid" : "Unavailable");
|
printf(" EW status : %s\n", (mm->bFlags & MODES_ACFLAGS_EWSPEED_VALID) ? "Valid" : "Unavailable");
|
||||||
|
|
2
net_io.c
2
net_io.c
|
@ -787,6 +787,8 @@ char *generateAircraftJson(const char *url_path, int *len) {
|
||||||
p += snprintf(p, end-p, ",\"track\":%d", a->track);
|
p += snprintf(p, end-p, ",\"track\":%d", a->track);
|
||||||
if (a->bFlags & MODES_ACFLAGS_SPEED_VALID)
|
if (a->bFlags & MODES_ACFLAGS_SPEED_VALID)
|
||||||
p += snprintf(p, end-p, ",\"speed\":%d", a->speed);
|
p += snprintf(p, end-p, ",\"speed\":%d", a->speed);
|
||||||
|
if (a->bFlags & MODES_ACFLAGS_CATEGORY_VALID)
|
||||||
|
p += snprintf(p, end-p, ",\"category\":\"%02X\"", a->category);
|
||||||
|
|
||||||
p += snprintf(p, end-p, ",\"messages\":%ld,\"seen\":%.1f,\"rssi\":%.1f}",
|
p += snprintf(p, end-p, ",\"messages\":%ld,\"seen\":%.1f,\"rssi\":%.1f}",
|
||||||
a->messages, (now - a->seen)/1000.0,
|
a->messages, (now - a->seen)/1000.0,
|
||||||
|
|
5
track.c
5
track.c
|
@ -495,6 +495,11 @@ struct aircraft *trackUpdateFromMessage(struct modesMessage *mm)
|
||||||
a->vert_rate = mm->vert_rate;
|
a->vert_rate = mm->vert_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a (new) category has been received, copy it to the aircraft structure
|
||||||
|
if (mm->bFlags & MODES_ACFLAGS_CATEGORY_VALID) {
|
||||||
|
a->category = mm->category;
|
||||||
|
}
|
||||||
|
|
||||||
// Update the aircrafts a->bFlags to reflect the newly received mm->bFlags;
|
// Update the aircrafts a->bFlags to reflect the newly received mm->bFlags;
|
||||||
a->bFlags |= mm->bFlags;
|
a->bFlags |= mm->bFlags;
|
||||||
|
|
||||||
|
|
2
track.h
2
track.h
|
@ -95,6 +95,8 @@ struct aircraft {
|
||||||
double lat, lon; // Coordinated obtained from CPR encoded data
|
double lat, lon; // Coordinated obtained from CPR encoded data
|
||||||
unsigned pos_nuc; // NUCp of last computed position
|
unsigned pos_nuc; // NUCp of last computed position
|
||||||
|
|
||||||
|
unsigned category; // Aircraft category A0 - D7 encoded as a single hex byte
|
||||||
|
|
||||||
int bFlags; // Flags related to valid fields in this structure
|
int bFlags; // Flags related to valid fields in this structure
|
||||||
struct aircraft *next; // Next aircraft in our linked list
|
struct aircraft *next; // Next aircraft in our linked list
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue