Subversion Repositories Projects

Rev

Rev 305 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 305 Rev 306
1
/***************************************************************************
1
/***************************************************************************
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
2
 *   Copyright (C) 2008 by Manuel Schrape                                  *
3
 *   manuel.schrape@gmx.de                                                 *
3
 *   manuel.schrape@gmx.de                                                 *
4
 *                                                                         *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License.        *
7
 *   the Free Software Foundation; either version 2 of the License.        *
8
 *                                                                         *
8
 *                                                                         *
9
 *   This program is distributed in the hope that it will be useful,       *
9
 *   This program is distributed in the hope that it will be useful,       *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
10
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
11
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12
 *   GNU General Public License for more details.                          *
12
 *   GNU General Public License for more details.                          *
13
 *                                                                         *
13
 *                                                                         *
14
 *   You should have received a copy of the GNU General Public License     *
14
 *   You should have received a copy of the GNU General Public License     *
15
 *   along with this program; if not, write to the                         *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
18
 ***************************************************************************/
19
 
19
 
20
 
20
 
21
#ifndef MKTOOL_H
21
#ifndef MKTOOL_H
22
#define MKTOOL_H
22
#define MKTOOL_H
23
 
23
 
24
#include <QMainWindow>
24
#include <QMainWindow>
25
#include <QSettings>
25
#include <QSettings>
26
#include <QString>
26
#include <QString>
27
#include <QTimer>
27
#include <QTimer>
28
#include <QComboBox>
28
#include <QComboBox>
29
#include <QIcon>
29
#include <QIcon>
30
#include <QProcess>
30
#include <QProcess>
31
 
31
 
32
#include <qwt_plot_curve.h>
32
#include <qwt_plot_curve.h>
33
#include <qwt_plot_grid.h>
33
#include <qwt_plot_grid.h>
34
#include <qwt_legend.h>
34
#include <qwt_legend.h>
35
#include <qwt_plot.h>
35
#include <qwt_plot.h>
36
#include <qwt_compass.h>
36
#include <qwt_compass.h>
37
#include <qwt_compass_rose.h>
37
#include <qwt_compass_rose.h>
38
#include <qwt_dial_needle.h>
38
#include <qwt_dial_needle.h>
39
 
39
 
40
#include "ui_mktool.h"
40
#include "ui_mktool.h"
41
#include "wdg_Settings.h"
41
#include "wdg_Settings.h"
42
#include "dlg_LCD.h"
42
#include "dlg_LCD.h"
43
#include "dlg_Map.h"
43
#include "dlg_Map.h"
44
 
44
 
45
#include "../Classes/cConnection.h"
45
#include "../Classes/cConnection.h"
46
#include "../Classes/cSettings.h"
46
#include "../Classes/cSettings.h"
47
#include "../Classes/cServer.h"
47
#include "../Classes/cKML_Server.h"
48
#include "../Classes/cQMK_Server.h"
48
#include "../Classes/cQMK_Server.h"
49
#include "../Classes/cAttitude.h"
49
#include "../Classes/cAttitude.h"
50
#include "../Classes/cSpeedMeter.h"
50
#include "../Classes/cSpeedMeter.h"
51
#include "../Logger/Logger.h"
51
#include "../Logger/Logger.h"
52
#include "../typedefs.h"
52
#include "../typedefs.h"
53
 
-
 
54
#include "../qmapcontrol.h"
-
 
55
 
-
 
56
using namespace qmapcontrol;
-
 
57
 
53
 
58
class QextSerialPort;
54
class QextSerialPort;
59
 
55
 
60
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
56
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
61
{
57
{
62
      Q_OBJECT
58
      Q_OBJECT
63
 
59
 
64
public:
60
public:
65
      MKTool();
61
      MKTool();
66
      ~MKTool();
62
      ~MKTool();
67
 
63
 
68
private:
64
private:
69
 
-
 
70
    MapControl* mc;
-
 
71
    MapAdapter* mapadapter;
-
 
72
    Layer* mainlayer;
-
 
73
 
-
 
74
    // Object für Kopter-Verbindung
65
    // Object für Kopter-Verbindung
75
    cConnection *Conn;
66
    cConnection *o_Connection;
76
 
67
 
77
    // Settings-Object (Programmeinstellungen)
68
    // Settings-Object (Programmeinstellungen)
78
    cSettings *Settings;
69
    cSettings *Settings;
79
 
70
 
80
    // Settings-Widget (FC-Settings)
71
    // Settings-Widget (FC-Settings)
81
    wdg_Settings *f_Settings;
72
    wdg_Settings *f_Settings;
82
 
73
 
83
    // HTTP-Server-Object für Google Earth
74
    // HTTP-Server-Object für KML-Files
84
    cServer *GE_Server;
75
    cKML_Server *KML_Server;
85
 
76
 
86
    // QMK-Serverobjekt
77
    // QMK-Serverobjekt
87
    cQMK_Server *QMK_Server;
78
    cQMK_Server *QMK_Server;
88
 
79
 
89
    // LCD-Dialog
80
    // LCD-Dialog
90
    dlg_LCD *f_LCD;
81
    dlg_LCD *f_LCD;
91
 
82
 
92
    // LCD-Dialog
83
    // Map-Dialog
93
    dlg_Map *f_Map;
84
    dlg_Map *f_Map;
94
 
85
 
95
    //TCP-Socket
86
    //TCP-Socket
96
    QTcpSocket *TcpSocket;
87
    QTcpSocket *TcpSocket;
97
 
88
 
98
    // Default-Ticker
89
    // Default-Ticker
99
    QTimer *Ticker;
90
    QTimer *Ticker;
100
 
91
 
101
    // Kopie der Tabs des Hauptfensters
92
    // Kopie der Tabs des Hauptfensters
102
    QWidget *TabWidgets[7];
93
    QWidget *TabWidgets[7];
103
 
94
 
104
    // Analogwert-Beschreibungen
95
    // Analogwert-Beschreibungen
105
    QLabel *lb_Analog[MaxAnalog];
96
    QLabel *lb_Analog[MaxAnalog];
106
 
97
 
107
    // Analogwerte
98
    // Analogwerte
108
    int AnalogData[MaxAnalog];
99
    int AnalogData[MaxAnalog];
109
 
100
 
110
    // Plots für die Analogwerte
101
    // Plots für die Analogwerte
111
    QwtPlotCurve *Plot[MaxAnalog];    
102
    QwtPlotCurve *Plot[MaxAnalog];    
112
 
103
 
113
    // Datenspeicher für die Plots
104
    // Datenspeicher für die Plots
114
    double aData[MaxAnalog][MaxPlot];
105
    double aData[MaxAnalog][MaxPlot];
115
    double aID[MaxPlot];
106
    double aID[MaxPlot];
116
    int NextPlot;
107
    int NextPlot;
117
 
108
 
118
    AttitudeIndicator *Attitude;
109
    AttitudeIndicator *Attitude;
119
    cSpeedMeter * SpeedMeter;
110
    cSpeedMeter * SpeedMeter;
120
 
111
 
121
    // Ticker-Event-Array
112
    // Ticker-Event-Array
122
    bool TickerEvent[MaxTickerEvents];
113
    bool TickerEvent[MaxTickerEvents];
123
    bool TickerDiv;
114
    bool TickerDiv;
124
 
115
 
125
    // Aktuelle und Max-Anzahl der LCD-Seiten
116
    // Aktuelle und Max-Anzahl der LCD-Seiten
126
    int LCD_Page;
117
    int LCD_Page;
127
    int LCD_MAX_Page;
118
    int LCD_MAX_Page;
128
 
119
 
129
    //Logger für CVS und andere
120
    //Logger für CVS und andere
130
    Logger * logger;
121
    Logger * logger;
131
 
122
 
132
    sMode Mode;
123
    sMode Mode;
133
    sRxData RxData;
124
    sRxData RxData;
134
    sNaviData Navi;
125
    sNaviData Navi;
135
 
126
 
136
    QString RXS;
127
    QString RXS;
137
    QString LastSend;
128
    QString LastSend;
138
 
129
 
139
    // Softwareupdate
130
    // Softwareupdate
140
    QProcess *Update;
131
    QProcess *Update;
141
 
132
 
142
    // Sendedatenbuffer
133
    // Sendedatenbuffer
143
    char TX_Data[150];
134
    char TX_Data[150];
144
 
135
 
145
    // FC-Settings
136
    // FC-Settings
146
    int FCSettings[MaxParameter];
137
    int FCSettings[MaxParameter];
147
 
138
 
148
    // Programm Initialisieren
139
    // Programm Initialisieren
149
    void init_GUI();
140
    void init_GUI();
150
    void init_Objects();
141
    void init_Objects();
151
    void init_Connections();
142
    void init_Connections();
152
    void init_Arrays();
143
    void init_Arrays();
153
    void init_Plot();
144
    void init_Plot();
-
 
145
    void init_Cockpit();
154
 
146
 
155
    // Daten-Plotter
147
    // Daten-Plotter
156
    void update_Plot();
148
    void update_Plot();
157
    void config_Plot();
149
    void config_Plot();
158
 
150
 
159
    void new_NaviData(sRxData RX);
151
    void new_NaviData(sRxData RX);
160
    void parse_TargetKML();
152
    void parse_TargetKML();
161
 
153
 
162
    // Debugdaten anzeigen und speichern.
154
    // Debugdaten anzeigen und speichern.
163
    void show_DebugData();
155
    void show_DebugData();
164
    void update_Log();
156
    void update_Log();
165
 
157
 
166
    // Programmeinstellungen speichern
158
    // Programmeinstellungen speichern
167
    void set_Preferences();
159
    void set_Preferences();
168
 
160
 
169
private slots:
161
private slots:
170
    void slot_QMKS_Connect();
162
    void slot_QMKS_Connect();
171
    void slot_QMKS_Connected();
163
    void slot_QMKS_Connected();
172
    void slot_QMKS_Disconnected(int Error);
164
    void slot_QMKS_Disconnected(int Error);
-
 
165
 
-
 
166
    void slot_set_Settings(cSettings *t_Settings);
-
 
167
 
-
 
168
    void slot_MAP_SetTarget(sWayPoint Target);
173
 
169
 
174
    void slot_showTerminal(int Typ, QString Text);
170
    void slot_showTerminal(int Typ, QString Text);
175
 
171
 
176
    void slot_ac_Hardware();
172
    void slot_ac_Hardware();
177
    void slot_rb_Hardware();
173
    void slot_rb_Hardware();
178
 
174
 
179
    void slot_ac_StartServer();
175
    void slot_ac_StartServer();
180
 
176
 
181
    void slot_Test();
177
    void slot_Test();
182
 
178
 
183
    void slot_ac_Config();
179
    void slot_ac_Config();
184
    void slot_ac_Preferences();
180
    void slot_ac_Preferences();
185
    void slot_ac_StartPlotter();
181
    void slot_ac_StartPlotter();
186
    void slot_ac_View();
182
    void slot_ac_View();
187
    void slot_ac_FastDebug();
183
    void slot_ac_FastDebug();
188
    void slot_ac_NoDebug();
184
    void slot_ac_NoDebug();
189
    void slot_ac_FastNavi();
185
    void slot_ac_FastNavi();
190
    void slot_ac_NoNavi();
186
    void slot_ac_NoNavi();
191
    void slot_ac_About();
187
    void slot_ac_About();
192
    void slot_ac_GetLabels();
188
    void slot_ac_GetLabels();
193
    void slot_ac_Motortest();
189
    void slot_ac_Motortest();
194
    void slot_ac_LCD();
190
    void slot_ac_LCD();
195
    void slot_ac_Map();
191
    void slot_ac_Map();
196
 
192
 
197
    void slot_pb_HexFile();
193
    void slot_pb_HexFile();
198
    void slot_pb_SendWaypoint();
194
    void slot_pb_SendWaypoint();
199
 
195
 
200
    // Default-Ticker
196
    // Default-Ticker
201
    void slot_Ticker();
197
    void slot_Ticker();
202
 
198
 
203
    // LCD-Seite vor / zurück
199
    // LCD-Seite vor / zurück
204
    void slot_LCD_UP();
200
    void slot_LCD_UP();
205
    void slot_LCD_DOWN();
201
    void slot_LCD_DOWN();
206
 
202
 
207
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
203
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
208
 
204
 
209
    // Firmeware-Update
205
    // Firmeware-Update
210
    void slot_pb_Update();
206
    void slot_pb_Update();
211
    void slot_UpdateShell();
207
    void slot_UpdateShell();
212
 
208
 
213
    // Seriell-Port Slots
209
    // Seriell-Port Slots
214
    void slot_newData(sRxData RX);
210
    void slot_newData(sRxData RX);
215
    void slot_OpenPort();
211
    void slot_OpenPort();
216
 
212
 
217
    void slot_TabChanged(int Tab);
213
    void slot_TabChanged(int Tab);
218
 
214
 
219
    void slot_RecordLog();
215
    void slot_RecordLog();
220
 
216
 
221
    void slot_ScrollPlot(int Pos);
217
    void slot_ScrollPlot(int Pos);
222
 
218
 
223
    // FC-Settings lesen / Schreiben
219
    // FC-Settings lesen / Schreiben
224
    void slot_GetFCSettings();
220
    void slot_GetFCSettings();
225
    void slot_SetFCSettings();
221
    void slot_SetFCSettings();
226
};
222
};
227
 
223
 
228
#endif
224
#endif
229
 
225