forked from JvanKatwijk/qt-1090
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qt-1090.h
executable file
·119 lines (110 loc) · 3.43 KB
/
qt-1090.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#
/*
* qt-1090 is based on and contains source code from dump1090
* Copyright (C) 2012 by Salvatore Sanfilippo <[email protected]>
* all rights acknowledged.
*
* Copyright (C) 2018
* Jan van Katwijk ([email protected])
* Lazy Chair Computing
*
* This file is part of the qt-1090
*
* qt-1090 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* qt-1090 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with qt-1090; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __QT_1090__
#define __QT_1090__
#include "adsb-constants.h"
#include <QMainWindow>
#include <QObject>
#include <QSettings>
#include <QMessageBox>
#include <QCloseEvent>
#include <QTimer>
#include <stdio.h>
#include "qhttpserverfwd.h"
#include <qhttpserver.h>
#include <qhttprequest.h>
#include <qhttpresponse.h>
#include "message-handling.h"
#include "ui_qt-1090.h"
class deviceHandler;
class syncViewer;
class qt1090: public QMainWindow, private Ui_mainwindow {
Q_OBJECT
public:
qt1090 (QSettings *, int freq, bool network);
~qt1090 (void);
private:
void finalize (void);
void closeEvent (QCloseEvent *event);
int decodeBits (uint8_t *bits, uint16_t *m);
void detectModeS (uint16_t *m, uint32_t mlen);
void update_table (int16_t, int);
deviceHandler *setDevice (int32_t, bool);
int table [32];
QHttpServer *httpServer;
QTimer screenTimer;
public slots:
void processData (void);
private:
pthread_t reader_thread;
deviceHandler *theDevice;
QSettings *qt1090Settings;
uint16_t *magnitudeVector;
uint32_t data_len; /* Buffer length. */
int httpPort;
syncViewer *viewer;
bool singleView;
// Configuration */
bool net; /* Enable networking. */
bool interactive; /* Interactive mode */
bool metric; /* Use metric units. */
int bitstoShow;
FILE *dumpfilePointer;
public:
icaoCache *icao_cache;
bool check_crc; /* Only display messages with good CRC. */
int handle_errors; /* Level of error correction */
int interactive_ttl; /* Interactive mode: TTL before deletion. */
int debug; /* Debugging mode. */
// Interactive mode */
aircraft *planeList;
long long interactive_last_update; /* Last screen update in milliseconds */
void sendMap (QHttpResponse *);
void sendPlaneData (QHttpResponse *, aircraft *);
// Statistics */
public:
long long stat_valid_preamble;
long long stat_goodcrc;
long long stat_badcrc;
long long stat_fixed;
long long stat_single_bit_fix;
long long stat_two_bits_fix;
long long stat_http_requests;
long long stat_phase_corrected;
private slots:
void handle_interactiveButton (void);
void handle_errorhandlingCombo (const QString &);
void handle_httpButton (void);
void set_ttl (int);
void handle_metricButton (void);
void handleRequest (QHttpRequest *,
QHttpResponse *);
void updateScreen (void);
void handle_dumpButton (void);
void handle_viewButton (void);
};
#endif