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

Last change on this file since 1422 was 1387, checked in by mervart, 15 years ago

* empty log message *

File size: 23.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"
[1386]56#include "bncnetqueryv2.h"
[223]57#include "RTCM3/rtcm3torinex.h"
[75]58
59using namespace std;
60
[73]61// Constructor
62////////////////////////////////////////////////////////////////////////////
[408]63bncRinex::bncRinex(const QByteArray& statID, const QUrl& mountPoint,
[366]64 const QByteArray& format, const QByteArray& latitude,
[1387]65 const QByteArray& longitude, const QByteArray& nmea) {
66
[408]67 _statID = statID;
[336]68 _mountPoint = mountPoint;
[337]69 _format = format.left(6);
[366]70 _latitude = latitude;
71 _longitude = longitude;
72 _nmea = nmea;
[77]73 _headerWritten = false;
[369]74 _reconnectFlag = false;
[656]75 _reloadTable = false;
76 _reloadDone = false;
[132]77
78 QSettings settings;
79 _rnxScriptName = settings.value("rnxScript").toString();
80 expandEnvVar(_rnxScriptName);
[153]81
[157]82 _pgmName = ((bncApp*)qApp)->bncVersion().leftJustified(20, ' ', true);
[319]83#ifdef WIN32
84 _userName = QString("${USERNAME}");
85#else
[158]86 _userName = QString("${USER}");
[319]87#endif
[157]88 expandEnvVar(_userName);
[158]89 _userName = _userName.leftJustified(20, ' ', true);
[539]90
91 if ( Qt::CheckState(settings.value("rnxV3").toInt()) == Qt::Checked) {
92 _rinexVers = 3;
93 }
94 else {
95 _rinexVers = 2;
96 }
[1044]97
98 _approxPos[0] = _approxPos[1] = _approxPos[2] = 0.0;
[73]99}
100
101// Destructor
102////////////////////////////////////////////////////////////////////////////
103bncRinex::~bncRinex() {
[622]104 QListIterator<p_obs> it(_obs);
[607]105 while (it.hasNext()) {
106 delete it.next();
107 }
[698]108 QSettings settings;
109 if ((_rinexVers == 3) && ( Qt::CheckState(settings.value("rnxAppend").toInt()) != Qt::Checked) ) {
[843]110 _out << "> 4 1" << endl;
[698]111 _out << "END OF FILE" << endl;
112 }
[77]113 _out.close();
[73]114}
115
[420]116// Download Skeleton Header File
117////////////////////////////////////////////////////////////////////////////
118t_irc bncRinex::downloadSkeleton() {
119
120 t_irc irc = failure;
121
122 QStringList table;
123 bncTableDlg::getFullTable(_mountPoint.host(), _mountPoint.port(),
[1376]124 table, _reloadTable);
[420]125 QString net;
126 QStringListIterator it(table);
127 while (it.hasNext()) {
128 QString line = it.next();
129 if (line.indexOf("STR") == 0) {
130 QStringList tags = line.split(";");
131 if (tags.at(1) == _mountPoint.path().mid(1).toAscii()) {
132 net = tags.at(7);
133 break;
134 }
135 }
136 }
137 QString sklDir;
138 it.toFront();
139 while (it.hasNext()) {
140 QString line = it.next();
141 if (line.indexOf("NET") == 0) {
142 QStringList tags = line.split(";");
143 if (tags.at(1) == net) {
144 sklDir = tags.at(6).trimmed();
145 break;
146 }
147 }
148 }
149 if (!sklDir.isEmpty() && sklDir != "none") {
150 QUrl url(sklDir + "/" + _mountPoint.path().mid(1,4).toLower() + ".skl");
151 if (url.port() == -1) {
152 url.setPort(80);
153 }
154
[1386]155 bncNetQueryV2 query;
156 QByteArray outData;
157 query.waitForRequestResult(url, outData);
158 if (query.status() == bncNetQuery::finished) {
159 _headerLines.clear();
160 bool firstLineRead = false;
161 QTextStream in(outData);
162 QString line = in.readLine();
163 while ( !line.isNull() ) {
[1348]164 if (line.indexOf("MARKER NAME") != -1) {
165 irc = success;
166 }
167 if (line.indexOf("RINEX VERSION") != -1) {
168 if (_rinexVers == 3) {
169 _headerLines.append(" 3.00 OBSERVATION DATA"
170 " M (MIXED)"
171 " RINEX VERSION / TYPE");
[556]172 }
[1348]173 else {
174 _headerLines.append(" 2.11 OBSERVATION DATA"
175 " M (MIXED)"
176 " RINEX VERSION / TYPE");
[421]177 }
[1348]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");
184 if (_rinexVers == 2) {
185 _headerLines.append(
186 QString(" 1 1").leftJustified(60, ' ', true) +
187 "WAVELENGTH FACT L1/2");
[421]188 }
[1348]189 _headerLines.append("TIME OF FIRST OBS");
190 _headerLines.append( line );
191 break;
[421]192 }
[420]193 else {
[1348]194 _headerLines.append( line );
[420]195 }
196 }
[1386]197 line = in.readLine();
[420]198 }
[1386]199 }
200 else {
201 return failure;
[420]202 }
[1386]203
[420]204 }
205 return irc;
206}
207
[82]208// Read Skeleton Header File
209////////////////////////////////////////////////////////////////////////////
210void bncRinex::readSkeleton() {
211
[420]212 // Read the local file
213 // -------------------
[276]214 QFile skl(_sklName);
[82]215 if ( skl.exists() && skl.open(QIODevice::ReadOnly) ) {
[422]216 _headerLines.clear();
[82]217 QTextStream in(&skl);
218 while ( !in.atEnd() ) {
219 _headerLines.append( in.readLine() );
220 if (_headerLines.last().indexOf("END OF HEADER") != -1) {
221 break;
222 }
223 }
224 }
[298]225
[420]226 // Read downloaded file
227 // --------------------
[298]228 else {
[1154]229 QDate currDate = currentDateAndTimeGPS().date();
[420]230 if ( !_skeletonDate.isValid() || _skeletonDate != currDate ) {
231 if ( downloadSkeleton() == success) {
232 _skeletonDate = currDate;
[656]233 _reloadDone = false;
[298]234 }
[656]235 else {
236 if(!_reloadDone) {
237 _reloadTable = true;
238 if ( downloadSkeleton() == success) {
239 _skeletonDate = currDate;
240 }
241 _reloadTable = false;
242 _reloadDone = true;
243 }
244 }
[298]245 }
246 }
[82]247}
248
[647]249// Next File Epoch (static)
[82]250////////////////////////////////////////////////////////////////////////////
[647]251QString bncRinex::nextEpochStr(const QDateTime& datTim,
252 const QString& intStr, QDateTime* nextEpoch) {
[82]253
[647]254 QString epoStr;
[82]255
[129]256 QTime nextTime;
257 QDate nextDate;
258
[204]259 int indHlp = intStr.indexOf("min");
260
261 if ( indHlp != -1) {
262 int step = intStr.left(indHlp-1).toInt();
[127]263 char ch = 'A' + datTim.time().hour();
[647]264 epoStr = ch;
[204]265 if (datTim.time().minute() >= 60-step) {
[647]266 epoStr += QString("%1").arg(60-step, 2, 10, QChar('0'));
[199]267 if (datTim.time().hour() < 23) {
268 nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
269 nextDate = datTim.date();
270 }
271 else {
272 nextTime.setHMS(0, 0, 0);
273 nextDate = datTim.date().addDays(1);
274 }
275 }
276 else {
[204]277 for (int limit = step; limit <= 60-step; limit += step) {
278 if (datTim.time().minute() < limit) {
[647]279 epoStr += QString("%1").arg(limit-step, 2, 10, QChar('0'));
[204]280 nextTime.setHMS(datTim.time().hour(), limit, 0);
281 nextDate = datTim.date();
282 break;
283 }
[199]284 }
285 }
286 }
[127]287 else if (intStr == "1 hour") {
288 char ch = 'A' + datTim.time().hour();
[647]289 epoStr = ch;
[129]290 if (datTim.time().hour() < 23) {
291 nextTime.setHMS(datTim.time().hour() + 1 , 0, 0);
292 nextDate = datTim.date();
293 }
294 else {
295 nextTime.setHMS(0, 0, 0);
296 nextDate = datTim.date().addDays(1);
297 }
[127]298 }
299 else {
[647]300 epoStr = "0";
[129]301 nextTime.setHMS(0, 0, 0);
302 nextDate = datTim.date().addDays(1);
[127]303 }
[82]304
[647]305 if (nextEpoch) {
306 *nextEpoch = QDateTime(nextDate, nextTime);
307 }
308
309 return epoStr;
310}
311
312// File Name according to RINEX Standards
313////////////////////////////////////////////////////////////////////////////
314void bncRinex::resolveFileName(const QDateTime& datTim) {
315
316 QSettings settings;
317 QString path = settings.value("rnxPath").toString();
318 expandEnvVar(path);
319
320 if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) {
321 path += QDir::separator();
322 }
323
324 QString hlpStr = nextEpochStr(datTim, settings.value("rnxIntr").toString(),
325 &_nextCloseEpoch);
326
[183]327 QString ID4 = _statID.left(4);
328
329 // Check name conflict
330 // -------------------
331 QString distStr;
332 int num = 0;
333 QListIterator<QString> it(settings.value("mountPoints").toStringList());
334 while (it.hasNext()) {
335 QString mp = it.next();
336 if (mp.indexOf(ID4) != -1) {
337 ++num;
338 }
339 }
340 if (num > 1) {
341 distStr = "_" + _statID.mid(4);
342 }
343
[276]344 QString sklExt = settings.value("rnxSkel").toString();
345 if (!sklExt.isEmpty()) {
346 _sklName = path + ID4 + distStr + "." + sklExt;
347 }
348
[183]349 path += ID4 +
[127]350 QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
[276]351 hlpStr + distStr + datTim.toString(".yyO");
[82]352
353 _fName = path.toAscii();
354}
355
[77]356// Write RINEX Header
357////////////////////////////////////////////////////////////////////////////
[267]358void bncRinex::writeHeader(const QDateTime& datTim,
359 const QDateTime& datTimNom) {
[77]360
[356]361 QSettings settings;
362
[77]363 // Open the Output File
364 // --------------------
[267]365 resolveFileName(datTimNom);
[260]366
367 // Append to existing file and return
368 // ----------------------------------
369 if ( QFile::exists(_fName) ) {
[369]370 if (_reconnectFlag ||
371 Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
[260]372 _out.open(_fName.data(), ios::app);
373 _out.setf(ios::showpoint | ios::fixed);
374 _headerWritten = true;
[369]375 _reconnectFlag = false;
[260]376 return;
377 }
378 }
379
[82]380 _out.open(_fName.data());
[85]381 _out.setf(ios::showpoint | ios::fixed);
[77]382
[82]383 // Copy Skeleton Header
384 // --------------------
[276]385 readSkeleton();
[82]386 if (_headerLines.size() > 0) {
387 QStringListIterator it(_headerLines);
388 while (it.hasNext()) {
389 QString line = it.next();
[157]390 if (line.indexOf("PGM / RUN BY / DATE") != -1) {
[552]391 if (_rinexVers == 3) {
[1154]392 QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
[552]393 _out << _pgmName.toAscii().data() << _userName.toAscii().data()
394 << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
395 }
396 else {
[1154]397 QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
[552]398 _out << _pgmName.toAscii().data() << _userName.toAscii().data()
399 << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
400 }
[157]401 }
402 else if (line.indexOf("# / TYPES OF OBSERV") != -1) {
[545]403 if (_rinexVers == 3) {
[689]404// Changed declaration of data types, consistent with Rinex3 Perlt
405 _out << "G 10 C1C C1P L1C S1C C2X C2P L2X S2X L2P S2P SYS / # / OBS TYPES" << endl;
406 _out << "R 10 C1C C1P L1C S1C C2C C2P L2C S2C L2P S2P SYS / # / OBS TYPES" << endl;
407 _out << "S 3 C1C L1C S1C SYS / # / OBS TYPES" << endl;
[545]408 }
409 else {
410 _out << " 8 C1 C2 P1 P2 L1 L2 S1 S2"
411 " # / TYPES OF OBSERV" << endl;
412 }
[82]413 }
414 else if (line.indexOf("TIME OF FIRST OBS") != -1) {
[125]415 _out << datTim.toString(" yyyy MM dd"
416 " hh mm ss.zzz0000").toAscii().data();
[553]417 _out << " GPS TIME OF FIRST OBS" << endl;
[337]418 QString hlp = (_format + QString(" %1").arg(_mountPoint.host() +
419 _mountPoint.path())).leftJustified(60, ' ', true);
[156]420 _out << hlp.toAscii().data() << "COMMENT" << endl;
[82]421 }
[689]422// Added header line for Rinex3 regarding mandatory MARKER TYPE field Perlt
423 else if (line.indexOf("MARKER NAME") != -1) {
424 if (_rinexVers == 3) {
425 _out << line.toAscii().data() << endl;
426 _out << setw(71) << "GEODETIC MARKER TYPE" << endl;
427 }
428 else {
429 _out << line.toAscii().data() << endl;
430 }
431// End
432 }
[82]433 else {
434 _out << line.toAscii().data() << endl;
435 }
436 }
437 }
[78]438
[82]439 // Write Dummy Header
440 // ------------------
441 else {
442 double antennaNEU[3]; antennaNEU[0] = antennaNEU[1] = antennaNEU[2] = 0.0;
443
[545]444 if (_rinexVers == 3) {
445 _out << " 3.00 OBSERVATION DATA M (MIXED) RINEX VERSION / TYPE" << endl;
[1154]446 QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
[552]447 _out << _pgmName.toAscii().data() << _userName.toAscii().data()
448 << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
[545]449 }
450 else {
451 _out << " 2.11 OBSERVATION DATA M (MIXED) RINEX VERSION / TYPE" << endl;
[1154]452 QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
[552]453 _out << _pgmName.toAscii().data() << _userName.toAscii().data()
454 << hlp.toAscii().data() << "PGM / RUN BY / DATE" << endl;
[545]455 }
[86]456 _out.setf(ios::left);
[82]457 _out << setw(60) << _statID.data() << "MARKER NAME" << endl;
[689]458// Added header line for Rinex3 regarding mandatory MARKER TYPE field Perlt
459 if (_rinexVers == 3) {
460 _out << setw(60) << "unknown" << "MARKER TYPE " << endl;
461 }
462// End
[354]463 _out << setw(60) << "unknown unknown" << "OBSERVER / AGENCY" << endl;
[82]464 _out << setw(20) << "unknown"
465 << setw(20) << "unknown"
466 << setw(20) << "unknown" << "REC # / TYPE / VERS" << endl;
467 _out << setw(20) << "unknown"
468 << setw(20) << "unknown"
469 << setw(20) << " " << "ANT # / TYPE" << endl;
[86]470 _out.unsetf(ios::left);
[1044]471 _out << setw(14) << setprecision(4) << _approxPos[0]
472 << setw(14) << setprecision(4) << _approxPos[1]
473 << setw(14) << setprecision(4) << _approxPos[2]
[82]474 << " " << "APPROX POSITION XYZ" << endl;
475 _out << setw(14) << setprecision(4) << antennaNEU[0]
476 << setw(14) << setprecision(4) << antennaNEU[1]
477 << setw(14) << setprecision(4) << antennaNEU[2]
478 << " " << "ANTENNA: DELTA H/E/N" << endl;
[544]479 if (_rinexVers == 3) {
[689]480// Changed declaration of data types, consistent with Rinex3 Perlt
481 _out << "G 10 C1C C1P L1C S1C C2X C2P L2X S2X L2P S2P SYS / # / OBS TYPES" << endl;
482 _out << "R 10 C1C C1P L1C S1C C2C C2P L2C S2C L2P S2P SYS / # / OBS TYPES" << endl;
483 _out << "S 3 C1C L1C S1C SYS / # / OBS TYPES" << endl;
[544]484
485 }
486 else {
487 _out << " 1 1 WAVELENGTH FACT L1/2" << endl;
488 _out << " 8 C1 C2 P1 P2 L1 L2 S1 S2 # / TYPES OF OBSERV" << endl;
489 }
490 _out << datTim.toString(" yyyy MM dd"
[125]491 " hh mm ss.zzz0000").toAscii().data();
[553]492 _out << " GPS TIME OF FIRST OBS" << endl;
[552]493 QString hlp = (_format + QString(" %1").arg(_mountPoint.host() +
[337]494 _mountPoint.path())).leftJustified(60, ' ', true);
[156]495 _out << hlp.toAscii().data() << "COMMENT" << endl;
[366]496
[410]497 if (_nmea == "yes") {
498 hlp = ("NMEA LAT=" + _latitude + " " + "LONG=" + _longitude).leftJustified(60, ' ',true);
[366]499 _out << hlp.toAscii().data() << "COMMENT" << endl; }
500
[82]501 _out << " END OF HEADER" << endl;
502 }
[78]503
[77]504 _headerWritten = true;
505}
506
[73]507// Stores Observation into Internal Array
508////////////////////////////////////////////////////////////////////////////
[622]509void bncRinex::deepCopy(const p_obs obs) {
510 p_obs newObs = new t_obs();
[626]511 memcpy(&newObs->_o, &obs->_o, sizeof(t_obsInternal));
[74]512 _obs.push_back(newObs);
[73]513}
514
515// Write One Epoch into the RINEX File
516////////////////////////////////////////////////////////////////////////////
[160]517void bncRinex::dumpEpoch(long maxTime) {
[73]518
[160]519 // Select observations older than maxTime
520 // --------------------------------------
[622]521 QList<p_obs> dumpList;
522 QMutableListIterator<p_obs> mIt(_obs);
[160]523 while (mIt.hasNext()) {
[622]524 p_obs obs = mIt.next();
525 if (obs->_o.GPSWeek * 7*24*3600 + obs->_o.GPSWeeks < maxTime - 0.05) {
526 dumpList.push_back(obs);
[160]527 mIt.remove();
528 }
529 }
530
[75]531 // Easy Return
532 // -----------
[160]533 if (dumpList.isEmpty()) {
[75]534 return;
535 }
536
537 // Time of Epoch
538 // -------------
[622]539 p_obs fObs = *dumpList.begin();
540 QDateTime datTim = dateAndTimeFromGPSweek(fObs->_o.GPSWeek, fObs->_o.GPSWeeks);
541 QDateTime datTimNom = dateAndTimeFromGPSweek(fObs->_o.GPSWeek,
542 floor(fObs->_o.GPSWeeks+0.5));
[75]543
[130]544 // Close the file
545 // --------------
[267]546 if (_nextCloseEpoch.isValid() && datTimNom >= _nextCloseEpoch) {
[130]547 closeFile();
548 _headerWritten = false;
549 }
550
[78]551 // Write RINEX Header
552 // ------------------
553 if (!_headerWritten) {
[267]554 writeHeader(datTim, datTimNom);
[78]555 }
556
[622]557 double sec = double(datTim.time().second()) + fmod(fObs->_o.GPSWeeks,1.0);
[75]558
[1044]559 // Epoch header line: RINEX Version 3
560 // ----------------------------------
[540]561 if (_rinexVers == 3) {
562 _out << datTim.toString("> yyyy MM dd hh mm ").toAscii().data()
563 << setw(10) << setprecision(7) << sec
564 << " " << 0 << setw(3) << dumpList.size() << endl;
[74]565 }
[1044]566 // Epoch header line: RINEX Version 2
567 // ----------------------------------
[540]568 else {
569 _out << datTim.toString(" yy MM dd hh mm ").toAscii().data()
570 << setw(10) << setprecision(7) << sec
571 << " " << 0 << setw(3) << dumpList.size();
[1044]572
[622]573 QListIterator<p_obs> it(dumpList); int iSat = 0;
[540]574 while (it.hasNext()) {
575 iSat++;
[622]576 p_obs obs = it.next();
577 _out << obs->_o.satSys << setw(2) << obs->_o.satNum;
[540]578 if (iSat == 12 && it.hasNext()) {
579 _out << endl << " ";
580 iSat = 0;
581 }
582 }
[77]583 _out << endl;
[1044]584 }
585
586 QListIterator<p_obs> it(dumpList);
587 while (it.hasNext()) {
588 p_obs obs = it.next();
589
590 // Cycle slips detection
591 // ---------------------
592 int prn = 0;
593 switch (obs->_o.satSys) {
594 case 'G': prn = obs->_o.satNum; break;
595 case 'R': prn = obs->_o.satNum + 200; break;
596 default: prn = obs->_o.satNum;
597 }
598
599 char lli1 = ' ';
600 char lli2 = ' ';
601 if ( obs->_o.slip_cnt_L1 >= 0 ) {
602 if ( _slip_cnt_L1.find(prn) != _slip_cnt_L1.end() &&
603 _slip_cnt_L1.find(prn).value() != obs->_o.slip_cnt_L1 ) {
604 lli1 = '1';
605 }
606 }
607 else if ( obs->_o.lock_timei_L1 >= 0 ) {
608 if ( _lock_timei_L1.find(prn) != _lock_timei_L1.end() &&
609 _lock_timei_L1.find(prn).value() != obs->_o.lock_timei_L1 ) {
610 lli1 = '1';
611 }
612 }
613
614 if ( obs->_o.slip_cnt_L2 >= 0 ) {
615 if ( _slip_cnt_L2.find(prn) != _slip_cnt_L2.end() &&
616 _slip_cnt_L2.find(prn).value() != obs->_o.slip_cnt_L2 ) {
617 lli2 = '1';
618 }
619 }
620 else if ( obs->_o.lock_timei_L2 >= 0 ) {
621 if ( _lock_timei_L2.find(prn) != _lock_timei_L2.end() &&
622 _lock_timei_L2.find(prn).value() != obs->_o.lock_timei_L2 ) {
623 lli2 = '1';
624 }
625 }
626
627 _slip_cnt_L1[prn] = obs->_o.slip_cnt_L1;
628 _slip_cnt_L2[prn] = obs->_o.slip_cnt_L2;
629
630 _lock_timei_L1[prn] = obs->_o.lock_timei_L1;
631 _lock_timei_L2[prn] = obs->_o.lock_timei_L2;
632
633 // RINEX Version 3
634 // ---------------
635 if (_rinexVers == 3) {
636 char sbasflag = 'S';
637 // Changed data output, C1P, C2C|X, L2C|X, S2C|X added. Changed Output for SBAS Perlt
638 if (sbasflag != obs->_o.satSys) {
639 _out << obs->_o.satSys
640 << setw(2) << setfill('0') << obs->_o.satNum << setfill(' ')
641 << setw(14) << setprecision(3) << obs->_o.C1 << " "
642 << setw(14) << setprecision(3) << obs->_o.P1 << " "
643 << setw(14) << setprecision(3) << obs->_o.L1 << lli1
644 << setw(1) << obs->_o.SNR1
645 << setw(14) << setprecision(3) << obs->_o.S1 << " "
646 << setw(14) << setprecision(3) << obs->_o.C2 << " "
647 << setw(14) << setprecision(3) << obs->_o.P2 << " " ;
648 if ((obs->_o.C2 != 0.0) && (obs->_o.P2 == 0.0)) {
649 _out << setw(14) << setprecision(3) << obs->_o.L2 << lli2
650 << setw(1) << obs->_o.SNR2
651 << setw(14) << setprecision(3) << obs->_o.S2 << " "
652 << " 0.000 0.000 ";
653 }
654 else {
655 _out << " 0.000 0.000 "
656 << setw(14) << setprecision(3) << obs->_o.L2 << " "
657 << setw(1) << obs->_o.SNR2
658 << setw(14) << setprecision(3) << obs->_o.S2;
659 }
660 _out << endl;
661 }
662 else {
663 _out << obs->_o.satSys
664 << setw(2) << setfill('0') << obs->_o.satNum << setfill(' ')
665 << setw(14) << setprecision(3) << obs->_o.C1 << " "
666 << setw(14) << setprecision(3) << obs->_o.P1 << " "
667 << setw(14) << setprecision(3) << obs->_o.L1 << lli1
668 << setw(1) << obs->_o.SNR1
669 << setw(14) << setprecision(3) << obs->_o.S1 << endl;
670 }
671 }
672
673 // RINEX Version 2
674 // ---------------
675 else {
[540]676 char lli = ' ';
677 char snr = ' ';
[622]678 _out << setw(14) << setprecision(3) << obs->_o.C1 << lli << snr;
679 _out << setw(14) << setprecision(3) << obs->_o.C2 << lli << snr;
680 _out << setw(14) << setprecision(3) << obs->_o.P1 << lli << snr;
681 _out << setw(14) << setprecision(3) << obs->_o.P2 << lli << snr;
[1044]682 _out << setw(14) << setprecision(3) << obs->_o.L1 << lli1
[622]683 << setw(1) << obs->_o.SNR1 << endl;
[1044]684 _out << setw(14) << setprecision(3) << obs->_o.L2 << lli2
[622]685 << setw(1) << obs->_o.SNR2;
686 _out << setw(14) << setprecision(3) << obs->_o.S1 ;
687 _out << setw(16) << setprecision(3) << obs->_o.S2 ;
[540]688 _out << endl;
689 }
[1044]690
691 delete obs;
[75]692 }
693
[77]694 _out.flush();
[73]695}
696
[130]697// Close the Old RINEX File
698////////////////////////////////////////////////////////////////////////////
699void bncRinex::closeFile() {
[436]700 QMutexLocker locker(&_mutex);
[698]701 if (_rinexVers == 3) {
[843]702 _out << "> 4 1" << endl;
[698]703 _out << "END OF FILE" << endl;
704 }
[130]705 _out.close();
[132]706 if (!_rnxScriptName.isEmpty()) {
[675]707 msleep(1);
[435]708#ifdef WIN32
709 QProcess::startDetached(_rnxScriptName, QStringList() << _fName) ;
710#else
[475]711 QProcess::startDetached("nohup", QStringList() << _rnxScriptName << _fName) ;
[435]712#endif
[436]713
[132]714 }
[130]715}
Note: See TracBrowser for help on using the repository browser.