Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
// view1090, a Mode S messages viewer for dump1090 devices.
|
|
|
|
//
|
2014-04-25 15:48:14 +02:00
|
|
|
// Copyright (C) 2014 by Malcolm Robb <Support@ATTAvionics.com>
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
#include "view1090.h"
|
|
|
|
//
|
|
|
|
// ============================= Utility functions ==========================
|
|
|
|
//
|
|
|
|
void sigintHandler(int dummy) {
|
|
|
|
NOTUSED(dummy);
|
|
|
|
signal(SIGINT, SIG_DFL); // reset signal handler - bit extra safety
|
|
|
|
Modes.exit = 1; // Signal to threads that we are done
|
|
|
|
}
|
|
|
|
//
|
2014-02-22 23:11:11 +01:00
|
|
|
// =============================== Terminal handling ========================
|
|
|
|
//
|
|
|
|
#ifndef _WIN32
|
|
|
|
// Get the number of rows after the terminal changes size.
|
|
|
|
int getTermRows() {
|
|
|
|
struct winsize w;
|
|
|
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
|
|
|
return (w.ws_row);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Handle resizing terminal
|
|
|
|
void sigWinchCallback() {
|
|
|
|
signal(SIGWINCH, SIG_IGN);
|
|
|
|
Modes.interactive_rows = getTermRows();
|
|
|
|
interactiveShowData();
|
|
|
|
signal(SIGWINCH, sigWinchCallback);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
int getTermRows() { return MODES_INTERACTIVE_ROWS;}
|
|
|
|
#endif
|
|
|
|
//
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
// =============================== Initialization ===========================
|
|
|
|
//
|
|
|
|
void view1090InitConfig(void) {
|
|
|
|
// Default everything to zero/NULL
|
|
|
|
memset(&Modes, 0, sizeof(Modes));
|
|
|
|
memset(&View1090, 0, sizeof(View1090));
|
|
|
|
|
|
|
|
// Now initialise things that should not be 0/NULL to their defaults
|
|
|
|
Modes.check_crc = 1;
|
|
|
|
strcpy(View1090.net_input_beast_ipaddr,VIEW1090_NET_OUTPUT_IP_ADDRESS);
|
|
|
|
Modes.net_input_beast_port = MODES_NET_OUTPUT_BEAST_PORT;
|
2014-02-22 23:11:11 +01:00
|
|
|
Modes.interactive_rows = getTermRows();
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
Modes.interactive_display_ttl = MODES_INTERACTIVE_DISPLAY_TTL;
|
|
|
|
|
|
|
|
Modes.interactive = 1;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
//=========================================================================
|
|
|
|
//
|
|
|
|
void view1090Init(void) {
|
|
|
|
|
2014-07-10 19:11:13 +02:00
|
|
|
pthread_mutex_init(&Modes.data_mutex,NULL);
|
|
|
|
pthread_cond_init(&Modes.data_cond,NULL);
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
if ( (!Modes.wsaData.wVersion)
|
|
|
|
&& (!Modes.wsaData.wHighVersion) ) {
|
|
|
|
// Try to start the windows socket support
|
|
|
|
if (WSAStartup(MAKEWORD(2,1),&Modes.wsaData) != 0)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "WSAStartup returned Error\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
// Validate the users Lat/Lon home location inputs
|
|
|
|
if ( (Modes.fUserLat > 90.0) // Latitude must be -90 to +90
|
|
|
|
|| (Modes.fUserLat < -90.0) // and
|
|
|
|
|| (Modes.fUserLon > 360.0) // Longitude must be -180 to +360
|
|
|
|
|| (Modes.fUserLon < -180.0) ) {
|
|
|
|
Modes.fUserLat = Modes.fUserLon = 0.0;
|
|
|
|
} else if (Modes.fUserLon > 180.0) { // If Longitude is +180 to +360, make it -180 to 0
|
|
|
|
Modes.fUserLon -= 360.0;
|
|
|
|
}
|
|
|
|
// If both Lat and Lon are 0.0 then the users location is either invalid/not-set, or (s)he's in the
|
|
|
|
// Atlantic ocean off the west coast of Africa. This is unlikely to be correct.
|
|
|
|
// Set the user LatLon valid flag only if either Lat or Lon are non zero. Note the Greenwich meridian
|
|
|
|
// is at 0.0 Lon,so we must check for either fLat or fLon being non zero not both.
|
|
|
|
// Testing the flag at runtime will be much quicker than ((fLon != 0.0) || (fLat != 0.0))
|
|
|
|
Modes.bUserFlags &= ~MODES_USER_LATLON_VALID;
|
|
|
|
if ((Modes.fUserLat != 0.0) || (Modes.fUserLon != 0.0)) {
|
|
|
|
Modes.bUserFlags |= MODES_USER_LATLON_VALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Prepare error correction tables
|
2015-01-21 00:04:05 +01:00
|
|
|
modesChecksumInit(Modes.nfix_crc);
|
2015-01-21 00:53:26 +01:00
|
|
|
icaoFilterInit();
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
}
|
2014-07-02 13:38:46 +02:00
|
|
|
|
|
|
|
// Set up data connection
|
|
|
|
int setupConnection(struct client *c) {
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
// Try to connect to the selected ip address and port. We only support *ONE* input connection which we initiate.here.
|
|
|
|
if ((fd = anetTcpConnect(Modes.aneterr, View1090.net_input_beast_ipaddr, Modes.net_input_beast_port)) != ANET_ERR) {
|
2014-07-02 13:41:43 +02:00
|
|
|
anetNonBlock(Modes.aneterr, fd);
|
2014-07-02 13:38:46 +02:00
|
|
|
//
|
|
|
|
// Setup a service callback client structure for a beast binary input (from dump1090)
|
|
|
|
// This is a bit dodgy under Windows. The fd parameter is a handle to the internet
|
|
|
|
// socket on which we are receiving data. Under Linux, these seem to start at 0 and
|
|
|
|
// count upwards. However, Windows uses "HANDLES" and these don't nececeriy start at 0.
|
|
|
|
// dump1090 limits fd to values less than 1024, and then uses the fd parameter to
|
|
|
|
// index into an array of clients. This is ok-ish if handles are allocated up from 0.
|
|
|
|
// However, there is no gaurantee that Windows will behave like this, and if Windows
|
|
|
|
// allocates a handle greater than 1024, then dump1090 won't like it. On my test machine,
|
|
|
|
// the first Windows handle is usually in the 0x54 (84 decimal) region.
|
|
|
|
|
|
|
|
c->next = NULL;
|
|
|
|
c->buflen = 0;
|
|
|
|
c->fd =
|
|
|
|
c->service =
|
|
|
|
Modes.bis = fd;
|
|
|
|
Modes.clients = c;
|
|
|
|
}
|
|
|
|
return fd;
|
|
|
|
}
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
//
|
|
|
|
// ================================ Main ====================================
|
|
|
|
//
|
|
|
|
void showHelp(void) {
|
|
|
|
printf(
|
|
|
|
"-----------------------------------------------------------------------------\n"
|
2014-12-10 13:44:00 +01:00
|
|
|
"| view1090 ModeS Viewer %45s |\n"
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
"-----------------------------------------------------------------------------\n"
|
|
|
|
"--interactive Interactive mode refreshing data on screen\n"
|
|
|
|
"--interactive-rows <num> Max number of rows in interactive mode (default: 15)\n"
|
|
|
|
"--interactive-ttl <sec> Remove from list if idle for <sec> (default: 60)\n"
|
|
|
|
"--interactive-rtl1090 Display flight table in RTL1090 format\n"
|
|
|
|
"--modeac Enable decoding of SSR modes 3/A & 3/C\n"
|
|
|
|
"--net-bo-ipaddr <IPv4> TCP Beast output listen IPv4 (default: 127.0.0.1)\n"
|
|
|
|
"--net-bo-port <port> TCP Beast output listen port (default: 30005)\n"
|
|
|
|
"--lat <latitude> Reference/receiver latitide for surface posn (opt)\n"
|
|
|
|
"--lon <longitude> Reference/receiver longitude for surface posn (opt)\n"
|
|
|
|
"--no-crc-check Disable messages with broken CRC (discouraged)\n"
|
|
|
|
"--no-fix Disable single-bits error correction using CRC\n"
|
|
|
|
"--fix Enable single-bits error correction using CRC\n"
|
|
|
|
"--aggressive More CPU for more messages (two bits fixes, ...)\n"
|
|
|
|
"--metric Use metric units (meters, km/h, ...)\n"
|
2014-12-10 13:44:00 +01:00
|
|
|
"--help Show this help\n",
|
|
|
|
MODES_DUMP1090_VARIANT " " MODES_DUMP1090_VERSION
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
);
|
|
|
|
}
|
2014-04-25 15:48:14 +02:00
|
|
|
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
//
|
|
|
|
//=========================================================================
|
|
|
|
//
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
int j, fd;
|
|
|
|
struct client *c;
|
2014-07-02 13:38:46 +02:00
|
|
|
char pk_buf[8];
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
|
|
|
|
// Set sane defaults
|
|
|
|
|
|
|
|
view1090InitConfig();
|
|
|
|
signal(SIGINT, sigintHandler); // Define Ctrl/C handler (exit program)
|
|
|
|
|
|
|
|
// Parse the command line options
|
|
|
|
for (j = 1; j < argc; j++) {
|
|
|
|
int more = ((j + 1) < argc); // There are more arguments
|
|
|
|
|
|
|
|
if (!strcmp(argv[j],"--net-bo-port") && more) {
|
|
|
|
Modes.net_input_beast_port = atoi(argv[++j]);
|
|
|
|
} else if (!strcmp(argv[j],"--net-bo-ipaddr") && more) {
|
|
|
|
strcpy(View1090.net_input_beast_ipaddr, argv[++j]);
|
|
|
|
} else if (!strcmp(argv[j],"--modeac")) {
|
|
|
|
Modes.mode_ac = 1;
|
|
|
|
} else if (!strcmp(argv[j],"--interactive-rows") && more) {
|
|
|
|
Modes.interactive_rows = atoi(argv[++j]);
|
|
|
|
} else if (!strcmp(argv[j],"--interactive")) {
|
|
|
|
Modes.interactive = 1;
|
|
|
|
} else if (!strcmp(argv[j],"--interactive-ttl") && more) {
|
2015-02-10 22:49:37 +01:00
|
|
|
Modes.interactive_display_ttl = (uint64_t)(1000 * atof(argv[++j]));
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
} else if (!strcmp(argv[j],"--interactive-rtl1090")) {
|
|
|
|
Modes.interactive = 1;
|
|
|
|
Modes.interactive_rtl1090 = 1;
|
|
|
|
} else if (!strcmp(argv[j],"--lat") && more) {
|
|
|
|
Modes.fUserLat = atof(argv[++j]);
|
|
|
|
} else if (!strcmp(argv[j],"--lon") && more) {
|
|
|
|
Modes.fUserLon = atof(argv[++j]);
|
|
|
|
} else if (!strcmp(argv[j],"--metric")) {
|
|
|
|
Modes.metric = 1;
|
|
|
|
} else if (!strcmp(argv[j],"--no-crc-check")) {
|
|
|
|
Modes.check_crc = 0;
|
|
|
|
} else if (!strcmp(argv[j],"--fix")) {
|
|
|
|
Modes.nfix_crc = 1;
|
|
|
|
} else if (!strcmp(argv[j],"--no-fix")) {
|
|
|
|
Modes.nfix_crc = 0;
|
|
|
|
} else if (!strcmp(argv[j],"--aggressive")) {
|
|
|
|
Modes.nfix_crc = MODES_MAX_BITERRORS;
|
|
|
|
} else if (!strcmp(argv[j],"--help")) {
|
|
|
|
showHelp();
|
|
|
|
exit(0);
|
|
|
|
} else {
|
|
|
|
fprintf(stderr, "Unknown or not enough arguments for option '%s'.\n\n", argv[j]);
|
|
|
|
showHelp();
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-25 15:48:14 +02:00
|
|
|
#ifdef _WIN32
|
|
|
|
// Try to comply with the Copyright license conditions for binary distribution
|
|
|
|
if (!Modes.quiet) {showCopyright();}
|
2014-07-10 19:11:13 +02:00
|
|
|
#define MSG_DONTWAIT 0
|
2014-04-25 15:48:14 +02:00
|
|
|
#endif
|
|
|
|
|
2014-02-22 23:11:11 +01:00
|
|
|
#ifndef _WIN32
|
|
|
|
// Setup for SIGWINCH for handling lines
|
|
|
|
if (Modes.interactive) {signal(SIGWINCH, sigWinchCallback);}
|
|
|
|
#endif
|
|
|
|
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
// Initialization
|
|
|
|
view1090Init();
|
|
|
|
|
|
|
|
// Try to connect to the selected ip address and port. We only support *ONE* input connection which we initiate.here.
|
2014-07-02 13:38:46 +02:00
|
|
|
c = (struct client *) malloc(sizeof(*c));
|
|
|
|
if ((fd = setupConnection(c)) == ANET_ERR) {
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
fprintf(stderr, "Failed to connect to %s:%d\n", View1090.net_input_beast_ipaddr, Modes.net_input_beast_port);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Keep going till the user does something that stops us
|
|
|
|
while (!Modes.exit) {
|
2015-01-21 00:53:26 +01:00
|
|
|
icaoFilterExpire();
|
2015-02-08 15:27:03 +01:00
|
|
|
trackPeriodicUpdate();
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
interactiveShowData();
|
2014-07-02 13:38:46 +02:00
|
|
|
if ((fd == ANET_ERR) || (recv(c->fd, pk_buf, sizeof(pk_buf), MSG_PEEK | MSG_DONTWAIT) == 0)) {
|
|
|
|
free(c);
|
|
|
|
usleep(1000000);
|
|
|
|
c = (struct client *) malloc(sizeof(*c));
|
|
|
|
fd = setupConnection(c);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
modesReadFromClient(c,"",decodeBinMessage);
|
2014-07-03 08:41:06 +02:00
|
|
|
usleep(100000);
|
Implement a remote interactive screen
No changes to dump1090, (except the version number)
Include a sample Linux batch start file called dump1090.sh for use when
running dump1090 headless. This file needs to be copied to the
/etc/init.d/ subdirectory on your raspberry pi, and marked as
executable. Then when you re-start your RPi, dump1090 will start-up
auto-magically and run as a sort of server to allow both local and
remote connection to it's various internet ports.
Modified the Makefile to build a new headless helper application called
view1090
Added view1090. This is an executable that allows you to connect to
dump1090 when it is running and 'see' the interactive screen display.
The default is to try and connect to dump1090 on IP address 127.0.0.1
port 30005. This should work if you are running on the same RPi as
dump1090 and using the default dump1090 port settings. However, if
you're running on a different machine you will have to specify the IP
address of the RPi running dump1090 using the --net-bo-ipaddr switch.
Something like "view1090 --net-bo-ipaddr 192.168.2.65" . You may also
have to sudo it, depending on your privilige settings.
I've also compiled view1090 as a Wiin32 exe, so you should be able to
run it under any 32 bit version of Microsoft Windows - i.e. Win95, Win
2K, Win XP, Win 7 etc. It may work on Win 8 and 64 bit Windows, but I
haven't tried it. The Win32 version is compiled from the same source, so
takes all the same command line switches.
2013-09-24 19:37:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// The user has stopped us, so close any socket we opened
|
|
|
|
if (fd != ANET_ERR)
|
|
|
|
{close(fd);}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
//
|
|
|
|
//=========================================================================
|
|
|
|
//
|