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

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