2017-10-06 05:25:30 +02:00
|
|
|
#ifndef STRUCTS
|
|
|
|
#define STRUCTS
|
|
|
|
|
2017-09-14 05:21:36 +02:00
|
|
|
#include "defs.h"
|
|
|
|
|
2019-09-09 06:23:38 +02:00
|
|
|
typedef struct AppData
|
2017-09-14 05:21:36 +02:00
|
|
|
{
|
2019-09-08 01:11:20 +02:00
|
|
|
SDL_Window *window;
|
|
|
|
SDL_Renderer *renderer;
|
2020-02-18 07:19:45 +01:00
|
|
|
SDL_Texture *mapTexture;
|
2017-10-06 05:25:30 +02:00
|
|
|
|
2019-09-08 01:11:20 +02:00
|
|
|
TTF_Font *mapFont;
|
|
|
|
TTF_Font *mapBoldFont;
|
|
|
|
TTF_Font *listFont;
|
2017-10-06 18:34:36 +02:00
|
|
|
|
2019-09-08 01:11:20 +02:00
|
|
|
TTF_Font *messageFont;
|
|
|
|
TTF_Font *labelFont;
|
2017-10-06 18:34:36 +02:00
|
|
|
|
2017-10-10 22:56:05 +02:00
|
|
|
int mapFontWidth;
|
|
|
|
int mapFontHeight;
|
2017-10-06 18:34:36 +02:00
|
|
|
int labelFontWidth;
|
|
|
|
int labelFontHeight;
|
|
|
|
int messageFontWidth;
|
|
|
|
int messageFontHeight;
|
2017-09-16 04:25:26 +02:00
|
|
|
|
2019-09-09 06:23:38 +02:00
|
|
|
// map options
|
|
|
|
int showList;
|
|
|
|
int mapLogDist;
|
|
|
|
float maxDist;
|
|
|
|
|
|
|
|
//display options
|
|
|
|
int screen_upscale;
|
|
|
|
int screen_uiscale;
|
|
|
|
int screen_width;
|
|
|
|
int screen_height;
|
|
|
|
int screen_depth;
|
|
|
|
int fullscreen;
|
|
|
|
|
|
|
|
double centerLon;
|
|
|
|
double centerLat;
|
|
|
|
|
2020-02-17 06:54:46 +01:00
|
|
|
uint64_t touchDownTime;
|
|
|
|
int touchx;
|
|
|
|
int touchy;
|
|
|
|
|
2020-02-18 07:19:45 +01:00
|
|
|
int mapMoved;
|
2020-02-19 00:37:41 +01:00
|
|
|
QuadTree *mapContinue;
|
2020-02-18 07:19:45 +01:00
|
|
|
|
2019-09-09 06:23:38 +02:00
|
|
|
uint64_t lastFrameTime;
|
|
|
|
} AppData;
|
|
|
|
|
|
|
|
AppData appData;
|
|
|
|
|
|
|
|
// mirrors aircraft struct in dump1090, separating for refactoring
|
|
|
|
|
|
|
|
struct planeObj {
|
|
|
|
uint32_t addr; // ICAO address
|
|
|
|
char flight[16]; // Flight number
|
|
|
|
unsigned char signalLevel[8]; // Last 8 Signal Amplitudes
|
2019-09-09 06:52:09 +02:00
|
|
|
double messageRate;
|
2019-09-09 06:23:38 +02:00
|
|
|
int altitude; // Altitude
|
|
|
|
int speed; // Velocity
|
|
|
|
int track; // Angle of flight
|
|
|
|
int vert_rate; // Vertical rate.
|
|
|
|
time_t seen; // Time at which the last packet was received
|
2019-09-09 08:17:40 +02:00
|
|
|
time_t seenLatLon; // Time at which the last packet was received
|
2019-09-09 06:52:09 +02:00
|
|
|
time_t prev_seen;
|
2019-09-09 06:23:38 +02:00
|
|
|
double lat, lon; // Coordinated obtained from CPR encoded data
|
|
|
|
|
|
|
|
//history
|
|
|
|
double oldLon[TRAIL_LENGTH];
|
|
|
|
double oldLat[TRAIL_LENGTH];
|
|
|
|
double oldHeading[TRAIL_LENGTH];
|
|
|
|
time_t oldSeen[TRAIL_LENGTH];
|
|
|
|
uint8_t oldIdx;
|
|
|
|
uint64_t created;
|
2019-09-09 08:17:40 +02:00
|
|
|
uint64_t msSeen;
|
|
|
|
uint64_t msSeenLatLon;
|
2019-09-09 06:23:38 +02:00
|
|
|
int live;
|
|
|
|
|
|
|
|
struct planeObj *next; // Next aircraft in our linked list
|
2019-09-16 02:54:06 +02:00
|
|
|
|
|
|
|
//// label stuff
|
|
|
|
|
|
|
|
int x, y, cx, cy, w, h;
|
|
|
|
float ox, oy, dox, doy, ddox, ddoy;
|
2019-09-22 03:46:52 +02:00
|
|
|
float pressure;
|
2019-09-09 06:23:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct planeObj *planes;
|
|
|
|
|
2020-02-18 03:11:05 +01:00
|
|
|
|
|
|
|
struct planeObj *selectedPlane;
|
|
|
|
|
2019-09-09 06:23:38 +02:00
|
|
|
struct {
|
|
|
|
double msgRate;
|
|
|
|
double avgSig;
|
|
|
|
int numPlanes;
|
|
|
|
int numVisiblePlanes;
|
|
|
|
double maxDist;
|
|
|
|
struct aircraft *closeCall;
|
|
|
|
} Status;
|
2017-09-17 17:38:22 +02:00
|
|
|
|
2017-09-16 04:25:26 +02:00
|
|
|
// functions
|
|
|
|
|
|
|
|
//font.c
|
|
|
|
TTF_Font *loadFont(char *, int);
|
|
|
|
void closeFont(TTF_Font *);
|
|
|
|
void drawString(char *, int, int, TTF_Font *, SDL_Color);
|
2017-10-06 18:34:36 +02:00
|
|
|
void drawString90(char *, int, int, TTF_Font *, SDL_Color);
|
2017-09-17 17:38:22 +02:00
|
|
|
void drawStringBG(char *, int, int, TTF_Font *, SDL_Color, SDL_Color);
|
2017-09-16 04:25:26 +02:00
|
|
|
|
|
|
|
//init.c
|
|
|
|
void init(char *);
|
|
|
|
void cleanup(void);
|
|
|
|
|
|
|
|
//input.c
|
|
|
|
void getInput(void);
|
|
|
|
|
2017-09-17 16:46:48 +02:00
|
|
|
//mapdata.c
|
2017-09-17 17:38:22 +02:00
|
|
|
void initMaps();
|
|
|
|
|
|
|
|
//list.c
|
2019-09-08 21:29:21 +02:00
|
|
|
void drawList(int top);
|
2017-10-05 16:58:23 +02:00
|
|
|
|
|
|
|
//draw.c
|
2017-10-06 05:25:30 +02:00
|
|
|
void draw();
|
2020-02-17 06:54:46 +01:00
|
|
|
void latLonFromScreenCoords(double *lat, double *lon, int x, int y);
|
|
|
|
|
2017-10-06 05:25:30 +02:00
|
|
|
|
|
|
|
//status.c
|
|
|
|
void updateStatus();
|
|
|
|
void drawStatus();
|
|
|
|
|
2019-09-09 06:23:38 +02:00
|
|
|
//planeObj.c
|
|
|
|
void updatePlanes();
|
|
|
|
|
|
|
|
|
2017-10-06 05:25:30 +02:00
|
|
|
#endif
|