builds and runs

Former-commit-id: 5158d4459d5b43213803b859ae4491113cf765f9
Former-commit-id: cd1720a0ea9b781adbe21e052efb79b75bc137f1
This commit is contained in:
Nathan Matsuda 2020-03-10 16:56:59 -07:00
parent 8b23d25dd1
commit be5ec5c0ed
10 changed files with 12 additions and 12 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
*.svg *.svg
view1090 view1090
map1090
*.swp *.swp
.~ .~

View file

@ -9,7 +9,7 @@ int AircraftData::setupConnection(struct client *c) {
int fd; int fd;
// Try to connect to the selected ip address and port. We only support *ONE* input connection which we initiate.here. // 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) { if ((fd = anetTcpConnect(modes.aneterr, server, modes.net_input_beast_port)) != ANET_ERR) {
anetNonBlock(modes.aneterr, fd); anetNonBlock(modes.aneterr, fd);
// //
// Setup a service callback client structure for a beast binary input (from dump1090) // Setup a service callback client structure for a beast binary input (from dump1090)
@ -58,7 +58,7 @@ void AircraftData::connect() {
c = (struct client *) malloc(sizeof(*c)); c = (struct client *) malloc(sizeof(*c));
while(1) { while(1) {
if ((fd = setupConnection(c)) == ANET_ERR) { if ((fd = setupConnection(c)) == ANET_ERR) {
fprintf(stderr, "Waiting on %s:%d\n", View1090.net_input_beast_ipaddr, modes.net_input_beast_port); fprintf(stderr, "Waiting on %s:%d\n", server, modes.net_input_beast_port);
sleep(1); sleep(1);
} else { } else {
break; break;
@ -92,11 +92,10 @@ void AircraftData::update() {
AircraftData::AircraftData(){ AircraftData::AircraftData(){
// Default everything to zero/NULL // Default everything to zero/NULL
memset(&modes, 0, sizeof(Modes)); memset(&modes, 0, sizeof(Modes));
memset(&View1090, 0, sizeof(View1090));
// Now initialise things that should not be 0/NULL to their defaults // Now initialise things that should not be 0/NULL to their defaults
modes.check_crc = 1; modes.check_crc = 1;
strcpy(View1090.net_input_beast_ipaddr,VIEW1090_NET_OUTPUT_IP_ADDRESS); strcpy(server,VIEW1090_NET_OUTPUT_IP_ADDRESS);
modes.net_input_beast_port = MODES_NET_OUTPUT_BEAST_PORT; modes.net_input_beast_port = MODES_NET_OUTPUT_BEAST_PORT;
modes.interactive_rows = MODES_INTERACTIVE_ROWS; modes.interactive_rows = MODES_INTERACTIVE_ROWS;
modes.interactive_delete_ttl = MODES_INTERACTIVE_DELETE_TTL; modes.interactive_delete_ttl = MODES_INTERACTIVE_DELETE_TTL;

View file

@ -29,6 +29,8 @@ class AircraftData {
AircraftList aircraftList; AircraftList aircraftList;
Aircraft *selectedAircraft; Aircraft *selectedAircraft;
Modes modes; Modes modes;
char server[32];
}; };
#endif #endif

View file

@ -1,5 +1,5 @@
#ifndef INPUT_H #ifndef INPUT_H
#define INPUT #define INPUT_H
#include "AircraftData.h" #include "AircraftData.h"
#include "View.h" #include "View.h"

View file

@ -1 +0,0 @@
fca1e79ced7e4bc0ee43c01bdd40d67f708ae6bb

View file

@ -1 +0,0 @@
ad971cbbab08e7bc43c68649b1796aa31b989e1e

View file

@ -1 +1 @@
a18a4bc87ddef182cd7d61470daf952ae025186b 93406437edceb4cd6d39e963d3094663472f660b

View file

@ -34,6 +34,8 @@
#include "View.h" #include "View.h"
#include "Input.h" #include "Input.h"
#include <cstring>
//time utility, might change to std::chrono //time utility, might change to std::chrono
uint64_t mstime(void) { uint64_t mstime(void) {
struct timeval tv; struct timeval tv;
@ -96,10 +98,8 @@ int main(int argc, char **argv) {
aircraftData.modes.net_input_beast_port = atoi(argv[++j]); aircraftData.modes.net_input_beast_port = atoi(argv[++j]);
} else if (!strcmp(argv[j],"--port") && more) { } else if (!strcmp(argv[j],"--port") && more) {
aircraftData.modes.net_input_beast_port = atoi(argv[++j]); aircraftData.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],"--server") && more) { } else if (!strcmp(argv[j],"--server") && more) {
strcpy(View1090.net_input_beast_ipaddr, argv[++j]); std::strcpy(aircraftData.server, argv[++j]);
} else if (!strcmp(argv[j],"--lat") && more) { } else if (!strcmp(argv[j],"--lat") && more) {
aircraftData.modes.fUserLat = atof(argv[++j]); aircraftData.modes.fUserLat = atof(argv[++j]);
appData.centerLat = aircraftData.modes.fUserLat; appData.centerLat = aircraftData.modes.fUserLat;

View file

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
./view1090 --screensize 640 360 --fullscreen --server adsb --lat 47.6 --lon -122.3 ./map1090 --screensize 640 360 --fullscreen --server adsb --lat 47.6 --lon -122.3