##// END OF EJS Templates
ASM_F1 and ASM_F2 displays added to lfrsgse
leroy -
r75:be11db85f112 default
parent child
Show More
@@ -1,723 +1,731
1 #include "mainwindow.h"
1 #include "mainwindow.h"
2 #include <iostream>
2 #include <iostream>
3 #include <QNetworkInterface>
3 #include <QNetworkInterface>
4
4
5 MainWindow::MainWindow(QWidget *parent)
5 MainWindow::MainWindow(QWidget *parent)
6 : QMainWindow(parent)
6 : QMainWindow(parent)
7 {
7 {
8 parsingContinue = false;
8 parsingContinue = false;
9 totalOfBytes = 0;
9 totalOfBytes = 0;
10 totalOfPackets = 0;
10 totalOfPackets = 0;
11
11
12 spectraPacketNormalSpectrumF0 = new SpectraPacket(0, 128);
12 spectraPacketNormalSpectrumF0 = new SpectraPacket(0, 128);
13 spectraPacketNormalSpectrumF1 = new SpectraPacket(0, 128);
14 spectraPacketNormalSpectrumF2 = new SpectraPacket(0, 128);
13
15
14 //*********
16 //*********
15 // wfPacket
17 // wfPacket
16 wfPacketNormal[0] = new WFPacket(0, 2048);
18 wfPacketNormal[0] = new WFPacket(0, 2048);
17 wfPacketNormal[1] = new WFPacket(0, 2048);
19 wfPacketNormal[1] = new WFPacket(0, 2048);
18 wfPacketNormal[2] = new WFPacket(0, 2048);
20 wfPacketNormal[2] = new WFPacket(0, 2048);
19 wfPacketNormal[3] = new WFPacket(0, 2688);
21 wfPacketNormal[3] = new WFPacket(0, 2688);
20 wfPacketBurst = new WFPacket(0, 2688);
22 wfPacketBurst = new WFPacket(0, 2688);
21 wfPacketSBM1 = new WFPacket(0, 2688);
23 wfPacketSBM1 = new WFPacket(0, 2688);
22 wfPacketSBM2 = new WFPacket(0, 2688);
24 wfPacketSBM2 = new WFPacket(0, 2688);
23 wfPacketCWF_F3 = new WFPacket(0, 2688);
25 wfPacketCWF_F3 = new WFPacket(0, 2688);
24
26
25 //****
27 //****
26 // XML
28 // XML
27 // xml handlers
29 // xml handlers
28 xmlHandler = new LFRXmlHandler();
30 xmlHandler = new LFRXmlHandler();
29 // xml sources
31 // xml sources
30 sourceTC = new QXmlInputSource();
32 sourceTC = new QXmlInputSource();
31 // xml writer
33 // xml writer
32 lfrXmlWriter = new LFRXmlWriter();
34 lfrXmlWriter = new LFRXmlWriter();
33 // setup xml parser for the echo bridge
35 // setup xml parser for the echo bridge
34 lfrXmlParser = new LFRXmlParser();
36 lfrXmlParser = new LFRXmlParser();
35
37
36 UI = new MainWindowUI();
38 UI = new MainWindowUI();
37 readSettings();
39 readSettings();
38 this->UI->serverTMEchoDialogBox->setIP(echoBridgeIP0, echoBridgeIP1, echoBridgeIP2, echoBridgeIP3);
40 this->UI->serverTMEchoDialogBox->setIP(echoBridgeIP0, echoBridgeIP1, echoBridgeIP2, echoBridgeIP3);
39
41
40 lfrXmlParser->generalCCSDSPacketStore = &this->generalCCSDSPacketStore;
42 lfrXmlParser->generalCCSDSPacketStore = &this->generalCCSDSPacketStore;
41
43
42 initSocketStatesList();
44 initSocketStatesList();
43
45
44 this->setCentralWidget(this->UI);
46 this->setCentralWidget(this->UI);
45 //this->setLayout(UI->layout());
47 //this->setLayout(UI->layout());
46
48
47 analyserSGSEServerTC = new QTcpServer();
49 analyserSGSEServerTC = new QTcpServer();
48 analyserSGSEServerTM = new QTcpServer();
50 analyserSGSEServerTM = new QTcpServer();
49
51
50 socketTC = NULL;
52 socketTC = NULL;
51 socketTM = NULL;
53 socketTM = NULL;
52 socketEchoServer = new QTcpSocket();
54 socketEchoServer = new QTcpSocket();
53
55
54 connect(this->UI->button_openServerTCTM, SIGNAL(clicked()), this, SLOT(listenOnTCTMPorts()));
56 connect(this->UI->button_openServerTCTM, SIGNAL(clicked()), this, SLOT(listenOnTCTMPorts()));
55 connect(this->UI->button_testServerTCTM, SIGNAL(clicked()), this, SLOT(testTCTMPorts()));
57 connect(this->UI->button_testServerTCTM, SIGNAL(clicked()), this, SLOT(testTCTMPorts()));
56 connect(this->UI->button_openSocketEchoServer, SIGNAL(clicked()), this, SLOT(openEchoServer()));
58 connect(this->UI->button_openSocketEchoServer, SIGNAL(clicked()), this, SLOT(openEchoServer()));
57 //
59 //
58 connect(this->analyserSGSEServerTC, SIGNAL(newConnection()), this, SLOT(newConnectionOnTCServer()));
60 connect(this->analyserSGSEServerTC, SIGNAL(newConnection()), this, SLOT(newConnectionOnTCServer()));
59 connect(this->analyserSGSEServerTM, SIGNAL(newConnection()), this, SLOT(newConnectionOnTMServer()));
61 connect(this->analyserSGSEServerTM, SIGNAL(newConnection()), this, SLOT(newConnectionOnTMServer()));
60 //
62 //
61 connect(this, SIGNAL(socketTMHasChanged(QTcpSocket*)), this->lfrXmlWriter, SLOT(setSocketTM(QTcpSocket*)));
63 connect(this, SIGNAL(socketTMHasChanged(QTcpSocket*)), this->lfrXmlWriter, SLOT(setSocketTM(QTcpSocket*)));
62 connect(this->UI->button_TCAcknowledgement, SIGNAL(clicked()), this->lfrXmlWriter, SLOT(sendXML_TC_Acknowledgment()));
64 connect(this->UI->button_TCAcknowledgement, SIGNAL(clicked()), this->lfrXmlWriter, SLOT(sendXML_TC_Acknowledgment()));
63 connect(this->UI->button_TCRejection, SIGNAL(clicked()), this->lfrXmlWriter, SLOT(sendXML_TC_rejection()));
65 connect(this->UI->button_TCRejection, SIGNAL(clicked()), this->lfrXmlWriter, SLOT(sendXML_TC_rejection()));
64 connect(this->UI->button_GSEHK, SIGNAL(clicked()), this->lfrXmlWriter, SLOT(sendXML_GSE_HK()));
66 connect(this->UI->button_GSEHK, SIGNAL(clicked()), this->lfrXmlWriter, SLOT(sendXML_GSE_HK()));
65
67
66 // socket echo server
68 // socket echo server
67 connect(this->socketEchoServer, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
69 connect(this->socketEchoServer, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
68 this, SLOT(socket_TMEcho_ServerHasChanged()));
70 this, SLOT(socket_TMEcho_ServerHasChanged()));
69 connect(this->socketEchoServer, SIGNAL(readyRead()),
71 connect(this->socketEchoServer, SIGNAL(readyRead()),
70 this, SLOT(readDataOnSocketEchoServer()));
72 this, SLOT(readDataOnSocketEchoServer()));
71
73
72 // display on console
74 // display on console
73 connect(this->xmlHandler, SIGNAL(displayMessage(QString)),
75 connect(this->xmlHandler, SIGNAL(displayMessage(QString)),
74 this, SLOT(displayOnConsole(QString)));
76 this, SLOT(displayOnConsole(QString)));
75 connect(this->UI->hkDisplay, SIGNAL(displayMessage(QString)),
77 connect(this->UI->hkDisplay, SIGNAL(displayMessage(QString)),
76 this, SLOT(displayOnConsole(QString)));
78 this, SLOT(displayOnConsole(QString)));
77 connect(this->lfrXmlParser, SIGNAL(sendMessage(QString)),
79 connect(this->lfrXmlParser, SIGNAL(sendMessage(QString)),
78 this, SLOT(displayOnConsole(QString)));
80 this, SLOT(displayOnConsole(QString)));
79 //
81 //
80 connect(this->lfrXmlParser, SIGNAL(processPacketStore()),
82 connect(this->lfrXmlParser, SIGNAL(processPacketStore()),
81 this, SLOT(processPacketStore()));
83 this, SLOT(processPacketStore()));
82 //
84 //
83 connect(this->UI->button_resetStatistics, SIGNAL(clicked()),
85 connect(this->UI->button_resetStatistics, SIGNAL(clicked()),
84 this, SLOT(resetStatistics()));
86 this, SLOT(resetStatistics()));
85
87
86 displayNetworkInterfaces();
88 displayNetworkInterfaces();
87
89
88 this->xmlHandler->packetStoreHasChanged(&generalCCSDSPacketStore);
90 this->xmlHandler->packetStoreHasChanged(&generalCCSDSPacketStore);
89 };
91 };
90
92
91 MainWindow::~MainWindow()
93 MainWindow::~MainWindow()
92 {
94 {
93 delete wfPacketNormal[0];
95 delete wfPacketNormal[0];
94 delete wfPacketNormal[1];
96 delete wfPacketNormal[1];
95 delete wfPacketNormal[2];
97 delete wfPacketNormal[2];
96 delete wfPacketNormal[3];
98 delete wfPacketNormal[3];
97 delete wfPacketBurst;
99 delete wfPacketBurst;
98 delete wfPacketSBM1;
100 delete wfPacketSBM1;
99 delete wfPacketSBM2;
101 delete wfPacketSBM2;
100 delete wfPacketCWF_F3;
102 delete wfPacketCWF_F3;
101 }
103 }
102
104
103 void MainWindow::displayNetworkInterfaces()
105 void MainWindow::displayNetworkInterfaces()
104 {
106 {
105 QList<QHostAddress> list = QNetworkInterface::allAddresses();
107 QList<QHostAddress> list = QNetworkInterface::allAddresses();
106 this->displayOnConsole("Network interfaces:");
108 this->displayOnConsole("Network interfaces:");
107 for(int nIter=0; nIter<list.count(); nIter++)
109 for(int nIter=0; nIter<list.count(); nIter++)
108 {
110 {
109 this->UI->displayOnConsole(list[nIter].toString());
111 this->UI->displayOnConsole(list[nIter].toString());
110 }
112 }
111 }
113 }
112
114
113 void MainWindow::listenOnTCTMPorts()
115 void MainWindow::listenOnTCTMPorts()
114 {
116 {
115 QString str;
117 QString str;
116
118
117 //***
119 //***
118 // TC
120 // TC
119 analyserSGSEServerTC->listen(QHostAddress::Any, this->UI->getTCPort());
121 analyserSGSEServerTC->listen(QHostAddress::Any, this->UI->getTCPort());
120 str = analyserSGSEServerTC->errorString();
122 str = analyserSGSEServerTC->errorString();
121 if (!str.isEmpty())
123 if (!str.isEmpty())
122 {
124 {
123 this->displayOnConsole(str);
125 this->displayOnConsole(str);
124 }
126 }
125 this->displayOnConsole("Listening TC on port "
127 this->displayOnConsole("Listening TC on port "
126 + QString::number(this->UI->getTCPort())
128 + QString::number(this->UI->getTCPort())
127 );
129 );
128
130
129 //***
131 //***
130 // TM
132 // TM
131 analyserSGSEServerTM->listen(QHostAddress::Any, this->UI->getTMPort());
133 analyserSGSEServerTM->listen(QHostAddress::Any, this->UI->getTMPort());
132 str = analyserSGSEServerTM->errorString();
134 str = analyserSGSEServerTM->errorString();
133 if (!str.isEmpty())
135 if (!str.isEmpty())
134 {
136 {
135 this->displayOnConsole(str);
137 this->displayOnConsole(str);
136 }
138 }
137 this->displayOnConsole("Listening TM on port "
139 this->displayOnConsole("Listening TM on port "
138 + QString::number(this->UI->getTMPort())
140 + QString::number(this->UI->getTMPort())
139 );
141 );
140 }
142 }
141
143
142 void MainWindow::testTCTMPorts()
144 void MainWindow::testTCTMPorts()
143 {
145 {
144 if (socketTC != NULL)
146 if (socketTC != NULL)
145 {
147 {
146 this->displayOnConsole("TC socket *** " + socketStates.at(socketTC->state()) );
148 this->displayOnConsole("TC socket *** " + socketStates.at(socketTC->state()) );
147 }
149 }
148 else
150 else
149 {
151 {
150 this->displayOnConsole("TC socket *** not tested, (socketTC) is NULL" );
152 this->displayOnConsole("TC socket *** not tested, (socketTC) is NULL" );
151 }
153 }
152 if (socketTM != NULL)
154 if (socketTM != NULL)
153 {
155 {
154 this->displayOnConsole("TM socket *** " + socketStates.at(socketTM->state()) );
156 this->displayOnConsole("TM socket *** " + socketStates.at(socketTM->state()) );
155 }
157 }
156 else
158 else
157 {
159 {
158 this->displayOnConsole("TM socket *** not tested, (socketTM) is NULL" );
160 this->displayOnConsole("TM socket *** not tested, (socketTM) is NULL" );
159 }
161 }
160 }
162 }
161
163
162 void MainWindow::newConnectionOnTCServer()
164 void MainWindow::newConnectionOnTCServer()
163 {
165 {
164 this->displayOnConsole("got new connection on TC port");
166 this->displayOnConsole("got new connection on TC port");
165 socketTC = analyserSGSEServerTC->nextPendingConnection();
167 socketTC = analyserSGSEServerTC->nextPendingConnection();
166 this->displayOnConsole("TC socket *** " + socketStates.at(socketTC->state()) );
168 this->displayOnConsole("TC socket *** " + socketStates.at(socketTC->state()) );
167 connect(this->socketTC, SIGNAL(readyRead()), this, SLOT(readDataOnTCPort()));
169 connect(this->socketTC, SIGNAL(readyRead()), this, SLOT(readDataOnTCPort()));
168 }
170 }
169
171
170 void MainWindow::newConnectionOnTMServer()
172 void MainWindow::newConnectionOnTMServer()
171 {
173 {
172 this->displayOnConsole("got new connection on TM port");
174 this->displayOnConsole("got new connection on TM port");
173 socketTM = analyserSGSEServerTM->nextPendingConnection();
175 socketTM = analyserSGSEServerTM->nextPendingConnection();
174 this->displayOnConsole("TM socket *** " + socketStates.at(socketTM->state()) );
176 this->displayOnConsole("TM socket *** " + socketStates.at(socketTM->state()) );
175 connect(this->socketTM, SIGNAL(readyRead()), this, SLOT(readDataOnTMPort()));
177 connect(this->socketTM, SIGNAL(readyRead()), this, SLOT(readDataOnTMPort()));
176
178
177 emit socketTMHasChanged(this->socketTM);
179 emit socketTMHasChanged(this->socketTM);
178 }
180 }
179
181
180 void MainWindow::readDataOnTCPort()
182 void MainWindow::readDataOnTCPort()
181 {
183 {
182 bool ok;
184 bool ok;
183 int nbBytesAvailable = 0;
185 int nbBytesAvailable = 0;
184
186
185 nbBytesAvailable = socketTC->bytesAvailable();
187 nbBytesAvailable = socketTC->bytesAvailable();
186 buffer = (char *) malloc(nbBytesAvailable);
188 buffer = (char *) malloc(nbBytesAvailable);
187 socketTC->read(buffer, nbBytesAvailable);
189 socketTC->read(buffer, nbBytesAvailable);
188
190
189 this->displayOnConsole("readDataOnTCPort *** "
191 this->displayOnConsole("readDataOnTCPort *** "
190 + QString::number(nbBytesAvailable)
192 + QString::number(nbBytesAvailable)
191 + " read");
193 + " read");
192
194
193 QByteArray xmlData( buffer, nbBytesAvailable);
195 QByteArray xmlData( buffer, nbBytesAvailable);
194
196
195 free(buffer);
197 free(buffer);
196
198
197 sourceTC->setData( xmlData );
199 sourceTC->setData( xmlData );
198
200
199 xmlReader.setContentHandler(xmlHandler);
201 xmlReader.setContentHandler(xmlHandler);
200 xmlReader.setErrorHandler(xmlHandler);
202 xmlReader.setErrorHandler(xmlHandler);
201
203
202 ok = xmlReader.parse(sourceTC);
204 ok = xmlReader.parse(sourceTC);
203 if (!ok) {
205 if (!ok) {
204 std::cout << "Parsing failed." << std::endl;
206 std::cout << "Parsing failed." << std::endl;
205 }
207 }
206 else {
208 else {
207 QStringList names = xmlHandler->names();
209 QStringList names = xmlHandler->names();
208 QList<int> indentations = xmlHandler->indentations();
210 QList<int> indentations = xmlHandler->indentations();
209
211
210 int items = names.count();
212 int items = names.count();
211
213
212 for (int i = 0; i < items; ++i) {
214 for (int i = 0; i < items; ++i) {
213 displayOnConsole(
215 displayOnConsole(
214 names[i]
216 names[i]
215 + " --- identations: "
217 + " --- identations: "
216 + QString::number(indentations[i]));
218 + QString::number(indentations[i]));
217 }
219 }
218 }
220 }
219 }
221 }
220
222
221 void MainWindow::readDataOnTMPort()
223 void MainWindow::readDataOnTMPort()
222 {
224 {
223 this->displayOnConsole("TM data received, begin parsing");
225 this->displayOnConsole("TM data received, begin parsing");
224 }
226 }
225
227
226 void MainWindow::readDataOnSocketEchoServer()
228 void MainWindow::readDataOnSocketEchoServer()
227 {
229 {
228 QString dataString;
230 QString dataString;
229
231
230 dataArray.append(socketEchoServer->readAll());
232 dataArray.append(socketEchoServer->readAll());
231 // dataString = QString::fromAscii(dataArray);
233 // dataString = QString::fromAscii(dataArray);
232 dataString = QString::fromLatin1(dataArray);
234 dataString = QString::fromLatin1(dataArray);
233 this->lfrXmlParser->processIncomingStr(dataString);
235 this->lfrXmlParser->processIncomingStr(dataString);
234 dataArray.clear();
236 dataArray.clear();
235 }
237 }
236
238
237 void MainWindow::displayOnConsole(QString message)
239 void MainWindow::displayOnConsole(QString message)
238 {
240 {
239 this->UI->displayOnConsole( message );
241 this->UI->displayOnConsole( message );
240 }
242 }
241
243
242 void MainWindow::initSocketStatesList()
244 void MainWindow::initSocketStatesList()
243 {
245 {
244 socketStates.append("The socket is not connected");
246 socketStates.append("The socket is not connected");
245 socketStates.append("The socket is performing a host name lookup");
247 socketStates.append("The socket is performing a host name lookup");
246 socketStates.append("The socket has started establishing a connection");
248 socketStates.append("The socket has started establishing a connection");
247 socketStates.append("A connection is established");
249 socketStates.append("A connection is established");
248 socketStates.append("The socket is bound to an address and port (for servers)");
250 socketStates.append("The socket is bound to an address and port (for servers)");
249 socketStates.append("The socket is about to close (data may still be waiting to be written)");
251 socketStates.append("The socket is about to close (data may still be waiting to be written)");
250 socketStates.append("For internal use only");
252 socketStates.append("For internal use only");
251 }
253 }
252
254
253 void MainWindow::openEchoServer()
255 void MainWindow::openEchoServer()
254 {
256 {
255 socketEchoServer->connectToHost(this->UI->serverTMEchoDialogBox->getIP(),
257 socketEchoServer->connectToHost(this->UI->serverTMEchoDialogBox->getIP(),
256 this->UI->spinbox_serverTMEchoPort->value());
258 this->UI->spinbox_serverTMEchoPort->value());
257 //socketEchoServer->open();
259 //socketEchoServer->open();
258 }
260 }
259
261
260 void MainWindow::socket_TMEcho_ServerHasChanged()
262 void MainWindow::socket_TMEcho_ServerHasChanged()
261 {
263 {
262 this->displayOnConsole("TM Echo Socket socket *** " + socketStates.at(socketEchoServer->state()) );
264 this->displayOnConsole("TM Echo Socket socket *** " + socketStates.at(socketEchoServer->state()) );
263 }
265 }
264
266
265 void MainWindow::buildWFAndDisplay_SWF(TMPacketToRead *packet, WFPacket *wfPacket, unsigned char num_page)
267 void MainWindow::buildWFAndDisplay_SWF(TMPacketToRead *packet, WFPacket *wfPacket, unsigned char num_page)
266 {
268 {
267 unsigned int i = 0;
269 unsigned int i = 0;
268 static unsigned int nbSamples = 0;
270 static unsigned int nbSamples = 0;
269 unsigned char *data;
271 unsigned char *data;
270 unsigned char pa_lfr_pkt_cnt;
272 unsigned char pa_lfr_pkt_cnt;
271 unsigned char pa_lfr_pkt_nr;
273 unsigned char pa_lfr_pkt_nr;
272 unsigned int pa_lfr_swf_blk_nr = 0;
274 unsigned int pa_lfr_swf_blk_nr = 0;
273 double deltaT;
275 double deltaT;
274
276
275 switch(num_page)
277 switch(num_page)
276 {
278 {
277 case 0: // F0
279 case 0: // F0
278 deltaT = 1. / 24576;
280 deltaT = 1. / 24576;
279 break;
281 break;
280 case 1: // F1
282 case 1: // F1
281 deltaT = 1. / 4096;
283 deltaT = 1. / 4096;
282 break;
284 break;
283 case 2: // F2
285 case 2: // F2
284 deltaT = 1. / 256;
286 deltaT = 1. / 256;
285 break;
287 break;
286 default:
288 default:
287 deltaT = 0;
289 deltaT = 0;
288 break;
290 break;
289 }
291 }
290 pa_lfr_pkt_cnt = packet->Value[22];
292 pa_lfr_pkt_cnt = packet->Value[22];
291 pa_lfr_pkt_nr = packet->Value[23]; // PA_LFR_PKT_NR
293 pa_lfr_pkt_nr = packet->Value[23]; // PA_LFR_PKT_NR
292 pa_lfr_swf_blk_nr = packet->Value[30] * 256 + packet->Value[31]; // PA_LFR_SWF_BLK_NR
294 pa_lfr_swf_blk_nr = packet->Value[30] * 256 + packet->Value[31]; // PA_LFR_SWF_BLK_NR
293 data = &packet->Value[32]; // start of the first data block;
295 data = &packet->Value[32]; // start of the first data block;
294
296
295 if (pa_lfr_pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
297 if (pa_lfr_pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
296 {
298 {
297 nbSamples = 0;
299 nbSamples = 0;
298 wfPacket->coarseTime = ((packet->Value[24] & 0x7f) << 24)
300 wfPacket->coarseTime = ((packet->Value[24] & 0x7f) << 24)
299 + (packet->Value[25] << 16)
301 + (packet->Value[25] << 16)
300 + (packet->Value[26] << 8)
302 + (packet->Value[26] << 8)
301 + packet->Value[27];
303 + packet->Value[27];
302 wfPacket->fineTime = (packet->Value[28] << 8) + packet->Value[29];
304 wfPacket->fineTime = (packet->Value[28] << 8) + packet->Value[29];
303 }
305 }
304
306
305 for ( i=0; i<pa_lfr_swf_blk_nr; i++ ){
307 for ( i=0; i<pa_lfr_swf_blk_nr; i++ ){
306 wfPacket->wf_v[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) ] << 8) + (data[ (i*BLK_SIZE) + 1]) );
308 wfPacket->wf_v[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) ] << 8) + (data[ (i*BLK_SIZE) + 1]) );
307 wfPacket->wf_e1[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 2] << 8) + (data[ (i*BLK_SIZE) + 3]) );
309 wfPacket->wf_e1[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 2] << 8) + (data[ (i*BLK_SIZE) + 3]) );
308 wfPacket->wf_e2[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 4] << 8) + (data[ (i*BLK_SIZE) + 5]) );
310 wfPacket->wf_e2[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 4] << 8) + (data[ (i*BLK_SIZE) + 5]) );
309 wfPacket->wf_b1[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 6] << 8) + (data[ (i*BLK_SIZE) + 7]) );
311 wfPacket->wf_b1[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 6] << 8) + (data[ (i*BLK_SIZE) + 7]) );
310 wfPacket->wf_b2[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 8] << 8) + (data[ (i*BLK_SIZE) + 9]) );
312 wfPacket->wf_b2[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 8] << 8) + (data[ (i*BLK_SIZE) + 9]) );
311 wfPacket->wf_b3[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 10] << 8) + (data[ (i*BLK_SIZE) + 11]) );
313 wfPacket->wf_b3[nbSamples + i] = (short) ( (data[ (i * BLK_SIZE) + 10] << 8) + (data[ (i*BLK_SIZE) + 11]) );
312 }
314 }
313
315
314 nbSamples = nbSamples + pa_lfr_swf_blk_nr;
316 nbSamples = nbSamples + pa_lfr_swf_blk_nr;
315
317
316 if (pa_lfr_pkt_nr == pa_lfr_pkt_cnt)
318 if (pa_lfr_pkt_nr == pa_lfr_pkt_cnt)
317 {
319 {
318 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_v, num_page, 0, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
320 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_v, num_page, 0, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
319 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_e1, num_page, 1, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
321 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_e1, num_page, 1, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
320 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_e2, num_page, 2, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
322 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_e2, num_page, 2, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
321 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_b1, num_page, 3, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
323 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_b1, num_page, 3, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
322 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_b2, num_page, 4, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
324 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_b2, num_page, 4, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
323 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_b3, num_page, 5, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
325 this->UI->wfDisplay->displayOnPlot(wfPacket->wf_b3, num_page, 5, wfPacket->coarseTime, wfPacket->fineTime, deltaT, nbSamples);
324 }
326 }
325 }
327 }
326
328
327 void MainWindow::buildWFAndDisplay_CWF_LONG_F3(TMPacketToRead *packet, WFPacket *wfPacket)
329 void MainWindow::buildWFAndDisplay_CWF_LONG_F3(TMPacketToRead *packet, WFPacket *wfPacket)
328 {
330 {
329 unsigned int i = 0;
331 unsigned int i = 0;
330 unsigned int j = 0;
332 unsigned int j = 0;
331 unsigned char *data;
333 unsigned char *data;
332 static unsigned char pkt_nr = 1;
334 static unsigned char pkt_nr = 1;
333 unsigned int blk_nr = 0;
335 unsigned int blk_nr = 0;
334 static unsigned int coarseTime;
336 static unsigned int coarseTime;
335 static unsigned int fineTime;
337 static unsigned int fineTime;
336 unsigned int tmpCoarseTime;
338 unsigned int tmpCoarseTime;
337 unsigned int tmpFineTime;
339 unsigned int tmpFineTime;
338 double deltaT;
340 double deltaT;
339 double DELTA;
341 double DELTA;
340 unsigned int nbData;
342 unsigned int nbData;
341
343
342 deltaT = 1 / 16.;
344 deltaT = 1 / 16.;
343
345
344 if (pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
346 if (pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
345 {
347 {
346 tmpCoarseTime = coarseTime;
348 tmpCoarseTime = coarseTime;
347 tmpFineTime = fineTime;
349 tmpFineTime = fineTime;
348 coarseTime = ((packet->Value[22] & 0x7f) << 24)
350 coarseTime = ((packet->Value[22] & 0x7f) << 24)
349 + (packet->Value[23] << 16)
351 + (packet->Value[23] << 16)
350 + (packet->Value[24] << 8)
352 + (packet->Value[24] << 8)
351 + packet->Value[25];
353 + packet->Value[25];
352 fineTime = (packet->Value[26] << 8) + packet->Value[27];
354 fineTime = (packet->Value[26] << 8) + packet->Value[27];
353 DELTA = (coarseTime + fineTime * 1. / 65536.)
355 DELTA = (coarseTime + fineTime * 1. / 65536.)
354 - (tmpCoarseTime + tmpFineTime * 1. / 65536);
356 - (tmpCoarseTime + tmpFineTime * 1. / 65536);
355 displayOnConsole( "DELTA = " + QString::number(DELTA, 'f', 10) );
357 displayOnConsole( "DELTA = " + QString::number(DELTA, 'f', 10) );
356 }
358 }
357 blk_nr = packet->Value[28] * 256 + packet->Value[29]; // PA_LFR_CWFL3_BLK_NR
359 blk_nr = packet->Value[28] * 256 + packet->Value[29]; // PA_LFR_CWFL3_BLK_NR
358 data = &packet->Value[30]; // start of the first data block;
360 data = &packet->Value[30]; // start of the first data block;
359
361
360 j = (pkt_nr-1) * blk_nr;
362 j = (pkt_nr-1) * blk_nr;
361 for ( i=0; i<blk_nr; i++ ){
363 for ( i=0; i<blk_nr; i++ ){
362 wfPacket->wf_v[j + i] = (short) ( (data[ (i * BLK_SIZE) ] << 8) + (data[ (i*BLK_SIZE) + 1]) );
364 wfPacket->wf_v[j + i] = (short) ( (data[ (i * BLK_SIZE) ] << 8) + (data[ (i*BLK_SIZE) + 1]) );
363 wfPacket->wf_e1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 2] << 8) + (data[ (i*BLK_SIZE) + 3]) );
365 wfPacket->wf_e1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 2] << 8) + (data[ (i*BLK_SIZE) + 3]) );
364 wfPacket->wf_e2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 4] << 8) + (data[ (i*BLK_SIZE) + 5]) );
366 wfPacket->wf_e2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 4] << 8) + (data[ (i*BLK_SIZE) + 5]) );
365 wfPacket->wf_b1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 6] << 8) + (data[ (i*BLK_SIZE) + 7]) );
367 wfPacket->wf_b1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 6] << 8) + (data[ (i*BLK_SIZE) + 7]) );
366 wfPacket->wf_b2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 8] << 8) + (data[ (i*BLK_SIZE) + 9]) );
368 wfPacket->wf_b2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 8] << 8) + (data[ (i*BLK_SIZE) + 9]) );
367 wfPacket->wf_b3[j + i] = (short) ( (data[ (i * BLK_SIZE) + 10] << 8) + (data[ (i*BLK_SIZE) + 11]) );
369 wfPacket->wf_b3[j + i] = (short) ( (data[ (i * BLK_SIZE) + 10] << 8) + (data[ (i*BLK_SIZE) + 11]) );
368 }
370 }
369 pkt_nr = pkt_nr + 1;
371 pkt_nr = pkt_nr + 1;
370 if (pkt_nr == (NB_PACKETS_PER_GROUP_OF_CWF+1))
372 if (pkt_nr == (NB_PACKETS_PER_GROUP_OF_CWF+1))
371 {
373 {
372 nbData = j + blk_nr;
374 nbData = j + blk_nr;
373 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_v, 0, coarseTime, fineTime, deltaT, nbData);
375 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_v, 0, coarseTime, fineTime, deltaT, nbData);
374 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_e1, 1, coarseTime, fineTime, deltaT, nbData);
376 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_e1, 1, coarseTime, fineTime, deltaT, nbData);
375 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_e2, 2, coarseTime, fineTime, deltaT, nbData);
377 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_e2, 2, coarseTime, fineTime, deltaT, nbData);
376 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b1, 3, coarseTime, fineTime, deltaT, nbData);
378 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b1, 3, coarseTime, fineTime, deltaT, nbData);
377 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b2, 4, coarseTime, fineTime, deltaT, nbData);
379 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b2, 4, coarseTime, fineTime, deltaT, nbData);
378 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b3, 5, coarseTime, fineTime, deltaT, nbData);
380 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b3, 5, coarseTime, fineTime, deltaT, nbData);
379 pkt_nr = 1;
381 pkt_nr = 1;
380 }
382 }
381 }
383 }
382
384
383 void MainWindow::buildWFAndDisplay_CWF_F3_light(TMPacketToRead *packet, WFPacket *wfPacket)
385 void MainWindow::buildWFAndDisplay_CWF_F3_light(TMPacketToRead *packet, WFPacket *wfPacket)
384 {
386 {
385 unsigned int i = 0;
387 unsigned int i = 0;
386 unsigned int j = 0;
388 unsigned int j = 0;
387 unsigned char *data;
389 unsigned char *data;
388 static unsigned char pkt_nr = 1;
390 static unsigned char pkt_nr = 1;
389 unsigned int blk_nr = 0;
391 unsigned int blk_nr = 0;
390 static unsigned int coarseTime;
392 static unsigned int coarseTime;
391 static unsigned int fineTime;
393 static unsigned int fineTime;
392 unsigned int tmpCoarseTime;
394 unsigned int tmpCoarseTime;
393 unsigned int tmpFineTime;
395 unsigned int tmpFineTime;
394 double deltaT;
396 double deltaT;
395 double DELTA;
397 double DELTA;
396 unsigned int nbData;
398 unsigned int nbData;
397
399
398 deltaT = 1 / 16.;
400 deltaT = 1 / 16.;
399
401
400 if (pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
402 if (pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
401 {
403 {
402 tmpCoarseTime = coarseTime;
404 tmpCoarseTime = coarseTime;
403 tmpFineTime = fineTime;
405 tmpFineTime = fineTime;
404 coarseTime = ((packet->Value[22] & 0x7f) << 24)
406 coarseTime = ((packet->Value[22] & 0x7f) << 24)
405 + (packet->Value[23] << 16)
407 + (packet->Value[23] << 16)
406 + (packet->Value[24] << 8)
408 + (packet->Value[24] << 8)
407 + packet->Value[25];
409 + packet->Value[25];
408 fineTime = (packet->Value[26] << 8) + packet->Value[27];
410 fineTime = (packet->Value[26] << 8) + packet->Value[27];
409 DELTA = (coarseTime + fineTime * 1. / 65536.)
411 DELTA = (coarseTime + fineTime * 1. / 65536.)
410 - (tmpCoarseTime + tmpFineTime * 1. / 65536);
412 - (tmpCoarseTime + tmpFineTime * 1. / 65536);
411 displayOnConsole( "DELTA = " + QString::number(DELTA, 'f', 10) );
413 displayOnConsole( "DELTA = " + QString::number(DELTA, 'f', 10) );
412 }
414 }
413 blk_nr = packet->Value[28] * 256 + packet->Value[29]; // PA_LFR_CWF3_BLK_NR
415 blk_nr = packet->Value[28] * 256 + packet->Value[29]; // PA_LFR_CWF3_BLK_NR
414 data = &packet->Value[30]; // start of the first data block;
416 data = &packet->Value[30]; // start of the first data block;
415
417
416 j = (pkt_nr-1) * blk_nr;
418 j = (pkt_nr-1) * blk_nr;
417 for ( i=0; i<blk_nr; i++ ){
419 for ( i=0; i<blk_nr; i++ ){
418 wfPacket->wf_v[j + i] = (short) ( (data[ (i * BLK_SIZE_CWF3_LIGHT) ] << 8) + (data[ (i*BLK_SIZE_CWF3_LIGHT) + 1]) );
420 wfPacket->wf_v[j + i] = (short) ( (data[ (i * BLK_SIZE_CWF3_LIGHT) ] << 8) + (data[ (i*BLK_SIZE_CWF3_LIGHT) + 1]) );
419 wfPacket->wf_e1[j + i] = (short) ( (data[ (i * BLK_SIZE_CWF3_LIGHT) + 2] << 8) + (data[ (i*BLK_SIZE_CWF3_LIGHT) + 3]) );
421 wfPacket->wf_e1[j + i] = (short) ( (data[ (i * BLK_SIZE_CWF3_LIGHT) + 2] << 8) + (data[ (i*BLK_SIZE_CWF3_LIGHT) + 3]) );
420 wfPacket->wf_e2[j + i] = (short) ( (data[ (i * BLK_SIZE_CWF3_LIGHT) + 4] << 8) + (data[ (i*BLK_SIZE_CWF3_LIGHT) + 5]) );
422 wfPacket->wf_e2[j + i] = (short) ( (data[ (i * BLK_SIZE_CWF3_LIGHT) + 4] << 8) + (data[ (i*BLK_SIZE_CWF3_LIGHT) + 5]) );
421 wfPacket->wf_b1[j + i] = 0;
423 wfPacket->wf_b1[j + i] = 0;
422 wfPacket->wf_b2[j + i] = 0;
424 wfPacket->wf_b2[j + i] = 0;
423 wfPacket->wf_b3[j + i] = 0;
425 wfPacket->wf_b3[j + i] = 0;
424 }
426 }
425 pkt_nr = pkt_nr + 1;
427 pkt_nr = pkt_nr + 1;
426 if (pkt_nr == (NB_PACKETS_PER_GROUP_OF_CWF_LIGHT+1))
428 if (pkt_nr == (NB_PACKETS_PER_GROUP_OF_CWF_LIGHT+1))
427 {
429 {
428 nbData = j + blk_nr;
430 nbData = j + blk_nr;
429 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_v, 0, coarseTime, fineTime, deltaT, nbData);
431 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_v, 0, coarseTime, fineTime, deltaT, nbData);
430 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_e1, 1, coarseTime, fineTime, deltaT, nbData);
432 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_e1, 1, coarseTime, fineTime, deltaT, nbData);
431 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_e2, 2, coarseTime, fineTime, deltaT, nbData);
433 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_e2, 2, coarseTime, fineTime, deltaT, nbData);
432 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b1, 3, coarseTime, fineTime, deltaT, nbData);
434 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b1, 3, coarseTime, fineTime, deltaT, nbData);
433 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b2, 4, coarseTime, fineTime, deltaT, nbData);
435 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b2, 4, coarseTime, fineTime, deltaT, nbData);
434 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b3, 5, coarseTime, fineTime, deltaT, nbData);
436 this->UI->wfPage_CWF_F3->displayOnPlot(wfPacket->wf_b3, 5, coarseTime, fineTime, deltaT, nbData);
435 pkt_nr = 1;
437 pkt_nr = 1;
436 }
438 }
437 }
439 }
438
440
439 void MainWindow::buildWFAndDisplay_CWF_F1(TMPacketToRead *packet, WFPacket *wfPacket)
441 void MainWindow::buildWFAndDisplay_CWF_F1(TMPacketToRead *packet, WFPacket *wfPacket)
440 {
442 {
441 unsigned int i = 0;
443 unsigned int i = 0;
442 unsigned int j = 0;
444 unsigned int j = 0;
443 unsigned char *data;
445 unsigned char *data;
444 static unsigned char pkt_nr = 1;
446 static unsigned char pkt_nr = 1;
445 unsigned int blk_nr = 0;
447 unsigned int blk_nr = 0;
446 static unsigned int coarseTime;
448 static unsigned int coarseTime;
447 static unsigned int fineTime;
449 static unsigned int fineTime;
448 double deltaT;
450 double deltaT;
449 unsigned int nbData;
451 unsigned int nbData;
450
452
451 deltaT = 1. / 4096.;
453 deltaT = 1. / 4096.;
452
454
453 if (pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
455 if (pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
454 {
456 {
455 coarseTime = ((packet->Value[22] & 0x7f) << 24)
457 coarseTime = ((packet->Value[22] & 0x7f) << 24)
456 + (packet->Value[23] << 16)
458 + (packet->Value[23] << 16)
457 + (packet->Value[24] << 8)
459 + (packet->Value[24] << 8)
458 + packet->Value[25];
460 + packet->Value[25];
459 fineTime = (packet->Value[26] << 8) + packet->Value[27];
461 fineTime = (packet->Value[26] << 8) + packet->Value[27];
460 }
462 }
461 blk_nr = packet->Value[28] * 256 + packet->Value[29]; // PA_LFR_CWF_BLK_NR
463 blk_nr = packet->Value[28] * 256 + packet->Value[29]; // PA_LFR_CWF_BLK_NR
462 data = &packet->Value[30]; // start of the first data block;
464 data = &packet->Value[30]; // start of the first data block;
463
465
464 j = (pkt_nr-1) * blk_nr;
466 j = (pkt_nr-1) * blk_nr;
465 for ( i=0; i<blk_nr; i++ ){
467 for ( i=0; i<blk_nr; i++ ){
466 wfPacket->wf_v[j + i] = (short) ( (data[ (i * BLK_SIZE) ] << 8) + (data[ (i*BLK_SIZE) + 1]) );
468 wfPacket->wf_v[j + i] = (short) ( (data[ (i * BLK_SIZE) ] << 8) + (data[ (i*BLK_SIZE) + 1]) );
467 wfPacket->wf_e1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 2] << 8) + (data[ (i*BLK_SIZE) + 3]) );
469 wfPacket->wf_e1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 2] << 8) + (data[ (i*BLK_SIZE) + 3]) );
468 wfPacket->wf_e2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 4] << 8) + (data[ (i*BLK_SIZE) + 5]) );
470 wfPacket->wf_e2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 4] << 8) + (data[ (i*BLK_SIZE) + 5]) );
469 wfPacket->wf_b1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 6] << 8) + (data[ (i*BLK_SIZE) + 7]) );
471 wfPacket->wf_b1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 6] << 8) + (data[ (i*BLK_SIZE) + 7]) );
470 wfPacket->wf_b2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 8] << 8) + (data[ (i*BLK_SIZE) + 9]) );
472 wfPacket->wf_b2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 8] << 8) + (data[ (i*BLK_SIZE) + 9]) );
471 wfPacket->wf_b3[j + i] = (short) ( (data[ (i * BLK_SIZE) + 10] << 8) + (data[ (i*BLK_SIZE) + 11]) );
473 wfPacket->wf_b3[j + i] = (short) ( (data[ (i * BLK_SIZE) + 10] << 8) + (data[ (i*BLK_SIZE) + 11]) );
472 }
474 }
473 pkt_nr = pkt_nr + 1;
475 pkt_nr = pkt_nr + 1;
474 if (pkt_nr == (NB_PACKETS_PER_GROUP_OF_CWF+1))
476 if (pkt_nr == (NB_PACKETS_PER_GROUP_OF_CWF+1))
475 {
477 {
476 nbData = j + blk_nr;
478 nbData = j + blk_nr;
477 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_v, 0, coarseTime, fineTime, deltaT, nbData);
479 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_v, 0, coarseTime, fineTime, deltaT, nbData);
478 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_e1, 1, coarseTime, fineTime, deltaT, nbData);
480 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_e1, 1, coarseTime, fineTime, deltaT, nbData);
479 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_e2, 2, coarseTime, fineTime, deltaT, nbData);
481 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_e2, 2, coarseTime, fineTime, deltaT, nbData);
480 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_b1, 3, coarseTime, fineTime, deltaT, nbData);
482 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_b1, 3, coarseTime, fineTime, deltaT, nbData);
481 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_b2, 4, coarseTime, fineTime, deltaT, nbData);
483 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_b2, 4, coarseTime, fineTime, deltaT, nbData);
482 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_b3, 5, coarseTime, fineTime, deltaT, nbData);
484 this->UI->wfPage_CWF_F1->displayOnPlot(wfPacket->wf_b3, 5, coarseTime, fineTime, deltaT, nbData);
483 pkt_nr = 1;
485 pkt_nr = 1;
484 }
486 }
485 }
487 }
486
488
487 void MainWindow::buildWFAndDisplay_CWF_F2(TMPacketToRead *packet, WFPacket *wfPacket)
489 void MainWindow::buildWFAndDisplay_CWF_F2(TMPacketToRead *packet, WFPacket *wfPacket)
488 {
490 {
489 unsigned int i = 0;
491 unsigned int i = 0;
490 unsigned int j = 0;
492 unsigned int j = 0;
491 unsigned char *data;
493 unsigned char *data;
492 static unsigned char pkt_nr = 1;
494 static unsigned char pkt_nr = 1;
493 unsigned int blk_nr = 0;
495 unsigned int blk_nr = 0;
494 static unsigned int coarseTime;
496 static unsigned int coarseTime;
495 static unsigned int fineTime;
497 static unsigned int fineTime;
496 double deltaT;
498 double deltaT;
497 unsigned int nbData;
499 unsigned int nbData;
498
500
499 deltaT = 1. / 256.;
501 deltaT = 1. / 256.;
500
502
501 if (pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
503 if (pkt_nr == 1) // the acquisition time of the first packet of the snapshot is taken as starting time
502 {
504 {
503 coarseTime = ((packet->Value[22] & 0x7f) << 24)
505 coarseTime = ((packet->Value[22] & 0x7f) << 24)
504 + (packet->Value[23] << 16)
506 + (packet->Value[23] << 16)
505 + (packet->Value[24] << 8)
507 + (packet->Value[24] << 8)
506 + packet->Value[25];
508 + packet->Value[25];
507 fineTime = (packet->Value[26] << 8) + packet->Value[27];
509 fineTime = (packet->Value[26] << 8) + packet->Value[27];
508 }
510 }
509 blk_nr = packet->Value[28] * 256 + packet->Value[29]; // PA_LFR_CWF3_BLK_NR
511 blk_nr = packet->Value[28] * 256 + packet->Value[29]; // PA_LFR_CWF3_BLK_NR
510 data = &packet->Value[30]; // start of the first data block;
512 data = &packet->Value[30]; // start of the first data block;
511
513
512 j = (pkt_nr-1) * blk_nr;
514 j = (pkt_nr-1) * blk_nr;
513 for ( i=0; i<blk_nr; i++ ){
515 for ( i=0; i<blk_nr; i++ ){
514 wfPacket->wf_v[j + i] = (short) ( (data[ (i * BLK_SIZE) ] << 8) + (data[ (i*BLK_SIZE) + 1]) );
516 wfPacket->wf_v[j + i] = (short) ( (data[ (i * BLK_SIZE) ] << 8) + (data[ (i*BLK_SIZE) + 1]) );
515 wfPacket->wf_e1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 2] << 8) + (data[ (i*BLK_SIZE) + 3]) );
517 wfPacket->wf_e1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 2] << 8) + (data[ (i*BLK_SIZE) + 3]) );
516 wfPacket->wf_e2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 4] << 8) + (data[ (i*BLK_SIZE) + 5]) );
518 wfPacket->wf_e2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 4] << 8) + (data[ (i*BLK_SIZE) + 5]) );
517 wfPacket->wf_b1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 6] << 8) + (data[ (i*BLK_SIZE) + 7]) );
519 wfPacket->wf_b1[j + i] = (short) ( (data[ (i * BLK_SIZE) + 6] << 8) + (data[ (i*BLK_SIZE) + 7]) );
518 wfPacket->wf_b2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 8] << 8) + (data[ (i*BLK_SIZE) + 9]) );
520 wfPacket->wf_b2[j + i] = (short) ( (data[ (i * BLK_SIZE) + 8] << 8) + (data[ (i*BLK_SIZE) + 9]) );
519 wfPacket->wf_b3[j + i] = (short) ( (data[ (i * BLK_SIZE) + 10] << 8) + (data[ (i*BLK_SIZE) + 11]) );
521 wfPacket->wf_b3[j + i] = (short) ( (data[ (i * BLK_SIZE) + 10] << 8) + (data[ (i*BLK_SIZE) + 11]) );
520 }
522 }
521 pkt_nr = pkt_nr + 1;
523 pkt_nr = pkt_nr + 1;
522 if (pkt_nr == (NB_PACKETS_PER_GROUP_OF_CWF+1))
524 if (pkt_nr == (NB_PACKETS_PER_GROUP_OF_CWF+1))
523 {
525 {
524 nbData = j + blk_nr;
526 nbData = j + blk_nr;
525 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_v, 0, coarseTime, fineTime, deltaT, nbData);
527 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_v, 0, coarseTime, fineTime, deltaT, nbData);
526 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_e1, 1, coarseTime, fineTime, deltaT, nbData);
528 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_e1, 1, coarseTime, fineTime, deltaT, nbData);
527 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_e2, 2, coarseTime, fineTime, deltaT, nbData);
529 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_e2, 2, coarseTime, fineTime, deltaT, nbData);
528 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_b1, 3, coarseTime, fineTime, deltaT, nbData);
530 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_b1, 3, coarseTime, fineTime, deltaT, nbData);
529 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_b2, 4, coarseTime, fineTime, deltaT, nbData);
531 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_b2, 4, coarseTime, fineTime, deltaT, nbData);
530 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_b3, 5, coarseTime, fineTime, deltaT, nbData);
532 this->UI->wfPage_CWF_F2->displayOnPlot(wfPacket->wf_b3, 5, coarseTime, fineTime, deltaT, nbData);
531 pkt_nr = 1;
533 pkt_nr = 1;
532 }
534 }
533 }
535 }
534
536
535 void MainWindow::build_ASM_AndDisplay_NORM_F0(TMPacketToRead *packet, SpectraPacket *spectraPacket)
537 void MainWindow::build_ASM_AndDisplay_NORM(TMPacketToRead *packet, SpectraPacket *spectraPacket,
538 double deltaF, unsigned char indiceStart,
539 ASMPage* asmPage )
536 {
540 {
537 unsigned int i;
541 unsigned int i;
538 unsigned int j;
542 unsigned int j;
539 unsigned char *data;
543 unsigned char *data;
540 unsigned char *aux;
544 unsigned char *aux;
541 unsigned char cntASM;
545 unsigned char cntASM;
542 unsigned char nrASM;
546 unsigned char nrASM;
543 unsigned int blkNR;
547 unsigned int blkNR;
544 double deltaF;
545 unsigned int nbData;
548 unsigned int nbData;
546
549
547 cntASM = packet->Value[22];
550 cntASM = packet->Value[22];
548 nrASM = packet->Value[23];
551 nrASM = packet->Value[23];
549 blkNR = packet->Value[30] * 256 + packet->Value[31];
552 blkNR = packet->Value[30] * 256 + packet->Value[31];
550
553
551 data = &packet->Value[32]; // start of the first data block;
554 data = &packet->Value[32]; // start of the first data block;
552
555
553 j = (nrASM-1) * blkNR;
556 j = (nrASM-1) * blkNR;
554 for ( i=0; i<blkNR; i++ ){
557 for ( i=0; i<blkNR; i++ ){
555 aux = (unsigned char*) &spectraPacket->s11[ j + i ]; // s11 is a table of float
558 aux = (unsigned char*) &spectraPacket->s11[ j + i ]; // s11 is a table of float
556 aux[3] = data[ (i * 50 + 2*0 ) ];
559 aux[3] = data[ (i * 50 + 2*0 ) ];
557 aux[2] = data[ (i * 50 + 2*0 ) + 1];
560 aux[2] = data[ (i * 50 + 2*0 ) + 1];
558 aux = (unsigned char*) &spectraPacket->s22[ j + i ]; // s22 is a table of float
561 aux = (unsigned char*) &spectraPacket->s22[ j + i ]; // s22 is a table of float
559 aux[3] = data[ (i * 50 + 2*9 ) ];
562 aux[3] = data[ (i * 50 + 2*9 ) ];
560 aux[2] = data[ (i * 50 + 2*9 ) + 1];
563 aux[2] = data[ (i * 50 + 2*9 ) + 1];
561 aux = (unsigned char*) &spectraPacket->s33[ j + i ]; // s33 is a table of float
564 aux = (unsigned char*) &spectraPacket->s33[ j + i ]; // s33 is a table of float
562 aux[3] = data[ (i * 50 + 2*16) ];
565 aux[3] = data[ (i * 50 + 2*16) ];
563 aux[2] = data[ (i * 50 + 2*16) + 1];
566 aux[2] = data[ (i * 50 + 2*16) + 1];
564 aux = (unsigned char*) &spectraPacket->s44[ j + i ]; // s44 is a table of float
567 aux = (unsigned char*) &spectraPacket->s44[ j + i ]; // s44 is a table of float
565 aux[3] = data[ (i * 50 + 2*21) ];
568 aux[3] = data[ (i * 50 + 2*21) ];
566 aux[2] = data[ (i * 50 + 2*21) + 1];
569 aux[2] = data[ (i * 50 + 2*21) + 1];
567 aux = (unsigned char*) &spectraPacket->s55[ j + i ]; // s55 is a table of float
570 aux = (unsigned char*) &spectraPacket->s55[ j + i ]; // s55 is a table of float
568 aux[3] = data[ (i * 50 + 2*24) ];
571 aux[3] = data[ (i * 50 + 2*24) ];
569 aux[2] = data[ (i * 50 + 2*24) + 1];
572 aux[2] = data[ (i * 50 + 2*24) + 1];
570 }
573 }
571
574
572 deltaF = 24576. / 256. ;
573 nbData = j + blkNR;
575 nbData = j + blkNR;
574 if (nrASM == cntASM)
576 if (nrASM == cntASM)
575 {
577 {
576 this->UI->asmPage_F0->displayOnPlot(spectraPacket->s11, 0, ASM_F0_INDICE_START, deltaF, nbData);
578 asmPage->displayOnPlot(spectraPacket->s11, 0, indiceStart, deltaF, nbData);
577 this->UI->asmPage_F0->displayOnPlot(spectraPacket->s22, 1, ASM_F0_INDICE_START, deltaF, nbData);
579 asmPage->displayOnPlot(spectraPacket->s22, 1, indiceStart, deltaF, nbData);
578 this->UI->asmPage_F0->displayOnPlot(spectraPacket->s33, 2, ASM_F0_INDICE_START, deltaF, nbData);
580 asmPage->displayOnPlot(spectraPacket->s33, 2, indiceStart, deltaF, nbData);
579 this->UI->asmPage_F0->displayOnPlot(spectraPacket->s44, 3, ASM_F0_INDICE_START, deltaF, nbData);
581 asmPage->displayOnPlot(spectraPacket->s44, 3, indiceStart, deltaF, nbData);
580 this->UI->asmPage_F0->displayOnPlot(spectraPacket->s55, 4, ASM_F0_INDICE_START, deltaF, nbData);
582 asmPage->displayOnPlot(spectraPacket->s55, 4, indiceStart, deltaF, nbData);
581 }
583 }
582 }
584 }
583
585
584 void MainWindow::resetStatistics()
586 void MainWindow::resetStatistics()
585 {
587 {
586 totalOfBytes = 0;
588 totalOfBytes = 0;
587 totalOfPackets = 0;
589 totalOfPackets = 0;
588 this->UI->totalOfBytesHasChanged(totalOfBytes);
590 this->UI->totalOfBytesHasChanged(totalOfBytes);
589 this->UI->totalOfPacketsHasChanged(totalOfPackets);
591 this->UI->totalOfPacketsHasChanged(totalOfPackets);
590 }
592 }
591
593
592 //******************
594 //******************
593 // packet processing
595 // packet processing
594
596
595 void MainWindow::processPacketStore()
597 void MainWindow::processPacketStore()
596 {
598 {
597 TMPacketToRead *packet;
599 TMPacketToRead *packet;
598 while(!generalCCSDSPacketStore.isEmpty())
600 while(!generalCCSDSPacketStore.isEmpty())
599 {
601 {
600 packet = generalCCSDSPacketStore.takeFirst();
602 packet = generalCCSDSPacketStore.takeFirst();
601 processIncomingPacket(packet);
603 processIncomingPacket(packet);
602 delete(packet);
604 delete(packet);
603 }
605 }
604 }
606 }
605
607
606 void MainWindow::processIncomingPacket(TMPacketToRead *packet)
608 void MainWindow::processIncomingPacket(TMPacketToRead *packet)
607 {
609 {
608 totalOfBytes = totalOfBytes + packet->size;
610 totalOfBytes = totalOfBytes + packet->size;
609 totalOfPackets = totalOfPackets + 1;
611 totalOfPackets = totalOfPackets + 1;
610 this->UI->totalOfBytesHasChanged(totalOfBytes);
612 this->UI->totalOfBytesHasChanged(totalOfBytes);
611 this->UI->totalOfPacketsHasChanged(totalOfPackets);
613 this->UI->totalOfPacketsHasChanged(totalOfPackets);
612 preProcessPacket(packet);
614 preProcessPacket(packet);
613 }
615 }
614
616
615 void MainWindow::preProcessPacket(TMPacketToRead *packet)
617 void MainWindow::preProcessPacket(TMPacketToRead *packet)
616 {
618 {
617 unsigned char pid = 0;
619 unsigned char pid = 0;
618 unsigned char cat = 0;
620 unsigned char cat = 0;
619 unsigned char typ = 0;
621 unsigned char typ = 0;
620 unsigned char sub = 0;
622 unsigned char sub = 0;
621 unsigned int sid = 0;
623 unsigned int sid = 0;
622 unsigned int length = 0;
624 unsigned int length = 0;
623 unsigned int coarse_t = 0;
625 unsigned int coarse_t = 0;
624 unsigned int fine_t = 0;
626 unsigned int fine_t = 0;
625
627
626 //*********************************
628 //*********************************
627 // get the parameters of the packet
629 // get the parameters of the packet
628 pid = this->UI->tmStatistics->getPID( packet );
630 pid = this->UI->tmStatistics->getPID( packet );
629 cat = this->UI->tmStatistics->getCAT( packet );
631 cat = this->UI->tmStatistics->getCAT( packet );
630 typ = this->UI->tmStatistics->getTYPE( packet );
632 typ = this->UI->tmStatistics->getTYPE( packet );
631 sub = this->UI->tmStatistics->getSUBTYPE( packet );
633 sub = this->UI->tmStatistics->getSUBTYPE( packet );
632 length = this->UI->tmStatistics->getLENGTH( packet );
634 length = this->UI->tmStatistics->getLENGTH( packet );
633 coarse_t = this->UI->tmStatistics->getCoarseTime( packet );
635 coarse_t = this->UI->tmStatistics->getCoarseTime( packet );
634 fine_t = this->UI->tmStatistics->getFineTime( packet );
636 fine_t = this->UI->tmStatistics->getFineTime( packet );
635 sid = this->UI->tmStatistics->getSID( packet, pid, cat, typ, sub );
637 sid = this->UI->tmStatistics->getSID( packet, pid, cat, typ, sub );
636
638
637 this->UI->tmStatistics->updateStatistics(pid, cat, typ, sub, sid, length, coarse_t, fine_t);
639 this->UI->tmStatistics->updateStatistics(pid, cat, typ, sub, sid, length, coarse_t, fine_t);
638
640
639 // compare length in the packet with the size of the packet
641 // compare length in the packet with the size of the packet
640 if ( (length + 1 + 10) != (packet->size))
642 if ( (length + 1 + 10) != (packet->size))
641 {
643 {
642 displayOnConsole("reception of " + QString::number(packet->size)
644 displayOnConsole("reception of " + QString::number(packet->size)
643 + " bytes instead of " + QString::number(length + 1 + 10));
645 + " bytes instead of " + QString::number(length + 1 + 10));
644 }
646 }
645
647
646 //***************************************************
648 //***************************************************
647 // if the packet is an HK packet, display its content
649 // if the packet is an HK packet, display its content
648 if ( (pid == TM_PACKET_PID_DEFAULT) & (cat == TM_PACKET_CAT_HK)
650 if ( (pid == TM_PACKET_PID_DEFAULT) & (cat == TM_PACKET_CAT_HK)
649 & (typ == TM_TYPE_HK) & (sub == TM_SUBTYPE_HK) )
651 & (typ == TM_TYPE_HK) & (sub == TM_SUBTYPE_HK) )
650 {
652 {
651 this->UI->hkDisplay->displayPacket(packet);
653 this->UI->hkDisplay->displayPacket(packet);
652 }
654 }
653
655
654 //**************************************************************
656 //**************************************************************
655 // if the packet is a parameter dump packet, display its content
657 // if the packet is a parameter dump packet, display its content
656 if ( (pid == TM_PACKET_PID_DEFAULT) & (cat == TM_PACKET_CAT_PARAMETER_DUMP)
658 if ( (pid == TM_PACKET_PID_DEFAULT) & (cat == TM_PACKET_CAT_PARAMETER_DUMP)
657 & (typ == TM_TYPE_PARAMETER_DUMP) & (sub == TM_SUBTYPE_PARAMETER_DUMP) )
659 & (typ == TM_TYPE_PARAMETER_DUMP) & (sub == TM_SUBTYPE_PARAMETER_DUMP) )
658 {
660 {
659 this->UI->parameterDump->updateParameterDump(packet);
661 this->UI->parameterDump->updateParameterDump(packet);
660 }
662 }
661
663
662 //****************************************
664 //****************************************
663 // if the packet is a waveform, display it
665 // if the packet is a waveform, display it
664 if ( (typ == TM_TYPE_LFR_SCIENCE) & (sub == TM_SUBTYPE_LFR_SCIENCE) )
666 if ( (typ == TM_TYPE_LFR_SCIENCE) & (sub == TM_SUBTYPE_LFR_SCIENCE) )
665 {
667 {
666 //sid = packet->Value[20]; // SID
668 //sid = packet->Value[20]; // SID
667 switch (sid){
669 switch (sid){
668 case SID_NORMAL_SWF_F0:
670 case SID_NORMAL_SWF_F0:
669 buildWFAndDisplay_SWF(packet, wfPacketNormal[0], 0);
671 buildWFAndDisplay_SWF(packet, wfPacketNormal[0], 0);
670 break;
672 break;
671 case SID_NORMAL_SWF_F1:
673 case SID_NORMAL_SWF_F1:
672 buildWFAndDisplay_SWF(packet, wfPacketNormal[1], 1);
674 buildWFAndDisplay_SWF(packet, wfPacketNormal[1], 1);
673 break;
675 break;
674 case SID_NORMAL_SWF_F2:
676 case SID_NORMAL_SWF_F2:
675 buildWFAndDisplay_SWF(packet, wfPacketNormal[2], 2);
677 buildWFAndDisplay_SWF(packet, wfPacketNormal[2], 2);
676 break;
678 break;
677 case SID_NORMAL_CWF_F3:
679 case SID_NORMAL_CWF_F3:
678 buildWFAndDisplay_CWF_F3_light(packet, wfPacketCWF_F3);
680 buildWFAndDisplay_CWF_F3_light(packet, wfPacketCWF_F3);
679 break;
681 break;
680 case SID_NORMAL_CWF_LONG_F3:
682 case SID_NORMAL_CWF_LONG_F3:
681 buildWFAndDisplay_CWF_LONG_F3(packet, wfPacketCWF_F3);
683 buildWFAndDisplay_CWF_LONG_F3(packet, wfPacketCWF_F3);
682 break;
684 break;
683 case SID_BURST_CWF_F2:
685 case SID_BURST_CWF_F2:
684 buildWFAndDisplay_CWF_F2(packet, wfPacketBurst);
686 buildWFAndDisplay_CWF_F2(packet, wfPacketBurst);
685 break;
687 break;
686 case SID_SBM1_CWF_F1:
688 case SID_SBM1_CWF_F1:
687 buildWFAndDisplay_CWF_F1(packet, wfPacketSBM1);
689 buildWFAndDisplay_CWF_F1(packet, wfPacketSBM1);
688 break;
690 break;
689 case SID_SBM2_CWF_F2:
691 case SID_SBM2_CWF_F2:
690 buildWFAndDisplay_CWF_F2(packet, wfPacketSBM2);
692 buildWFAndDisplay_CWF_F2(packet, wfPacketSBM2);
691 break;
693 break;
692 case SID_NORMAL_ASM_F0:
694 case SID_NORMAL_ASM_F0:
693 build_ASM_AndDisplay_NORM_F0(packet, spectraPacketNormalSpectrumF0);
695 build_ASM_AndDisplay_NORM(packet, spectraPacketNormalSpectrumF0, 4096./256., ASM_F1_INDICE_START, this->UI->asmPage_F0 );
696 break;
697 case SID_NORMAL_ASM_F1:
698 build_ASM_AndDisplay_NORM(packet, spectraPacketNormalSpectrumF1, 4096./256., ASM_F1_INDICE_START, this->UI->asmPage_F1 );
699 break;
700 case SID_NORMAL_ASM_F2:
701 build_ASM_AndDisplay_NORM(packet, spectraPacketNormalSpectrumF2, 256./256., ASM_F2_INDICE_START, this->UI->asmPage_F2 );
694 break;
702 break;
695 }
703 }
696 }
704 }
697 }
705 }
698
706
699 //******************
707 //******************
700 // general functions
708 // general functions
701
709
702 void MainWindow::readSettings()
710 void MainWindow::readSettings()
703 {
711 {
704 QSettings settings("lpp", "lfrsgse");
712 QSettings settings("lpp", "lfrsgse");
705 echoBridgeIP0 = (unsigned char) settings.value("echoBridgeIP0", 127).toInt();
713 echoBridgeIP0 = (unsigned char) settings.value("echoBridgeIP0", 127).toInt();
706 echoBridgeIP1 = (unsigned char) settings.value("echoBridgeIP1", 0).toInt();
714 echoBridgeIP1 = (unsigned char) settings.value("echoBridgeIP1", 0).toInt();
707 echoBridgeIP2 = (unsigned char) settings.value("echoBridgeIP2", 0).toInt();
715 echoBridgeIP2 = (unsigned char) settings.value("echoBridgeIP2", 0).toInt();
708 echoBridgeIP3 = (unsigned char) settings.value("echoBridgeIP3", 1).toInt();
716 echoBridgeIP3 = (unsigned char) settings.value("echoBridgeIP3", 1).toInt();
709 }
717 }
710
718
711 void MainWindow::writeSettings()
719 void MainWindow::writeSettings()
712 {
720 {
713 QSettings settings("lpp", "lfrsgse");
721 QSettings settings("lpp", "lfrsgse");
714 settings.setValue("echoBridgeIP0", this->UI->serverTMEchoDialogBox->get_addressPart1());
722 settings.setValue("echoBridgeIP0", this->UI->serverTMEchoDialogBox->get_addressPart1());
715 settings.setValue("echoBridgeIP1", this->UI->serverTMEchoDialogBox->get_addressPart2());
723 settings.setValue("echoBridgeIP1", this->UI->serverTMEchoDialogBox->get_addressPart2());
716 settings.setValue("echoBridgeIP2", this->UI->serverTMEchoDialogBox->get_addressPart3());
724 settings.setValue("echoBridgeIP2", this->UI->serverTMEchoDialogBox->get_addressPart3());
717 settings.setValue("echoBridgeIP3", this->UI->serverTMEchoDialogBox->get_addressPart4());
725 settings.setValue("echoBridgeIP3", this->UI->serverTMEchoDialogBox->get_addressPart4());
718 }
726 }
719
727
720 void MainWindow::closeEvent(QCloseEvent *)
728 void MainWindow::closeEvent(QCloseEvent *)
721 {
729 {
722 writeSettings();
730 writeSettings();
723 }
731 }
@@ -1,113 +1,116
1 #ifndef MAINWINDOW_H
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
2 #define MAINWINDOW_H
3
3
4 #include <QTcpServer>
4 #include <QTcpServer>
5 #include <QTcpSocket>
5 #include <QTcpSocket>
6 #include <QXmlSimpleReader>
6 #include <QXmlSimpleReader>
7 #include <QSettings>
7 #include <QSettings>
8 #include <QMainWindow>
8 #include <QMainWindow>
9
9
10 #include <lfrxmlhandler.h>
10 #include <lfrxmlhandler.h>
11 #include <lfrxmlwriter.h>
11 #include <lfrxmlwriter.h>
12 #include <mainwindowui.h>
12 #include <mainwindowui.h>
13 #include <spectrapacket.h>
13 #include <spectrapacket.h>
14
14
15 #include "tmpackettoread.h"
15 #include "tmpackettoread.h"
16 #include "wfpacket.h"
16 #include "wfpacket.h"
17 #include "lfrxmlparser.h"
17 #include "lfrxmlparser.h"
18
18
19 class MainWindow : public QMainWindow
19 class MainWindow : public QMainWindow
20 {
20 {
21 Q_OBJECT
21 Q_OBJECT
22
22
23 public:
23 public:
24 MainWindow(QWidget *parent = 0);
24 MainWindow(QWidget *parent = 0);
25 ~MainWindow();
25 ~MainWindow();
26
26
27 void displayNetworkInterfaces();
27 void displayNetworkInterfaces();
28 void initSocketStatesList();
28 void initSocketStatesList();
29 //
29 //
30 void preProcessPacket(TMPacketToRead *packet);
30 void preProcessPacket(TMPacketToRead *packet);
31 unsigned char getPID(TMPacketToRead *packet);
31 unsigned char getPID(TMPacketToRead *packet);
32 unsigned char getCAT(TMPacketToRead *packet);
32 unsigned char getCAT(TMPacketToRead *packet);
33 unsigned char getTYPE(TMPacketToRead *packet);
33 unsigned char getTYPE(TMPacketToRead *packet);
34 unsigned char getSUBTYPE(TMPacketToRead *packet);
34 unsigned char getSUBTYPE(TMPacketToRead *packet);
35 unsigned int getLENGTH(TMPacketToRead *packet);
35 unsigned int getLENGTH(TMPacketToRead *packet);
36 unsigned int getCoarseTime(TMPacketToRead *packet);
36 unsigned int getCoarseTime(TMPacketToRead *packet);
37 unsigned int getFineTime(TMPacketToRead *packet);
37 unsigned int getFineTime(TMPacketToRead *packet);
38 unsigned int getSID(TMPacketToRead *packet, unsigned char pid, unsigned char cat, unsigned char typ, unsigned char sub);
38 unsigned int getSID(TMPacketToRead *packet, unsigned char pid, unsigned char cat, unsigned char typ, unsigned char sub);
39 //
39 //
40 void buildWFAndDisplay_SWF(TMPacketToRead *packet, WFPacket *wfPacket, unsigned char num_page);
40 void buildWFAndDisplay_SWF(TMPacketToRead *packet, WFPacket *wfPacket, unsigned char num_page);
41 void buildWFAndDisplay_CWF_LONG_F3(TMPacketToRead *packet, WFPacket *wfPacket);
41 void buildWFAndDisplay_CWF_LONG_F3(TMPacketToRead *packet, WFPacket *wfPacket);
42 void buildWFAndDisplay_CWF_F3_light(TMPacketToRead *packet, WFPacket *wfPacket);
42 void buildWFAndDisplay_CWF_F3_light(TMPacketToRead *packet, WFPacket *wfPacket);
43 void buildWFAndDisplayBurst(TMPacketToRead *packet, WFPacket *wfPacket);
43 void buildWFAndDisplayBurst(TMPacketToRead *packet, WFPacket *wfPacket);
44 void buildWFAndDisplay_CWF_F1(TMPacketToRead *packet, WFPacket *wfPacket);
44 void buildWFAndDisplay_CWF_F1(TMPacketToRead *packet, WFPacket *wfPacket);
45 void buildWFAndDisplay_CWF_F2(TMPacketToRead *packet, WFPacket *wfPacket);
45 void buildWFAndDisplay_CWF_F2(TMPacketToRead *packet, WFPacket *wfPacket);
46 void build_ASM_AndDisplay_NORM_F0(TMPacketToRead *packet, SpectraPacket *spectraPacket);
46 void build_ASM_AndDisplay_NORM_F0(TMPacketToRead *packet, SpectraPacket *spectraPacket);
47 void build_ASM_AndDisplay_NORM(TMPacketToRead *packet, SpectraPacket *spectraPacket, double deltaF, unsigned char indiceStart, ASMPage *asmPage);
47
48
48 protected:
49 protected:
49 void closeEvent(QCloseEvent *);
50 void closeEvent(QCloseEvent *);
50
51
51 private:
52 private:
52 void readSettings();
53 void readSettings();
53 void writeSettings();
54 void writeSettings();
54 unsigned char echoBridgeIP0;
55 unsigned char echoBridgeIP0;
55 unsigned char echoBridgeIP1;
56 unsigned char echoBridgeIP1;
56 unsigned char echoBridgeIP2;
57 unsigned char echoBridgeIP2;
57 unsigned char echoBridgeIP3;
58 unsigned char echoBridgeIP3;
58
59
59 QByteArray dataArray;
60 QByteArray dataArray;
60
61
61 QList<TMPacketToRead*> generalCCSDSPacketStore;
62 QList<TMPacketToRead*> generalCCSDSPacketStore;
62
63
63 QTcpServer *analyserSGSEServerTC;
64 QTcpServer *analyserSGSEServerTC;
64 QTcpServer *analyserSGSEServerTM;
65 QTcpServer *analyserSGSEServerTM;
65 QTcpSocket *socketTC;
66 QTcpSocket *socketTC;
66 QTcpSocket *socketTM;
67 QTcpSocket *socketTM;
67 QTcpSocket *socketEchoServer;
68 QTcpSocket *socketEchoServer;
68
69
69 unsigned int totalOfBytes;
70 unsigned int totalOfBytes;
70 unsigned int totalOfPackets;
71 unsigned int totalOfPackets;
71
72
72 QXmlSimpleReader xmlReader;
73 QXmlSimpleReader xmlReader;
73 QXmlInputSource *sourceTC;
74 QXmlInputSource *sourceTC;
74 LFRXmlHandler *xmlHandler;
75 LFRXmlHandler *xmlHandler;
75 LFRXmlParser *lfrXmlParser;
76 LFRXmlParser *lfrXmlParser;
76
77
77 QList<QString> socketStates;
78 QList<QString> socketStates;
78
79
79 char *buffer;
80 char *buffer;
80
81
81 MainWindowUI *UI;
82 MainWindowUI *UI;
82
83
83 LFRXmlWriter *lfrXmlWriter;
84 LFRXmlWriter *lfrXmlWriter;
84
85
85 WFPacket *wfPacketNormal[4];
86 WFPacket *wfPacketNormal[4];
86 WFPacket *wfPacketBurst;
87 WFPacket *wfPacketBurst;
87 WFPacket *wfPacketSBM1;
88 WFPacket *wfPacketSBM1;
88 WFPacket *wfPacketSBM2;
89 WFPacket *wfPacketSBM2;
89 WFPacket *wfPacketCWF_F3;
90 WFPacket *wfPacketCWF_F3;
90 SpectraPacket *spectraPacketNormalSpectrumF0;
91 SpectraPacket *spectraPacketNormalSpectrumF0;
92 SpectraPacket *spectraPacketNormalSpectrumF1;
93 SpectraPacket *spectraPacketNormalSpectrumF2;
91
94
92 bool parsingContinue;
95 bool parsingContinue;
93
96
94 signals:
97 signals:
95 void socketTMHasChanged(QTcpSocket *socket);
98 void socketTMHasChanged(QTcpSocket *socket);
96
99
97 public slots:
100 public slots:
98 void displayOnConsole(QString message);
101 void displayOnConsole(QString message);
99 void listenOnTCTMPorts();
102 void listenOnTCTMPorts();
100 void testTCTMPorts();
103 void testTCTMPorts();
101 void newConnectionOnTCServer();
104 void newConnectionOnTCServer();
102 void newConnectionOnTMServer();
105 void newConnectionOnTMServer();
103 void readDataOnTCPort();
106 void readDataOnTCPort();
104 void readDataOnTMPort();
107 void readDataOnTMPort();
105 void readDataOnSocketEchoServer();
108 void readDataOnSocketEchoServer();
106 void openEchoServer();
109 void openEchoServer();
107 void socket_TMEcho_ServerHasChanged();
110 void socket_TMEcho_ServerHasChanged();
108 void processIncomingPacket(TMPacketToRead *packet);
111 void processIncomingPacket(TMPacketToRead *packet);
109 void resetStatistics();
112 void resetStatistics();
110 void processPacketStore();
113 void processPacketStore();
111 };
114 };
112
115
113 #endif // MAINWINDOW_H
116 #endif // MAINWINDOW_H
@@ -1,203 +1,219
1 #include "mainwindowui.h"
1 #include "mainwindowui.h"
2
2
3 MainWindowUI::MainWindowUI(QWidget *parent) :
3 MainWindowUI::MainWindowUI(QWidget *parent) :
4 QWidget(parent)
4 QWidget(parent)
5 {
5 {
6 label_serverTMEcho = new QLabel(tr("TM Echo Server address"));
6 label_serverTMEcho = new QLabel(tr("TM Echo Server address"));
7 label_serverTMEchoPort = new QLabel(tr("TM Echo Server Port"));
7 label_serverTMEchoPort = new QLabel(tr("TM Echo Server Port"));
8 label_TMServerPort = new QLabel(tr("TM Server Port:"));
8 label_TMServerPort = new QLabel(tr("TM Server Port:"));
9 label_TCServerPort = new QLabel(tr("TC Server Port:"));
9 label_TCServerPort = new QLabel(tr("TC Server Port:"));
10 label_currentTCTMServer = new QLabel(tr("Current IP address:"));
10 label_currentTCTMServer = new QLabel(tr("Current IP address:"));
11 label_currentTCTMServerIP = new QLabel(tr("-"));
11 label_currentTCTMServerIP = new QLabel(tr("-"));
12 label_totalOfBytes = new QLabel(tr("Received Bytes: -"));
12 label_totalOfBytes = new QLabel(tr("Received Bytes: -"));
13 label_totalOfPackets = new QLabel(tr("Received Packets: -"));
13 label_totalOfPackets = new QLabel(tr("Received Packets: -"));
14
14
15 console = new QTextEdit();
15 console = new QTextEdit();
16
16
17 spwTabWidget = new QTabWidget();
17 spwTabWidget = new QTabWidget();
18 spwTabWidgetPage0 = new QWidget();
18 spwTabWidgetPage0 = new QWidget();
19 spwTabWidgetPage1 = new QWidget();
19 spwTabWidgetPage1 = new QWidget();
20 spwTabWidgetPage2 = new QWidget();
20 spwTabWidgetPage2 = new QWidget();
21 spwTabWidgetPage3 = new QWidget();
21 spwTabWidgetPage3 = new QWidget();
22
22
23 tmStatistics = new TMStatistics;
23 tmStatistics = new TMStatistics;
24
24
25 wfDisplay = new WFDisplay(0, 2048, 2048, 15000);
25 wfDisplay = new WFDisplay(0, 2048, 2048, 15000);
26 wfPage_CWF_F1 = new WFPage(0, 8 * BLK_NR_CWF, 8 * BLK_NR_CWF, 15000);
26 wfPage_CWF_F1 = new WFPage(0, 8 * BLK_NR_CWF, 8 * BLK_NR_CWF, 15000);
27 wfPage_CWF_F2 = new WFPage(0, 8 * BLK_NR_CWF, 8 * BLK_NR_CWF, 15000);
27 wfPage_CWF_F2 = new WFPage(0, 8 * BLK_NR_CWF, 8 * BLK_NR_CWF, 15000);
28 wfPage_CWF_F3 = new WFPage(0, 8 * BLK_NR_CWF, 8 * BLK_NR_CWF, 15000);
28 wfPage_CWF_F3 = new WFPage(0, 8 * BLK_NR_CWF, 8 * BLK_NR_CWF, 15000);
29 asmPage_F0 = new ASMPage(0, NB_BINS_PER_ASM_F0, NB_BINS_PER_ASM_F0, 15000);
29 asmPage_F0 = new ASMPage(0, NB_BINS_PER_ASM_F0, NB_BINS_PER_ASM_F0, 15000);
30 asmPage_F1 = new ASMPage(0, NB_BINS_PER_ASM_F1, NB_BINS_PER_ASM_F1, 15000);
31 asmPage_F2 = new ASMPage(0, NB_BINS_PER_ASM_F2, NB_BINS_PER_ASM_F2, 15000);
30
32
31 wfPage_CWF_F1->pageTitle = "SBM1_CWF_F1";
33 wfPage_CWF_F1->pageTitle = "SBM1_CWF_F1";
32 wfPage_CWF_F2->pageTitle = "SBM2_CWF_F2";
34 wfPage_CWF_F2->pageTitle = "SBM2_CWF_F2";
33 wfPage_CWF_F3->pageTitle = "NORM_CWF_F3";
35 wfPage_CWF_F3->pageTitle = "NORM_CWF_F3";
34 asmPage_F0->pageTitle = "ASM_F0";
36 asmPage_F0->pageTitle = "ASM_F0";
37 asmPage_F1->pageTitle = "ASM_F1";
38 asmPage_F2->pageTitle = "ASM_F2";
35 hkDisplay = new HKDisplay();
39 hkDisplay = new HKDisplay();
36 recordPage = new RecordPage;
40 recordPage = new RecordPage;
37
41
38 spinbox_TMServerPort = new QSpinBox();
42 spinbox_TMServerPort = new QSpinBox();
39 spinbox_TCServerPort = new QSpinBox();
43 spinbox_TCServerPort = new QSpinBox();
40 spinbox_serverTMEchoPort = new QSpinBox();
44 spinbox_serverTMEchoPort = new QSpinBox();
41 spinbox_TMServerPort->setRange(59000, 65535);
45 spinbox_TMServerPort->setRange(59000, 65535);
42 spinbox_TCServerPort->setRange(59001, 65535);
46 spinbox_TCServerPort->setRange(59001, 65535);
43 spinbox_serverTMEchoPort->setRange(59002, 65535);
47 spinbox_serverTMEchoPort->setRange(59002, 65535);
44
48
45 button_openServerTCTM = new QPushButton(tr("Open TC / TM Ports"));
49 button_openServerTCTM = new QPushButton(tr("Open TC / TM Ports"));
46 button_testServerTCTM = new QPushButton(tr("Test TC / TM Ports"));
50 button_testServerTCTM = new QPushButton(tr("Test TC / TM Ports"));
47 button_openSocketEchoServer = new QPushButton(tr("Open Echo Server"));
51 button_openSocketEchoServer = new QPushButton(tr("Open Echo Server"));
48 button_TCAcknowledgement = new QPushButton(tr("send TC Acknowledgement"));
52 button_TCAcknowledgement = new QPushButton(tr("send TC Acknowledgement"));
49 button_TCRejection = new QPushButton(tr("send TC rejection"));
53 button_TCRejection = new QPushButton(tr("send TC rejection"));
50 button_GSEHK = new QPushButton(tr("send GSE HK"));
54 button_GSEHK = new QPushButton(tr("send GSE HK"));
51 button_clearConsole = new QPushButton(tr("Clear console"));
55 button_clearConsole = new QPushButton(tr("Clear console"));
52 button_resetStatistics = new QPushButton(tr("Reset statistics"));
56 button_resetStatistics = new QPushButton(tr("Reset statistics"));
53
57
54 serverTMEchoDialogBox = new QIPDialogBox();
58 serverTMEchoDialogBox = new QIPDialogBox();
55 serverTMEchoDialogBox->setIP(127, 0, 0, 1);
59 serverTMEchoDialogBox->setIP(127, 0, 0, 1);
56
60
57 groupbox_TMEcho = new QGroupBox(tr("TM Echo Server"));
61 groupbox_TMEcho = new QGroupBox(tr("TM Echo Server"));
58 groupbox_ports = new QGroupBox(tr("Ports for the TM and TC Servers"));
62 groupbox_ports = new QGroupBox(tr("Ports for the TM and TC Servers"));
59 groupbox_TMToForeignGSETester = new QGroupBox(tr("Send TM to the foreign GSE tester"));
63 groupbox_TMToForeignGSETester = new QGroupBox(tr("Send TM to the foreign GSE tester"));
60
64
61 layout_TMEcho = new QVBoxLayout();
65 layout_TMEcho = new QVBoxLayout();
62 layout_overallLayout = new QVBoxLayout();
66 layout_overallLayout = new QVBoxLayout();
63 layout_ports = new QGridLayout();
67 layout_ports = new QGridLayout();
64 layout_TMToForeignGSETester = new QVBoxLayout();
68 layout_TMToForeignGSETester = new QVBoxLayout();
65 mainLayout = new QGridLayout();
69 mainLayout = new QGridLayout();
66
70
67 parameterDump = new ParameterDump();
71 parameterDump = new ParameterDump();
68
72
69 layout_TMEcho->addWidget(label_serverTMEcho);
73 layout_TMEcho->addWidget(label_serverTMEcho);
70 layout_TMEcho->addWidget(serverTMEchoDialogBox);
74 layout_TMEcho->addWidget(serverTMEchoDialogBox);
71 layout_TMEcho->addWidget(label_serverTMEchoPort);
75 layout_TMEcho->addWidget(label_serverTMEchoPort);
72 layout_TMEcho->addWidget(spinbox_serverTMEchoPort);
76 layout_TMEcho->addWidget(spinbox_serverTMEchoPort);
73 layout_TMEcho->addWidget(button_openSocketEchoServer);
77 layout_TMEcho->addWidget(button_openSocketEchoServer);
74 layout_TMEcho->addWidget(label_totalOfPackets);
78 layout_TMEcho->addWidget(label_totalOfPackets);
75 layout_TMEcho->addWidget(label_totalOfBytes);
79 layout_TMEcho->addWidget(label_totalOfBytes);
76 layout_TMEcho->addWidget(button_resetStatistics);
80 layout_TMEcho->addWidget(button_resetStatistics);
77 groupbox_TMEcho->setLayout(layout_TMEcho);
81 groupbox_TMEcho->setLayout(layout_TMEcho);
78
82
79 layout_ports->addWidget(label_TMServerPort, 0, 0, 1, 1);
83 layout_ports->addWidget(label_TMServerPort, 0, 0, 1, 1);
80 layout_ports->addWidget(spinbox_TMServerPort, 0, 1, 1, 1);
84 layout_ports->addWidget(spinbox_TMServerPort, 0, 1, 1, 1);
81 layout_ports->addWidget(label_TCServerPort, 1, 0, 1, 1);
85 layout_ports->addWidget(label_TCServerPort, 1, 0, 1, 1);
82 layout_ports->addWidget(spinbox_TCServerPort, 1, 1, 1, 1);
86 layout_ports->addWidget(spinbox_TCServerPort, 1, 1, 1, 1);
83 layout_ports->addWidget(button_openServerTCTM, 2, 0, 1, 2);
87 layout_ports->addWidget(button_openServerTCTM, 2, 0, 1, 2);
84 layout_ports->addWidget(button_testServerTCTM, 3, 0, 1, 2);
88 layout_ports->addWidget(button_testServerTCTM, 3, 0, 1, 2);
85 groupbox_ports->setLayout(layout_ports);
89 groupbox_ports->setLayout(layout_ports);
86
90
87 layout_TMToForeignGSETester->addWidget(button_TCAcknowledgement);
91 layout_TMToForeignGSETester->addWidget(button_TCAcknowledgement);
88 layout_TMToForeignGSETester->addWidget(button_TCRejection);
92 layout_TMToForeignGSETester->addWidget(button_TCRejection);
89 layout_TMToForeignGSETester->addWidget(button_GSEHK);
93 layout_TMToForeignGSETester->addWidget(button_GSEHK);
90 groupbox_TMToForeignGSETester->setLayout(layout_TMToForeignGSETester);
94 groupbox_TMToForeignGSETester->setLayout(layout_TMToForeignGSETester);
91
95
92 mainLayout->addWidget(groupbox_TMEcho, 0, 0, 1, 1);
96 mainLayout->addWidget(groupbox_TMEcho, 0, 0, 1, 1);
93 mainLayout->addWidget(button_clearConsole, 1, 0, 1, 1);
97 mainLayout->addWidget(button_clearConsole, 1, 0, 1, 1);
94 mainLayout->addWidget(console, 0, 1, 2, 1);
98 mainLayout->addWidget(console, 0, 1, 2, 1);
95 mainLayout->addWidget(groupbox_ports, 2, 0, 1, 1);
99 mainLayout->addWidget(groupbox_ports, 2, 0, 1, 1);
96 mainLayout->addWidget(groupbox_TMToForeignGSETester, 2, 1, 1, 1);
100 mainLayout->addWidget(groupbox_TMToForeignGSETester, 2, 1, 1, 1);
97 mainLayout->setColumnStretch(2, 1);
101 mainLayout->setColumnStretch(2, 1);
98 mainLayout->setRowStretch(3, 1);
102 mainLayout->setRowStretch(3, 1);
99
103
100 spwTabWidget->addTab(spwTabWidgetPage0, tr("Connection"));
104 spwTabWidget->addTab(spwTabWidgetPage0, tr("Connection"));
101 spwTabWidget->addTab(spwTabWidgetPage1, tr("TM Statistics"));
105 spwTabWidget->addTab(spwTabWidgetPage1, tr("TM Statistics"));
102 spwTabWidget->addTab(spwTabWidgetPage3, tr("HK"));
106 spwTabWidget->addTab(spwTabWidgetPage3, tr("HK"));
103 spwTabWidget->addTab(parameterDump, tr("DUMP"));
107 spwTabWidget->addTab(parameterDump, tr("DUMP"));
104 spwTabWidget->addTab(recordPage, tr("REC"));
108 spwTabWidget->addTab(recordPage, tr("REC"));
105 spwTabWidget->addTab(spwTabWidgetPage2, tr("WFRM NORM"));
109 spwTabWidget->addTab(spwTabWidgetPage2, tr("WFRM NORM"));
106 spwTabWidget->addTab( wfPage_CWF_F1, tr("CWF_F1"));
110 spwTabWidget->addTab( wfPage_CWF_F1, tr("CWF_F1"));
107 spwTabWidget->addTab( wfPage_CWF_F2, tr("CWF_F2"));
111 spwTabWidget->addTab( wfPage_CWF_F2, tr("CWF_F2"));
108 spwTabWidget->addTab( wfPage_CWF_F3, tr("CWF_F3"));
112 spwTabWidget->addTab( wfPage_CWF_F3, tr("CWF_F3"));
109 spwTabWidget->addTab( asmPage_F0, tr("ASM_F0"));
113 spwTabWidget->addTab( asmPage_F0, tr("ASM_F0"));
114 spwTabWidget->addTab( asmPage_F1, tr("ASM_F1"));
115 spwTabWidget->addTab( asmPage_F2, tr("ASM_F2"));
110
116
111 spwTabWidgetPage0->setLayout(mainLayout);
117 spwTabWidgetPage0->setLayout(mainLayout);
112 spwTabWidgetPage1->setLayout(tmStatistics->layout());
118 spwTabWidgetPage1->setLayout(tmStatistics->layout());
113 spwTabWidgetPage2->setLayout(wfDisplay->layout());
119 spwTabWidgetPage2->setLayout(wfDisplay->layout());
114 spwTabWidgetPage3->setLayout(hkDisplay->layout());
120 spwTabWidgetPage3->setLayout(hkDisplay->layout());
115
121
116 layout_overallLayout->addWidget(spwTabWidget);
122 layout_overallLayout->addWidget(spwTabWidget);
117
123
118 this->setLayout(layout_overallLayout);
124 this->setLayout(layout_overallLayout);
119
125
120 connect(this->button_clearConsole, SIGNAL(clicked()), this, SLOT(clearConsole()));
126 connect(this->button_clearConsole, SIGNAL(clicked()), this, SLOT(clearConsole()));
121
127
122 // SWF_F0
128 // SWF_F0
123 connect(this->recordPage, SIGNAL(signal_store_swf_f0()),
129 connect(this->recordPage, SIGNAL(signal_store_swf_f0()),
124 this->wfDisplay->page_f0, SLOT(storeWfrm()));
130 this->wfDisplay->page_f0, SLOT(storeWfrm()));
125 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
131 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
126 this->wfDisplay->page_f0, SLOT(setDefaultStorageDirectory(QString)));
132 this->wfDisplay->page_f0, SLOT(setDefaultStorageDirectory(QString)));
127 // SWF_F1
133 // SWF_F1
128 connect(this->recordPage, SIGNAL(signal_store_swf_f1()),
134 connect(this->recordPage, SIGNAL(signal_store_swf_f1()),
129 this->wfDisplay->page_f1, SLOT(storeWfrm()));
135 this->wfDisplay->page_f1, SLOT(storeWfrm()));
130 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
136 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
131 this->wfDisplay->page_f1, SLOT(setDefaultStorageDirectory(QString)));
137 this->wfDisplay->page_f1, SLOT(setDefaultStorageDirectory(QString)));
132 // SWF_F2
138 // SWF_F2
133 connect(this->recordPage, SIGNAL(signal_store_swf_f2()),
139 connect(this->recordPage, SIGNAL(signal_store_swf_f2()),
134 this->wfDisplay->page_f2, SLOT(storeWfrm()));
140 this->wfDisplay->page_f2, SLOT(storeWfrm()));
135 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
141 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
136 this->wfDisplay->page_f2, SLOT(setDefaultStorageDirectory(QString)));
142 this->wfDisplay->page_f2, SLOT(setDefaultStorageDirectory(QString)));
137 // CWF_F1
143 // CWF_F1
138 connect(this->recordPage, SIGNAL(signal_store_cwf_f1()),
144 connect(this->recordPage, SIGNAL(signal_store_cwf_f1()),
139 this->wfPage_CWF_F1, SLOT(storeWfrm()));
145 this->wfPage_CWF_F1, SLOT(storeWfrm()));
140 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
146 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
141 this->wfPage_CWF_F1, SLOT(setDefaultStorageDirectory(QString)));
147 this->wfPage_CWF_F1, SLOT(setDefaultStorageDirectory(QString)));
142 // CWF_F2
148 // CWF_F2
143 connect(this->recordPage, SIGNAL(signal_store_cwf_f2()),
149 connect(this->recordPage, SIGNAL(signal_store_cwf_f2()),
144 this->wfPage_CWF_F2, SLOT(storeWfrm()));
150 this->wfPage_CWF_F2, SLOT(storeWfrm()));
145 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
151 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
146 this->wfPage_CWF_F2, SLOT(setDefaultStorageDirectory(QString)));
152 this->wfPage_CWF_F2, SLOT(setDefaultStorageDirectory(QString)));
147 // CWF_F3
153 // CWF_F3
148 connect(this->recordPage, SIGNAL(signal_store_cwf_f3()),
154 connect(this->recordPage, SIGNAL(signal_store_cwf_f3()),
149 this->wfPage_CWF_F3, SLOT(storeWfrm()));
155 this->wfPage_CWF_F3, SLOT(storeWfrm()));
150 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
156 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
151 this->wfPage_CWF_F3, SLOT(setDefaultStorageDirectory(QString)));
157 this->wfPage_CWF_F3, SLOT(setDefaultStorageDirectory(QString)));
152 // ASM_F0
158 // ASM_F0
153 connect(this->recordPage, SIGNAL(signal_store_asm_f0()),
159 connect(this->recordPage, SIGNAL(signal_store_asm_f0()),
154 this->asmPage_F0, SLOT(storeWfrm()));
160 this->asmPage_F0, SLOT(storeWfrm()));
155 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
161 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
156 this->asmPage_F0, SLOT(setDefaultStorageDirectory(QString)));
162 this->asmPage_F0, SLOT(setDefaultStorageDirectory(QString)));
163 // ASM_F1
164 connect(this->recordPage, SIGNAL(signal_store_asm_f1()),
165 this->asmPage_F1, SLOT(storeWfrm()));
166 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
167 this->asmPage_F1, SLOT(setDefaultStorageDirectory(QString)));
168 // ASM_F2
169 connect(this->recordPage, SIGNAL(signal_store_asm_f2()),
170 this->asmPage_F2, SLOT(storeWfrm()));
171 connect(this->recordPage, SIGNAL(signal_defaultStorageDirectoryUpdated(QString)),
172 this->asmPage_F2, SLOT(setDefaultStorageDirectory(QString)));
157
173
158 emit this->recordPage->signal_defaultStorageDirectoryUpdated(this->recordPage->defaultStorageDirectory);
174 emit this->recordPage->signal_defaultStorageDirectoryUpdated(this->recordPage->defaultStorageDirectory);
159 }
175 }
160
176
161 QString MainWindowUI::getTMEchoServerAddress()
177 QString MainWindowUI::getTMEchoServerAddress()
162 {
178 {
163 return(serverTMEchoDialogBox->getIP());
179 return(serverTMEchoDialogBox->getIP());
164 }
180 }
165
181
166 void MainWindowUI::setTCTMServerAddressIP(QString address)
182 void MainWindowUI::setTCTMServerAddressIP(QString address)
167 {
183 {
168 label_currentTCTMServerIP->setText(address);
184 label_currentTCTMServerIP->setText(address);
169 }
185 }
170
186
171 int MainWindowUI::getTMPort()
187 int MainWindowUI::getTMPort()
172 {
188 {
173 return spinbox_TMServerPort->value();
189 return spinbox_TMServerPort->value();
174 }
190 }
175
191
176 int MainWindowUI::getTCPort()
192 int MainWindowUI::getTCPort()
177 {
193 {
178 return spinbox_TCServerPort->value();
194 return spinbox_TCServerPort->value();
179 }
195 }
180
196
181 void MainWindowUI::displayOnConsole(QString message)
197 void MainWindowUI::displayOnConsole(QString message)
182 {
198 {
183 console->append(message);
199 console->append(message);
184 }
200 }
185
201
186 void MainWindowUI::clearConsole()
202 void MainWindowUI::clearConsole()
187 {
203 {
188 console->clear();
204 console->clear();
189 }
205 }
190
206
191 void MainWindowUI::totalOfBytesHasChanged(unsigned int nbBytes)
207 void MainWindowUI::totalOfBytesHasChanged(unsigned int nbBytes)
192 {
208 {
193 label_totalOfBytes->setText(
209 label_totalOfBytes->setText(
194 "Received Bytes: "
210 "Received Bytes: "
195 + QString::number(nbBytes));
211 + QString::number(nbBytes));
196 }
212 }
197
213
198 void MainWindowUI::totalOfPacketsHasChanged(unsigned int nbPackets)
214 void MainWindowUI::totalOfPacketsHasChanged(unsigned int nbPackets)
199 {
215 {
200 label_totalOfPackets->setText(
216 label_totalOfPackets->setText(
201 "Received Packets: "
217 "Received Packets: "
202 + QString::number(nbPackets));
218 + QString::number(nbPackets));
203 }
219 }
@@ -1,104 +1,106
1 #ifndef MAINWINDOWUI_H
1 #ifndef MAINWINDOWUI_H
2 #define MAINWINDOWUI_H
2 #define MAINWINDOWUI_H
3
3
4 #include <QWidget>
4 #include <QWidget>
5 #include <qipdialogbox.h>
5 #include <qipdialogbox.h>
6 #include <QLabel>
6 #include <QLabel>
7 #include <QPushButton>
7 #include <QPushButton>
8 #include <QGridLayout>
8 #include <QGridLayout>
9 #include <QVBoxLayout>
9 #include <QVBoxLayout>
10 #include <QGroupBox>
10 #include <QGroupBox>
11 #include <QSpinBox>
11 #include <QSpinBox>
12 #include <QTextEdit>
12 #include <QTextEdit>
13 #include <QTabWidget>
13 #include <QTabWidget>
14
14
15 #include <wfdisplay.h>
15 #include <wfdisplay.h>
16 #include <pagespectra.h>
16 #include <pagespectra.h>
17 #include <asmpage.h>
17 #include <asmpage.h>
18 #include <parameterdump.h>
18 #include <parameterdump.h>
19
19
20 #include "tmstatistics.h"
20 #include "tmstatistics.h"
21 #include "hkdisplay.h"
21 #include "hkdisplay.h"
22 #include "recordpage.h"
22 #include "recordpage.h"
23
23
24 class MainWindowUI : public QWidget
24 class MainWindowUI : public QWidget
25 {
25 {
26 Q_OBJECT
26 Q_OBJECT
27 public:
27 public:
28 explicit MainWindowUI(QWidget *parent = 0);
28 explicit MainWindowUI(QWidget *parent = 0);
29
29
30 void setTCTMServerAddressIP(QString address);
30 void setTCTMServerAddressIP(QString address);
31 QString getTMEchoServerAddress();
31 QString getTMEchoServerAddress();
32 int getTMPort();
32 int getTMPort();
33 int getTCPort();
33 int getTCPort();
34 void displayOnConsole(QString message);
34 void displayOnConsole(QString message);
35
35
36 QTabWidget *spwTabWidget;
36 QTabWidget *spwTabWidget;
37 QWidget* spwTabWidgetPage0;
37 QWidget* spwTabWidgetPage0;
38 QWidget* spwTabWidgetPage1;
38 QWidget* spwTabWidgetPage1;
39 QWidget* spwTabWidgetPage2;
39 QWidget* spwTabWidgetPage2;
40 QWidget* spwTabWidgetPage3;
40 QWidget* spwTabWidgetPage3;
41
41
42 TMStatistics* tmStatistics;
42 TMStatistics* tmStatistics;
43
43
44 WFDisplay* wfDisplay;
44 WFDisplay* wfDisplay;
45 WFPage* wfPage_CWF_F1;
45 WFPage* wfPage_CWF_F1;
46 WFPage* wfPage_CWF_F2;
46 WFPage* wfPage_CWF_F2;
47 WFPage* wfPage_CWF_F3;
47 WFPage* wfPage_CWF_F3;
48 ASMPage* asmPage_F0;
48 ASMPage* asmPage_F0;
49 ASMPage* asmPage_F1;
50 ASMPage* asmPage_F2;
49 HKDisplay* hkDisplay;
51 HKDisplay* hkDisplay;
50 RecordPage* recordPage;
52 RecordPage* recordPage;
51
53
52 QWidget* widget_spectrogram;
54 QWidget* widget_spectrogram;
53
55
54 ParameterDump* parameterDump;
56 ParameterDump* parameterDump;
55
57
56 QPushButton *button_openServerTCTM;
58 QPushButton *button_openServerTCTM;
57 QPushButton *button_testServerTCTM;
59 QPushButton *button_testServerTCTM;
58 QPushButton *button_openSocketEchoServer;
60 QPushButton *button_openSocketEchoServer;
59 QPushButton *button_TCAcknowledgement;
61 QPushButton *button_TCAcknowledgement;
60 QPushButton *button_TCRejection;
62 QPushButton *button_TCRejection;
61 QPushButton *button_GSEHK;
63 QPushButton *button_GSEHK;
62 QPushButton *button_clearConsole;
64 QPushButton *button_clearConsole;
63 QPushButton *button_resetStatistics;
65 QPushButton *button_resetStatistics;
64
66
65 QIPDialogBox *serverTMEchoDialogBox;
67 QIPDialogBox *serverTMEchoDialogBox;
66
68
67 QSpinBox *spinbox_serverTMEchoPort;
69 QSpinBox *spinbox_serverTMEchoPort;
68
70
69 signals:
71 signals:
70
72
71 public slots:
73 public slots:
72 void clearConsole();
74 void clearConsole();
73 void totalOfBytesHasChanged(unsigned int nbBytes);
75 void totalOfBytesHasChanged(unsigned int nbBytes);
74 void totalOfPacketsHasChanged(unsigned int nbPackets);
76 void totalOfPacketsHasChanged(unsigned int nbPackets);
75
77
76 private:
78 private:
77 QLabel *label_serverTMEcho;
79 QLabel *label_serverTMEcho;
78 QLabel *label_serverTMEchoPort;
80 QLabel *label_serverTMEchoPort;
79 QLabel *label_TMServerPort;
81 QLabel *label_TMServerPort;
80 QLabel *label_TCServerPort;
82 QLabel *label_TCServerPort;
81 QLabel *label_currentTCTMServer;
83 QLabel *label_currentTCTMServer;
82 QLabel *label_currentTCTMServerIP;
84 QLabel *label_currentTCTMServerIP;
83 QLabel *label_totalOfBytes;
85 QLabel *label_totalOfBytes;
84 QLabel *label_totalOfPackets;
86 QLabel *label_totalOfPackets;
85
87
86 QTextEdit *console;
88 QTextEdit *console;
87
89
88 QSpinBox *spinbox_TMServerPort;
90 QSpinBox *spinbox_TMServerPort;
89 QSpinBox *spinbox_TCServerPort;
91 QSpinBox *spinbox_TCServerPort;
90
92
91 QGroupBox *groupbox_TMEcho;
93 QGroupBox *groupbox_TMEcho;
92 QGroupBox *groupbox_ports;
94 QGroupBox *groupbox_ports;
93 QGroupBox *groupbox_TMToForeignGSETester;
95 QGroupBox *groupbox_TMToForeignGSETester;
94
96
95 QVBoxLayout *layout_TMEcho;
97 QVBoxLayout *layout_TMEcho;
96 QVBoxLayout *layout_TMToForeignGSETester;
98 QVBoxLayout *layout_TMToForeignGSETester;
97 QVBoxLayout *layout_overallLayout;
99 QVBoxLayout *layout_overallLayout;
98
100
99 QGridLayout *mainLayout;
101 QGridLayout *mainLayout;
100 QGridLayout *layout_ports;
102 QGridLayout *layout_ports;
101
103
102 };
104 };
103
105
104 #endif // MAINWINDOWUI_H
106 #endif // MAINWINDOWUI_H
@@ -1,157 +1,171
1 #include "recordpage.h"
1 #include "recordpage.h"
2
2
3 RecordPage::RecordPage(QWidget *parent) :
3 RecordPage::RecordPage(QWidget *parent) :
4 QWidget(parent)
4 QWidget(parent)
5 {
5 {
6 logFileEn = false;
6 logFileEn = false;
7
7
8 radiobutton_swf_f0 = new QRadioButton("swf_f0");
8 radiobutton_swf_f0 = new QRadioButton("swf_f0");
9 radiobutton_swf_f1 = new QRadioButton("swf_f1");
9 radiobutton_swf_f1 = new QRadioButton("swf_f1");
10 radiobutton_swf_f2 = new QRadioButton("swf_f2");
10 radiobutton_swf_f2 = new QRadioButton("swf_f2");
11 radiobutton_cwf_f1 = new QRadioButton("cwf_f1");
11 radiobutton_cwf_f1 = new QRadioButton("cwf_f1");
12 radiobutton_cwf_f2 = new QRadioButton("cwf_f2");
12 radiobutton_cwf_f2 = new QRadioButton("cwf_f2");
13 radiobutton_cwf_f3 = new QRadioButton("cwf_f3");
13 radiobutton_cwf_f3 = new QRadioButton("cwf_f3");
14 radiobutton_asm_f0 = new QRadioButton("asm_f0");
14 radiobutton_asm_f0 = new QRadioButton("asm_f0");
15 radiobutton_asm_f1 = new QRadioButton("asm_f1");
16 radiobutton_asm_f2 = new QRadioButton("asm_f2");
15
17
16 radiobutton_swf_f0->setAutoExclusive(false);
18 radiobutton_swf_f0->setAutoExclusive(false);
17 radiobutton_swf_f1->setAutoExclusive(false);
19 radiobutton_swf_f1->setAutoExclusive(false);
18 radiobutton_swf_f2->setAutoExclusive(false);
20 radiobutton_swf_f2->setAutoExclusive(false);
19 radiobutton_cwf_f1->setAutoExclusive(false);
21 radiobutton_cwf_f1->setAutoExclusive(false);
20 radiobutton_cwf_f2->setAutoExclusive(false);
22 radiobutton_cwf_f2->setAutoExclusive(false);
21 radiobutton_cwf_f3->setAutoExclusive(false);
23 radiobutton_cwf_f3->setAutoExclusive(false);
22 radiobutton_asm_f0->setAutoExclusive(false);
24 radiobutton_asm_f0->setAutoExclusive(false);
25 radiobutton_asm_f1->setAutoExclusive(false);
26 radiobutton_asm_f2->setAutoExclusive(false);
23
27
24 label_currentDir = new QLabel("Current Dir: -");
28 label_currentDir = new QLabel("Current Dir: -");
25
29
26 button_chooseDir = new QPushButton("choose dir");
30 button_chooseDir = new QPushButton("choose dir");
27 button_storeWfrm = new QPushButton(tr("REC"));
31 button_storeWfrm = new QPushButton(tr("REC"));
28
32
29 groupbox_waveforms = new QGroupBox("waveforms");
33 groupbox_waveforms = new QGroupBox("waveforms");
30 groupbox_matrices = new QGroupBox("spectral matrices");
34 groupbox_matrices = new QGroupBox("spectral matrices");
31 groupbox_directory = new QGroupBox("directory");
35 groupbox_directory = new QGroupBox("directory");
32
36
33 vboxlayout_waveforms = new QVBoxLayout();
37 vboxlayout_waveforms = new QVBoxLayout();
34 vboxlayout_matrices = new QVBoxLayout();
38 vboxlayout_matrices = new QVBoxLayout();
35 vboxlayout_directory = new QVBoxLayout();
39 vboxlayout_directory = new QVBoxLayout();
36
40
37 mainLayout = new QGridLayout();
41 mainLayout = new QGridLayout();
38
42
39 this->readSettings();
43 this->readSettings();
40
44
41 vboxlayout_waveforms->addWidget(radiobutton_swf_f0);
45 vboxlayout_waveforms->addWidget(radiobutton_swf_f0);
42 vboxlayout_waveforms->addWidget(radiobutton_swf_f1);
46 vboxlayout_waveforms->addWidget(radiobutton_swf_f1);
43 vboxlayout_waveforms->addWidget(radiobutton_swf_f2);
47 vboxlayout_waveforms->addWidget(radiobutton_swf_f2);
44 vboxlayout_waveforms->addWidget(radiobutton_cwf_f1);
48 vboxlayout_waveforms->addWidget(radiobutton_cwf_f1);
45 vboxlayout_waveforms->addWidget(radiobutton_cwf_f2);
49 vboxlayout_waveforms->addWidget(radiobutton_cwf_f2);
46 vboxlayout_waveforms->addWidget(radiobutton_cwf_f3);
50 vboxlayout_waveforms->addWidget(radiobutton_cwf_f3);
47 vboxlayout_waveforms->addStretch();
51 vboxlayout_waveforms->addStretch();
48
52
49
53
50 vboxlayout_matrices->addWidget(radiobutton_asm_f0);
54 vboxlayout_matrices->addWidget(radiobutton_asm_f0);
55 vboxlayout_matrices->addWidget(radiobutton_asm_f1);
56 vboxlayout_matrices->addWidget(radiobutton_asm_f2);
51 vboxlayout_matrices->addStretch();
57 vboxlayout_matrices->addStretch();
52
58
53 vboxlayout_directory->addWidget(button_storeWfrm);
59 vboxlayout_directory->addWidget(button_storeWfrm);
54 vboxlayout_directory->addWidget(button_chooseDir);
60 vboxlayout_directory->addWidget(button_chooseDir);
55 vboxlayout_directory->addWidget(label_currentDir);
61 vboxlayout_directory->addWidget(label_currentDir);
56 vboxlayout_directory->addStretch();
62 vboxlayout_directory->addStretch();
57
63
58 groupbox_waveforms->setLayout(vboxlayout_waveforms);
64 groupbox_waveforms->setLayout(vboxlayout_waveforms);
59 groupbox_matrices->setLayout(vboxlayout_matrices);
65 groupbox_matrices->setLayout(vboxlayout_matrices);
60 groupbox_directory->setLayout(vboxlayout_directory);
66 groupbox_directory->setLayout(vboxlayout_directory);
61
67
62 mainLayout->addWidget(groupbox_directory, 0, 0, 1, 1);
68 mainLayout->addWidget(groupbox_directory, 0, 0, 1, 1);
63 mainLayout->addWidget(groupbox_waveforms, 0, 1, 1, 1);
69 mainLayout->addWidget(groupbox_waveforms, 0, 1, 1, 1);
64 mainLayout->addWidget(groupbox_matrices, 0, 2, 1, 1);
70 mainLayout->addWidget(groupbox_matrices, 0, 2, 1, 1);
65 mainLayout->setRowStretch(1, 1);
71 mainLayout->setRowStretch(1, 1);
66 mainLayout->setColumnStretch(3, 1);
72 mainLayout->setColumnStretch(3, 1);
67
73
68 this->setLayout(mainLayout);
74 this->setLayout(mainLayout);
69
75
70 connect(this->button_chooseDir, SIGNAL(clicked()), this, SLOT(chooseDir()));
76 connect(this->button_chooseDir, SIGNAL(clicked()), this, SLOT(chooseDir()));
71 connect(this->button_storeWfrm, SIGNAL(clicked()), this, SLOT(storeWfrm()));
77 connect(this->button_storeWfrm, SIGNAL(clicked()), this, SLOT(storeWfrm()));
72 }
78 }
73
79
74 RecordPage::~RecordPage()
80 RecordPage::~RecordPage()
75 {
81 {
76 this->writeSettings();
82 this->writeSettings();
77 }
83 }
78
84
79 void RecordPage::chooseDir()
85 void RecordPage::chooseDir()
80 {
86 {
81 QString tmpDefaultStorageDirectory;
87 QString tmpDefaultStorageDirectory;
82 tmpDefaultStorageDirectory = QFileDialog::getExistingDirectory(this,
88 tmpDefaultStorageDirectory = QFileDialog::getExistingDirectory(this,
83 "choose the directory",
89 "choose the directory",
84 QDir::homePath(),
90 QDir::homePath(),
85 QFileDialog::ShowDirsOnly);
91 QFileDialog::ShowDirsOnly);
86
92
87 if( !tmpDefaultStorageDirectory.isEmpty() )
93 if( !tmpDefaultStorageDirectory.isEmpty() )
88 {
94 {
89 defaultStorageDirectory = tmpDefaultStorageDirectory;
95 defaultStorageDirectory = tmpDefaultStorageDirectory;
90 }
96 }
91
97
92 label_currentDir->setText(defaultStorageDirectory);
98 label_currentDir->setText(defaultStorageDirectory);
93 emit signal_defaultStorageDirectoryUpdated( defaultStorageDirectory );
99 emit signal_defaultStorageDirectoryUpdated( defaultStorageDirectory );
94 }
100 }
95
101
96 void RecordPage::storeWfrm()
102 void RecordPage::storeWfrm()
97 {
103 {
98 if (logFileEn == false)
104 if (logFileEn == false)
99 {
105 {
100 // enable storage
106 // enable storage
101 button_storeWfrm->setText(tr("STOP"));
107 button_storeWfrm->setText(tr("STOP"));
102 logFileEn = true;
108 logFileEn = true;
103 if (radiobutton_swf_f0->isChecked()) emit signal_store_swf_f0();
109 if (radiobutton_swf_f0->isChecked()) emit signal_store_swf_f0();
104 if (radiobutton_swf_f1->isChecked()) emit signal_store_swf_f1();
110 if (radiobutton_swf_f1->isChecked()) emit signal_store_swf_f1();
105 if (radiobutton_swf_f2->isChecked()) emit signal_store_swf_f2();
111 if (radiobutton_swf_f2->isChecked()) emit signal_store_swf_f2();
106 if (radiobutton_cwf_f1->isChecked()) emit signal_store_cwf_f1();
112 if (radiobutton_cwf_f1->isChecked()) emit signal_store_cwf_f1();
107 if (radiobutton_cwf_f2->isChecked()) emit signal_store_cwf_f2();
113 if (radiobutton_cwf_f2->isChecked()) emit signal_store_cwf_f2();
108 if (radiobutton_cwf_f3->isChecked()) emit signal_store_cwf_f3();
114 if (radiobutton_cwf_f3->isChecked()) emit signal_store_cwf_f3();
109 if (radiobutton_asm_f0->isChecked()) emit signal_store_asm_f0();
115 if (radiobutton_asm_f0->isChecked()) emit signal_store_asm_f0();
116 if (radiobutton_asm_f1->isChecked()) emit signal_store_asm_f0();
117 if (radiobutton_asm_f2->isChecked()) emit signal_store_asm_f0();
110 radiobutton_swf_f0->setEnabled(false);
118 radiobutton_swf_f0->setEnabled(false);
111 radiobutton_swf_f1->setEnabled(false);
119 radiobutton_swf_f1->setEnabled(false);
112 radiobutton_swf_f2->setEnabled(false);
120 radiobutton_swf_f2->setEnabled(false);
113 radiobutton_cwf_f1->setEnabled(false);
121 radiobutton_cwf_f1->setEnabled(false);
114 radiobutton_cwf_f2->setEnabled(false);
122 radiobutton_cwf_f2->setEnabled(false);
115 radiobutton_cwf_f3->setEnabled(false);
123 radiobutton_cwf_f3->setEnabled(false);
116 radiobutton_asm_f0->setEnabled(false);
124 radiobutton_asm_f0->setEnabled(false);
125 radiobutton_asm_f1->setEnabled(false);
126 radiobutton_asm_f2->setEnabled(false);
117 }
127 }
118 else
128 else
119 {
129 {
120 // disable storage
130 // disable storage
121 button_storeWfrm->setText(tr("REC"));
131 button_storeWfrm->setText(tr("REC"));
122 logFileEn = false;
132 logFileEn = false;
123 if (radiobutton_swf_f0->isChecked()) emit signal_store_swf_f0();
133 if (radiobutton_swf_f0->isChecked()) emit signal_store_swf_f0();
124 if (radiobutton_swf_f1->isChecked()) emit signal_store_swf_f1();
134 if (radiobutton_swf_f1->isChecked()) emit signal_store_swf_f1();
125 if (radiobutton_swf_f2->isChecked()) emit signal_store_swf_f2();
135 if (radiobutton_swf_f2->isChecked()) emit signal_store_swf_f2();
126 if (radiobutton_cwf_f1->isChecked()) emit signal_store_cwf_f1();
136 if (radiobutton_cwf_f1->isChecked()) emit signal_store_cwf_f1();
127 if (radiobutton_cwf_f2->isChecked()) emit signal_store_cwf_f2();
137 if (radiobutton_cwf_f2->isChecked()) emit signal_store_cwf_f2();
128 if (radiobutton_cwf_f3->isChecked()) emit signal_store_cwf_f3();
138 if (radiobutton_cwf_f3->isChecked()) emit signal_store_cwf_f3();
129 if (radiobutton_asm_f0->isChecked()) emit signal_store_asm_f0();
139 if (radiobutton_asm_f0->isChecked()) emit signal_store_asm_f0();
140 if (radiobutton_asm_f1->isChecked()) emit signal_store_asm_f1();
141 if (radiobutton_asm_f2->isChecked()) emit signal_store_asm_f2();
130 radiobutton_swf_f0->setEnabled(true);
142 radiobutton_swf_f0->setEnabled(true);
131 radiobutton_swf_f1->setEnabled(true);
143 radiobutton_swf_f1->setEnabled(true);
132 radiobutton_swf_f2->setEnabled(true);
144 radiobutton_swf_f2->setEnabled(true);
133 radiobutton_cwf_f1->setEnabled(true);
145 radiobutton_cwf_f1->setEnabled(true);
134 radiobutton_cwf_f2->setEnabled(true);
146 radiobutton_cwf_f2->setEnabled(true);
135 radiobutton_cwf_f3->setEnabled(true);
147 radiobutton_cwf_f3->setEnabled(true);
136 radiobutton_asm_f0->setEnabled(true);
148 radiobutton_asm_f0->setEnabled(true);
149 radiobutton_asm_f1->setEnabled(true);
150 radiobutton_asm_f2->setEnabled(true);
137 }
151 }
138 }
152 }
139
153
140 void RecordPage::readSettings()
154 void RecordPage::readSettings()
141 {
155 {
142 QSettings settings("lpp", "lfrsgse");
156 QSettings settings("lpp", "lfrsgse");
143 defaultStorageDirectory = settings.value( "storageDirectory", QDir::homePath() ).toString();
157 defaultStorageDirectory = settings.value( "storageDirectory", QDir::homePath() ).toString();
144 label_currentDir->setText( defaultStorageDirectory );
158 label_currentDir->setText( defaultStorageDirectory );
145 emit signal_defaultStorageDirectoryUpdated( defaultStorageDirectory );
159 emit signal_defaultStorageDirectoryUpdated( defaultStorageDirectory );
146 }
160 }
147
161
148 void RecordPage::writeSettings()
162 void RecordPage::writeSettings()
149 {
163 {
150 QSettings settings("lpp", "lfrsgse");
164 QSettings settings("lpp", "lfrsgse");
151 settings.setValue("storageDirectory", defaultStorageDirectory);
165 settings.setValue("storageDirectory", defaultStorageDirectory);
152 }
166 }
153
167
154 void RecordPage::closeEvent(QCloseEvent *event)
168 void RecordPage::closeEvent(QCloseEvent *event)
155 {
169 {
156 event->accept();
170 event->accept();
157 }
171 }
@@ -1,70 +1,74
1 #ifndef RECORDPAGE_H
1 #ifndef RECORDPAGE_H
2 #define RECORDPAGE_H
2 #define RECORDPAGE_H
3
3
4 #include <QWidget>
4 #include <QWidget>
5 #include <QRadioButton>
5 #include <QRadioButton>
6 #include <QGroupBox>
6 #include <QGroupBox>
7 #include <QVBoxLayout>
7 #include <QVBoxLayout>
8 #include <QGridLayout>
8 #include <QGridLayout>
9 #include <QLabel>
9 #include <QLabel>
10 #include <QPushButton>
10 #include <QPushButton>
11 #include <QSettings>
11 #include <QSettings>
12 #include <QFileDialog>
12 #include <QFileDialog>
13 #include <QCloseEvent>
13 #include <QCloseEvent>
14
14
15 class RecordPage : public QWidget
15 class RecordPage : public QWidget
16 {
16 {
17 Q_OBJECT
17 Q_OBJECT
18 public:
18 public:
19 explicit RecordPage(QWidget *parent = 0);
19 explicit RecordPage(QWidget *parent = 0);
20 ~RecordPage();
20 ~RecordPage();
21
21
22 QLabel *label_currentDir;
22 QLabel *label_currentDir;
23
23
24 bool logFileEn;
24 bool logFileEn;
25
25
26 QPushButton *button_chooseDir;
26 QPushButton *button_chooseDir;
27 QPushButton *button_storeWfrm;
27 QPushButton *button_storeWfrm;
28
28
29 QRadioButton *radiobutton_swf_f0;
29 QRadioButton *radiobutton_swf_f0;
30 QRadioButton *radiobutton_swf_f1;
30 QRadioButton *radiobutton_swf_f1;
31 QRadioButton *radiobutton_swf_f2;
31 QRadioButton *radiobutton_swf_f2;
32 QRadioButton *radiobutton_cwf_f1;
32 QRadioButton *radiobutton_cwf_f1;
33 QRadioButton *radiobutton_cwf_f2;
33 QRadioButton *radiobutton_cwf_f2;
34 QRadioButton *radiobutton_cwf_f3;
34 QRadioButton *radiobutton_cwf_f3;
35 QRadioButton *radiobutton_asm_f0;
35 QRadioButton *radiobutton_asm_f0;
36 QRadioButton *radiobutton_asm_f1;
37 QRadioButton *radiobutton_asm_f2;
36
38
37 QGroupBox *groupbox_waveforms;
39 QGroupBox *groupbox_waveforms;
38 QGroupBox *groupbox_matrices;
40 QGroupBox *groupbox_matrices;
39 QGroupBox *groupbox_directory;
41 QGroupBox *groupbox_directory;
40
42
41 QVBoxLayout *vboxlayout_waveforms;
43 QVBoxLayout *vboxlayout_waveforms;
42 QVBoxLayout *vboxlayout_matrices;
44 QVBoxLayout *vboxlayout_matrices;
43 QVBoxLayout *vboxlayout_directory;
45 QVBoxLayout *vboxlayout_directory;
44
46
45 QString defaultStorageDirectory;
47 QString defaultStorageDirectory;
46
48
47 QGridLayout *mainLayout;
49 QGridLayout *mainLayout;
48
50
49 protected:
51 protected:
50 void closeEvent(QCloseEvent *event);
52 void closeEvent(QCloseEvent *event);
51
53
52 signals:
54 signals:
53 void signal_store_swf_f0();
55 void signal_store_swf_f0();
54 void signal_store_swf_f1();
56 void signal_store_swf_f1();
55 void signal_store_swf_f2();
57 void signal_store_swf_f2();
56 void signal_store_cwf_f1();
58 void signal_store_cwf_f1();
57 void signal_store_cwf_f2();
59 void signal_store_cwf_f2();
58 void signal_store_cwf_f3();
60 void signal_store_cwf_f3();
59 void signal_store_asm_f0();
61 void signal_store_asm_f0();
62 void signal_store_asm_f1();
63 void signal_store_asm_f2();
60 void signal_defaultStorageDirectoryUpdated( QString nameOfTheDirectory );
64 void signal_defaultStorageDirectoryUpdated( QString nameOfTheDirectory );
61
65
62 public slots:
66 public slots:
63 void chooseDir();
67 void chooseDir();
64 void storeWfrm();
68 void storeWfrm();
65 void readSettings();
69 void readSettings();
66 void writeSettings();
70 void writeSettings();
67
71
68 };
72 };
69
73
70 #endif // RECORDPAGE_H
74 #endif // RECORDPAGE_H
General Comments 0
You need to be logged in to leave comments. Login now