Subversion Repositories Projects

Rev

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