source: ntrip/trunk/BNC/bncrinex.cpp@ 789

Last change on this file since 789 was 698, checked in by weber, 17 years ago

* empty log message *

File size: 22.1 KB
RevLine 
[280]1// Part of BNC, a utility for retrieving decoding and
[464]2// converting GNSS data streams from NTRIP broadcasters.
[280]3//
[464]4// Copyright (C) 2007
[280]5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
[464]7// Czech Technical University Prague, Department of Geodesy
[280]8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
[73]24
25/* -------------------------------------------------------------------------
[93]26 * BKG NTRIP Client
[73]27 * -------------------------------------------------------------------------
28 *
29 * Class: bncRinex
30 *
31 * Purpose: writes RINEX files
32 *
33 * Author: L. Mervart
34 *
35 * Created: 27-Aug-2006
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
[292]41#include <stdlib.h>
[300]42#include <iostream>
[75]43#include <iomanip>
[221]44#include <math.h>
[75]45
[300]46#include <QtCore>
47#include <QUrl>
48#include <QString>
49
[73]50#include "bncrinex.h"
[157]51#include "bncapp.h"
[82]52#include "bncutils.h"
[126]53#include "bncconst.h"
[298]54#include "bnctabledlg.h"
[301]55#include "bncgetthread.h"
[223]56#include "RTCM3/rtcm3torinex.h"
[75]57
58using namespace std;
59
[73]60// Constructor
61////////////////////////////////////////////////////////////////////////////
[408]62bncRinex::bncRinex(const QByteArray& statID, const QUrl& mountPoint,
[366]63 const QByteArray& format, const QByteArray& latitude,
64 const QByteArray& longitude, const QByteArray& nmea) {
[408]65 _statID = statID;
[336]66 _mountPoint = mountPoint;
[337]67 _format = format.left(6);
[366]68 _latitude = latitude;
69 _longitude = longitude;
70 _nmea = nmea;
[77]71 _headerWritten = false;
[369]72 _reconnectFlag = false;
[656]73 _reloadTable = false;
74 _reloadDone = false;
[132]75
76 QSettings settings;
77 _rnxScriptName = settings.value("rnxScript").toString();
78 expandEnvVar(_rnxScriptName);
[153]79
[157]80 _pgmName = ((bncApp*)qApp)->bncVersion().leftJustified(20, ' ', true);
[319]81#ifdef WIN32
82 _userName = QString("${USERNAME}");
83#else
[158]84 _userName = QString("${USER}");
[319]85#endif
[157]86 expandEnvVar(_userName);
[158]87 _userName = _userName.leftJustified(20, ' ', true);
[539]88
89 if ( Qt::CheckState(settings.value("rnxV3").toInt()) == Qt::Checked) {
90 _rinexVers = 3;
91 }
92 else {
93 _rinexVers = 2;
94 }
[73]95}
96
97// Destructor
98////////////////////////////////////////////////////////////////////////////
99bncRinex::~bncRinex() {
[622]100 QListIterator<p_obs> it(_obs);
[607]101 while (it.hasNext()) {
102 delete it.next();
103 }
[698]104 QSettings settings;
105 if ((_rinexVers == 3) && ( Qt::CheckState(settings.value("rnxAppend").toInt()) != Qt::Checked) ) {
106 _out << "END OF FILE" << endl;
107 }
[77]108 _out.close();
[73]109}
110
[420]111// Download Skeleton Header File
112////////////////////////////////////////////////////////////////////////////
113t_irc bncRinex::downloadSkeleton() {
114
115 t_irc irc = failure;
116
117 QStringList table;
118 bncTableDlg::getFullTable(_mountPoint.host(), _mountPoint.port(),
[656]119 table, _reloadTable);
[420]120 QString net;
121 QStringListIterator it(table);
122 while (it.hasNext()) {
123 QString line = it.next();
124 if (line.indexOf("STR") == 0) {
125 QStringList tags = line.split(";");
126 if (tags.at(1) == _mountPoint.path().mid(1).toAscii()) {
127 net = tags.at(7);
128 break;
129 }
130 }
131 }
132 QString sklDir;
133 it.toFront();
134 while (it.hasNext()) {
135 QString line = it.next();
136 if (line.indexOf("NET") == 0) {
137 QStringList tags = line.split(";");
138 if (tags.at(1) == net) {
139 sklDir = tags.at(6).trimmed();
140 break;
141 }
142 }
143 }
144 if (!sklDir.isEmpty() && sklDir != "none") {
145 QUrl url(sklDir + "/" + _mountPoint.path().mid(1,4).toLower() + ".skl");
146 if (url.port() == -1) {
147 url.setPort(80);
148 }
149
150 const int timeOut = 10*1000;
151 QString msg;
152 QByteArray _latitude;
153 QByteArray _longitude;
154 QByteArray _nmea;
155 QTcpSocket* socket = bncGetThread::request(url, _latitude, _longitude, _nmea, timeOut, msg);
156
157 if (socket) {
[421]158 _headerLines.clear();
159 bool firstLineRead = false;
[420]160 while (true) {
161 if (socket->canReadLine()) {
[421]162 QString line = socket->readLine();
163 line.chop(1);
[556]164 if (line.indexOf("MARKER NAME") != -1) {
165 irc = success;
166 }
[421]167 if (line.indexOf("RINEX VERSION") != -1) {
[545]168 if (_rinexVers == 3) {
169 _headerLines.append(" 3.00 OBSERVATION DATA"
170 " M (MIXED)"
171 " RINEX VERSION / TYPE");
172 }
173 else {
174 _headerLines.append(" 2.11 OBSERVATION DATA"
175 " M (MIXED)"
176 " RINEX VERSION / TYPE");
177 }
[421]178 _headerLines.append("PGM / RUN BY / DATE");
179 firstLineRead = true;
180 }
181 else if (firstLineRead) {
182 if (line.indexOf("END OF HEADER") != -1) {
183 _headerLines.append("# / TYPES OF OBSERV");
[546]184 if (_rinexVers == 2) {
185 _headerLines.append(
186 QString(" 1 1").leftJustified(60, ' ', true) +
187 "WAVELENGTH FACT L1/2");
188 }
[421]189 _headerLines.append("TIME OF FIRST OBS");
190 _headerLines.append( line );
191 break;
192 }
193 else {
194 _headerLines.append( line );
195 }
196 }
[420]197 }
198 else {
199 socket->waitForReadyRead(timeOut);
200 if (socket->bytesAvailable() > 0) {
201 continue;
202 }
203 else {
204 break;
205 }
206 }
207 }
208 delete socket;
209 }
210 }
211 return irc;
212}
213
[82]214// Read Skeleton Header File
215////////////////////////////////////////////////////////////////////////////
216void bncRinex::readSkeleton() {
217
[420]218 // Read the local file
219 // -------------------
[276]220 QFile skl(_sklName);
[82]221 if ( skl.exists() && skl.open(QIODevice::ReadOnly) ) {
[422]222 _headerLines.clear();
[82]223 QTextStream in(&skl);
224 while ( !in.atEnd() ) {
225 _headerLines.append( in.readLine() );
226 if (_headerLines.last().indexOf("END OF HEADER") != -1) {
227 break;
228 }
229 }
230 }
[298]231
[420]232 // Read downloaded file
233 // --------------------
[298]234 else {
[566]235 QDate currDate = QDateTime::currentDateTime().toUTC().date();
[420]236 if ( !_skeletonDate.isValid() || _skeletonDate != currDate ) {
237 if ( downloadSkeleton() == success) {
238 _skeletonDate = currDate;
[656]239 _reloadDone = false;
[298]240 }
[656]241 else {
242 if(!_reloadDone) {
243 _reloadTable = true;
244 if ( downloadSkeleton() == success) {
245 _skeletonDate = currDate;
246 }
247 _reloadTable = false;
248 _reloadDone = true;
249 }
250 }
[298]251 }
252 }
[82]253}
254
[647]255// Next File Epoch (static)
[82]256////////////////////////////////////////////////////////////////////////////
[647]257QString bncRinex::nextEpochStr(const QDateTime& datTim,
258 const QString& intStr, QDateTime* nextEpoch) {
[82]259
[647]260 QString epoStr;
[82]261
[129]262 QTime nextTime;
263 QDate nextDate;
264
[204]265 int indHlp = intStr.indexOf("min");
266
267 if ( indHlp != -1) {
268 int step = intStr.left(indHlp-1).toInt();
[127]269 char ch = 'A' + datTim.time().hour();
[647]270 epoStr = ch;
[204]271 if (datTim.time().minute() >= 60-step) {
[647]272 epoStr += QString("%1").arg(60-step, 2, 10, QChar('0'));
[199]273 if (datTim.time().hour() < 23) {
274 nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
275 nextDate = datTim.date();
276 }
277 else {
278 nextTime.setHMS(0, 0, 0);
279 nextDate = datTim.date().addDays(1);
280 }
281 }
282 else {
[204]283 for (int limit = step; limit <= 60-step; limit += step) {
284 if (datTim.time().minute() < limit) {
[647]285 epoStr += QString("%1").arg(limit-step, 2, 10, QChar('0'));
[204]286 nextTime.setHMS(datTim.time().hour(), limit, 0);
287 nextDate = datTim.date();
288 break;
289 }
[199]290 }
291 }
292 }
[127]293 else if (intStr == "1 hour") {
294 char ch = 'A' + datTim.time().hour();
[647]295 epoStr = ch;
[129]296 if (datTim.time().hour() < 23) {
297 nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
298 nextDate = datTim.date();
299 }
300 else {
301 nextTime.setHMS(0, 0, 0);
302 nextDate = datTim.date().addDays(1);
303 }
[127]304 }
305 else {
[647]306 epoStr = "0";
[129]307 nextTime.setHMS(0, 0, 0);
308 nextDate = datTim.date().addDays(1);
[127]309 }
[82]310
[647]311 if (nextEpoch) {
312 *nextEpoch = QDateTime(nextDate, nextTime);
313 }
314
315 return epoStr;
316}
317
318// File Name according to RINEX Standards
319////////////////////////////////////////////////////////////////////////////
320void bncRinex::resolveFileName(const QDateTime& datTim) {
321
322 QSettings settings;
323 QString path = settings.value("rnxPath").toString();
324 expandEnvVar(path);
325
326 if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) {
327 path += QDir::separator();
328 }
329
330 QString hlpStr = nextEpochStr(datTim, settings.value("rnxIntr").toString(),
331 &_nextCloseEpoch);
332
[183]333 QString ID4 = _statID.left(4);
334
335 // Check name conflict
336 // -------------------
337 QString distStr;
338 int num = 0;
339 QListIterator<QString> it(settings.value("mountPoints").toStringList());
340 while (it.hasNext()) {
341 QString mp = it.next();
342 if (mp.indexOf(ID4) != -1) {
343 ++num;
344 }
345 }
346 if (num > 1) {
347 distStr = "_" + _statID.mid(4);
348 }
349
[276]350 QString sklExt = settings.value("rnxSkel").toString();
351 if (!sklExt.isEmpty()) {
352 _sklName = path + ID4 + distStr + "." + sklExt;
353 }
354
[183]355 path += ID4 +
[127]356 QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
[276]357 hlpStr + distStr + datTim.toString(".yyO");
[82]358
359 _fName = path.toAscii();
360}
361
[77]362// Write RINEX Header
363////////////////////////////////////////////////////////////////////////////
[267]364void bncRinex::writeHeader(const QDateTime& datTim,
365 const QDateTime& datTimNom) {
[77]366
[356]367 QSettings settings;
368
[77]369 // Open the Output File
370 // --------------------
[267]371 resolveFileName(datTimNom);
[260]372
373 // Append to existing file and return
374 // ----------------------------------
375 if ( QFile::exists(_fName) ) {
[369]376 if (_reconnectFlag ||
377 Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
[260]378 _out.open(_fName.data(), ios::app);
379 _out.setf(ios::showpoint | ios::fixed);
380 _headerWritten = true;
[369]381 _reconnectFlag = false;
[260]382 return;
383 }
384 }
385
[82]386 _out.open(_fName.data());
[85]387 _out.setf(ios::showpoint | ios::fixed);
[77]388
[82]389 // Copy Skeleton Header
390 // --------------------
[276]391 readSkeleton();
[82]392 if (_headerLines.size() > 0) {
393 QStringListIterator it(_headerLines);
394 while (it.hasNext()) {
395 QString line = it.next();
[157]396 if (line.indexOf("PGM / RUN BY / DATE") != -1) {
[552]397 if (_rinexVers == 3) {
[566]398 QString hlp = QDateTime::currentDateTime().toUTC().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
[552]399 _out << _pgmName.toAscii().data() << _userName.toAscii().data()
400 << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
401 }
402 else {
[566]403 QString hlp = QDateTime::currentDateTime().toUTC().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
[552]404 _out << _pgmName.toAscii().data() << _userName.toAscii().data()
405 << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
406 }
[157]407 }
408 else if (line.indexOf("# / TYPES OF OBSERV") != -1) {
[545]409 if (_rinexVers == 3) {
[689]410// Changed declaration of data types, consistent with Rinex3 Perlt
411 _out << "G 10 C1C C1P L1C S1C C2X C2P L2X S2X L2P S2P SYS / # / OBS TYPES" << endl;
412 _out << "R 10 C1C C1P L1C S1C C2C C2P L2C S2C L2P S2P SYS / # / OBS TYPES" << endl;
413 _out << "S 3 C1C L1C S1C SYS / # / OBS TYPES" << endl;
[545]414 }
415 else {
416 _out << " 8 C1 C2 P1 P2 L1 L2 S1 S2"
417 " # / TYPES OF OBSERV" << endl;
418 }
[82]419 }
420 else if (line.indexOf("TIME OF FIRST OBS") != -1) {
[125]421 _out << datTim.toString(" yyyy MM dd"
422 " hh mm ss.zzz0000").toAscii().data();
[553]423 _out << " GPS TIME OF FIRST OBS" << endl;
[337]424 QString hlp = (_format + QString(" %1").arg(_mountPoint.host() +
425 _mountPoint.path())).leftJustified(60, ' ', true);
[156]426 _out << hlp.toAscii().data() << "COMMENT" << endl;
[82]427 }
[689]428// Added header line for Rinex3 regarding mandatory MARKER TYPE field Perlt
429 else if (line.indexOf("MARKER NAME") != -1) {
430 if (_rinexVers == 3) {
431 _out << line.toAscii().data() << endl;
432 _out << setw(71) << "GEODETIC MARKER TYPE" << endl;
433 }
434 else {
435 _out << line.toAscii().data() << endl;
436 }
437// End
438 }
[82]439 else {
440 _out << line.toAscii().data() << endl;
441 }
442 }
443 }
[78]444
[82]445 // Write Dummy Header
446 // ------------------
447 else {
448 double approxPos[3]; approxPos[0] = approxPos[1] = approxPos[2] = 0.0;
449 double antennaNEU[3]; antennaNEU[0] = antennaNEU[1] = antennaNEU[2] = 0.0;
450
[545]451 if (_rinexVers == 3) {
452 _out << " 3.00 OBSERVATION DATA M (MIXED) RINEX VERSION / TYPE" << endl;
[566]453 QString hlp = QDateTime::currentDateTime().toUTC().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
[552]454 _out << _pgmName.toAscii().data() << _userName.toAscii().data()
455 << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
[545]456 }
457 else {
458 _out << " 2.11 OBSERVATION DATA M (MIXED) RINEX VERSION / TYPE" << endl;
[566]459 QString hlp = QDateTime::currentDateTime().toUTC().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
[552]460 _out << _pgmName.toAscii().data() << _userName.toAscii().data()
461 << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
[545]462 }
[86]463 _out.setf(ios::left);
[82]464 _out << setw(60) << _statID.data() << "MARKER NAME" << endl;
[689]465// Added header line for Rinex3 regarding mandatory MARKER TYPE field Perlt
466 if (_rinexVers == 3) {
467 _out << setw(60) << "unknown" << "MARKER TYPE " << endl;
468 }
469// End
[354]470 _out << setw(60) << "unknown unknown" << "OBSERVER / AGENCY" << endl;
[82]471 _out << setw(20) << "unknown"
472 << setw(20) << "unknown"
473 << setw(20) << "unknown" << "REC # / TYPE / VERS" << endl;
474 _out << setw(20) << "unknown"
475 << setw(20) << "unknown"
476 << setw(20) << " " << "ANT # / TYPE" << endl;
[86]477 _out.unsetf(ios::left);
[82]478 _out << setw(14) << setprecision(4) << approxPos[0]
479 << setw(14) << setprecision(4) << approxPos[1]
480 << setw(14) << setprecision(4) << approxPos[2]
481 << " " << "APPROX POSITION XYZ" << endl;
482 _out << setw(14) << setprecision(4) << antennaNEU[0]
483 << setw(14) << setprecision(4) << antennaNEU[1]
484 << setw(14) << setprecision(4) << antennaNEU[2]
485 << " " << "ANTENNA: DELTA H/E/N" << endl;
[544]486 if (_rinexVers == 3) {
[689]487// Changed declaration of data types, consistent with Rinex3 Perlt
488 _out << "G 10 C1C C1P L1C S1C C2X C2P L2X S2X L2P S2P SYS / # / OBS TYPES" << endl;
489 _out << "R 10 C1C C1P L1C S1C C2C C2P L2C S2C L2P S2P SYS / # / OBS TYPES" << endl;
490 _out << "S 3 C1C L1C S1C SYS / # / OBS TYPES" << endl;
[544]491
492 }
493 else {
494 _out << " 1 1 WAVELENGTH FACT L1/2" << endl;
495 _out << " 8 C1 C2 P1 P2 L1 L2 S1 S2 # / TYPES OF OBSERV" << endl;
496 }
497 _out << datTim.toString(" yyyy MM dd"
[125]498 " hh mm ss.zzz0000").toAscii().data();
[553]499 _out << " GPS TIME OF FIRST OBS" << endl;
[552]500 QString hlp = (_format + QString(" %1").arg(_mountPoint.host() +
[337]501 _mountPoint.path())).leftJustified(60, ' ', true);
[156]502 _out << hlp.toAscii().data() << "COMMENT" << endl;
[366]503
[410]504 if (_nmea == "yes") {
505 hlp = ("NMEA LAT=" + _latitude + " " + "LONG=" + _longitude).leftJustified(60, ' ',true);
[366]506 _out << hlp.toAscii().data() << "COMMENT" << endl; }
507
[82]508 _out << " END OF HEADER" << endl;
509 }
[78]510
[77]511 _headerWritten = true;
512}
513
[73]514// Stores Observation into Internal Array
515////////////////////////////////////////////////////////////////////////////
[622]516void bncRinex::deepCopy(const p_obs obs) {
517 p_obs newObs = new t_obs();
[626]518 memcpy(&newObs->_o, &obs->_o, sizeof(t_obsInternal));
[74]519 _obs.push_back(newObs);
[73]520}
521
522// Write One Epoch into the RINEX File
523////////////////////////////////////////////////////////////////////////////
[160]524void bncRinex::dumpEpoch(long maxTime) {
[73]525
[160]526 // Select observations older than maxTime
527 // --------------------------------------
[622]528 QList<p_obs> dumpList;
529 QMutableListIterator<p_obs> mIt(_obs);
[160]530 while (mIt.hasNext()) {
[622]531 p_obs obs = mIt.next();
532 if (obs->_o.GPSWeek * 7*24*3600 + obs->_o.GPSWeeks < maxTime - 0.05) {
533 dumpList.push_back(obs);
[160]534 mIt.remove();
535 }
536 }
537
[75]538 // Easy Return
539 // -----------
[160]540 if (dumpList.isEmpty()) {
[75]541 return;
542 }
543
544 // Time of Epoch
545 // -------------
[622]546 p_obs fObs = *dumpList.begin();
547 QDateTime datTim = dateAndTimeFromGPSweek(fObs->_o.GPSWeek, fObs->_o.GPSWeeks);
548 QDateTime datTimNom = dateAndTimeFromGPSweek(fObs->_o.GPSWeek,
549 floor(fObs->_o.GPSWeeks+0.5));
[75]550
[130]551 // Close the file
552 // --------------
[267]553 if (_nextCloseEpoch.isValid() && datTimNom >= _nextCloseEpoch) {
[130]554 closeFile();
555 _headerWritten = false;
556 }
557
[78]558 // Write RINEX Header
559 // ------------------
560 if (!_headerWritten) {
[267]561 writeHeader(datTim, datTimNom);
[78]562 }
563
[622]564 double sec = double(datTim.time().second()) + fmod(fObs->_o.GPSWeeks,1.0);
[75]565
[540]566 // RINEX Version 3
567 // ---------------
568 if (_rinexVers == 3) {
[689]569 char sbasflag = 'S';
[540]570 _out << datTim.toString("> yyyy MM dd hh mm ").toAscii().data()
571 << setw(10) << setprecision(7) << sec
572 << " " << 0 << setw(3) << dumpList.size() << endl;
[539]573
[622]574 QListIterator<p_obs> it(dumpList);
[540]575 while (it.hasNext()) {
[622]576 p_obs obs = it.next();
[689]577// Changed data output, C1P, C2C|X, L2C|X, S2C|X added. Changed Output for SBAS Perlt
578 if (sbasflag != obs->_o.satSys) {
[622]579 _out << obs->_o.satSys
580 << setw(2) << setfill('0') << obs->_o.satNum << setfill(' ')
581 << setw(14) << setprecision(3) << obs->_o.C1 << " "
[689]582 << setw(14) << setprecision(3) << obs->_o.P1 << " "
[622]583 << setw(14) << setprecision(3) << obs->_o.L1 << " "
584 << setw(1) << obs->_o.SNR1
585 << setw(14) << setprecision(3) << obs->_o.S1 << " "
[689]586 << setw(14) << setprecision(3) << obs->_o.C2 << " "
587 << setw(14) << setprecision(3) << obs->_o.P2 << " " ;
588 if ((obs->_o.C2 != 0.0) && (obs->_o.P2 == 0.0)) {
589 _out << setw(14) << setprecision(3) << obs->_o.L2 << " "
590 << setw(1) << obs->_o.SNR2
591 << setw(14) << setprecision(3) << obs->_o.S2 << " "
592 << " ";
593 }
594 else {
595 _out << " "
596 << setw(14) << setprecision(3) << obs->_o.L2 << " "
597 << setw(1) << obs->_o.SNR2
598 << setw(14) << setprecision(3) << obs->_o.S2;
599 }
600 _out << endl;
601 }
602 else {
603 _out << obs->_o.satSys
604 << setw(2) << setfill('0') << obs->_o.satNum << setfill(' ')
605 << setw(14) << setprecision(3) << obs->_o.C1 << " "
606 << setw(14) << setprecision(3) << obs->_o.P1 << " "
607 << setw(14) << setprecision(3) << obs->_o.L1 << " "
608 << setw(1) << obs->_o.SNR1
609 << setw(14) << setprecision(3) << obs->_o.S1 << endl;
610 }
[622]611 delete obs;
[75]612 }
[74]613 }
[75]614
[540]615 // RINEX Version 2
616 // ---------------
617 else {
618 _out << datTim.toString(" yy MM dd hh mm ").toAscii().data()
619 << setw(10) << setprecision(7) << sec
620 << " " << 0 << setw(3) << dumpList.size();
621
[622]622 QListIterator<p_obs> it(dumpList); int iSat = 0;
[540]623 while (it.hasNext()) {
624 iSat++;
[622]625 p_obs obs = it.next();
626 _out << obs->_o.satSys << setw(2) << obs->_o.satNum;
[540]627 if (iSat == 12 && it.hasNext()) {
628 _out << endl << " ";
629 iSat = 0;
630 }
631 }
[77]632 _out << endl;
[540]633
634 it.toFront();
635 while (it.hasNext()) {
[622]636 p_obs obs = it.next();
[540]637
638 char lli = ' ';
639 char snr = ' ';
[622]640 _out << setw(14) << setprecision(3) << obs->_o.C1 << lli << snr;
641 _out << setw(14) << setprecision(3) << obs->_o.C2 << lli << snr;
642 _out << setw(14) << setprecision(3) << obs->_o.P1 << lli << snr;
643 _out << setw(14) << setprecision(3) << obs->_o.P2 << lli << snr;
644 _out << setw(14) << setprecision(3) << obs->_o.L1 << lli
645 << setw(1) << obs->_o.SNR1 << endl;
646 _out << setw(14) << setprecision(3) << obs->_o.L2 << lli
647 << setw(1) << obs->_o.SNR2;
648 _out << setw(14) << setprecision(3) << obs->_o.S1 ;
649 _out << setw(16) << setprecision(3) << obs->_o.S2 ;
[540]650 _out << endl;
651
[622]652 delete obs;
[540]653 }
[75]654 }
655
[77]656 _out.flush();
[73]657}
658
[130]659// Close the Old RINEX File
660////////////////////////////////////////////////////////////////////////////
661void bncRinex::closeFile() {
[436]662 QMutexLocker locker(&_mutex);
[698]663 if (_rinexVers == 3) {
664 _out << "END OF FILE" << endl;
665 }
[130]666 _out.close();
[132]667 if (!_rnxScriptName.isEmpty()) {
[675]668 msleep(1);
[435]669#ifdef WIN32
670 QProcess::startDetached(_rnxScriptName, QStringList() << _fName) ;
671#else
[475]672 QProcess::startDetached("nohup", QStringList() << _rnxScriptName << _fName) ;
[435]673#endif
[436]674
[132]675 }
[130]676}
Note: See TracBrowser for help on using the repository browser.