##// END OF EJS Templates
QSettings used in the lfrsgse to store the IP address of the echo bridge
leroy -
r28:66e3fbb189eb default
parent child
Show More
@@ -1,6 +1,6
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2013-06-27T15:10:56. -->
3 <!-- Written by Qt Creator 2.4.1, 2013-07-01T12:13:58. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -77,3 +77,23 void QIPDialogBox::setIP(unsigned char a
77 addressPart3->repaint();
77 addressPart3->repaint();
78 addressPart4->repaint();
78 addressPart4->repaint();
79 }
79 }
80
81 unsigned char QIPDialogBox::getAddressPart1()
82 {
83 return (unsigned char) addressPart1->value();
84 }
85
86 unsigned char QIPDialogBox::getAddressPart2()
87 {
88 return (unsigned char) addressPart2->value();
89 }
90
91 unsigned char QIPDialogBox::getAddressPart3()
92 {
93 return (unsigned char) addressPart3->value();
94 }
95
96 unsigned char QIPDialogBox::getAddressPart4()
97 {
98 return (unsigned char) addressPart4->value();
99 }
@@ -18,6 +18,10 signals:
18 public slots:
18 public slots:
19 void valueChanged();
19 void valueChanged();
20 QString getIP();
20 QString getIP();
21 unsigned char getAddressPart1();
22 unsigned char getAddressPart2();
23 unsigned char getAddressPart3();
24 unsigned char getAddressPart4();
21
25
22 private:
26 private:
23 QSpinBox *addressPart1;
27 QSpinBox *addressPart1;
@@ -8,7 +8,7 QT += core gui
8 QT += network
8 QT += network
9 QT += xml
9 QT += xml
10
10
11 TARGET = gselesia
11 TARGET = lfrsgse
12 TEMPLATE = app
12 TEMPLATE = app
13
13
14 INCLUDEPATH += \
14 INCLUDEPATH += \
@@ -1,6 +1,6
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2013-06-28T13:47:27. -->
3 <!-- Written by Qt Creator 2.4.1, 2013-07-02T14:22:52. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -28,6 +28,8 MainWindow::MainWindow(QWidget *parent)
28 lfrXmlParser = new LFRXmlParser();
28 lfrXmlParser = new LFRXmlParser();
29
29
30 UI = new MainWindowUI();
30 UI = new MainWindowUI();
31 readSettings();
32 this->UI->serverTMEchoDialogBox->setIP(echoBridgeIP0, echoBridgeIP1, echoBridgeIP2, echoBridgeIP3);
31
33
32 lfrXmlParser->generalCCSDSPacketStore = &this->generalCCSDSPacketStore;
34 lfrXmlParser->generalCCSDSPacketStore = &this->generalCCSDSPacketStore;
33
35
@@ -470,3 +472,26 void MainWindow::processPacketStore()
470 delete(packet);
472 delete(packet);
471 }
473 }
472 }
474 }
475
476 void MainWindow::readSettings()
477 {
478 QSettings settings("lpp", "lfrsge");
479 echoBridgeIP0 = (unsigned char) settings.value("echoBridgeIP0", 127).toInt();
480 echoBridgeIP1 = (unsigned char) settings.value("echoBridgeIP1", 0).toInt();
481 echoBridgeIP2 = (unsigned char) settings.value("echoBridgeIP2", 0).toInt();
482 echoBridgeIP3 = (unsigned char) settings.value("echoBridgeIP3", 1).toInt();
483 }
484
485 void MainWindow::writeSettings()
486 {
487 QSettings settings("lpp", "lfrsge");
488 settings.setValue("echoBridgeIP0", this->UI->serverTMEchoDialogBox->getAddressPart1());
489 settings.setValue("echoBridgeIP1", this->UI->serverTMEchoDialogBox->getAddressPart2());
490 settings.setValue("echoBridgeIP2", this->UI->serverTMEchoDialogBox->getAddressPart3());
491 settings.setValue("echoBridgeIP3", this->UI->serverTMEchoDialogBox->getAddressPart4());
492 }
493
494 void MainWindow::closeEvent(QCloseEvent *)
495 {
496 writeSettings();
497 }
@@ -5,6 +5,7
5 #include <QTcpServer>
5 #include <QTcpServer>
6 #include <QTcpSocket>
6 #include <QTcpSocket>
7 #include <QXmlSimpleReader>
7 #include <QXmlSimpleReader>
8 #include <QSettings>
8
9
9 #include <lfrxmlhandler.h>
10 #include <lfrxmlhandler.h>
10 #include <lfrxmlwriter.h>
11 #include <lfrxmlwriter.h>
@@ -29,7 +30,17 public:
29 void buildWFAndDisplaySBM1(TMPacketToRead *packet, WFPacket *wfPacket);
30 void buildWFAndDisplaySBM1(TMPacketToRead *packet, WFPacket *wfPacket);
30 void buildWFAndDisplaySBM2(TMPacketToRead *packet, WFPacket *wfPacket);
31 void buildWFAndDisplaySBM2(TMPacketToRead *packet, WFPacket *wfPacket);
31
32
33 protected:
34 void closeEvent(QCloseEvent *);
35
32 private:
36 private:
37 void readSettings();
38 void writeSettings();
39 unsigned char echoBridgeIP0;
40 unsigned char echoBridgeIP1;
41 unsigned char echoBridgeIP2;
42 unsigned char echoBridgeIP3;
43
33 QByteArray dataArray;
44 QByteArray dataArray;
34
45
35 QList<TMPacketToRead*> generalCCSDSPacketStore;
46 QList<TMPacketToRead*> generalCCSDSPacketStore;
@@ -245,7 +245,7 void rmapplugin::receivePacketFromBridge
245 preProcessPacket(packet);
245 preProcessPacket(packet);
246
246
247 // Send the packet to the TM echo bridge for processing
247 // Send the packet to the TM echo bridge for processing
248 this->UI->tmEchoBridge->sendTMPacket_v2(packet);
248 this->UI->tmEchoBridge->sendTMPacket(packet);
249 //this->UI->tmEchoBridge->sendTMPacket_alternative(packet);
249 //this->UI->tmEchoBridge->sendTMPacket_alternative(packet);
250
250
251 this->generalCCSDSPacketStore.append(packet);
251 this->generalCCSDSPacketStore.append(packet);
@@ -157,52 +157,6 void TMEchoBridge::sendXML_GSE_HK()
157
157
158 void TMEchoBridge::sendTMPacket(TMPacketToRead *tmPacketToRead)
158 void TMEchoBridge::sendTMPacket(TMPacketToRead *tmPacketToRead)
159 {
159 {
160 if (tmEchoBridgeSocket->state() == QAbstractSocket::ConnectedState)
161 {
162 // START DOCUMENT
163 //xmlWriter->writeStartDocument();
164
165 // <Event>
166 xmlWriter->writeStartElement("Event");
167
168 // <EventDate>
169 xmlWriter->writeStartElement("EventDate");
170 xmlWriter->writeEndElement();
171
172 // <Event Time>
173 xmlWriter->writeStartElement("EventTime");
174 xmlWriter->writeEndElement();
175
176 // <EventBinary>
177 xmlWriter->writeStartElement("EventBinary");
178 xmlWriter->writeCharacters(
179 QByteArray::fromRawData( (char*) tmPacketToRead->Value, tmPacketToRead->size).toHex()
180 );
181 //tmEchoBridgeSocket->write(QByteArray::fromRawData( (char*) tmPacketToRead->Value, tmPacketToRead->size));
182 xmlWriter->writeEndElement();
183
184 // </Event>
185 xmlWriter->writeEndElement();
186
187 // END DOCUMENT
188 xmlWriter->writeEndDocument();
189
190 tmEchoBridgeSocket->flush();
191
192 totalOfBytes = totalOfBytes + tmPacketToRead->size;
193 totalOfPackets = totalOfPackets + 1;
194 label_totalOfBytes->setText("Number of TM bytes sent: " + QString::number(totalOfBytes));
195 label_totalOfPackets->setText("Number of TM packets sent: " + QString::number(totalOfPackets));
196 }
197 else
198 {
199 totalOfPacketsDropped = totalOfPacketsDropped + 1;
200 label_totalOfPacketsDropped->setText("Number of TM packets dropped: " + QString::number(totalOfPacketsDropped));
201 }
202 }
203
204 void TMEchoBridge::sendTMPacket_v2(TMPacketToRead *tmPacketToRead)
205 {
206 QByteArray ccsdsArray;
160 QByteArray ccsdsArray;
207 QTime echoBridgeTimeout;
161 QTime echoBridgeTimeout;
208
162
@@ -32,7 +32,6 public slots:
32 void newConnectionOnTCServer();
32 void newConnectionOnTCServer();
33 void sendXML_GSE_HK();
33 void sendXML_GSE_HK();
34 void sendTMPacket(TMPacketToRead *tmPacketToRead);
34 void sendTMPacket(TMPacketToRead *tmPacketToRead);
35 void sendTMPacket_v2(TMPacketToRead *tmPacketToRead);
36 void clearConsole();
35 void clearConsole();
37 void resetTMStatistics();
36 void resetTMStatistics();
38
37
@@ -1,6 +1,6
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2013-06-28T13:26:54. -->
3 <!-- Written by Qt Creator 2.4.1, 2013-07-02T16:01:34. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
General Comments 0
You need to be logged in to leave comments. Login now