Interactive list aircraft display and delete changes

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.
This commit is contained in:
Malcolm Robb 2013-08-19 15:55:17 +01:00
parent da8151dd70
commit 1ebdd6d7a7
2 changed files with 279 additions and 222 deletions

View file

@ -1,32 +1,32 @@
/* dump1090, a Mode S messages decoder for RTLSDR devices.
*
* Copyright (C) 2012 by Salvatore Sanfilippo <antirez@gmail.com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// dump1090, a Mode S messages decoder for RTLSDR devices.
//
// Copyright (C) 2012 by Salvatore Sanfilippo <antirez@gmail.com>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#ifndef __DUMP1090_H
#define __DUMP1090_H
@ -37,9 +37,9 @@
// 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.07.2305.13"
#define MODES_DUMP1090_VERSION "1.07.1908.13"
/* ============================= Include files ========================== */
// ============================= Include files ==========================
#ifndef _WIN32
#include <stdio.h>
@ -63,7 +63,7 @@
#include "rtl-sdr.h"
#endif
/* ============================= #defines =============================== */
// ============================= #defines ===============================
#ifdef USER_LATITUDE
#define MODES_USER_LATITUDE_DFLT (USER_LATITUDE)
@ -155,8 +155,9 @@
#define MODES_DEBUG_NOPREAMBLE_LEVEL 25
#define MODES_INTERACTIVE_REFRESH_TIME 250 // Milliseconds
#define MODES_INTERACTIVE_ROWS 15 // Rows on screen
#define MODES_INTERACTIVE_TTL 60 // TTL before being removed
#define MODES_INTERACTIVE_ROWS 22 // Rows on screen
#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_MAX_FD 1024
#define MODES_NET_INPUT_RAW_PORT 30001
@ -174,7 +175,7 @@
#define MODES_NOTUSED(V) ((void) V)
/* ======================== structure declarations ========================= */
//======================== structure declarations =========================
// Structure used to describe a networking client
struct client {
@ -278,7 +279,8 @@ struct { // Internal state
int quiet; // Suppress stdout
int interactive; // Interactive mode
int interactive_rows; // Interactive mode: max number of rows
int interactive_ttl; // Interactive mode: TTL before deletion
int interactive_display_ttl; // Interactive mode: TTL display
int interactive_delete_ttl; // Interactive mode: TTL before deletion
int stats; // Print stats at exit in --ifile mode
int onlyaddr; // Print only ICAO addresses
int metric; // Use metric units
@ -373,24 +375,38 @@ struct modesMessage {
int bFlags; // Flags related to fields in this structure
};
/* ======================== function declarations ========================= */
// ======================== function declarations =========================
#ifdef __cplusplus
extern "C" {
#endif
//
// Functions exported from mode_ac.c
//
int detectModeA (uint16_t *m, struct modesMessage *mm);
void decodeModeAMessage(struct modesMessage *mm, int ModeA);
int ModeAToModeC (unsigned int ModeA);
void interactiveShowData(void);
//
// Functions exported from interactive.c
//
struct aircraft* interactiveReceiveData(struct modesMessage *mm);
void interactiveShowData(void);
void interactiveRemoveStaleAircrafts(void);
//
// Functions exported from dump1090.c
//
void modesSendAllClients (int service, void *msg, int len);
void modesSendRawOutput (struct modesMessage *mm);
void modesSendBeastOutput (struct modesMessage *mm);
void modesSendSBSOutput (struct modesMessage *mm);
void useModesMessage (struct modesMessage *mm);
void decodeCPR (struct aircraft *a, int fflag, int surface);
int decodeCPRrelative(struct aircraft *a, int fflag, int surface);
int fixBitErrors (unsigned char *msg, int bits, int maxfix, char *fixedbits);
void modesInitErrorInfo ();