Subversion Repositories Projects

Rev

Rev 305 | 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"
158 KeyOz 44
 
250 KeyOz 45
#include "../Classes/cConnection.h"
227 KeyOz 46
#include "../Classes/cSettings.h"
306 KeyOz 47
#include "../Classes/cKML_Server.h"
227 KeyOz 48
#include "../Classes/cQMK_Server.h"
49
#include "../Classes/cAttitude.h"
50
#include "../Classes/cSpeedMeter.h"
239 Brean 51
#include "../Logger/Logger.h"
250 KeyOz 52
#include "../typedefs.h"
158 KeyOz 53
 
54
class QextSerialPort;
55
 
56
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
57
{
58
      Q_OBJECT
59
 
60
public:
61
      MKTool();
62
      ~MKTool();
63
 
64
private:
272 KeyOz 65
    // Object für Kopter-Verbindung
306 KeyOz 66
    cConnection *o_Connection;
158 KeyOz 67
 
199 KeyOz 68
    // Settings-Object (Programmeinstellungen)
158 KeyOz 69
    cSettings *Settings;
70
 
199 KeyOz 71
    // Settings-Widget (FC-Settings)
167 KeyOz 72
    wdg_Settings *f_Settings;
73
 
306 KeyOz 74
    // HTTP-Server-Object für KML-Files
75
    cKML_Server *KML_Server;
199 KeyOz 76
 
227 KeyOz 77
    // QMK-Serverobjekt
272 KeyOz 78
    cQMK_Server *QMK_Server;
227 KeyOz 79
 
80
    // LCD-Dialog
81
    dlg_LCD *f_LCD;
82
 
306 KeyOz 83
    // Map-Dialog
305 KeyOz 84
    dlg_Map *f_Map;
85
 
227 KeyOz 86
    //TCP-Socket
87
    QTcpSocket *TcpSocket;
88
 
158 KeyOz 89
    // Default-Ticker
90
    QTimer *Ticker;
91
 
199 KeyOz 92
    // Kopie der Tabs des Hauptfensters
227 KeyOz 93
    QWidget *TabWidgets[7];
158 KeyOz 94
 
95
    // Analogwert-Beschreibungen
96
    QLabel *lb_Analog[MaxAnalog];
97
 
98
    // Analogwerte
99
    int AnalogData[MaxAnalog];
100
 
101
    // Plots für die Analogwerte
227 KeyOz 102
    QwtPlotCurve *Plot[MaxAnalog];    
158 KeyOz 103
 
104
    // Datenspeicher für die Plots
105
    double aData[MaxAnalog][MaxPlot];
106
    double aID[MaxPlot];
107
    int NextPlot;
108
 
227 KeyOz 109
    AttitudeIndicator *Attitude;
110
    cSpeedMeter * SpeedMeter;
111
 
158 KeyOz 112
    // Ticker-Event-Array
113
    bool TickerEvent[MaxTickerEvents];
114
    bool TickerDiv;
115
 
199 KeyOz 116
    // Aktuelle und Max-Anzahl der LCD-Seiten
159 KeyOz 117
    int LCD_Page;
118
    int LCD_MAX_Page;
119
 
239 Brean 120
    //Logger für CVS und andere
121
    Logger * logger;
158 KeyOz 122
 
123
    sMode Mode;
124
    sRxData RxData;
199 KeyOz 125
    sNaviData Navi;
158 KeyOz 126
 
127
    QString RXS;
128
    QString LastSend;
129
 
167 KeyOz 130
    // Softwareupdate
162 KeyOz 131
    QProcess *Update;
158 KeyOz 132
 
199 KeyOz 133
    // Sendedatenbuffer
158 KeyOz 134
    char TX_Data[150];
135
 
199 KeyOz 136
    // FC-Settings
137
    int FCSettings[MaxParameter];
158 KeyOz 138
 
139
    // Programm Initialisieren
140
    void init_GUI();
141
    void init_Objects();
142
    void init_Connections();
143
    void init_Arrays();
144
    void init_Plot();
306 KeyOz 145
    void init_Cockpit();
158 KeyOz 146
 
147
    // Daten-Plotter
148
    void update_Plot();
149
    void config_Plot();
150
 
199 KeyOz 151
    void new_NaviData(sRxData RX);
250 KeyOz 152
    void parse_TargetKML();
199 KeyOz 153
 
158 KeyOz 154
    // Debugdaten anzeigen und speichern.
155
    void show_DebugData();
239 Brean 156
    void update_Log();
158 KeyOz 157
 
158
    // Programmeinstellungen speichern
167 KeyOz 159
    void set_Preferences();
158 KeyOz 160
 
161
private slots:
227 KeyOz 162
    void slot_QMKS_Connect();
163
    void slot_QMKS_Connected();
164
    void slot_QMKS_Disconnected(int Error);
165
 
306 KeyOz 166
    void slot_set_Settings(cSettings *t_Settings);
167
 
168
    void slot_MAP_SetTarget(sWayPoint Target);
169
 
250 KeyOz 170
    void slot_showTerminal(int Typ, QString Text);
171
 
199 KeyOz 172
    void slot_ac_Hardware();
173
    void slot_rb_Hardware();
174
 
175
    void slot_ac_StartServer();
176
 
177
    void slot_Test();
178
 
158 KeyOz 179
    void slot_ac_Config();
159 KeyOz 180
    void slot_ac_Preferences();
158 KeyOz 181
    void slot_ac_StartPlotter();
182
    void slot_ac_View();
199 KeyOz 183
    void slot_ac_FastDebug();
184
    void slot_ac_NoDebug();
185
    void slot_ac_FastNavi();
186
    void slot_ac_NoNavi();
158 KeyOz 187
    void slot_ac_About();
188
    void slot_ac_GetLabels();
189
    void slot_ac_Motortest();
227 KeyOz 190
    void slot_ac_LCD();
305 KeyOz 191
    void slot_ac_Map();
250 KeyOz 192
 
166 KeyOz 193
    void slot_pb_HexFile();
250 KeyOz 194
    void slot_pb_SendWaypoint();
158 KeyOz 195
 
196
    // Default-Ticker
197
    void slot_Ticker();
198
 
199 KeyOz 199
    // LCD-Seite vor / zurück
159 KeyOz 200
    void slot_LCD_UP();
201
    void slot_LCD_DOWN();
202
 
158 KeyOz 203
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
204
 
199 KeyOz 205
    // Firmeware-Update
158 KeyOz 206
    void slot_pb_Update();
207
    void slot_UpdateShell();
208
 
209
    // Seriell-Port Slots
250 KeyOz 210
    void slot_newData(sRxData RX);
158 KeyOz 211
    void slot_OpenPort();
212
 
213
    void slot_TabChanged(int Tab);
214
 
239 Brean 215
    void slot_RecordLog();
158 KeyOz 216
 
217
    void slot_ScrollPlot(int Pos);
218
 
199 KeyOz 219
    // FC-Settings lesen / Schreiben
220
    void slot_GetFCSettings();
221
    void slot_SetFCSettings();
158 KeyOz 222
};
223
 
224
#endif