diff --git a/Release/view1090.exe b/Release/view1090.exe index 2a879c5..db55062 100644 Binary files a/Release/view1090.exe and b/Release/view1090.exe differ diff --git a/coaa1090.obj b/coaa1090.obj index 7e35631..845210c 100644 Binary files a/coaa1090.obj and b/coaa1090.obj differ diff --git a/dump1090.c b/dump1090.c index 70a4d04..b8ec611 100644 --- a/dump1090.c +++ b/dump1090.c @@ -69,6 +69,7 @@ void modesInitConfig(void) { Modes.gain = MODES_MAX_GAIN; Modes.freq = MODES_DEFAULT_FREQ; Modes.check_crc = 1; + Modes.net_heartbeat_rate = MODES_NET_HEARTBEAT_RATE; Modes.net_output_sbs_port = MODES_NET_OUTPUT_SBS_PORT; Modes.net_output_raw_port = MODES_NET_OUTPUT_RAW_PORT; Modes.net_input_raw_port = MODES_NET_INPUT_RAW_PORT; @@ -412,6 +413,7 @@ void showHelp(void) { "--net-bo-port TCP Beast output listen port (default: 30005)\n" "--net-ro-size TCP raw output minimum size (default: 0)\n" "--net-ro-rate TCP raw output memory flush rate (default: 0)\n" +"--net-heartbeat TCP heartbeat rate in seconds (default: 60 sec)\n" "--lat Reference/receiver latitude for surface posn (opt)\n" "--lon Reference/receiver longitude for surface posn (opt)\n" "--fix Enable single-bits error correction using CRC\n" @@ -503,7 +505,9 @@ int main(int argc, char **argv) { } else if (!strcmp(argv[j],"--net-only")) { Modes.net = 1; Modes.net_only = 1; - } else if (!strcmp(argv[j],"--net-ro-size") && more) { + } else if (!strcmp(argv[j],"--net-heartbeat") && more) { + Modes.net_heartbeat_rate = atoi(argv[++j]) * 15; + } else if (!strcmp(argv[j],"--net-ro-size") && more) { Modes.net_output_raw_size = atoi(argv[++j]); } else if (!strcmp(argv[j],"--net-ro-rate") && more) { Modes.net_output_raw_rate = atoi(argv[++j]); diff --git a/dump1090.h b/dump1090.h index 28d7cf3..68bc6d9 100644 --- a/dump1090.h +++ b/dump1090.h @@ -37,7 +37,7 @@ // MinorVer changes when additional features are added, but not for bug fixes (range 00-99) // DayDate & Year changes for all changes, including for bug fixes. It represent the release date of the update // -#define MODES_DUMP1090_VERSION "1.08.2302.14" +#define MODES_DUMP1090_VERSION "1.08.1003.14" // ============================= Include files ========================== @@ -163,6 +163,8 @@ #define MODES_INTERACTIVE_DELETE_TTL 300 // Delete from the list after 300 seconds #define MODES_INTERACTIVE_DISPLAY_TTL 60 // Delete from display after 60 seconds +#define MODES_NET_HEARTBEAT_RATE 900 // Each block is approx 65mS - default is > 1 min + #define MODES_NET_SERVICES_NUM 6 #define MODES_NET_MAX_FD 1024 #define MODES_NET_INPUT_RAW_PORT 30001 @@ -281,6 +283,8 @@ struct { // Internal state int debug; // Debugging mode int net; // Enable networking int net_only; // Enable just networking + int net_heartbeat_count; // TCP heartbeat counter + int net_heartbeat_rate; // TCP heartbeat rate int net_output_sbs_port; // SBS output TCP port int net_output_raw_size; // Minimum Size of the output raw data int net_output_raw_rate; // Rate (in 64mS increments) of output raw data diff --git a/mode_s.c b/mode_s.c index 84bef2d..e5e9c81 100644 --- a/mode_s.c +++ b/mode_s.c @@ -1812,6 +1812,25 @@ void detectModeS(uint16_t *m, uint32_t mlen) { Modes.net_output_raw_rate_count = 0; } } + else if ( (Modes.net) + && (Modes.net_heartbeat_rate) + && ((++Modes.net_heartbeat_count) > Modes.net_heartbeat_rate) ) { + // + // We haven't received any Mode A/C/S messages for some time. To try and keep any TCP + // links alive, send a null frame. This will help stop any routers discarding our TCP + // link which will cause an un-recoverable link error if/when a real frame arrives. + // + // Fudge up a null message + memset(&mm, 0, sizeof(mm)); + mm.msgbits = MODES_SHORT_MSG_BITS; + mm.timestampMsg = Modes.timestampBlk; + + // Feed output clients + modesQueueOutput(&mm); + + // Reset the heartbeat counter + Modes.net_heartbeat_count = 0; + } } // //========================================================================= @@ -1836,6 +1855,9 @@ void useModesMessage(struct modesMessage *mm) { // Feed output clients if (Modes.net) {modesQueueOutput(mm);} + + // Heartbeat not required whilst we're seeing real messages + Modes.net_heartbeat_count = 0; } } //