Commit graph

120 commits

Author SHA1 Message Date
Oliver Jowett 25ea6d398b Overhaul mode A/C matching to be much cheaper.
The old matching process which tracked mode A values as pseudo-aircraft
got very, very expensive with a large number of mode A/C messages (and
with lots of single-bit errors, which seems common with a Beast doing
the reception)

Instead just count A/C messages directly into a 4096-entry array (which
is very fast) and periodically scan the mode S aircraft list to see if
we can match anything up (which is fixed overhead + cost proportional
to the number of mode S aircraft)
2016-10-11 18:00:11 +01:00
Oliver Jowett 60f1f3bcb6 Table-ize the Mode A to C conversions, add a Mode C to Mode A conversion function. 2016-10-11 17:57:25 +01:00
Oliver Jowett 85d3ecee62 Add source & address type for Mode A/C 2016-10-11 17:55:02 +01:00
Oliver Jowett 729d91c1ab Fix up address type categorization to match the spec. 2016-09-15 15:30:34 +01:00
Oliver Jowett 50a606d23f Make it clearer that ADDR_ADSB_ICAO includes Mode S too. 2016-09-14 17:19:49 +01:00
Oliver Jowett 2a4aa29f03 Record the address type details when decoding. 2016-09-14 16:37:07 +01:00
Oliver Jowett 10641303cb Add a couple more ME types. 2016-09-14 16:12:08 +01:00
Oliver Jowett 9e179d46bf Don't accept all-zeros messages (e.g. off the network - the demodulator
doesn't accept them already)
2016-09-14 16:11:31 +01:00
Oliver Jowett b827806ce8 Simplify ident decoding, add some sanity checks to the BDS2,0 case. 2016-09-14 16:02:20 +01:00
Oliver Jowett f9419f13d5 Break up decodeExtendedSquiiter, it was getting pretty large. 2016-09-01 23:13:31 +01:00
Oliver Jowett a1fdc07db2 Restructure decoding to use a helper function to extract bit ranges
With forced inlining this is about as fast, and it is much less
errorprone than the twisty little maze of handcoded bitshifts that
it was before.

(notably, at least one error - in the ACAS RI field - has been fixed)
2016-09-01 22:45:49 +01:00
Oliver Jowett 3e08de91ed WIP on decoding operational status & target state messages. 2016-08-29 11:11:04 +01:00
Oliver Jowett 54ca2c7fb2 WIP big rewrite of message decoding / aircraft tracking. 2016-08-27 14:34:14 +01:00
Oliver Jowett 8b8f8d7a40 Use INVALID_ALTITUDE in a few more places. 2016-08-26 21:38:06 +01:00
Oliver Jowett a910454c02 Comm-D ELM is actually DF 24..31, not just 24.
This DF is formatted with the first two bits as 1, and the next 3 bits
are part of the message rather than part of the DF code. So effectively
it spans 8 DF values if you are looking at the full 5 bits.
2016-08-26 11:35:11 +01:00
Raphael Geissert 1269d73690 Fix another string format where %d is used but an unsigned int is passed 2016-04-05 21:05:36 +02:00
Oliver Jowett 356cda2917 Flush stdout after writing message details so it works reasonably if there's also stderr output nearby. 2016-02-05 15:41:10 +00:00
Oliver Jowett 2a07897354 Be more selective about what is flagged as TIS-B. 2016-01-24 19:09:30 +00:00
Oliver Jowett 1a2926b311 Display ES data for DF=18, CF=2 when showing messages verbosely.
Always show an address for DF=18, using the NON_ICAO flag as needed.
2016-01-22 14:36:59 +00:00
Oliver Jowett cc04f315b4 Make the HAE/Baro offset field a bit clearer.
(given that I got confused by the old name after only a couple of weeks
away from that code..)
2016-01-22 14:36:17 +00:00
Oliver Jowett d9eec668cf Track what data we got via TIS-B, report it as such. 2016-01-21 19:42:37 +00:00
Oliver Jowett 9479a5c9be If --hae is passed, report altitudes as HAE where available, with a H suffix.
This affects interactive mode and SBS output.
2016-01-01 15:15:28 +00:00
Oliver Jowett efd6b94310 Track HAE altitude separately to baro altitude where possible. 2016-01-01 13:42:30 +00:00
Oliver Jowett f6ff1c853b Show synthetic MLAT messages as such. 2015-06-29 12:42:50 +01:00
Oliver Jowett 803760ca80 Treat an all-zeros message as bad. 2015-06-29 00:50:19 +01:00
Oliver Jowett 75851778c0 Fix up filter population so it's not completely insane.
The logic for DF11 was completely broken and inverted. How did this ever work??

Actually, the broken version kinda works because the only types of message that
can yield an address that's not already in the ICAO filter are DF11/17/18.
So DF=17; DF=18; and DF=11 with IID=0 would pass the broken logic and populate the
filter. All other DFs would pass the broken test, too, but they can only ever
re-add entries that were already there.
2015-06-29 00:46:34 +01:00
Oliver Jowett 934dfee6a4 Change the mlat timestamp to something that doesn't need escaping. 2015-06-29 00:31:42 +01:00
Oliver Jowett 12a7d45e75 Mlat synthetic message detection.
Notice synthetic mlat messages by looking for messages with a magic
timestamp value. If they arrive, tag the derived data as mlat-derived.

Don't include mlat-derived output in FATSV output to avoid loops.
2015-06-28 20:04:09 +01:00
Oliver Jowett f58ff14d7c Fix queueing/resending very old Mode A/C messages.
Fixes #47.
2015-06-07 23:00:24 +01:00
Oliver Jowett 0bd897cad1 Fix --mlat --raw stdout formatting on big-endian systems. 2015-04-19 00:57:24 +01:00
Oliver Jowett 15ea5ba3da Rearrangements to the receive thread.
Magnitude conversion now happens immediately when sample data is
received, so there is no risk of newly received data clobbering old
data under CPU overload.
2015-04-09 18:51:31 +01:00
Oliver Jowett e1d262d992 Add --show-only for extracting messages from a single plane. 2015-02-22 23:01:54 +00:00
Oliver Jowett 8f3be2cd79 Decode aircraft category, export in aircraft.json.
Closes #2.
2015-02-22 12:15:26 +00:00
Oliver Jowett 474fe45256 Don't mark undecodable altitudes as ALTITUDE_VALID when decoding. 2015-02-09 22:53:18 +00:00
Oliver Jowett 54677f3ae0 Don't try to correct >1 error in DF11.
We already do this check when scoring a message for the demodulator,
but there are other paths that can feed us a message so also do the
check in the main decode path.
2015-02-09 22:51:34 +00:00
Oliver Jowett 9fd0c822f6 Extract NUCp from message type; needed for #16. 2015-02-09 14:14:12 +00:00
Oliver Jowett e7e7f9e7c2 Only display altitude when dumping position messages if it is valid. 2015-02-09 14:11:04 +00:00
Oliver Jowett f1201a0069 Third time lucky? 2015-02-08 18:17:33 +00:00
Oliver Jowett b31709a278 Whoops, remove stray debugging that was left in. 2015-02-08 18:16:49 +00:00
Oliver Jowett 4ecd6958a1 If we squelch the first message from an aircraft, emit it when we see a second message.
This is possible now that the SBS output doesn't rely on the global block timestamp;
the output will look like this:

MSG,8,111,11111,4AC954,111111,2015/02/08,17:57:53.917,2015/02/08,17:57:53.936,,,,,,,,,,,,0
MSG,7,111,11111,392AEB,111111,2015/02/08,17:57:53.744,2015/02/08,17:57:53.936,,15375,,,,,,,,,,0
MSG,8,111,11111,392AEB,111111,2015/02/08,17:57:53.917,2015/02/08,17:57:53.936,,,,,,,,,,,,0
MSG,6,111,11111,800387,111111,2015/02/08,17:57:53.919,2015/02/08,17:57:53.936,,,,,,,,4745,0,0,0,0

where the "receive timestamp" (first time column) goes backwards to reflect the original reception
time of the delayed message, but the "forwarded timestamp" (second time column) reflects the actual
forwarding time.
2015-02-08 18:00:18 +00:00
Oliver Jowett 899c51ce85 Only emit network messages once we have seen two of them
(except in --net-verbatim mode, where we emit them all)

Move aircraft tracking into track.[ch].

Clean up references to "interactive mode" when tracking
aircraft - we always track aircraft, even in non-interactive
mode.
2015-02-08 14:27:03 +00:00
Oliver Jowett 9381a20198 Support more DF18 message formats. Test for the IMF bit where appropriate.
Fixes #4.
2015-01-29 23:08:33 +00:00
Oliver Jowett 26feb1d078 Add some testing code that looks for ambiguous syndromes that
could confuse the partial correction used in DF11.

That code shows that yes, there are ambiguous syndromes in the
2-bit correction case only, so disable corrections of more than
1 bit in DF11.
2015-01-23 21:59:31 +00:00
Oliver Jowett 5020d75b9e Move setting of CF earlier so we can use its value while decoding AA.
(Needed to notice non-ICAO addresses in TIS-B)
2015-01-22 22:19:38 +00:00
Oliver Jowett 008ae926e7 Add --net-verbatim, which forwards the original uncorrected message to net clients,
not the corrected version. Then the client can make its own policy decisions about
whether to accept and correct the damaged messages.
2015-01-22 19:56:38 +00:00
Oliver Jowett a59077a370 Stats overhaul. 2015-01-22 19:49:19 +00:00
Oliver Jowett ada188a1c8 Changed my mind, put the non-ICAO flag bit in the address itself
since we have 8 bits spare, so there's no chance of confusing it
with an ICAO address, and we can safely use the filter table to match
future messages without also matching equivalent ICAO addresses.
2015-01-22 12:30:12 +00:00
Oliver Jowett 9a91507583 Flag non-ICAO addresses, display them differently in interactive mode. 2015-01-22 11:14:22 +00:00
Oliver Jowett 34ae2c7349 Make sure to clear address. 2015-01-22 11:13:54 +00:00
Oliver Jowett 04eff1778f Use the right field for CF in DF 18 2015-01-22 10:59:11 +00:00