Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
157 | 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 | |||
31 | #include <qwt_plot_curve.h> |
||
32 | #include <qwt_plot_grid.h> |
||
33 | #include <qwt_legend.h> |
||
34 | #include <qwt_plot.h> |
||
35 | #include "ui_mktool.h" |
||
36 | |||
37 | #include "SerialPort/ManageSerialPort.h" |
||
38 | #include "../cSettings.h" |
||
39 | |||
40 | class QextSerialPort; |
||
41 | |||
42 | class MKTool : public QMainWindow, public Ui::dlg_mktool_UI |
||
43 | { |
||
44 | Q_OBJECT |
||
45 | |||
46 | public: |
||
47 | MKTool(); |
||
48 | ~MKTool(); |
||
49 | |||
50 | private: |
||
51 | // Object für Serielport |
||
52 | ManageSerialPort *serialPort; |
||
53 | |||
54 | // Settings-Object |
||
55 | cSettings *Settings; |
||
56 | |||
57 | // Analogwert-Beschreibungen |
||
58 | QLabel *lb_Analog[MaxAnalog]; |
||
59 | |||
60 | // Analogwerte |
||
61 | int AnalogData[MaxAnalog]; |
||
62 | |||
63 | // Plots für die Analogwerte |
||
64 | QwtPlotCurve *Plot[MaxAnalog]; |
||
65 | |||
66 | // Datenspeicher für die Plots |
||
67 | double aData[MaxAnalog][MaxPlot]; |
||
68 | double aID[MaxPlot]; |
||
69 | int NextPlot; |
||
70 | |||
71 | QIcon Icons[30]; |
||
72 | |||
73 | QByteArray allDataReceived; |
||
74 | QTimer *timer; |
||
75 | QTimer *Poll; |
||
76 | QFile *CSVFile; |
||
77 | QString RXS; |
||
78 | QString LastSend; |
||
79 | |||
80 | int DecodeData[150]; |
||
81 | char TX_Data[150]; |
||
82 | |||
83 | int ParameterSet[11][MaxParameter]; |
||
84 | |||
85 | void init_GUI(); |
||
86 | void init_Objects(); |
||
87 | void init_Connections(); |
||
88 | |||
89 | void init_Arrays(); |
||
90 | void init_Icons(); |
||
91 | |||
92 | void update_Plot(); |
||
93 | void config_Plot(); |
||
94 | |||
95 | QComboBox *setCombo(QComboBox *Combo, int Set, int Wert); |
||
96 | int get_Value(QComboBox *Combo); |
||
97 | |||
98 | bool check_CRC(QString RXString); |
||
99 | QString add_CRC(QString TXString); |
||
100 | |||
101 | void send_Data(char CMD, char Data[150],unsigned int Length, bool Resend = true); |
||
102 | void new_RXData(QString RX_Data); |
||
103 | |||
104 | void show_DebugData(); |
||
105 | void show_ParameterSet(int Set); |
||
106 | void store_ParameterSet(int Set); |
||
107 | |||
108 | void write_Settings(); |
||
109 | void write_CSV(); |
||
110 | |||
111 | QString Encode64(char Data[150],unsigned int Length); |
||
112 | bool Decode64(char *RxdBuffer, int len, bool Long = false); |
||
113 | |||
114 | void set_LED(QToolButton *ToolButton, bool On=false); |
||
115 | |||
116 | void init_Plot(); |
||
117 | |||
118 | private slots: |
||
119 | void slot_ac_Config(); |
||
120 | void slot_ac_StartPlotter(); |
||
121 | |||
122 | void slot_SliderMotorTest(int Wert); |
||
123 | |||
124 | void slot_newDataReceived(const QByteArray &dataReceived); |
||
125 | void slot_OpenPort(); |
||
126 | void slot_Quit(); |
||
127 | |||
128 | void slot_Timer(); |
||
129 | void slot_Poll(); |
||
130 | |||
131 | void slot_tbUp(); |
||
132 | void slot_tbDown(); |
||
133 | void slot_tbLeft(); |
||
134 | void slot_tbRight(); |
||
135 | void slot_LEDtoValue(); |
||
136 | void slot_ValuetoLED16(int Wert); |
||
137 | void slot_ValuetoLED17(int Wert); |
||
138 | |||
139 | void slot_TabChanged(int Tab); |
||
140 | |||
141 | void slot_RecordCSV(); |
||
142 | void slot_ScrollPlot(int Pos); |
||
143 | |||
144 | void slot_GetParameter(); |
||
145 | void slot_SetParameter(); |
||
146 | void slot_LoadParameter(); |
||
147 | void slot_SaveParameter(); |
||
148 | |||
149 | void slot_SetLogDir(); |
||
150 | void slot_SetParDir(); |
||
151 | |||
152 | void slot_About(); |
||
153 | }; |
||
154 | |||
155 | #endif |