Subversion Repositories Projects

Rev

Rev 159 | Go to most recent revision | Details | 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>
36
#include "ui_mktool.h"
37
 
38
#include "../SerialPort/ManageSerialPort.h"
39
#include "../cSettings.h"
40
 
41
class QextSerialPort;
42
 
43
class MKTool : public QMainWindow, public Ui::dlg_mktool_UI
44
{
45
      Q_OBJECT
46
 
47
public:
48
      MKTool();
49
      ~MKTool();
50
 
51
private:
52
    // Object für Serielport
53
    ManageSerialPort *serialPort;
54
 
55
    // Settings-Object
56
    cSettings *Settings;
57
 
58
    // Default-Ticker
59
    QTimer *Ticker;
60
 
61
    // Die Tabs des Hauptfensters
62
    QWidget *TabWidgets[6];
63
 
64
    // Analogwert-Beschreibungen
65
    QLabel *lb_Analog[MaxAnalog];
66
 
67
    // Analogwerte
68
    int AnalogData[MaxAnalog];
69
 
70
    // Plots für die Analogwerte
71
    QwtPlotCurve *Plot[MaxAnalog];
72
 
73
    // Datenspeicher für die Plots
74
    double aData[MaxAnalog][MaxPlot];
75
    double aID[MaxPlot];
76
    int NextPlot;
77
 
78
    // Ticker-Event-Array
79
    bool TickerEvent[MaxTickerEvents];
80
    bool TickerDiv;
81
 
82
    // Alle Icons
83
    QIcon Icons[30];
84
 
85
//    QByteArray allDataReceived;
86
 
87
    // Object für das Datenfile;
88
    QFile  *CSVFile;
89
 
90
    sMode Mode;
91
    sRxData RxData;
92
 
93
    QString RXS;
94
    QString LastSend;
95
 
96
    // TestOnly
97
    QProcess *diskfree;
98
 
99
 
100
//    int DecodeData[150];
101
    char TX_Data[150];
102
 
103
    int ParameterSet[11][MaxParameter];
104
 
105
    // Programm Initialisieren
106
    void init_GUI();
107
    void init_Objects();
108
    void init_Connections();
109
    void init_Arrays();
110
    void init_Icons();
111
    void init_Plot();
112
 
113
    // Daten-Plotter
114
    void update_Plot();
115
    void config_Plot();
116
 
117
    // Settings-Bereich
118
    QComboBox *setCombo(QComboBox *Combo, int Set, int Wert);
119
    int get_Value(QComboBox *Combo);
120
    void show_ParameterSet(int Set);
121
    void store_ParameterSet(int Set);
122
    void set_LED(QToolButton *ToolButton, bool On=false);
123
 
124
    // Daten Senden, Empfangen und verarbeiten
125
    void send_Data(char CMD, char Data[150],unsigned int Length, bool Resend = true);
126
    void new_RXData(sRxData RX);
127
 
128
    // Debugdaten anzeigen und speichern.
129
    void show_DebugData();
130
    void write_CSV();
131
 
132
    // Programmeinstellungen speichern
133
    void write_Settings();
134
 
135
private slots:
136
    void slot_ac_Config();
137
    void slot_ac_StartPlotter();
138
    void slot_ac_View();
139
    void slot_ac_MehrDaten();
140
    void slot_ac_About();
141
    void slot_ac_GetLabels();
142
    void slot_ac_Motortest();
143
 
144
    // Default-Ticker
145
    void slot_Ticker();
146
 
147
    void slot_Motortest(int Motor1, int Motor2, int Motor3, int Motor4);
148
 
149
    void slot_pb_Update();
150
 
151
    void slot_UpdateShell();
152
 
153
    // Seriell-Port Slots
154
    void slot_newDataReceived(const QByteArray &dataReceived);
155
    void slot_OpenPort();
156
 
157
    void slot_Quit();
158
 
159
    void slot_tbUp();
160
    void slot_tbDown();
161
    void slot_tbLeft();
162
    void slot_tbRight();
163
    void slot_LEDtoValue();
164
    void slot_ValuetoLED16(int Wert);
165
    void slot_ValuetoLED17(int Wert);
166
 
167
    void slot_TabChanged(int Tab);
168
 
169
    void slot_RecordCSV();
170
 
171
    void slot_ScrollPlot(int Pos);
172
 
173
    void slot_GetParameter();
174
    void slot_SetParameter();
175
    void slot_LoadParameter();
176
    void slot_SaveParameter();
177
 
178
    void slot_SetLogDir();
179
    void slot_SetParDir();
180
};
181
 
182
#endif