@@ -0,0 +1,44 | |||||
|
1 | #ifndef PARAMS_H | |||
|
2 | #define PARAMS_H | |||
|
3 | ||||
|
4 | #define XMAX 2048 | |||
|
5 | #define YMAX 10000 | |||
|
6 | #define FONT_SIZE_WAVEFORM_TITLE 10 | |||
|
7 | #define DEFAULT_SIZE 2048 | |||
|
8 | #define BLK_SIZE 12 | |||
|
9 | ||||
|
10 | //**************** | |||
|
11 | // TM packets SIDs | |||
|
12 | #define SID_NORMAL_SWF_F0 3 | |||
|
13 | #define SID_NORMAL_SWF_F1 4 | |||
|
14 | #define SID_NORMAL_SWF_F2 5 | |||
|
15 | #define SID_NORMAL_CWF_F3 1 | |||
|
16 | #define SID_NORMAL_ASM_F0 11 | |||
|
17 | #define SID_NORMAL_ASM_F1 12 | |||
|
18 | #define SID_NORMAL_ASM_F2 13 | |||
|
19 | #define SID_NORMAL_BP1_F0 14 | |||
|
20 | #define SID_NORMAL_BP1_F1 15 | |||
|
21 | #define SID_NORMAL_BP1_F2 16 | |||
|
22 | #define SID_NORMAL_BP2_F0 19 | |||
|
23 | #define SID_NORMAL_BP2_F1 20 | |||
|
24 | #define SID_NORMAL_BP2_F2 21 | |||
|
25 | // | |||
|
26 | #define SID_BURST_CWF_F2 2 | |||
|
27 | #define SID_BURST_BP1_F0 17 | |||
|
28 | #define SID_BURST_BP2_F0 22 | |||
|
29 | #define SID_BURST_BP1_F1 18 | |||
|
30 | #define SID_BURST_BP2_F1 23 | |||
|
31 | // | |||
|
32 | #define SID_SBM1_CWF_F1 24 | |||
|
33 | #define SID_SBM1_BP1_F0 28 | |||
|
34 | #define SID_SBM1_BP2_F0 31 | |||
|
35 | // | |||
|
36 | #define SID_SBM2_CWF_F2 25 | |||
|
37 | #define SID_SBM2_BP1_F0 29 | |||
|
38 | #define SID_SBM2_BP2_F0 32 | |||
|
39 | #define SID_SBM2_BP1_F1 30 | |||
|
40 | #define SID_SBM2_BP2_F1 33 | |||
|
41 | ||||
|
42 | #define RMAP_DEFAULT_SOURCE_ADDRESS 1 | |||
|
43 | ||||
|
44 | #endif // PARAMS_H |
This diff has been collapsed as it changes many lines, (517 lines changed) Show them Hide them | |||||
@@ -0,0 +1,517 | |||||
|
1 | #include "tmstatistics.h" | |||
|
2 | #include <QtGui> | |||
|
3 | #include <QFontInfo> | |||
|
4 | ||||
|
5 | TMStatistics::TMStatistics(QWidget *parent) : | |||
|
6 | QWidget(parent) | |||
|
7 | { | |||
|
8 | // Create Fonts | |||
|
9 | QFont font; | |||
|
10 | font = QFont(this->fontInfo().family(), STATISTICS_FONT_SIZE, QFont::Light); | |||
|
11 | ||||
|
12 | label_UNKNOWN = new QLabel("UNKNOWN"); | |||
|
13 | label_UNKNOWN_nb = new QLabel("-"); | |||
|
14 | ||||
|
15 | mainLayout = new QGridLayout(); | |||
|
16 | layout_stat = new QGridLayout(); // TM stastictics | |||
|
17 | layout_NORM = new QGridLayout(); // TM_LFR_SCIENCE_NORMAL_ | |||
|
18 | layout_BURST = new QGridLayout(); // TM_LFR_SCIENCE_BURST_ | |||
|
19 | layout_SBM1 = new QGridLayout(); // TM_LFR_SCIENCE_SBM1_ | |||
|
20 | layout_SBM2 = new QGridLayout(); // TM_LFR_SCIENCE_SBM2_ | |||
|
21 | layout_last = new QGridLayout(); // last TM description | |||
|
22 | ||||
|
23 | //*************** | |||
|
24 | // TM_LFR_TC_EXE_ | |||
|
25 | label_SUCC = new QLabel("SUCCESS"); | |||
|
26 | label_INCO = new QLabel("INCONSISTENT"); | |||
|
27 | label_NOTE = new QLabel("NOT_EXECUTABLE"); | |||
|
28 | label_NOTI = new QLabel("NOT_IMPLEMENTED"); | |||
|
29 | label_ERRO = new QLabel("ERROR"); | |||
|
30 | label_CORR = new QLabel("CORRUPTED"); | |||
|
31 | label_HK = new QLabel("TM_LFR_HK"); | |||
|
32 | // | |||
|
33 | label_SUCC_nb = new QLabel("-"); | |||
|
34 | label_INCO_nb = new QLabel("-"); | |||
|
35 | label_NOTE_nb = new QLabel("-"); | |||
|
36 | label_NOTI_nb = new QLabel("-"); | |||
|
37 | label_ERRO_nb = new QLabel("-"); | |||
|
38 | label_CORR_nb = new QLabel("-"); | |||
|
39 | label_HK_nb = new QLabel("-"); | |||
|
40 | ||||
|
41 | //*********************** | |||
|
42 | // TM_LFR_SCIENCE_NORMAL_ | |||
|
43 | label_NORM_SWF_F0 = new QLabel("SWF_F0"); | |||
|
44 | label_NORM_SWF_F1 = new QLabel("SWF_F1"); | |||
|
45 | label_NORM_SWF_F2 = new QLabel("SWF_F2"); | |||
|
46 | label_NORM_CWF_F3 = new QLabel("CWF_F3"); | |||
|
47 | label_NORM_ASM_F0 = new QLabel("ASM_F0"); | |||
|
48 | label_NORM_ASM_F1 = new QLabel("ASM_F1"); | |||
|
49 | label_NORM_ASM_F2 = new QLabel("ASM_F2"); | |||
|
50 | label_NORM_BP1_F0 = new QLabel("BP1_F0"); | |||
|
51 | label_NORM_BP1_F1 = new QLabel("BP1_F1"); | |||
|
52 | label_NORM_BP1_F2 = new QLabel("BP1_F2"); | |||
|
53 | label_NORM_BP2_F0 = new QLabel("BP2_F0"); | |||
|
54 | label_NORM_BP2_F1 = new QLabel("BP2_F1"); | |||
|
55 | label_NORM_BP2_F2 = new QLabel("BP2_F2"); | |||
|
56 | // | |||
|
57 | label_NORM_SWF_F0_nb = new QLabel("-"); | |||
|
58 | label_NORM_SWF_F1_nb = new QLabel("-"); | |||
|
59 | label_NORM_SWF_F2_nb = new QLabel("-"); | |||
|
60 | label_NORM_CWF_F3_nb = new QLabel("-"); | |||
|
61 | label_NORM_ASM_F0_nb = new QLabel("-"); | |||
|
62 | label_NORM_ASM_F1_nb = new QLabel("-"); | |||
|
63 | label_NORM_ASM_F2_nb = new QLabel("-"); | |||
|
64 | label_NORM_BP1_F0_nb = new QLabel("-"); | |||
|
65 | label_NORM_BP1_F1_nb = new QLabel("-"); | |||
|
66 | label_NORM_BP1_F2_nb = new QLabel("-"); | |||
|
67 | label_NORM_BP2_F0_nb = new QLabel("-"); | |||
|
68 | label_NORM_BP2_F1_nb = new QLabel("-"); | |||
|
69 | label_NORM_BP2_F2_nb = new QLabel("-"); | |||
|
70 | ||||
|
71 | //********************** | |||
|
72 | // TM_LFR_SCIENCE_BURST_ | |||
|
73 | label_BURST_CWF_F2 = new QLabel("CWF_F3"); | |||
|
74 | label_BURST_BP1_F0 = new QLabel("BP1_F0"); | |||
|
75 | label_BURST_BP2_F0 = new QLabel("BP2_F0"); | |||
|
76 | label_BURST_BP1_F1 = new QLabel("BP1_F1"); | |||
|
77 | label_BURST_BP2_F1 = new QLabel("BP2_F1"); | |||
|
78 | // | |||
|
79 | label_BURST_CWF_F2_nb = new QLabel("-"); | |||
|
80 | label_BURST_BP1_F0_nb = new QLabel("-"); | |||
|
81 | label_BURST_BP2_F0_nb = new QLabel("-"); | |||
|
82 | label_BURST_BP1_F1_nb = new QLabel("-"); | |||
|
83 | label_BURST_BP2_F1_nb = new QLabel("-"); | |||
|
84 | ||||
|
85 | //********************* | |||
|
86 | // TM_LFR_SCIENCE_SBM1_ | |||
|
87 | label_SBM1_CWF_F1 = new QLabel("CWF_F1"); | |||
|
88 | label_SBM1_BP1_F0 = new QLabel("BP1_F0"); | |||
|
89 | label_SBM1_BP2_F0 = new QLabel("BP2_F0"); | |||
|
90 | // | |||
|
91 | label_SBM1_CWF_F1_nb = new QLabel("-"); | |||
|
92 | label_SBM1_BP1_F0_nb = new QLabel("-"); | |||
|
93 | label_SBM1_BP2_F0_nb = new QLabel("-"); | |||
|
94 | ||||
|
95 | //********************* | |||
|
96 | // TM_LFR_SCIENCE_SBM2_ | |||
|
97 | label_SBM2_CWF_F2 = new QLabel("CWF_F2"); | |||
|
98 | label_SBM2_BP1_F0 = new QLabel("BP1_F0"); | |||
|
99 | label_SBM2_BP2_F0 = new QLabel("BP2_F0"); | |||
|
100 | label_SBM2_BP1_F1 = new QLabel("BP1_F1"); | |||
|
101 | label_SBM2_BP2_F1 = new QLabel("BP2_F1"); | |||
|
102 | // | |||
|
103 | label_SBM2_CWF_F2_nb = new QLabel("-"); | |||
|
104 | label_SBM2_BP1_F0_nb = new QLabel("-"); | |||
|
105 | label_SBM2_BP2_F0_nb = new QLabel("-"); | |||
|
106 | label_SBM2_BP1_F1_nb = new QLabel("-"); | |||
|
107 | label_SBM2_BP2_F1_nb = new QLabel("-"); | |||
|
108 | ||||
|
109 | //******** | |||
|
110 | // LAST TM | |||
|
111 | label_PID = new QLabel("PID"); | |||
|
112 | label_CAT = new QLabel("CAT"); | |||
|
113 | label_TYP = new QLabel("Type"); | |||
|
114 | label_SUB = new QLabel("Subtype"); | |||
|
115 | label_SID = new QLabel("SID"); | |||
|
116 | label_SIZ = new QLabel("Length"); | |||
|
117 | label_coarse_time = new QLabel("Coarse time: "); | |||
|
118 | label_fine_time = new QLabel("Fine time: "); | |||
|
119 | // | |||
|
120 | label_PID_is = new QLabel("-"); | |||
|
121 | label_CAT_is = new QLabel("-"); | |||
|
122 | label_TYP_is = new QLabel("-"); | |||
|
123 | label_SUB_is = new QLabel("-"); | |||
|
124 | label_SID_is = new QLabel("-"); | |||
|
125 | label_SIZ_is = new QLabel("-"); | |||
|
126 | label_coarse_time_val = new QLabel("-"); | |||
|
127 | label_fine_time_val = new QLabel("-"); | |||
|
128 | ||||
|
129 | // QPushButton | |||
|
130 | button_reset_stat = new QPushButton("reset stat"); | |||
|
131 | ||||
|
132 | //********** | |||
|
133 | // QGroupBox | |||
|
134 | this->setStyleSheet("QGroupBox {border: 1px solid black; }"); | |||
|
135 | ||||
|
136 | groupbox_stat = new QGroupBox("TM_LFR_TC_EXE_"); | |||
|
137 | groupbox_NORM = new QGroupBox("TM_LFR_SCIENCE_NORMAL_"); | |||
|
138 | groupbox_BURST = new QGroupBox("TM_LFR_SCIENCE_BURST_"); | |||
|
139 | groupbox_SBM1 = new QGroupBox("TM_LFR_SCIENCE_SBM1_"); | |||
|
140 | groupbox_SBM2 = new QGroupBox("TM_LFR_SCIENCE_SBM2_"); | |||
|
141 | groupbox_last = new QGroupBox("Last TM received"); | |||
|
142 | ||||
|
143 | groupbox_stat->setFont(font); | |||
|
144 | groupbox_NORM->setFont(font); | |||
|
145 | groupbox_BURST->setFont(font); | |||
|
146 | groupbox_SBM1->setFont(font); | |||
|
147 | groupbox_SBM2->setFont(font); | |||
|
148 | groupbox_last->setFont(font); | |||
|
149 | ||||
|
150 | initConstants(); | |||
|
151 | ||||
|
152 | buildMonitor_NORM(); | |||
|
153 | buildMonitor_BURST(); | |||
|
154 | buildMonitor_SBM1(); | |||
|
155 | buildMonitor_SBM2(); | |||
|
156 | buildMonitor(); | |||
|
157 | ||||
|
158 | connect(this->button_reset_stat, SIGNAL(clicked()), this, SLOT(resetStatistics())); | |||
|
159 | ||||
|
160 | } | |||
|
161 | ||||
|
162 | void TMStatistics::initConstants() | |||
|
163 | { | |||
|
164 | UNKNOWN_nb = 0; | |||
|
165 | ||||
|
166 | // TM_LFR_SCIENCE_NORMAL_ | |||
|
167 | SUCC_nb = 0; | |||
|
168 | INCO_nb = 0; | |||
|
169 | NOTE_nb = 0; | |||
|
170 | NOTI_nb = 0; | |||
|
171 | ERRO_nb = 0; | |||
|
172 | CORR_nb = 0; | |||
|
173 | HK_nb = 0; | |||
|
174 | ||||
|
175 | // TM_LFR_SCIENCE_NORMAL_ | |||
|
176 | NORM_SWF_F0_nb = 0; | |||
|
177 | NORM_SWF_F1_nb = 0; | |||
|
178 | NORM_SWF_F2_nb = 0; | |||
|
179 | NORM_CWF_F3_nb = 0; | |||
|
180 | NORM_ASM_F0_nb = 0; | |||
|
181 | NORM_ASM_F1_nb = 0; | |||
|
182 | NORM_ASM_F2_nb = 0; | |||
|
183 | NORM_BP1_F0_nb = 0; | |||
|
184 | NORM_BP1_F1_nb = 0; | |||
|
185 | NORM_BP1_F2_nb = 0; | |||
|
186 | NORM_BP2_F0_nb = 0; | |||
|
187 | NORM_BP2_F1_nb = 0; | |||
|
188 | NORM_BP2_F2_nb = 0; | |||
|
189 | ||||
|
190 | BURST_CWF_F2_nb = 0; | |||
|
191 | BURST_BP1_F0_nb = 0; | |||
|
192 | BURST_BP2_F0_nb = 0; | |||
|
193 | BURST_BP1_F1_nb = 0; | |||
|
194 | BURST_BP2_F1_nb = 0; | |||
|
195 | SBM1_CWF_F2_nb = 0; | |||
|
196 | SBM1_BP1_F0_nb = 0; | |||
|
197 | SBM1_BP2_F0_nb = 0; | |||
|
198 | SBM2_CWF_F2_nb = 0; | |||
|
199 | SBM2_BP1_F0_nb = 0; | |||
|
200 | SBM2_BP2_F0_nb = 0; | |||
|
201 | SBM2_BP1_F1_nb = 0; | |||
|
202 | SBM2_BP2_F1_nb = 0; | |||
|
203 | } | |||
|
204 | ||||
|
205 | void TMStatistics::buildMonitor_NORM() | |||
|
206 | { | |||
|
207 | layout_NORM->addWidget(label_NORM_SWF_F0, 0, 0, 1, 1); | |||
|
208 | layout_NORM->addWidget(label_NORM_SWF_F1, 1, 0, 1, 1); | |||
|
209 | layout_NORM->addWidget(label_NORM_SWF_F2, 2, 0, 1, 1); | |||
|
210 | layout_NORM->addWidget(label_NORM_CWF_F3, 3, 0, 1, 1); | |||
|
211 | // | |||
|
212 | layout_NORM->addWidget(label_NORM_SWF_F0_nb, 0, 1, 1, 1); | |||
|
213 | layout_NORM->addWidget(label_NORM_SWF_F1_nb, 1, 1, 1, 1); | |||
|
214 | layout_NORM->addWidget(label_NORM_SWF_F2_nb, 2, 1, 1, 1); | |||
|
215 | layout_NORM->addWidget(label_NORM_CWF_F3_nb, 3, 1, 1, 1); | |||
|
216 | // | |||
|
217 | layout_NORM->addWidget(label_NORM_ASM_F0, 4, 0, 1, 1); | |||
|
218 | layout_NORM->addWidget(label_NORM_ASM_F1, 5, 0, 1, 1); | |||
|
219 | layout_NORM->addWidget(label_NORM_ASM_F2, 6, 0, 1, 1); | |||
|
220 | // | |||
|
221 | layout_NORM->addWidget(label_NORM_ASM_F0_nb, 4, 1, 1, 1); | |||
|
222 | layout_NORM->addWidget(label_NORM_ASM_F1_nb, 5, 1, 1, 1); | |||
|
223 | layout_NORM->addWidget(label_NORM_ASM_F2_nb, 6, 1, 1, 1); | |||
|
224 | // | |||
|
225 | layout_NORM->addWidget(label_NORM_BP1_F0, 0, 2, 1, 1); | |||
|
226 | layout_NORM->addWidget(label_NORM_BP1_F1, 1, 2, 1, 1); | |||
|
227 | layout_NORM->addWidget(label_NORM_BP1_F2, 2, 2, 1, 1); | |||
|
228 | layout_NORM->addWidget(label_NORM_BP2_F0, 3, 2, 1, 1); | |||
|
229 | layout_NORM->addWidget(label_NORM_BP2_F1, 4, 2, 1, 1); | |||
|
230 | layout_NORM->addWidget(label_NORM_BP2_F2, 5, 2, 1, 1); | |||
|
231 | // | |||
|
232 | layout_NORM->addWidget(label_NORM_BP1_F0_nb, 0, 3, 1, 1); | |||
|
233 | layout_NORM->addWidget(label_NORM_BP1_F1_nb, 1, 3, 1, 1); | |||
|
234 | layout_NORM->addWidget(label_NORM_BP1_F2_nb, 2, 3, 1, 1); | |||
|
235 | layout_NORM->addWidget(label_NORM_BP2_F0_nb, 3, 3, 1, 1); | |||
|
236 | layout_NORM->addWidget(label_NORM_BP2_F1_nb, 4, 3, 1, 1); | |||
|
237 | layout_NORM->addWidget(label_NORM_BP2_F2_nb, 5, 3, 1, 1); | |||
|
238 | } | |||
|
239 | ||||
|
240 | void TMStatistics::buildMonitor_BURST() | |||
|
241 | { | |||
|
242 | layout_BURST->addWidget(label_BURST_CWF_F2, 0, 0, 1, 1); | |||
|
243 | layout_BURST->addWidget(label_BURST_BP1_F0, 1, 0, 1, 1); | |||
|
244 | layout_BURST->addWidget(label_BURST_BP2_F0, 2, 0, 1, 1); | |||
|
245 | layout_BURST->addWidget(label_BURST_BP1_F1, 3, 0, 1, 1); | |||
|
246 | layout_BURST->addWidget(label_BURST_BP2_F1, 4, 0, 1, 1); | |||
|
247 | // | |||
|
248 | layout_BURST->addWidget(label_BURST_CWF_F2_nb, 0, 1, 1, 1); | |||
|
249 | layout_BURST->addWidget(label_BURST_BP1_F0_nb, 1, 1, 1, 1); | |||
|
250 | layout_BURST->addWidget(label_BURST_BP2_F0_nb, 2, 1, 1, 1); | |||
|
251 | layout_BURST->addWidget(label_BURST_BP1_F1_nb, 3, 1, 1, 1); | |||
|
252 | layout_BURST->addWidget(label_BURST_BP2_F1_nb, 4, 1, 1, 1); | |||
|
253 | // | |||
|
254 | layout_BURST->setRowStretch(5, 1); | |||
|
255 | layout_BURST->setColumnStretch(2,1); | |||
|
256 | } | |||
|
257 | ||||
|
258 | void TMStatistics::buildMonitor_SBM1() | |||
|
259 | { | |||
|
260 | layout_SBM1->addWidget(label_SBM1_CWF_F1, 0, 0, 1, 1); | |||
|
261 | layout_SBM1->addWidget(label_SBM1_BP1_F0, 1, 0, 1, 1); | |||
|
262 | layout_SBM1->addWidget(label_SBM1_BP2_F0, 2, 0, 1, 1); | |||
|
263 | // | |||
|
264 | layout_SBM1->addWidget(label_SBM1_CWF_F1_nb, 0, 1, 1, 1); | |||
|
265 | layout_SBM1->addWidget(label_SBM1_BP1_F0_nb, 1, 1, 1, 1); | |||
|
266 | layout_SBM1->addWidget(label_SBM1_BP2_F0_nb, 2, 1, 1, 1); | |||
|
267 | // | |||
|
268 | layout_SBM1->setRowStretch(3, 1); | |||
|
269 | layout_SBM1->setColumnStretch(2,1); | |||
|
270 | } | |||
|
271 | ||||
|
272 | void TMStatistics::buildMonitor_SBM2() | |||
|
273 | { | |||
|
274 | layout_SBM2->addWidget(label_SBM2_CWF_F2, 0, 0, 1, 1); | |||
|
275 | layout_SBM2->addWidget(label_SBM2_BP1_F0, 1, 0, 1, 1); | |||
|
276 | layout_SBM2->addWidget(label_SBM2_BP2_F0, 2, 0, 1, 1); | |||
|
277 | layout_SBM2->addWidget(label_SBM2_BP1_F1, 3, 0, 1, 1); | |||
|
278 | layout_SBM2->addWidget(label_SBM2_BP2_F1, 4, 0, 1, 1); | |||
|
279 | // | |||
|
280 | layout_SBM2->addWidget(label_SBM2_CWF_F2_nb, 0, 1, 1, 1); | |||
|
281 | layout_SBM2->addWidget(label_SBM2_BP1_F0_nb, 1, 1, 1, 1); | |||
|
282 | layout_SBM2->addWidget(label_SBM2_BP2_F0_nb, 2, 1, 1, 1); | |||
|
283 | layout_SBM2->addWidget(label_SBM2_BP1_F1_nb, 3, 1, 1, 1); | |||
|
284 | layout_SBM2->addWidget(label_SBM2_BP2_F1_nb, 4, 1, 1, 1); | |||
|
285 | // | |||
|
286 | layout_SBM2->setRowStretch(5, 1); | |||
|
287 | layout_SBM2->setColumnStretch(2,1); | |||
|
288 | } | |||
|
289 | ||||
|
290 | void TMStatistics::buildMonitor() | |||
|
291 | { | |||
|
292 | //*************** | |||
|
293 | // TM_LFR_TC_EXE_ | |||
|
294 | layout_stat->addWidget(label_SUCC, 0, 0, 1, 1); | |||
|
295 | layout_stat->addWidget(label_INCO, 1, 0, 1, 1); | |||
|
296 | layout_stat->addWidget(label_NOTE, 2, 0, 1, 1); | |||
|
297 | layout_stat->addWidget(label_NOTI, 3, 0, 1, 1); | |||
|
298 | layout_stat->addWidget(label_ERRO, 4, 0, 1, 1); | |||
|
299 | layout_stat->addWidget(label_CORR, 5, 0, 1, 1); | |||
|
300 | layout_stat->addWidget(label_HK, 6, 0, 1, 1); | |||
|
301 | // | |||
|
302 | layout_stat->addWidget(label_SUCC_nb, 0, 1, 1, 1); | |||
|
303 | layout_stat->addWidget(label_INCO_nb, 1, 1, 1, 1); | |||
|
304 | layout_stat->addWidget(label_NOTE_nb, 2, 1, 1, 1); | |||
|
305 | layout_stat->addWidget(label_NOTI_nb, 3, 1, 1, 1); | |||
|
306 | layout_stat->addWidget(label_ERRO_nb, 4, 1, 1, 1); | |||
|
307 | layout_stat->addWidget(label_CORR_nb, 5, 1, 1, 1); | |||
|
308 | layout_stat->addWidget(label_HK_nb, 6, 1, 1, 1); | |||
|
309 | ||||
|
310 | //******** | |||
|
311 | // LAST TM | |||
|
312 | layout_last->addWidget(label_PID, 0, 0, 1, 1); | |||
|
313 | layout_last->addWidget(label_CAT, 0, 1, 1, 1); | |||
|
314 | layout_last->addWidget(label_TYP, 0, 2, 1, 1); | |||
|
315 | layout_last->addWidget(label_SUB, 0, 3, 1, 1); | |||
|
316 | layout_last->addWidget(label_SID, 0, 4, 1, 1); | |||
|
317 | layout_last->addWidget(label_SIZ, 0, 5, 1, 1); | |||
|
318 | // | |||
|
319 | layout_last->addWidget(label_PID_is, 1, 0, 1, 1); | |||
|
320 | layout_last->addWidget(label_CAT_is, 1, 1, 1, 1); | |||
|
321 | layout_last->addWidget(label_TYP_is, 1, 2, 1, 1); | |||
|
322 | layout_last->addWidget(label_SUB_is, 1, 3, 1, 1); | |||
|
323 | layout_last->addWidget(label_SID_is, 1, 4, 1, 1); | |||
|
324 | layout_last->addWidget(label_SIZ_is, 1, 5, 1, 1); | |||
|
325 | // | |||
|
326 | layout_last->addWidget(label_coarse_time, 2, 0, 1, 1); | |||
|
327 | layout_last->addWidget(label_coarse_time_val, 2, 1, 1, 1); | |||
|
328 | layout_last->addWidget(label_fine_time, 2, 2, 1, 1); | |||
|
329 | layout_last->addWidget(label_fine_time_val, 2, 3, 1, 1); | |||
|
330 | // | |||
|
331 | layout_last->addWidget(label_UNKNOWN, 3, 0, 1, 1); | |||
|
332 | layout_last->addWidget(label_UNKNOWN_nb, 3, 1, 1, 1); | |||
|
333 | ||||
|
334 | //*********** | |||
|
335 | // groupboxes | |||
|
336 | groupbox_stat->setLayout(layout_stat); | |||
|
337 | groupbox_NORM->setLayout(layout_NORM); | |||
|
338 | groupbox_BURST->setLayout(layout_BURST); | |||
|
339 | groupbox_SBM1->setLayout(layout_SBM1); | |||
|
340 | groupbox_SBM2->setLayout(layout_SBM2); | |||
|
341 | groupbox_last->setLayout(layout_last); | |||
|
342 | // | |||
|
343 | mainLayout->addWidget(groupbox_stat, 0, 0, 1, 1); | |||
|
344 | mainLayout->addWidget(groupbox_NORM, 1, 0, 1, 1); | |||
|
345 | mainLayout->addWidget(groupbox_last, 2, 0, 1, 2); | |||
|
346 | mainLayout->addWidget(groupbox_SBM1, 0, 1, 1, 1); | |||
|
347 | mainLayout->addWidget(groupbox_SBM2, 0, 2, 1, 1); | |||
|
348 | mainLayout->addWidget(groupbox_BURST, 1, 1, 1, 1); | |||
|
349 | mainLayout->addWidget(button_reset_stat, 3, 0, 1, 2); | |||
|
350 | mainLayout->setColumnStretch(3, 1); | |||
|
351 | mainLayout->setRowStretch(4, 1); | |||
|
352 | // | |||
|
353 | this->setLayout(mainLayout); | |||
|
354 | } | |||
|
355 | ||||
|
356 | void TMStatistics::resetStatistics() | |||
|
357 | { | |||
|
358 | initConstants(); | |||
|
359 | // | |||
|
360 | label_UNKNOWN_nb->setText("-"); | |||
|
361 | label_SUCC_nb->setText("-"); | |||
|
362 | label_INCO_nb->setText("-"); | |||
|
363 | label_NOTE_nb->setText("-"); | |||
|
364 | label_NOTI_nb->setText("-"); | |||
|
365 | label_ERRO_nb->setText("-"); | |||
|
366 | label_CORR_nb->setText("-"); | |||
|
367 | label_HK_nb->setText("-"); | |||
|
368 | // | |||
|
369 | label_NORM_SWF_F0_nb->setText("-"); | |||
|
370 | label_NORM_SWF_F1_nb->setText("-"); | |||
|
371 | label_NORM_SWF_F2_nb->setText("-"); | |||
|
372 | label_NORM_CWF_F3_nb->setText("-"); | |||
|
373 | // | |||
|
374 | label_PID_is->setText("-"); | |||
|
375 | label_CAT_is->setText("-"); | |||
|
376 | label_TYP_is->setText("-"); | |||
|
377 | label_SUB_is->setText("-"); | |||
|
378 | label_SID_is->setText("-"); | |||
|
379 | label_SIZ_is->setText("-"); | |||
|
380 | // | |||
|
381 | label_coarse_time_val->setText("-"); | |||
|
382 | label_fine_time_val->setText("-"); | |||
|
383 | } | |||
|
384 | ||||
|
385 | void TMStatistics::updateStatistics(unsigned char pid, unsigned char cat, | |||
|
386 | unsigned char typ, unsigned char sub, | |||
|
387 | unsigned int sid, unsigned int length, | |||
|
388 | unsigned int coarse_t, unsigned int fine_t) | |||
|
389 | { | |||
|
390 | if (cat == 1) | |||
|
391 | { | |||
|
392 | if (typ == 1) | |||
|
393 | { | |||
|
394 | if (sub == 7) | |||
|
395 | { | |||
|
396 | SUCC_nb = SUCC_nb + 1; | |||
|
397 | label_SUCC_nb->setText(QString::number(SUCC_nb)); | |||
|
398 | } | |||
|
399 | else if (sub == 8) | |||
|
400 | { | |||
|
401 | if (sid == 5) | |||
|
402 | { | |||
|
403 | INCO_nb = INCO_nb + 1; | |||
|
404 | label_INCO_nb->setText(QString::number(INCO_nb)); | |||
|
405 | } | |||
|
406 | else if (sid == 40000) | |||
|
407 | { | |||
|
408 | NOTE_nb = NOTE_nb + 1; | |||
|
409 | label_NOTE_nb->setText(QString::number(NOTE_nb)); | |||
|
410 | } | |||
|
411 | else if (sid == 40002) | |||
|
412 | { | |||
|
413 | NOTI_nb = NOTI_nb + 1; | |||
|
414 | label_NOTI_nb->setText(QString::number(NOTI_nb)); | |||
|
415 | } | |||
|
416 | else if (sid == 40003) | |||
|
417 | { | |||
|
418 | ERRO_nb = ERRO_nb + 1; | |||
|
419 | label_ERRO_nb->setText(QString::number(ERRO_nb)); | |||
|
420 | } | |||
|
421 | else if (sid == 40005) | |||
|
422 | { | |||
|
423 | CORR_nb = CORR_nb + 1; | |||
|
424 | label_CORR_nb->setText(QString::number(CORR_nb)); | |||
|
425 | } | |||
|
426 | else incrementUnknown(); | |||
|
427 | } | |||
|
428 | else incrementUnknown(); | |||
|
429 | } | |||
|
430 | else | |||
|
431 | incrementUnknown(); | |||
|
432 | } | |||
|
433 | else if (cat == 4) | |||
|
434 | { | |||
|
435 | if (typ == 3) | |||
|
436 | { | |||
|
437 | if (sub == 25) | |||
|
438 | if (sid == 1) | |||
|
439 | { | |||
|
440 | HK_nb = HK_nb + 1; | |||
|
441 | label_HK_nb->setText(QString::number(HK_nb)); | |||
|
442 | } | |||
|
443 | else | |||
|
444 | { | |||
|
445 | incrementUnknown(); | |||
|
446 | } | |||
|
447 | else | |||
|
448 | { | |||
|
449 | incrementUnknown(); | |||
|
450 | } | |||
|
451 | } | |||
|
452 | else | |||
|
453 | { | |||
|
454 | incrementUnknown(); | |||
|
455 | } | |||
|
456 | } | |||
|
457 | else if (cat == 12) | |||
|
458 | { | |||
|
459 | if (typ == 21) | |||
|
460 | { | |||
|
461 | if (sub == 3) | |||
|
462 | if (sid == 1) | |||
|
463 | { | |||
|
464 | NORM_CWF_F3_nb = NORM_CWF_F3_nb + 1; | |||
|
465 | label_NORM_CWF_F3_nb->setText(QString::number(NORM_CWF_F3_nb)); | |||
|
466 | } | |||
|
467 | else if (sid == 3) | |||
|
468 | { | |||
|
469 | NORM_SWF_F0_nb = NORM_SWF_F0_nb + 1; | |||
|
470 | label_NORM_SWF_F0_nb->setText(QString::number(NORM_SWF_F0_nb)); | |||
|
471 | } | |||
|
472 | else if (sid == 4) | |||
|
473 | { | |||
|
474 | NORM_SWF_F1_nb = NORM_SWF_F1_nb + 1; | |||
|
475 | label_NORM_SWF_F1_nb->setText(QString::number(NORM_SWF_F1_nb)); | |||
|
476 | } | |||
|
477 | else if (sid == 5) | |||
|
478 | { | |||
|
479 | NORM_SWF_F2_nb = NORM_SWF_F2_nb + 1; | |||
|
480 | label_NORM_SWF_F2_nb->setText(QString::number(NORM_SWF_F2_nb)); | |||
|
481 | } | |||
|
482 | else | |||
|
483 | { | |||
|
484 | incrementUnknown(); | |||
|
485 | } | |||
|
486 | } | |||
|
487 | else | |||
|
488 | { | |||
|
489 | incrementUnknown(); | |||
|
490 | } | |||
|
491 | } | |||
|
492 | else | |||
|
493 | { | |||
|
494 | incrementUnknown(); | |||
|
495 | } | |||
|
496 | ||||
|
497 | label_PID_is->setText(QString::number(pid)); | |||
|
498 | label_CAT_is->setText(QString::number(cat)); | |||
|
499 | label_TYP_is->setText(QString::number(typ)); | |||
|
500 | label_SUB_is->setText(QString::number(sub)); | |||
|
501 | label_SID_is->setText(QString::number(sid)); | |||
|
502 | label_SIZ_is->setText(QString::number(length)); | |||
|
503 | label_coarse_time_val->setText(QString::number(coarse_t, 16)); | |||
|
504 | label_fine_time_val->setText(QString::number(fine_t, 16)); | |||
|
505 | } | |||
|
506 | ||||
|
507 | void TMStatistics::incrementUnknown() | |||
|
508 | { | |||
|
509 | UNKNOWN_nb = UNKNOWN_nb + 1; | |||
|
510 | label_UNKNOWN_nb->setText(QString::number(UNKNOWN_nb)); | |||
|
511 | } | |||
|
512 | ||||
|
513 | ||||
|
514 | ||||
|
515 | ||||
|
516 | ||||
|
517 |
@@ -0,0 +1,205 | |||||
|
1 | #ifndef TMSTATISTICS_H | |||
|
2 | #define TMSTATISTICS_H | |||
|
3 | ||||
|
4 | #include <QWidget> | |||
|
5 | #include <QLabel> | |||
|
6 | #include <QPushButton> | |||
|
7 | #include <QGridLayout> | |||
|
8 | #include <QVBoxLayout> | |||
|
9 | #include <QGroupBox> | |||
|
10 | ||||
|
11 | #define STATISTICS_FONT_SIZE 9 | |||
|
12 | ||||
|
13 | class TMStatistics : public QWidget | |||
|
14 | { | |||
|
15 | Q_OBJECT | |||
|
16 | public: | |||
|
17 | ||||
|
18 | explicit TMStatistics(QWidget *parent = 0); | |||
|
19 | void initConstants(); | |||
|
20 | void buildMonitor_BURST(); | |||
|
21 | void buildMonitor_SBM1(); | |||
|
22 | void buildMonitor_SBM2(); | |||
|
23 | void buildMonitor_NORM(); | |||
|
24 | void buildMonitor(); | |||
|
25 | void incrementUnknown(); | |||
|
26 | ||||
|
27 | unsigned int UNKNOWN_nb; | |||
|
28 | unsigned int SUCC_nb; | |||
|
29 | unsigned int INCO_nb; | |||
|
30 | unsigned int NOTE_nb; | |||
|
31 | unsigned int NOTI_nb; | |||
|
32 | unsigned int ERRO_nb; | |||
|
33 | unsigned int CORR_nb; | |||
|
34 | unsigned int HK_nb; | |||
|
35 | unsigned int NORM_SWF_F0_nb; | |||
|
36 | unsigned int NORM_SWF_F1_nb; | |||
|
37 | unsigned int NORM_SWF_F2_nb; | |||
|
38 | unsigned int NORM_CWF_F3_nb; | |||
|
39 | unsigned int NORM_ASM_F0_nb; | |||
|
40 | unsigned int NORM_ASM_F1_nb; | |||
|
41 | unsigned int NORM_ASM_F2_nb; | |||
|
42 | unsigned int NORM_BP1_F0_nb; | |||
|
43 | unsigned int NORM_BP1_F1_nb; | |||
|
44 | unsigned int NORM_BP1_F2_nb; | |||
|
45 | unsigned int NORM_BP2_F0_nb; | |||
|
46 | unsigned int NORM_BP2_F1_nb; | |||
|
47 | unsigned int NORM_BP2_F2_nb; | |||
|
48 | // | |||
|
49 | unsigned int BURST_CWF_F2_nb; | |||
|
50 | unsigned int BURST_BP1_F0_nb; | |||
|
51 | unsigned int BURST_BP2_F0_nb; | |||
|
52 | unsigned int BURST_BP1_F1_nb; | |||
|
53 | unsigned int BURST_BP2_F1_nb; | |||
|
54 | unsigned int SBM1_CWF_F2_nb; | |||
|
55 | unsigned int SBM1_BP1_F0_nb; | |||
|
56 | unsigned int SBM1_BP2_F0_nb; | |||
|
57 | unsigned int SBM2_CWF_F2_nb; | |||
|
58 | unsigned int SBM2_BP1_F0_nb; | |||
|
59 | unsigned int SBM2_BP2_F0_nb; | |||
|
60 | unsigned int SBM2_BP1_F1_nb; | |||
|
61 | unsigned int SBM2_BP2_F1_nb; | |||
|
62 | ||||
|
63 | //******* | |||
|
64 | // QLabel | |||
|
65 | QLabel *label_UNKNOWN; | |||
|
66 | QLabel *label_UNKNOWN_nb; | |||
|
67 | ||||
|
68 | //*************** | |||
|
69 | // TM_LFR_TC_EXE_ | |||
|
70 | QLabel *label_SUCC; | |||
|
71 | QLabel *label_INCO; | |||
|
72 | QLabel *label_NOTE; | |||
|
73 | QLabel *label_NOTI; | |||
|
74 | QLabel *label_ERRO; | |||
|
75 | QLabel *label_CORR; | |||
|
76 | QLabel *label_HK; | |||
|
77 | // | |||
|
78 | QLabel *label_SUCC_nb; | |||
|
79 | QLabel *label_INCO_nb; | |||
|
80 | QLabel *label_NOTE_nb; | |||
|
81 | QLabel *label_NOTI_nb; | |||
|
82 | QLabel *label_ERRO_nb; | |||
|
83 | QLabel *label_CORR_nb; | |||
|
84 | QLabel *label_HK_nb; | |||
|
85 | ||||
|
86 | //*********************** | |||
|
87 | // TM_LFR_SCIENCE_NORMAL_ | |||
|
88 | QLabel *label_NORM_SWF_F0; | |||
|
89 | QLabel *label_NORM_SWF_F1; | |||
|
90 | QLabel *label_NORM_SWF_F2; | |||
|
91 | QLabel *label_NORM_CWF_F3; | |||
|
92 | QLabel *label_NORM_ASM_F0; | |||
|
93 | QLabel *label_NORM_ASM_F1; | |||
|
94 | QLabel *label_NORM_ASM_F2; | |||
|
95 | QLabel *label_NORM_BP1_F0; | |||
|
96 | QLabel *label_NORM_BP1_F1; | |||
|
97 | QLabel *label_NORM_BP1_F2; | |||
|
98 | QLabel *label_NORM_BP2_F0; | |||
|
99 | QLabel *label_NORM_BP2_F1; | |||
|
100 | QLabel *label_NORM_BP2_F2; | |||
|
101 | // | |||
|
102 | QLabel *label_NORM_SWF_F0_nb; | |||
|
103 | QLabel *label_NORM_SWF_F1_nb; | |||
|
104 | QLabel *label_NORM_SWF_F2_nb; | |||
|
105 | QLabel *label_NORM_CWF_F3_nb; | |||
|
106 | QLabel *label_NORM_ASM_F0_nb; | |||
|
107 | QLabel *label_NORM_ASM_F1_nb; | |||
|
108 | QLabel *label_NORM_ASM_F2_nb; | |||
|
109 | QLabel *label_NORM_BP1_F0_nb; | |||
|
110 | QLabel *label_NORM_BP1_F1_nb; | |||
|
111 | QLabel *label_NORM_BP1_F2_nb; | |||
|
112 | QLabel *label_NORM_BP2_F0_nb; | |||
|
113 | QLabel *label_NORM_BP2_F1_nb; | |||
|
114 | QLabel *label_NORM_BP2_F2_nb; | |||
|
115 | ||||
|
116 | //********************** | |||
|
117 | // TM_LFR_SCIENCE_BURST_ | |||
|
118 | QLabel *label_BURST_CWF_F2; | |||
|
119 | QLabel *label_BURST_BP1_F0; | |||
|
120 | QLabel *label_BURST_BP2_F0; | |||
|
121 | QLabel *label_BURST_BP1_F1; | |||
|
122 | QLabel *label_BURST_BP2_F1; | |||
|
123 | // | |||
|
124 | QLabel *label_BURST_CWF_F2_nb; | |||
|
125 | QLabel *label_BURST_BP1_F0_nb; | |||
|
126 | QLabel *label_BURST_BP2_F0_nb; | |||
|
127 | QLabel *label_BURST_BP1_F1_nb; | |||
|
128 | QLabel *label_BURST_BP2_F1_nb; | |||
|
129 | ||||
|
130 | //********************* | |||
|
131 | // TM_LFR_SCIENCE_SBM1_ | |||
|
132 | QLabel *label_SBM1_CWF_F1; | |||
|
133 | QLabel *label_SBM1_BP1_F0; | |||
|
134 | QLabel *label_SBM1_BP2_F0; | |||
|
135 | // | |||
|
136 | QLabel *label_SBM1_CWF_F1_nb; | |||
|
137 | QLabel *label_SBM1_BP1_F0_nb; | |||
|
138 | QLabel *label_SBM1_BP2_F0_nb; | |||
|
139 | ||||
|
140 | //********************* | |||
|
141 | // TM_LFR_SCIENCE_SBM2_ | |||
|
142 | QLabel *label_SBM2_CWF_F2; | |||
|
143 | QLabel *label_SBM2_BP1_F0; | |||
|
144 | QLabel *label_SBM2_BP2_F0; | |||
|
145 | QLabel *label_SBM2_BP1_F1; | |||
|
146 | QLabel *label_SBM2_BP2_F1; | |||
|
147 | // | |||
|
148 | QLabel *label_SBM2_CWF_F2_nb; | |||
|
149 | QLabel *label_SBM2_BP1_F0_nb; | |||
|
150 | QLabel *label_SBM2_BP2_F0_nb; | |||
|
151 | QLabel *label_SBM2_BP1_F1_nb; | |||
|
152 | QLabel *label_SBM2_BP2_F1_nb; | |||
|
153 | ||||
|
154 | //******** | |||
|
155 | // LAST TM | |||
|
156 | QLabel *label_PID; | |||
|
157 | QLabel *label_CAT; | |||
|
158 | QLabel *label_TYP; | |||
|
159 | QLabel *label_SUB; | |||
|
160 | QLabel *label_SID; | |||
|
161 | QLabel *label_SIZ; | |||
|
162 | QLabel *label_coarse_time; | |||
|
163 | QLabel *label_fine_time; | |||
|
164 | // | |||
|
165 | QLabel *label_PID_is; | |||
|
166 | QLabel *label_CAT_is; | |||
|
167 | QLabel *label_TYP_is; | |||
|
168 | QLabel *label_SUB_is; | |||
|
169 | QLabel *label_SID_is; | |||
|
170 | QLabel *label_SIZ_is; | |||
|
171 | QLabel *label_coarse_time_val; | |||
|
172 | QLabel *label_fine_time_val; | |||
|
173 | ||||
|
174 | // Layouts | |||
|
175 | QGridLayout *mainLayout; | |||
|
176 | QGridLayout *layout_stat; // TM stastictics | |||
|
177 | QGridLayout *layout_NORM; // TM_LFR_SCIENCE_NORMAL_ | |||
|
178 | QGridLayout *layout_BURST; // TM_LFR_SCIENCE_BURST_ | |||
|
179 | QGridLayout *layout_SBM1; // TM_LFR_SCIENCE_SBM1_ | |||
|
180 | QGridLayout *layout_SBM2; // TM_LFR_SCIENCE_SBM2_ | |||
|
181 | QGridLayout *layout_last; // last TM description | |||
|
182 | ||||
|
183 | // QPushButton | |||
|
184 | QPushButton *button_reset_stat; | |||
|
185 | ||||
|
186 | // QGroupBox | |||
|
187 | QGroupBox *groupbox_stat; | |||
|
188 | QGroupBox *groupbox_NORM; | |||
|
189 | QGroupBox *groupbox_BURST; | |||
|
190 | QGroupBox *groupbox_SBM1; | |||
|
191 | QGroupBox *groupbox_SBM2; | |||
|
192 | QGroupBox *groupbox_last; | |||
|
193 | ||||
|
194 | signals: | |||
|
195 | ||||
|
196 | public slots: | |||
|
197 | void resetStatistics(); | |||
|
198 | void updateStatistics(unsigned char pid, unsigned char cat, | |||
|
199 | unsigned char typ, unsigned char sub, | |||
|
200 | unsigned int sid, unsigned int length, | |||
|
201 | unsigned int coarse_t, unsigned int fine_t); | |||
|
202 | ||||
|
203 | }; | |||
|
204 | ||||
|
205 | #endif // TMSTATISTICS_H |
@@ -0,0 +1,52 | |||||
|
1 | #include "wfdisplay.h" | |||
|
2 | #include <QApplication> | |||
|
3 | ||||
|
4 | WFDisplay::WFDisplay(QWidget *parent) : | |||
|
5 | QWidget(parent) | |||
|
6 | { | |||
|
7 | waveforms_LAYOUT = new QVBoxLayout; | |||
|
8 | ||||
|
9 | spwTabWidget = new QTabWidget; | |||
|
10 | ||||
|
11 | page_f0 = new WFPage; | |||
|
12 | page_f1 = new WFPage; | |||
|
13 | page_f2 = new WFPage; | |||
|
14 | page_f3 = new WFPage; | |||
|
15 | ||||
|
16 | spwTabWidget->addTab(page_f0, tr("f0")); | |||
|
17 | spwTabWidget->addTab(page_f1, tr("f1")); | |||
|
18 | spwTabWidget->addTab(page_f2, tr("f2")); | |||
|
19 | spwTabWidget->addTab(page_f3, tr("f3")); | |||
|
20 | ||||
|
21 | waveforms_LAYOUT->addWidget(spwTabWidget); | |||
|
22 | ||||
|
23 | this->setLayout(waveforms_LAYOUT); | |||
|
24 | ||||
|
25 | } | |||
|
26 | ||||
|
27 | void WFDisplay::displayOnPlot(short *data, unsigned char num_page, unsigned char num) | |||
|
28 | { | |||
|
29 | QVector<double> x(XMAX), y(XMAX); | |||
|
30 | ||||
|
31 | for (int i=0; i<XMAX; ++i) | |||
|
32 | { | |||
|
33 | x[i] = i; | |||
|
34 | y[i] = (double) data[i]; | |||
|
35 | } | |||
|
36 | switch(num_page){ | |||
|
37 | case 0: | |||
|
38 | page_f0->displayOnPlot(data, num); | |||
|
39 | break; | |||
|
40 | case 1: | |||
|
41 | page_f1->displayOnPlot(data, num); | |||
|
42 | break; | |||
|
43 | case 2: | |||
|
44 | page_f2->displayOnPlot(data, num); | |||
|
45 | break; | |||
|
46 | case 3: | |||
|
47 | page_f3->displayOnPlot(data, num); | |||
|
48 | break; | |||
|
49 | } | |||
|
50 | ||||
|
51 | } | |||
|
52 |
@@ -0,0 +1,37 | |||||
|
1 | #ifndef WFDISPLAY_H | |||
|
2 | #define WFDISPLAY_H | |||
|
3 | ||||
|
4 | #include <QWidget> | |||
|
5 | #include <qcustomplot.h> | |||
|
6 | #include <QGridLayout> | |||
|
7 | #include <QVBoxLayout> | |||
|
8 | #include <wfplot.h> | |||
|
9 | #include <wfpage.h> | |||
|
10 | #include <QTabWidget> | |||
|
11 | #include <params.h> | |||
|
12 | ||||
|
13 | class WFDisplay : public QWidget | |||
|
14 | { | |||
|
15 | Q_OBJECT | |||
|
16 | public: | |||
|
17 | explicit WFDisplay(QWidget *parent = 0); | |||
|
18 | ||||
|
19 | WFPage * page_f0; | |||
|
20 | WFPage * page_f1; | |||
|
21 | WFPage * page_f2; | |||
|
22 | WFPage * page_f3; | |||
|
23 | ||||
|
24 | QTabWidget *spwTabWidget; | |||
|
25 | ||||
|
26 | QVBoxLayout *waveforms_LAYOUT; | |||
|
27 | ||||
|
28 | void displayOnPlot(short *data, unsigned char num_page, unsigned char num); | |||
|
29 | ||||
|
30 | ||||
|
31 | signals: | |||
|
32 | ||||
|
33 | public slots: | |||
|
34 | ||||
|
35 | }; | |||
|
36 | ||||
|
37 | #endif // WFDISPLAY_H |
@@ -0,0 +1,24 | |||||
|
1 | #include "wfpacket.h" | |||
|
2 | ||||
|
3 | WFPacket::WFPacket(QObject *parent) : | |||
|
4 | QObject(parent) | |||
|
5 | { | |||
|
6 | this->nbSamples = XMAX; | |||
|
7 | // | |||
|
8 | wf_v = (short*) malloc(2*XMAX); | |||
|
9 | wf_e1 = (short*) malloc(2*XMAX); | |||
|
10 | wf_e2 = (short*) malloc(2*XMAX); | |||
|
11 | wf_b1 = (short*) malloc(2*XMAX); | |||
|
12 | wf_b2 = (short*) malloc(2*XMAX); | |||
|
13 | wf_b3 = (short*) malloc(2*XMAX); | |||
|
14 | } | |||
|
15 | ||||
|
16 | WFPacket::~WFPacket() | |||
|
17 | { | |||
|
18 | free(wf_v); | |||
|
19 | free(wf_e1); | |||
|
20 | free(wf_e2); | |||
|
21 | free(wf_b1); | |||
|
22 | free(wf_b2); | |||
|
23 | free(wf_b3); | |||
|
24 | } |
@@ -0,0 +1,27 | |||||
|
1 | #ifndef WFPACKET_H | |||
|
2 | #define WFPACKET_H | |||
|
3 | ||||
|
4 | #include <QObject> | |||
|
5 | #include <params.h> | |||
|
6 | ||||
|
7 | class WFPacket : public QObject | |||
|
8 | { | |||
|
9 | Q_OBJECT | |||
|
10 | public: | |||
|
11 | explicit WFPacket(QObject *parent = 0); | |||
|
12 | ~WFPacket(); | |||
|
13 | unsigned int nbSamples; | |||
|
14 | short *wf_v; | |||
|
15 | short *wf_e1; | |||
|
16 | short *wf_e2; | |||
|
17 | short *wf_b1; | |||
|
18 | short *wf_b2; | |||
|
19 | short *wf_b3; | |||
|
20 | ||||
|
21 | signals: | |||
|
22 | ||||
|
23 | public slots: | |||
|
24 | ||||
|
25 | }; | |||
|
26 | ||||
|
27 | #endif // WFPACKET_H |
@@ -0,0 +1,53 | |||||
|
1 | #include "wfpage.h" | |||
|
2 | ||||
|
3 | WFPage::WFPage(QWidget *parent) : | |||
|
4 | QWidget(parent) | |||
|
5 | { | |||
|
6 | wfPlot_v = new WFPlot(); | |||
|
7 | wfPlot_e1 = new WFPlot(); | |||
|
8 | wfPlot_e2 = new WFPlot(); | |||
|
9 | wfPlot_b1 = new WFPlot(); | |||
|
10 | wfPlot_b2 = new WFPlot(); | |||
|
11 | wfPlot_b3 = new WFPlot(); | |||
|
12 | // | |||
|
13 | wfPlot_v->customPlot->setTitle("v"); | |||
|
14 | wfPlot_e1->customPlot->setTitle("e1"); | |||
|
15 | wfPlot_e2->customPlot->setTitle("e2"); | |||
|
16 | wfPlot_b1->customPlot->setTitle("b1"); | |||
|
17 | wfPlot_b2->customPlot->setTitle("b2"); | |||
|
18 | wfPlot_b3->customPlot->setTitle("b3"); | |||
|
19 | // | |||
|
20 | mainLayout = new QGridLayout; | |||
|
21 | mainLayout->addWidget(wfPlot_v, 0, 0, 1, 1); | |||
|
22 | mainLayout->addWidget(wfPlot_e1, 0, 1, 1, 1); | |||
|
23 | mainLayout->addWidget(wfPlot_e2, 0, 2, 1, 1); | |||
|
24 | mainLayout->addWidget(wfPlot_b1, 1, 0, 1, 1); | |||
|
25 | mainLayout->addWidget(wfPlot_b2, 1, 1, 1, 1); | |||
|
26 | mainLayout->addWidget(wfPlot_b3, 1, 2, 1, 1); | |||
|
27 | // | |||
|
28 | this->setLayout(mainLayout); | |||
|
29 | } | |||
|
30 | ||||
|
31 | void WFPage::displayOnPlot(short *data, unsigned char num) | |||
|
32 | { | |||
|
33 | switch(num){ | |||
|
34 | case 0: | |||
|
35 | wfPlot_v->displayOnPlot(data, DEFAULT_SIZE); | |||
|
36 | break; | |||
|
37 | case 1: | |||
|
38 | wfPlot_e1->displayOnPlot(data, DEFAULT_SIZE); | |||
|
39 | break; | |||
|
40 | case 2: | |||
|
41 | wfPlot_e2->displayOnPlot(data, DEFAULT_SIZE); | |||
|
42 | break; | |||
|
43 | case 3: | |||
|
44 | wfPlot_b1->displayOnPlot(data, DEFAULT_SIZE); | |||
|
45 | break; | |||
|
46 | case 4: | |||
|
47 | wfPlot_b2->displayOnPlot(data, DEFAULT_SIZE); | |||
|
48 | break; | |||
|
49 | case 5: | |||
|
50 | wfPlot_b3->displayOnPlot(data, DEFAULT_SIZE); | |||
|
51 | break; | |||
|
52 | } | |||
|
53 | } |
@@ -0,0 +1,31 | |||||
|
1 | #ifndef WFPAGE_H | |||
|
2 | #define WFPAGE_H | |||
|
3 | ||||
|
4 | #include <QWidget> | |||
|
5 | #include <wfplot.h> | |||
|
6 | #include <params.h> | |||
|
7 | ||||
|
8 | class WFPage : public QWidget | |||
|
9 | { | |||
|
10 | Q_OBJECT | |||
|
11 | public: | |||
|
12 | explicit WFPage(QWidget *parent = 0); | |||
|
13 | ||||
|
14 | WFPlot *wfPlot_v; | |||
|
15 | WFPlot *wfPlot_e1; | |||
|
16 | WFPlot *wfPlot_e2; | |||
|
17 | WFPlot *wfPlot_b1; | |||
|
18 | WFPlot *wfPlot_b2; | |||
|
19 | WFPlot *wfPlot_b3; | |||
|
20 | ||||
|
21 | QGridLayout *mainLayout; | |||
|
22 | ||||
|
23 | void displayOnPlot(short *data, unsigned char num); | |||
|
24 | ||||
|
25 | signals: | |||
|
26 | ||||
|
27 | public slots: | |||
|
28 | ||||
|
29 | }; | |||
|
30 | ||||
|
31 | #endif // WFPAGE_H |
@@ -0,0 +1,117 | |||||
|
1 | #include "wfplot.h" | |||
|
2 | #include <QFontInfo> | |||
|
3 | ||||
|
4 | WFPlot::WFPlot(QWidget *parent) : | |||
|
5 | QWidget(parent) | |||
|
6 | { | |||
|
7 | // Create Fonts | |||
|
8 | QFont font; | |||
|
9 | font = QFont(this->fontInfo().family(), FONT_SIZE_WAVEFORM_TITLE, QFont::Light); | |||
|
10 | customPlot = new QCustomPlot(); | |||
|
11 | mainLayout = new QVBoxLayout(); | |||
|
12 | ||||
|
13 | customPlot->setInteractions(QCustomPlot::iRangeDrag | QCustomPlot::iRangeZoom | QCustomPlot::iSelectAxes | | |||
|
14 | QCustomPlot::iSelectLegend | QCustomPlot::iSelectPlottables | QCustomPlot::iSelectTitle); | |||
|
15 | customPlot->setRangeDrag(Qt::Horizontal|Qt::Vertical); | |||
|
16 | customPlot->setRangeZoom(Qt::Horizontal|Qt::Vertical); | |||
|
17 | customPlot->xAxis->setRange(0, XMAX); | |||
|
18 | customPlot->yAxis->setRange(-YMAX, YMAX); | |||
|
19 | customPlot->setTitleFont(font); | |||
|
20 | //customPlot->setupFullAxesBox(); | |||
|
21 | ||||
|
22 | customPlot->addGraph(); | |||
|
23 | ||||
|
24 | mainLayout->addWidget(customPlot); | |||
|
25 | ||||
|
26 | this->setLayout(mainLayout); | |||
|
27 | ||||
|
28 | // connect slot that ties some axis selections together (especially opposite axes): | |||
|
29 | connect(customPlot, SIGNAL(selectionChangedByUser()), this, SLOT(selectionChanged())); | |||
|
30 | // connect slots that takes care that when an axis is selected, only that direction can be dragged and zoomed: | |||
|
31 | connect(customPlot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(mousePress())); | |||
|
32 | connect(customPlot, SIGNAL(mouseWheel(QWheelEvent*)), this, SLOT(mouseWheel())); | |||
|
33 | } | |||
|
34 | ||||
|
35 | void WFPlot::selectionChanged() | |||
|
36 | { | |||
|
37 | /* | |||
|
38 | normally, axis base line, axis tick labels and axis labels are selectable separately, but we want | |||
|
39 | the user only to be able to select the axis as a whole, so we tie the selected states of the tick labels | |||
|
40 | and the axis base line together. However, the axis label shall be selectable individually. | |||
|
41 | ||||
|
42 | The selection state of the left and right axes shall be synchronized as well as the state of the | |||
|
43 | bottom and top axes. | |||
|
44 | ||||
|
45 | Further, we want to synchronize the selection of the graphs with the selection state of the respective | |||
|
46 | legend item belonging to that graph. So the user can select a graph by either clicking on the graph itself | |||
|
47 | or on its legend item. | |||
|
48 | */ | |||
|
49 | ||||
|
50 | // make top and bottom axes be selected synchronously, and handle axis and tick labels as one selectable object: | |||
|
51 | if (customPlot->xAxis->selected().testFlag(QCPAxis::spAxis) || customPlot->xAxis->selected().testFlag(QCPAxis::spTickLabels) || | |||
|
52 | customPlot->xAxis2->selected().testFlag(QCPAxis::spAxis) || customPlot->xAxis2->selected().testFlag(QCPAxis::spTickLabels)) | |||
|
53 | { | |||
|
54 | customPlot->xAxis2->setSelected(QCPAxis::spAxis|QCPAxis::spTickLabels); | |||
|
55 | customPlot->xAxis->setSelected(QCPAxis::spAxis|QCPAxis::spTickLabels); | |||
|
56 | } | |||
|
57 | // make left and right axes be selected synchronously, and handle axis and tick labels as one selectable object: | |||
|
58 | if (customPlot->yAxis->selected().testFlag(QCPAxis::spAxis) || customPlot->yAxis->selected().testFlag(QCPAxis::spTickLabels) || | |||
|
59 | customPlot->yAxis2->selected().testFlag(QCPAxis::spAxis) || customPlot->yAxis2->selected().testFlag(QCPAxis::spTickLabels)) | |||
|
60 | { | |||
|
61 | customPlot->yAxis2->setSelected(QCPAxis::spAxis|QCPAxis::spTickLabels); | |||
|
62 | customPlot->yAxis->setSelected(QCPAxis::spAxis|QCPAxis::spTickLabels); | |||
|
63 | } | |||
|
64 | ||||
|
65 | // synchronize selection of graphs with selection of corresponding legend items: | |||
|
66 | for (int i=0; i<customPlot->graphCount(); ++i) | |||
|
67 | { | |||
|
68 | QCPGraph *graph = customPlot->graph(i); | |||
|
69 | QCPPlottableLegendItem *item = customPlot->legend->itemWithPlottable(graph); | |||
|
70 | if (item->selected() || graph->selected()) | |||
|
71 | { | |||
|
72 | item->setSelected(true); | |||
|
73 | graph->setSelected(true); | |||
|
74 | } | |||
|
75 | } | |||
|
76 | } | |||
|
77 | ||||
|
78 | void WFPlot::mousePress() | |||
|
79 | { | |||
|
80 | // if an axis is selected, only allow the direction of that axis to be dragged | |||
|
81 | // if no axis is selected, both directions may be dragged | |||
|
82 | ||||
|
83 | if (customPlot->xAxis->selected().testFlag(QCPAxis::spAxis)) | |||
|
84 | customPlot->setRangeDrag(customPlot->xAxis->orientation()); | |||
|
85 | else if (customPlot->yAxis->selected().testFlag(QCPAxis::spAxis)) | |||
|
86 | customPlot->setRangeDrag(customPlot->yAxis->orientation()); | |||
|
87 | else | |||
|
88 | customPlot->setRangeDrag(Qt::Horizontal|Qt::Vertical); | |||
|
89 | } | |||
|
90 | ||||
|
91 | void WFPlot::mouseWheel() | |||
|
92 | { | |||
|
93 | // if an axis is selected, only allow the direction of that axis to be zoomed | |||
|
94 | // if no axis is selected, both directions may be zoomed | |||
|
95 | ||||
|
96 | if (customPlot->xAxis->selected().testFlag(QCPAxis::spAxis)) | |||
|
97 | customPlot->setRangeZoom(customPlot->xAxis->orientation()); | |||
|
98 | else if (customPlot->yAxis->selected().testFlag(QCPAxis::spAxis)) | |||
|
99 | customPlot->setRangeZoom(customPlot->yAxis->orientation()); | |||
|
100 | else | |||
|
101 | customPlot->setRangeZoom(Qt::Horizontal|Qt::Vertical); | |||
|
102 | } | |||
|
103 | ||||
|
104 | void WFPlot::displayOnPlot(short *data, unsigned int size) | |||
|
105 | { | |||
|
106 | QVector<double> x(size), y(size); | |||
|
107 | ||||
|
108 | for (unsigned int i=0; i<size; ++i) | |||
|
109 | { | |||
|
110 | x[i] = i; | |||
|
111 | y[i] = (double) data[i]; | |||
|
112 | } | |||
|
113 | ||||
|
114 | customPlot->graph(0)->setData(x, y); | |||
|
115 | customPlot->replot(); | |||
|
116 | ||||
|
117 | } |
@@ -0,0 +1,28 | |||||
|
1 | #ifndef WFPLOT_H | |||
|
2 | #define WFPLOT_H | |||
|
3 | ||||
|
4 | #include <QWidget> | |||
|
5 | #include <qcustomplot.h> | |||
|
6 | #include <QVBoxLayout> | |||
|
7 | #include <params.h> | |||
|
8 | ||||
|
9 | class WFPlot : public QWidget | |||
|
10 | { | |||
|
11 | Q_OBJECT | |||
|
12 | public: | |||
|
13 | explicit WFPlot(QWidget *parent = 0); | |||
|
14 | ||||
|
15 | QCustomPlot * customPlot; | |||
|
16 | void displayOnPlot(short *data, unsigned int size); | |||
|
17 | QVBoxLayout *mainLayout; | |||
|
18 | ||||
|
19 | signals: | |||
|
20 | ||||
|
21 | public slots: | |||
|
22 | void selectionChanged(); | |||
|
23 | void mousePress(); | |||
|
24 | void mouseWheel(); | |||
|
25 | ||||
|
26 | }; | |||
|
27 | ||||
|
28 | #endif // WFPLOT_H |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now