Subversion Repositories Projects

Rev

Rev 239 | 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"
158 KeyOz 43
 
250 KeyOz 44
//#include "../SerialPort/ManageSerialPort.h"
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
 
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:
227 KeyOz 65
 
66
    int aa;
67
 
159 KeyOz 68
    bool AllowSend;
199 KeyOz 69
 
158 KeyOz 70
    // Object für Serielport
250 KeyOz 71
//    ManageSerialPort *serialPort;
72
    cConnection *Conn;
158 KeyOz 73
 
199 KeyOz 74
    // Settings-Object (Programmeinstellungen)
158 KeyOz 75
    cSettings *Settings;
76
 
199 KeyOz 77
    // Settings-Widget (FC-Settings)
167 KeyOz 78
    wdg_Settings *f_Settings;
79
 
227 KeyOz 80
    // HTTP-Server-Object für Google Earth
199 KeyOz 81
    cServer *Server;
82
 
227 KeyOz 83
    // QMK-Serverobjekt
84
    cQMK_Server *MyServer;
85
 
86
    // LCD-Dialog
87
    dlg_LCD *f_LCD;
88
 
89
    //TCP-Socket
90
    QTcpSocket *TcpSocket;
91
 
158 KeyOz 92
    // Default-Ticker
93
    QTimer *Ticker;
94
 
199 KeyOz 95
    // Kopie der Tabs des Hauptfensters
227 KeyOz 96
    QWidget *TabWidgets[7];
158 KeyOz 97
 
98
    // Analogwert-Beschreibungen
99
    QLabel *lb_Analog[MaxAnalog];
100
 
101
    // Analogwerte
102
    int AnalogData[MaxAnalog];
103
 
104
    // Plots für die Analogwerte
227 KeyOz 105
    QwtPlotCurve *Plot[MaxAnalog];    
158 KeyOz 106
 
107
    // Datenspeicher für die Plots
108
    double aData[MaxAnalog][MaxPlot];
109
    double aID[MaxPlot];
110
    int NextPlot;
111
 
227 KeyOz 112
    AttitudeIndicator *Attitude;
113
    cSpeedMeter * SpeedMeter;
114
 
158 KeyOz 115
    // Ticker-Event-Array
116
    bool TickerEvent[MaxTickerEvents];
117
    bool TickerDiv;
118
 
199 KeyOz 119
    // Aktuelle und Max-Anzahl der LCD-Seiten
159 KeyOz 120
    int LCD_Page;
121
    int LCD_MAX_Page;
122
 
239 Brean 123
    //Logger für CVS und andere
124
    Logger * logger;
158 KeyOz 125
 
126
    sMode Mode;
127
    sRxData RxData;
199 KeyOz 128
    sNaviData Navi;
158 KeyOz 129
 
130
    QString RXS;
131
    QString LastSend;
132
 
167 KeyOz 133
    // Softwareupdate
162 KeyOz 134
    QProcess *Update;
158 KeyOz 135
 
199 KeyOz 136
    // Sendedatenbuffer
158 KeyOz 137
    char TX_Data[150];
138
 
199 KeyOz 139
    // FC-Settings
140
    int FCSettings[MaxParameter];
158 KeyOz 141
 
142
    // Programm Initialisieren
143
    void init_GUI();
144
    void init_Objects();
145
    void init_Connections();
146
    void init_Arrays();
147
    void init_Plot();
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
 
250 KeyOz 168
    void slot_showTerminal(int Typ, QString Text);
169
 
199 KeyOz 170
    void slot_ac_Hardware();
171
    void slot_rb_Hardware();
172
 
173
    void slot_ac_StartServer();
174
 
175
    void slot_Test();
176
 
158 KeyOz 177
    void slot_ac_Config();
159 KeyOz 178
    void slot_ac_Preferences();
158 KeyOz 179
    void slot_ac_StartPlotter();
180
    void slot_ac_View();
199 KeyOz 181
    void slot_ac_FastDebug();
182
    void slot_ac_NoDebug();
183
    void slot_ac_FastNavi();
184
    void slot_ac_NoNavi();
158 KeyOz 185
    void slot_ac_About();
186
    void slot_ac_GetLabels();
187
    void slot_ac_Motortest();
227 KeyOz 188
    void slot_ac_LCD();
250 KeyOz 189
 
166 KeyOz 190
    void slot_pb_HexFile();
250 KeyOz 191
    void slot_pb_SendWaypoint();
158 KeyOz 192
 
193
    // Default-Ticker
194
    void slot_Ticker();
195
 
199 KeyOz 196
    // LCD-Seite vor / zurück
159 KeyOz 197
    void slot_LCD_UP();
198
    void slot_LCD_DOWN();
199
 
158 KeyOz 200
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
201
 
199 KeyOz 202
    // Firmeware-Update
158 KeyOz 203
    void slot_pb_Update();
204
    void slot_UpdateShell();
205
 
206
    // Seriell-Port Slots
250 KeyOz 207
    void slot_newData(sRxData RX);
158 KeyOz 208
    void slot_OpenPort();
209
 
210
    void slot_TabChanged(int Tab);
211
 
239 Brean 212
    void slot_RecordLog();
158 KeyOz 213
 
214
    void slot_ScrollPlot(int Pos);
215
 
199 KeyOz 216
    // FC-Settings lesen / Schreiben
217
    void slot_GetFCSettings();
218
    void slot_SetFCSettings();
158 KeyOz 219
};
220
 
221
#endif