The modesReadFromClient() funtion is called from modesReadFromClients(),
which in turn is called from backgroundTasks(). backgroundTasks() is
called from within the main processing loop.
However, modesReadFromClient() can and does block. It attempts to read
characters from the input stream, and loops whilst there was no error.
This stalls the main RTL processing loop until an error occurs. In order
to support simultaneous local reception (via our RTL dongle) and remote
forwarding (data received from the interweb) we cannot allow this
internet read to stall.
To fix this, in modesReadFromClient() attempt to read a buffer of data
(currently 0x400 bytes). If we get a full buffer of bytes, then process
them, and attempt to read another full buffer. Keep doing thios untill
we read only a partial buffer (less than 0x400 bytes). Process the
partial buffer bytes and return.
This allows us to occasionally process data that is arriving from the
internet (which is buffered anyway in the TCP stack), without blocking
local RTL dongle decoding.
Ok - this is likely to upset some people. Up until now, the vast
majority of the code has been in just one file - dump1090.c. This file
has grown so that it was approaching of 5000 lines long, and it was
becoming unmanagable. So I've split the file into several modules,
hopefully along fairly logical boundaries. The files are :
1) dump1090.c : Basically just the main() entry function, the help
function, the RTL dongle hardware interface, and a few orphan functions
that don't really fit anywhere else.
2) mode_s.c : This contains all the mode S / ADSB decoding functions.
3) mode_ac.c : This contains all the mode A & C decoding functions
4) interactive.c : This contains all the functions to maintain an
internal list of aircraft seen over the last period, and functions to
print them out to the local console.
5) net_io.c : This contains all the network input/output functions
allowing data to be passed in/out to/from other receivers, in formats
such as SBS-1/3, Beast, AVR and JavaScript.
Hopefully this should provide an easier way forward if/when more
functions are added.
Create two different Time-To-Live parameters for the interactive display
list.
1) Modes.interactive_display_ttl defines for how long the display of an
aircraft persists after the last received message. The default is
MODES_INTERACTIVE_DISPLAY_TTL, which is set to 60 seconds. This replaces
the previous Modes.interactive_ttl/MODES_INTERACTIVE_TTL settings (which
were also 60 seconds)
2) Add an additional Modes.interactive_delete_ttl parameter, and
default it to MODES_INTERACTIVE_DELETE_TTL, shich is set to 300
seconds/5 minutes. This defines for how long an aircraft persists in the
list structure after the last received message before being deleted.
Also tidy up a few comments.
I can't pretend that I understand what you guys are up to with all this Java stuff, but since the changes to the maon dump1090.c file are minimal I'll trust you :-)
Conflicts:
.gitignore
public_html/gmap.html
public_html/script.js
All conflicts fixed but you are still merging.
modified: .gitignore
modified: dump1090.c
new file: public_html/config.js
new file: public_html/coolclock/coolclock.js
new file: public_html/coolclock/excanvas.js
new file: public_html/coolclock/moreskins.js
new file: public_html/extension.js
modified: public_html/gmap.html
new file: public_html/options.js
new file: public_html/planeObject.js
modified: public_html/script.js
modified: public_html/style.css
"Please don't call authorities"-warning label is show on map if any special squawk is show.
modified: public_html/gmap.html
modified: public_html/script.js
modified: public_html/style.css
Fixed resetMap()-funtion to reset map-settings to default. Map saves last location and zoom values to localStorage.
Also added new css-class '.pointer'.
modified: public_html/gmap.html
modified: public_html/script.js
modified: public_html/style.css
Options:
SiteCircles = true;
SiteCirclesDistances = new Array(100,150,200);
Circles are only shown if 'SiteShow' is true. SiteCirclesDistances is array of numbers. Distances are in NM or km depending 'Metric'-settings.
modified: public_html/config.js
modified: public_html/script.js
Added option to show values in metric system.
Metric = false; // true|false
Removed unused conversion from aircraftsToJson() at dump1090.c-file.
Tweaked distance calculation to use google map api.
modified: dump1090.c
modified: public_html/config.js
modified: public_html/gmap.html
modified: public_html/script.js
Shows radars location on map. Default is not showing.
Settings:
SiteShow is boolean [true|false]
SiteLat & SiteLon in decimal format.
If using untrackedDeveloperSettings.js-file these settings can be
copy-pasted on that file:
SiteShow = false;
SiteLat = 45.0;
SiteLon = 9.0;
modified: public_html/config.js
modified: public_html/script.js
modified: public_html/style.css
Tweaked selected planes display so it won't push plane-table around. Added
link to FlightStats service and speed to selected plane table.
modified: public_html/script.js
modified: public_html/style.css
Load devel settings file after config.js and settings are saved for
developers even after merges.
modified: .gitignore
modified: public_html/config.js
modified: public_html/gmap.html
modified: public_html/script.js
Example file
--- untrackedDeveloperSettings.js ---
// Load this file after config.js so these settings are used
var CONST_CENTERLAT = 35.21928;
var CONST_CENTERLON = -80.94406;
var CONST_ZOOMLVL = 9;
--- untrackedDeveloperSettings.js END ---
This is the start of breaking the main dump109.c file into smaller
modules to make it a bit more maintainable.
Move all the #define and structure declarations into dump1090.h
Changes based on ideas from John VK1ET. His commit notes are as follows
:
1. Change input socket handling to avoid unnecessary memmove (use
pointers instead)
2. Add ability to read and decode binary beast format TCP.
3. Change output socket handling same as sbs_output - only call output
handler if there is a current client connected use separate ports for
beast in and out - no need for --net-beast flag. Will input/output
format defined by socket connected to. avr raw, beast binary and sbs can
be handled simultaneously.
4. Some comments changes, filtering of ModeAC to json,.
Resolves some merge conflicts that I couldn't find a way to fix during
the previous merge.
Remove a few Tabs that escaped in the edit/merge
Rename the fix_errors flag variable to nFix_crc since it now represents
the number of crc errors to attempt to fix.
Remove the aggressive variable since it's now part of nFix_crc
Only print phase correction statistics when phase correction is enabled.
Add an additional Modes.stat_ph_bit_fix[] to count the bits fixed during
phase correction
Sorry Ulrich - I can't get Github to resolve the merge errors and
preserve your commit notes, so I'll add them here.
Improvements on bit error correction, doc update, preparation for
program installation/package build
Hi,
I committed some further improvements on the bit error correction code,
updated the readme, and implemented a way to install the program in the
linux file system hierarchy (allows for package building).
Regards,
Ulrich
Bug fixes in the SBS output code as a result of an EMAIL from Liviu
Some software gets upset if null fields are output where the software is
expecting a valid value. This was being caused by DF0's outputting and
SBS MSG5. MSG5 needs Atert and SPI flags, which are derived from the FS
field. DF0 doesn't have an FS field, so cannot output a MSG5. Change so
that DF0 results in an SBS MSG7.
Also DF17/DF18 metypes 5 to 18 contain raw Lat/Lon data. However they
cannot be decoded into real Lat/Lon values unless both even and odd
parts are available Therefore, when we receive a DF17/DF18 we need to
check that we have successfully decoded the Lat/Lon before we attempt to
send an SBS MSG2 or MSG3. If we don't have a decoded Lat/Lon, send a
MSG7 instead.
untrackedDeveloperSettings.js
Create file and add line `var developerSettings = true;` on top of it.
After that some settings can be overwritten with deleloper's flavour.
-- Example File w/o line numbers --
var developerSettings = true;
var CONST_CENTERLAT = 60.0; // 45.0
var CONST_CENTERLON = 20.0; // 9.0
var CONST_ZOOMLVL = 6; //5
-- End of Example File --
modified: .gitignore
modified: public_html/gmap.html
modified: public_html/script.js