Subversion Repositories Projects

Rev

Rev 440 | Rev 442 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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