##// END OF EJS Templates
Function added to the plugin to store packets in CSV format.
leroy -
r55:4ea52012da18 default
parent child
Show More
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.8.1, 2013-11-07T12:53:04. -->
3 <!-- Written by QtCreator 2.8.1, 2013-11-14T14:43:39. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -1,9 +1,9
1 1 #############################################################################
2 2 # Makefile for building: lfrsgse
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Oct 10 08:44:30 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Nov 12 11:16:36 2013
4 4 # Project: gselesia.pro
5 5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile gselesia.pro
6 # Command: /usr/bin/qmake-qt4 -o Makefile gselesia.pro
7 7 #############################################################################
8 8
9 9 ####### Compiler, tools and options
@@ -174,7 +174,7 Makefile: gselesia.pro /usr/lib64/qt4/m
174 174 /usr/lib64/libQtCore.prl \
175 175 /usr/lib64/libQtGui.prl \
176 176 /usr/lib64/libQtNetwork.prl
177 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile gselesia.pro
177 $(QMAKE) -o Makefile gselesia.pro
178 178 /usr/lib64/qt4/mkspecs/common/unix.conf:
179 179 /usr/lib64/qt4/mkspecs/common/linux.conf:
180 180 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
@@ -205,7 +205,7 Makefile: gselesia.pro /usr/lib64/qt4/m
205 205 /usr/lib64/libQtGui.prl:
206 206 /usr/lib64/libQtNetwork.prl:
207 207 qmake: FORCE
208 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile gselesia.pro
208 @$(QMAKE) -o Makefile gselesia.pro
209 209
210 210 dist:
211 211 @$(CHK_DIR_EXISTS) .tmp/lfrsgse1.0.0 || $(MKDIR) .tmp/lfrsgse1.0.0
@@ -236,13 +236,11 compiler_moc_header_clean:
236 236 moc_mainwindow.cpp: lfrxmlhandler.h \
237 237 lfrxmlwriter.h \
238 238 mainwindowui.h \
239 lfrspectrogram.h \
240 239 lfrxmlparser.h \
241 240 mainwindow.h
242 241 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
243 242
244 moc_mainwindowui.cpp: lfrspectrogram.h \
245 mainwindowui.h
243 moc_mainwindowui.cpp: mainwindowui.h
246 244 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) mainwindowui.h -o moc_mainwindowui.cpp
247 245
248 246 moc_lfrxmlhandler.cpp: lfrxmlhandler.h
@@ -295,7 +293,6 main.o: main.cpp mainwindow.h \
295 293 lfrxmlhandler.h \
296 294 lfrxmlwriter.h \
297 295 mainwindowui.h \
298 lfrspectrogram.h \
299 296 lfrxmlparser.h
300 297 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
301 298
@@ -303,12 +300,10 mainwindow.o: mainwindow.cpp mainwindow.
303 300 lfrxmlhandler.h \
304 301 lfrxmlwriter.h \
305 302 mainwindowui.h \
306 lfrspectrogram.h \
307 303 lfrxmlparser.h
308 304 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
309 305
310 mainwindowui.o: mainwindowui.cpp mainwindowui.h \
311 lfrspectrogram.h
306 mainwindowui.o: mainwindowui.cpp mainwindowui.h
312 307 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindowui.o mainwindowui.cpp
313 308
314 309 lfrxmlhandler.o: lfrxmlhandler.cpp lfrxmlhandler.h
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.8.1, 2013-11-07T14:48:17. -->
3 <!-- Written by QtCreator 2.8.1, 2013-11-12T11:12:03. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
1 NO CONTENT: modified file, binary diff hidden
@@ -87,7 +87,7 void EnterMode::sendEnterMode( unsigned
87 87 packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
88 88 packet.serviceType = TC_TYPE_DEFAULT;
89 89 packet.serviceSubType = TC_SUBTYPE_ENTER_MODE;
90 packet.sourceID = SID_TC_DEFAULT;
90 packet.sourceID = SID_TC_GROUND;
91 91 packet.spare = 0x00;
92 92 packet.mode = mode;
93 93 packet.enterModeTime[0] = 0x00;
@@ -146,7 +146,7 void EnterMode::sendReset()
146 146 packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
147 147 packet.serviceType = TC_TYPE_DEFAULT;
148 148 packet.serviceSubType = TC_SUBTYPE_RESET;
149 packet.sourceID = SID_TC_DEFAULT;
149 packet.sourceID = SID_TC_GROUND;
150 150
151 151 parameterDump->GetCRCAsTwoBytes((unsigned char*) &packet, crcAsTwoBytes,
152 152 PACKET_LENGTH_TC_LFR_RESET + CCSDS_TC_TM_PACKET_OFFSET - 2);
@@ -172,7 +172,7 void EnterMode::sendUpdateInfo()
172 172 packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
173 173 packet.serviceType = TC_TYPE_DEFAULT;
174 174 packet.serviceSubType = TC_SUBTYPE_UPDATE_INFO;
175 packet.sourceID = SID_TC_DEFAULT;
175 packet.sourceID = SID_TC_GROUND;
176 176
177 177 packet.set1 = 0x00;
178 178 packet.set2 = 0x00;
@@ -229,7 +229,7 void EnterMode::sendEnableCalibration()
229 229 packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
230 230 packet.serviceType = TC_TYPE_DEFAULT;
231 231 packet.serviceSubType = TC_SUBTYPE_ENABLE_CALIBRATION;
232 packet.sourceID = SID_TC_DEFAULT;
232 packet.sourceID = SID_TC_GROUND;
233 233
234 234 parameterDump->GetCRCAsTwoBytes((unsigned char*) &packet, crcAsTwoBytes,
235 235 PACKET_LENGTH_TC_LFR_ENABLE_CALIBRATION + CCSDS_TC_TM_PACKET_OFFSET - 2);
@@ -255,7 +255,7 void EnterMode::sendDisableCalibration()
255 255 packet.ccsdsSecHeaderFlag_pusVersion_ack = 0x19;
256 256 packet.serviceType = TC_TYPE_DEFAULT;
257 257 packet.serviceSubType = TC_SUBTYPE_DISABLE_CALIBRATION;
258 packet.sourceID = SID_TC_DEFAULT;
258 packet.sourceID = SID_TC_GROUND;
259 259
260 260 parameterDump->GetCRCAsTwoBytes((unsigned char*) &packet, crcAsTwoBytes,
261 261 PACKET_LENGTH_TC_LFR_DISABLE_CALIBRATION + CCSDS_TC_TM_PACKET_OFFSET - 2);
@@ -135,8 +135,9 TMStatistics::TMStatistics(QWidget *pare
135 135 button_chooseDir = new QPushButton("choose dir");
136 136
137 137 //QCheckBox
138 checkbox_record = new QCheckBox("Record packets");
139 138 checkbox_packetLog = new QCheckBox("Log packets");
139 checkbox_packetRecording = new QCheckBox("Store packets (RAW)");
140 checkbox_CSVPacketRecording = new QCheckBox("Store Packets (CSV)");
140 141 label_currentDir = new QLabel("Current Dir: -");
141 142
142 143 //**********
@@ -154,8 +155,10 TMStatistics::TMStatistics(QWidget *pare
154 155 readSettings();
155 156 logFile = new QFile();
156 157 packetLogFile = new QFile();
158 csvPacketRecordFile = new QFile();
157 159 logFileEn = false;
158 160 packetLogFileEn = false;
161 csvPacketRecordFileEn = false;
159 162
160 163 initConstants();
161 164
@@ -176,8 +179,12 TMStatistics::TMStatistics(QWidget *pare
176 179 connect(this->button_reset_stat, SIGNAL(clicked()), this, SLOT(resetStatistics()));
177 180 connect(this->button_chooseDir, SIGNAL(clicked()), this, SLOT(chooseDir()));
178 181
179 connect(this->checkbox_record, SIGNAL(stateChanged(int)), this, SLOT(storePackets(int)));
180 connect(this->checkbox_packetLog, SIGNAL(stateChanged(int)), this, SLOT(logPackets(int)));
182 connect(this->checkbox_packetLog, SIGNAL(stateChanged(int)),
183 this, SLOT(logPackets(int)));
184 connect(this->checkbox_packetRecording, SIGNAL(stateChanged(int)),
185 this, SLOT(storePackets(int)));
186 connect(this->checkbox_CSVPacketRecording, SIGNAL(stateChanged(int)),
187 this, SLOT(storeCSVPackets(int)));
181 188 }
182 189
183 190 void TMStatistics::initConstants()
@@ -355,8 +362,9 void TMStatistics::buildMonitor()
355 362 layout_last->addWidget(label_UNKNOWN, 3, 0, 1, 1);
356 363 layout_last->addWidget(label_UNKNOWN_nb, 3, 1, 1, 1);
357 364
358 layout_record->addWidget(checkbox_record);
359 365 layout_record->addWidget(checkbox_packetLog);
366 layout_record->addWidget(checkbox_packetRecording);
367 layout_record->addWidget(checkbox_CSVPacketRecording);
360 368 layout_record->addWidget(button_chooseDir);
361 369 layout_record->addWidget(label_currentDir);
362 370 layout_record->insertStretch(4, 1);
@@ -674,10 +682,10 unsigned int TMStatistics::getSID(TMPack
674 682 unsigned char typ, unsigned char sub)
675 683 {
676 684 unsigned int sid = 0;
677 QByteArray packetAsAnArray;
678 685 QString packetName;
679 686 QTime currentTime;
680 687 QDate currentDate;
688 unsigned int i;
681 689
682 690 if ((pid == TM_PACKET_PID_DEFAULT) & (cat == TM_PACKET_CAT_TC_EXE)
683 691 & (typ == TM_TYPE_TC_EXE) & (sub == TM_SUBTYPE_EXE_NOK))
@@ -697,16 +705,14 unsigned int TMStatistics::getSID(TMPack
697 705
698 706 if (logFileEn == true)
699 707 {
700 // packetAsAnArray = QByteArray::fromRawData((char *) &packet->Value[4], (packet->size-4));
701 708 logFile->write((char *) &packet->Value[4], (packet->size-4));
702 // *(this->logFileStrm)
703 // << packetAsAnArray;
704 709 }
705 710
711 currentTime = QTime::currentTime();
712 currentDate = QDate::currentDate();
713
706 714 if (packetLogFileEn == true)
707 715 {
708 currentTime = QTime::currentTime();
709 currentDate = QDate::currentDate();
710 716 packetName = getPacketName( typ, sub, sid);
711 717
712 718 *(this->packetLogFileStrm)
@@ -723,6 +729,23 unsigned int TMStatistics::getSID(TMPack
723 729 << endl;
724 730 }
725 731
732 if (csvPacketRecordFileEn == true)
733 {
734 *(this->packetLogFileStrm)
735 << QString::number(currentDate.year()) + " "
736 << QString::number(currentDate.month()) + " "
737 << QString::number(currentDate.day()) + " "
738 << QTime::currentTime().toString() + ":"
739 << QString::number(currentTime.msec());
740 for (i=0; i< packet->size; i++)
741 {
742 *(this->packetLogFileStrm)
743 << ", " + QString::number( packet->Value[i] );
744 }
745 *(this->packetLogFileStrm)
746 << endl;
747 }
748
726 749 return sid;
727 750 }
728 751
@@ -747,7 +770,8 void TMStatistics::buildFileName()
747 770
748 771 if(this->logFile->isOpen()) this->logFile->close();
749 772 this->logFile->setFileName( prefix + "packet_record.data");
750 if(this->logFile->open(QIODevice::WriteOnly)) this->logFileStrm = new QTextStream(this->logFile);
773 if(this->logFile->open(QIODevice::WriteOnly))
774 this->logFileStrm = new QTextStream(this->logFile);
751 775 }
752 776
753 777 void TMStatistics::buildPacketLogFileName()
@@ -771,7 +795,33 void TMStatistics::buildPacketLogFileNam
771 795
772 796 if(this->packetLogFile->isOpen()) this->packetLogFile->close();
773 797 this->packetLogFile->setFileName( prefix + "packet_log.data");
774 if(this->packetLogFile->open(QIODevice::WriteOnly)) this->packetLogFileStrm = new QTextStream(this->packetLogFile);
798 if(this->packetLogFile->open(QIODevice::WriteOnly))
799 this->packetLogFileStrm = new QTextStream(this->packetLogFile);
800 }
801
802 void TMStatistics::buildCSVPacketRecordFileName()
803 {
804 QTime time;
805 QDate date;
806 QString dateTime;
807 QString prefix;
808
809 date = QDate::currentDate();
810 time = QTime::currentTime();
811
812 dateTime = QString::number( date.year() ) + "_"
813 + QString::number( date.month() ) + "_"
814 + QString::number( date.day() ) + "-"
815 + QString::number( time.hour() ) + "_"
816 + QString::number( time.minute() ) + "_"
817 + QString::number( time.second() );
818
819 prefix = defaultStorageDirectory + "/" + dateTime + "_" ;
820
821 if(this->csvPacketRecordFile->isOpen()) this->csvPacketRecordFile->close();
822 this->csvPacketRecordFile->setFileName( prefix + "packet_record.csv");
823 if(this->csvPacketRecordFile->open(QIODevice::WriteOnly))
824 this->csvPacketRecordFileStrm = new QTextStream(this->csvPacketRecordFile);
775 825 }
776 826
777 827 void TMStatistics::storePackets( int state )
@@ -788,6 +838,20 void TMStatistics::storePackets( int sta
788 838 }
789 839 }
790 840
841 void TMStatistics::storeCSVPackets( int state )
842 {
843 if (state == Qt::Checked)
844 {
845 buildCSVPacketRecordFileName();
846 csvPacketRecordFileEn = true;
847 }
848 else
849 {
850 if(this->csvPacketRecordFile->isOpen()) this->csvPacketRecordFile->close();
851 csvPacketRecordFileEn = false;
852 }
853 }
854
791 855 void TMStatistics::logPackets( int state )
792 856 {
793 857 if (state == Qt::Checked)
@@ -209,15 +209,19 public:
209 209 QPushButton *button_chooseDir;
210 210
211 211 //QCheckBox
212 QCheckBox *checkbox_record;
212 QCheckBox *checkbox_packetRecording;
213 213 QCheckBox *checkbox_packetLog;
214 QCheckBox *checkbox_CSVPacketRecording;
214 215
215 216 QFile *logFile;
216 217 QFile *packetLogFile;
218 QFile *csvPacketRecordFile;
217 219 QTextStream *logFileStrm;
218 220 QTextStream *packetLogFileStrm;
221 QTextStream *csvPacketRecordFileStrm;
219 222 bool logFileEn;
220 223 bool packetLogFileEn;
224 bool csvPacketRecordFileEn;
221 225 QString defaultStorageDirectory;
222 226
223 227 // QGroupBox
@@ -238,9 +242,11 public slots:
238 242 unsigned int sid, unsigned int length,
239 243 unsigned int coarse_t, unsigned int fine_t);
240 244 void storePackets(int state);
245 void storeCSVPackets( int state );
241 246 void logPackets(int state);
242 247 void buildFileName();
243 248 void buildPacketLogFileName();
249 void buildCSVPacketRecordFileName();
244 250 void readSettings();
245 251 void writeSettings();
246 252 void chooseDir();
@@ -1,9 +1,9
1 1 #############################################################################
2 2 # Makefile for building: libwfdisplay.so.1.0.0
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Wed Jul 24 10:11:16 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Nov 12 11:17:03 2013
4 4 # Project: wfdisplay.pro
5 5 # Template: lib
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile wfdisplay.pro
6 # Command: /usr/bin/qmake-qt4 -o Makefile wfdisplay.pro
7 7 #############################################################################
8 8
9 9 ####### Compiler, tools and options
@@ -80,6 +80,8 DIST = /usr/lib64/qt4/mkspecs/c
80 80 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
81 81 /usr/lib64/qt4/mkspecs/features/release.prf \
82 82 /usr/lib64/qt4/mkspecs/features/default_post.prf \
83 /usr/lib64/qt4/mkspecs/features/shared.prf \
84 /usr/lib64/qt4/mkspecs/features/dll.prf \
83 85 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
84 86 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
85 87 /usr/lib64/qt4/mkspecs/features/qt.prf \
@@ -153,6 +155,8 Makefile: wfdisplay.pro /usr/lib64/qt4/
153 155 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
154 156 /usr/lib64/qt4/mkspecs/features/release.prf \
155 157 /usr/lib64/qt4/mkspecs/features/default_post.prf \
158 /usr/lib64/qt4/mkspecs/features/shared.prf \
159 /usr/lib64/qt4/mkspecs/features/dll.prf \
156 160 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
157 161 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
158 162 /usr/lib64/qt4/mkspecs/features/qt.prf \
@@ -165,7 +169,7 Makefile: wfdisplay.pro /usr/lib64/qt4/
165 169 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
166 170 /usr/lib64/libQtGui.prl \
167 171 /usr/lib64/libQtCore.prl
168 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile wfdisplay.pro
172 $(QMAKE) -o Makefile wfdisplay.pro
169 173 /usr/lib64/qt4/mkspecs/common/unix.conf:
170 174 /usr/lib64/qt4/mkspecs/common/linux.conf:
171 175 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
@@ -180,6 +184,8 Makefile: wfdisplay.pro /usr/lib64/qt4/
180 184 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
181 185 /usr/lib64/qt4/mkspecs/features/release.prf:
182 186 /usr/lib64/qt4/mkspecs/features/default_post.prf:
187 /usr/lib64/qt4/mkspecs/features/shared.prf:
188 /usr/lib64/qt4/mkspecs/features/dll.prf:
183 189 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
184 190 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
185 191 /usr/lib64/qt4/mkspecs/features/qt.prf:
@@ -193,7 +199,7 Makefile: wfdisplay.pro /usr/lib64/qt4/
193 199 /usr/lib64/libQtGui.prl:
194 200 /usr/lib64/libQtCore.prl:
195 201 qmake: FORCE
196 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile wfdisplay.pro
202 @$(QMAKE) -o Makefile wfdisplay.pro
197 203
198 204 dist:
199 205 @$(CHK_DIR_EXISTS) .tmp/wfdisplay1.0.0 || $(MKDIR) .tmp/wfdisplay1.0.0
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.8.0, 2013-10-08T12:38:17. -->
3 <!-- Written by QtCreator 2.8.1, 2013-11-12T11:16:00. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -536,14 +536,22 void WFPage::storeWfrm()
536 536
537 537 void WFPage::buildFileName()
538 538 {
539 QString date;
540 QString time;
539 QTime time;
540 QDate date;
541 QString dateTime;
541 542 QString prefix;
542 543
543 date = QDate::currentDate().toString();
544 time = QTime::currentTime().toString();
544 date = QDate::currentDate();
545 time = QTime::currentTime();
545 546
546 prefix = defaultStorageDirectory + "/" + date + "_" + time + "_" + pageTitle ;
547 dateTime = QString::number( date.year() ) + "_"
548 + QString::number( date.month() ) + "_"
549 + QString::number( date.day() ) + "-"
550 + QString::number( time.hour() ) + "_"
551 + QString::number( time.minute() ) + "_"
552 + QString::number( time.second() );
553
554 prefix = defaultStorageDirectory + "/" + dateTime + "_" + pageTitle ;
547 555
548 556 if(this->logFile->isOpen()) this->logFile->close();
549 557 this->logFile->setFileName( prefix + ".data");
General Comments 0
You need to be logged in to leave comments. Login now