-
Notifications
You must be signed in to change notification settings - Fork 83
/
mainwindow.h
249 lines (218 loc) · 8.32 KB
/
mainwindow.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/*
Copyright 2016-2017 Benjamin Vedder [email protected]
This program 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 3 of the License, or
(at your option) any later version.
This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QList>
#include <QTimer>
#include <QSerialPort>
#include <QLabel>
#include <QTcpSocket>
#include "carinterface.h"
#include "copterinterface.h"
#include "packetinterface.h"
#include "ping.h"
#include "nmeaserver.h"
#include "rtcm3_simple.h"
#include "intersectiontest.h"
#include "tcpclientmulti.h"
#include "wireguard.h"
#include <memory>
#ifdef HAS_LIME_SDR
#include "gpssim.h"
#endif
#ifdef HAS_SIM_SCEN
#include "pagesimscen.h"
#endif
#ifdef HAS_JOYSTICK
#include "joystick.h"
#endif
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
bool eventFilter(QObject *object, QEvent *e);
void addCar(int id, bool pollData = false);
void connectJoystick(QString dev);
void addTcpConnection(QString ip, int port);
void setNetworkTcpEnabled(bool enabled, int port = -1);
void setNetworkUdpEnabled(bool enabled, int port = -1);
MapWidget *map();
private slots:
void serialDataAvailable();
void serialPortError(QSerialPort::SerialPortError error);
void timerSlot();
void sendHeartbeat();
void showStatusInfo(QString info, bool isGood);
void packetDataToSend(QByteArray &data);
void stateReceived(quint8 id, CAR_STATE state);
void mrStateReceived(quint8 id, MULTIROTOR_STATE state);
void mapPosSet(quint8 id, LocPoint pos);
void ackReceived(quint8 id, CMD_PACKET cmd, QString msg);
void rtcmReceived(QByteArray data);
void rtcmRefPosGet();
void pingRx(int time, QString msg);
void pingError(QString msg, QString error);
void enuRx(quint8 id, double lat, double lon, double height);
void nmeaGgaRx(int fields, NmeaServer::nmea_gga_info_t gga);
void routePointAdded(LocPoint pos);
void infoTraceChanged(int traceNow);
void jsButtonChanged(int button, bool pressed);
void on_carAddButton_clicked();
void on_copterAddButton_clicked();
void on_serialConnectButton_clicked();
void on_serialRefreshButton_clicked();
void on_disconnectButton_clicked();
void on_mapRemoveTraceButton_clicked();
void on_MapRemovePixmapsButton_clicked();
void on_udpConnectButton_clicked();
void on_udpPingButton_clicked();
void on_tcpConnectButton_clicked();
void on_tcpPingButton_clicked();
void on_mapZeroButton_clicked();
void on_mapRemoveRouteButton_clicked();
void on_mapRouteSpeedBox_valueChanged(double arg1);
void on_jsConnectButton_clicked();
void on_jsDisconnectButton_clicked();
void on_mapAntialiasBox_toggled(bool checked);
void on_carsWidget_tabCloseRequested(int index);
void on_genCircButton_clicked();
void on_mapSetAbsYawButton_clicked();
void on_mapAbsYawSlider_valueChanged(int value);
void on_mapAbsYawSlider_sliderReleased();
void on_stopButton_clicked();
void on_mapUploadRouteButton_clicked();
void on_mapGetRouteButton_clicked();
void on_mapApButton_clicked();
void on_mapKbButton_clicked();
void on_mapOffButton_clicked();
void on_mapUpdateSpeedButton_clicked();
void on_mapOpenStreetMapBox_toggled(bool checked);
void on_mapAntialiasOsmBox_toggled(bool checked);
void on_mapOsmResSlider_valueChanged(int value);
void on_mapChooseNmeaButton_clicked();
void on_mapImportNmeaButton_clicked();
void on_mapRemoveInfoAllButton_clicked();
void on_traceInfoMinZoomBox_valueChanged(double arg1);
void on_removeRouteExtraButton_clicked();
void on_mapOsmClearCacheButton_clicked();
void on_mapOsmServerOsmButton_toggled(bool checked);
void on_mapOsmServerHiResButton_toggled(bool checked);
void on_mapOsmServerVedderButton_toggled(bool checked);
void on_mapOsmServerVedderHdButton_toggled(bool checked);
void on_mapOsmMaxZoomBox_valueChanged(int arg1);
void on_mapDrawGridBox_toggled(bool checked);
void on_mapGetEnuButton_clicked();
void on_mapSetEnuButton_clicked();
void on_mapOsmStatsBox_toggled(bool checked);
void on_removeTraceExtraButton_clicked();
void on_mapEditHelpButton_clicked();
void on_mapStreamNmeaConnectButton_clicked();
void on_mapStreamNmeaDisconnectButton_clicked();
void on_mapStreamNmeaClearTraceButton_clicked();
void on_mapRouteBox_valueChanged(int arg1);
void on_mapRemoveRouteAllButton_clicked();
void on_mapUpdateTimeButton_clicked();
void on_mapRouteTimeEdit_timeChanged(const QTime &time);
void on_mapTraceMinSpaceCarBox_valueChanged(double arg1);
void on_mapTraceMinSpaceGpsBox_valueChanged(double arg1);
void on_mapInfoTraceBox_valueChanged(int arg1);
void on_removeInfoTraceExtraButton_clicked();
void on_pollIntervalBox_valueChanged(int arg1);
void on_actionAbout_triggered();
void on_actionAboutLibrariesUsed_triggered();
void on_actionExit_triggered();
void on_actionSaveRoutes_triggered();
void on_actionSaveRouteswithIDs_triggered();
void on_actionLoadRoutes_triggered();
void on_actionTestIntersection_triggered();
void on_actionSaveSelectedRouteAsDriveFile_triggered();
void on_actionLoadDriveFile_triggered();
void on_mapSaveAsPdfButton_clicked();
void on_mapSaveAsPngButton_clicked();
void on_mapSaveRetakeButton_clicked();
void on_modeRouteButton_toggled(bool checked);
void on_uploadAnchorButton_clicked();
void on_anchorIdBox_valueChanged(int arg1);
void on_anchorHeightBox_valueChanged(double arg1);
void on_removeAnchorsButton_clicked();
void on_mapDrawRouteTextBox_toggled(bool checked);
void on_actionGPSSimulator_triggered();
void on_mapDrawUwbTraceBox_toggled(bool checked);
void on_actionToggleFullscreen_triggered();
void on_mapCameraWidthBox_valueChanged(double arg1);
void on_mapCameraOpacityBox_valueChanged(double arg1);
void on_actionToggleCameraFullscreen_triggered();
void on_tabWidget_currentChanged(int index);
void on_routeZeroButton_clicked();
void on_routeZeroAllButton_clicked();
void on_mapRoutePosAttrBox_currentIndexChanged(int index);
void on_clearAnchorButton_clicked();
void on_setBoundsRoutePushButton_clicked();
void on_boundsFillPushButton_clicked();
void on_lowerToolsCheckBox_stateChanged(int arg1);
void on_raiseToolsCheckBox_stateChanged(int arg1);
void on_WgSettingsPushButton_clicked();
void on_WgConnectPushButton_clicked();
void on_WgDisconnectPushButton_clicked();
void on_AutopilotConfigurePushButton_clicked();
void on_AutopilotStartPushButton_clicked();
void on_AutopilotStopPushButton_clicked();
void on_AutopilotRestartPushButton_clicked();
void on_AutopilotPausePushButton_clicked();
private:
Ui::MainWindow *ui;
QTimer *mTimer;
QTimer *mHeartbeatTimer; // periodic heartbeat to vehicles for safety
const int mHeartbeatMS = 300;
QSerialPort *mSerialPort;
PacketInterface *mPacketInterface;
QList<CarInterface*> mCars;
QList<CopterInterface*> mCopters;
QLabel *mStatusLabel;
int mStatusInfoTime;
bool mKeyUp;
bool mKeyDown;
bool mKeyRight;
bool mKeyLeft;
double mThrottle;
double mSteering;
Ping *mPing;
NmeaServer *mNmea;
QUdpSocket *mUdpSocket;
TcpClientMulti *mTcpClientMulti;
QString mVersion;
rtcm3_state mRtcmState;
IntersectionTest *mIntersectionTest;
std::unique_ptr<WireGuard> mWireGuard;
QString mLastImgFileName;
QList<QPair<int, int> > mSupportedFirmwares;
#ifdef HAS_JOYSTICK
Joystick *mJoystick;
JS_TYPE mJsType;
#endif
#ifdef HAS_LIME_SDR
GpsSim *mGpsSim;
#endif
#ifdef HAS_SIM_SCEN
PageSimScen *mSimScen;
#endif
void saveRoutes(bool withId);
};
#endif // MAINWINDOW_H