source: ntrip/trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp@ 6630

Last change on this file since 6630 was 6564, checked in by stuerze, 10 years ago

try to fix some memory problems

File size: 20.0 KB
RevLine 
[866]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: RTCM3coDecoder
30 *
31 * Purpose: RTCM3 Clock Orbit Decoder
32 *
33 * Author: L. Mervart
34 *
35 * Created: 05-May-2008
36 *
[6215]37 * Changes:
[866]38 *
39 * -----------------------------------------------------------------------*/
40
[868]41#include <stdio.h>
[920]42#include <math.h>
[868]43
[866]44#include "RTCM3coDecoder.h"
[918]45#include "bncutils.h"
[934]46#include "bncrinex.h"
[5070]47#include "bnccore.h"
[1535]48#include "bncsettings.h"
[1834]49#include "rtcm3torinex.h"
[4428]50#include "bnctime.h"
[866]51
52using namespace std;
53
54// Constructor
55////////////////////////////////////////////////////////////////////////////
[970]56RTCM3coDecoder::RTCM3coDecoder(const QString& staID) {
[934]57
[970]58 _staID = staID;
59
[934]60 // File Output
61 // -----------
[1535]62 bncSettings settings;
[934]63 QString path = settings.value("corrPath").toString();
64 if (!path.isEmpty()) {
65 expandEnvVar(path);
66 if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) {
67 path += QDir::separator();
68 }
[970]69 _fileNameSkl = path + staID;
[934]70 }
[6141]71 _out = 0;
[934]72
[6215]73 connect(this, SIGNAL(newOrbCorrections(QList<t_orbCorr>)),
[6141]74 BNC_CORE, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)));
[1828]75
[6215]76 connect(this, SIGNAL(newClkCorrections(QList<t_clkCorr>)),
[6141]77 BNC_CORE, SLOT(slotNewClkCorrections(QList<t_clkCorr>)));
78
[6486]79 connect(this, SIGNAL(newCodeBiases(QList<t_satCodeBias>)),
80 BNC_CORE, SLOT(slotNewCodeBiases(QList<t_satCodeBias>)));
81
82 connect(this, SIGNAL(newPhaseBiases(QList<t_satPhaseBias>)),
83 BNC_CORE, SLOT(slotNewPhaseBiases(QList<t_satPhaseBias>)));
84
85 connect(this, SIGNAL(newTec(t_vTec)),
86 BNC_CORE, SLOT(slotNewTec(t_vTec)));
87
[6215]88 connect(this, SIGNAL(providerIDChanged(QString)),
[5577]89 BNC_CORE, SIGNAL(providerIDChanged(QString)));
90
[6215]91 connect(this, SIGNAL(newMessage(QByteArray,bool)),
[5068]92 BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
[4428]93
[6467]94 reset();
[5576]95
96 _providerID[0] = -1;
97 _providerID[1] = -1;
98 _providerID[2] = -1;
[866]99}
100
101// Destructor
102////////////////////////////////////////////////////////////////////////////
103RTCM3coDecoder::~RTCM3coDecoder() {
[935]104 delete _out;
[866]105}
106
[6467]107//
108////////////////////////////////////////////////////////////////////////////
109void RTCM3coDecoder::reset() {
110 memset(&_clkOrb, 0, sizeof(_clkOrb));
111 memset(&_codeBias, 0, sizeof(_codeBias));
112 memset(&_phaseBias, 0, sizeof(_phaseBias));
113 memset(&_vTEC, 0, sizeof(_vTEC));
114}
115
[934]116// Reopen Output File
[6215]117////////////////////////////////////////////////////////////////////////
[6141]118void RTCM3coDecoder::reopen() {
[934]119
[6141]120 if (!_fileNameSkl.isEmpty()) {
[934]121
[1535]122 bncSettings settings;
[934]123
[1154]124 QDateTime datTim = currentDateAndTimeGPS();
[934]125
126 QString hlpStr = bncRinex::nextEpochStr(datTim,
127 settings.value("corrIntr").toString());
128
[6215]129 QString fileNameHlp = _fileNameSkl
[934]130 + QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'))
[938]131 + hlpStr + datTim.toString(".yyC");
[934]132
[6141]133 if (_fileName == fileNameHlp) {
[934]134 return;
135 }
136 else {
[6141]137 _fileName = fileNameHlp;
[934]138 }
139
[6141]140 delete _out;
[1727]141 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
[6141]142 _out = new ofstream( _fileName.toAscii().data(), ios_base::out | ios_base::app );
[1727]143 }
144 else {
[6141]145 _out = new ofstream( _fileName.toAscii().data() );
[1727]146 }
[934]147 }
148}
149
[6215]150//
[866]151////////////////////////////////////////////////////////////////////////////
[1227]152t_irc RTCM3coDecoder::Decode(char* buffer, int bufLen, vector<string>& errmsg) {
[868]153
[1218]154 errmsg.clear();
155
[1227]156 _buffer.append(QByteArray(buffer,bufLen));
[868]157
[1023]158 t_irc retCode = failure;
159
[1832]160 while(_buffer.size()) {
161
[6454]162 struct ClockOrbit clkOrbSav;
163 struct CodeBias codeBiasSav;
164 struct PhaseBias phaseBiasSav;
165 struct VTEC vTECSav;
166 memcpy(&clkOrbSav, &_clkOrb, sizeof(clkOrbSav)); // save state
167 memcpy(&codeBiasSav, &_codeBias, sizeof(codeBiasSav));
168 memcpy(&phaseBiasSav, &_phaseBias, sizeof(phaseBiasSav));
169 memcpy(&vTECSav, &_vTEC, sizeof(vTECSav));
170
[879]171 int bytesused = 0;
[6454]172 GCOB_RETURN irc = GetSSR(&_clkOrb, &_codeBias, &_vTEC, &_phaseBias,
173 _buffer.data(), _buffer.size(), &bytesused);
[1829]174
[1833]175 if (irc <= -30) { // not enough data - restore state and exit loop
[6454]176 memcpy(&_clkOrb, &clkOrbSav, sizeof(clkOrbSav));
177 memcpy(&_codeBias, &codeBiasSav, sizeof(codeBiasSav));
178 memcpy(&_phaseBias, &phaseBiasSav, sizeof(phaseBiasSav));
179 memcpy(&_vTEC, &vTECSav, sizeof(vTECSav));
[1833]180 break;
[869]181 }
[1832]182
[1833]183 else if (irc < 0) { // error - skip 1 byte and retry
[6467]184 reset();
[1842]185 _buffer = _buffer.mid(bytesused ? bytesused : 1);
[1833]186 }
187
188 else { // OK or MESSAGEFOLLOWS
[1828]189 _buffer = _buffer.mid(bytesused);
190
[6467]191 if (irc == GCOBR_OK || irc == GCOBR_MESSAGEFOLLOWS ) {
[2435]192
[6556]193 setEpochTime(); // sets _lastTime
[6467]194
195 if (_lastTime.valid()) {
196 reopen();
197 checkProviderID();
198 sendResults();
199 retCode = success;
[919]200 }
[6467]201 else {
202 retCode = failure;
[1829]203 }
[918]204
[6467]205 reset();
[869]206 }
[1829]207 }
[1833]208 }
[1832]209
[1829]210 return retCode;
[866]211}
[934]212
[6215]213//
[934]214////////////////////////////////////////////////////////////////////////////
[6141]215void RTCM3coDecoder::sendResults() {
[934]216
[6455]217 // Orbit and clock corrections of all satellites
218 // ---------------------------------------------
[6454]219 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
[3022]220 char sysCh = ' ';
[6454]221 if (ii < _clkOrb.NumberOfSat[CLOCKORBIT_SATGPS]) {
[3022]222 sysCh = 'G';
223 }
224 else if (ii >= CLOCKORBIT_NUMGPS) {
225 sysCh = 'R';
226 }
[6141]227 else {
228 continue;
229 }
[3024]230
[6141]231 // Orbit correction
232 // ----------------
[6454]233 if ( _clkOrb.messageType == COTYPE_GPSCOMBINED ||
234 _clkOrb.messageType == COTYPE_GLONASSCOMBINED ||
235 _clkOrb.messageType == COTYPE_GPSORBIT ||
236 _clkOrb.messageType == COTYPE_GLONASSORBIT ) {
[3022]237
[6141]238 t_orbCorr orbCorr;
[6454]239 orbCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID);
[6564]240 orbCorr._staID = _staID.toStdString();
[6556]241 orbCorr._iod = _clkOrb.Sat[ii].IOD;
242 orbCorr._time = _lastTime;
243 orbCorr._updateInt = _clkOrb.UpdateInterval;
244 orbCorr._system = 'R';
245 orbCorr._xr[0] = _clkOrb.Sat[ii].Orbit.DeltaRadial;
246 orbCorr._xr[1] = _clkOrb.Sat[ii].Orbit.DeltaAlongTrack;
247 orbCorr._xr[2] = _clkOrb.Sat[ii].Orbit.DeltaCrossTrack;
248 orbCorr._dotXr[0] = _clkOrb.Sat[ii].Orbit.DotDeltaRadial;
249 orbCorr._dotXr[1] = _clkOrb.Sat[ii].Orbit.DotDeltaAlongTrack;
250 orbCorr._dotXr[2] = _clkOrb.Sat[ii].Orbit.DotDeltaCrossTrack;
[3022]251
[6497]252 _orbCorrections[_lastTime].push_back(orbCorr);
[3022]253
[6471]254 _IODs[orbCorr._prn] = _clkOrb.Sat[ii].IOD;
[6141]255 }
[3022]256
[6455]257 // Clock Corrections
258 // -----------------
[6454]259 if ( _clkOrb.messageType == COTYPE_GPSCOMBINED ||
260 _clkOrb.messageType == COTYPE_GLONASSCOMBINED ||
261 _clkOrb.messageType == COTYPE_GPSCLOCK ||
262 _clkOrb.messageType == COTYPE_GLONASSCLOCK ) {
[3022]263
[6141]264 t_clkCorr clkCorr;
[6454]265 clkCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID);
[6564]266 clkCorr._staID = _staID.toStdString();
[6141]267 clkCorr._time = _lastTime;
[6556]268 clkCorr._updateInt = _clkOrb.UpdateInterval;
[6454]269 clkCorr._dClk = _clkOrb.Sat[ii].Clock.DeltaA0 / t_CST::c;
270 clkCorr._dotDClk = _clkOrb.Sat[ii].Clock.DeltaA1 / t_CST::c;
271 clkCorr._dotDotDClk = _clkOrb.Sat[ii].Clock.DeltaA2 / t_CST::c;
[3022]272
[6471]273 _lastClkCorrections[clkCorr._prn] = clkCorr;
274
275 if (_IODs.contains(clkCorr._prn)) {
276 clkCorr._iod = _IODs[clkCorr._prn];
[6497]277 _clkCorrections[_lastTime].push_back(clkCorr);
[3022]278 }
279 }
[6141]280
281 // High-Resolution Clocks
282 // ----------------------
[6454]283 if ( _clkOrb.messageType == COTYPE_GPSHR ||
284 _clkOrb.messageType == COTYPE_GLONASSHR ) {
[6471]285
286 t_prn prn(sysCh, _clkOrb.Sat[ii].ID);
287 if (_lastClkCorrections.contains(prn)) {
288 t_clkCorr clkCorr;
[6556]289 clkCorr = _lastClkCorrections[prn];
290 clkCorr._time = _lastTime;
291 clkCorr._updateInt = _clkOrb.UpdateInterval;
292 clkCorr._dClk += _clkOrb.Sat[ii].hrclock / t_CST::c;
[6471]293 if (_IODs.contains(clkCorr._prn)) {
294 clkCorr._iod = _IODs[clkCorr._prn];
[6497]295 _clkCorrections[_lastTime].push_back(clkCorr);
[6471]296 }
297 }
[6141]298 }
[3022]299 }
300
[6455]301 // Code Biases
302 // -----------
[6454]303 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
[6141]304 char sysCh = ' ';
[6454]305 if (ii < _codeBias.NumberOfSat[CLOCKORBIT_SATGPS]) {
[6141]306 sysCh = 'G';
[3022]307 }
[6141]308 else if (ii >= CLOCKORBIT_NUMGPS) {
309 sysCh = 'R';
[3022]310 }
[6141]311 else {
312 continue;
313 }
[6463]314 t_satCodeBias satCodeBias;
315 satCodeBias._prn.set(sysCh, _codeBias.Sat[ii].ID);
[6564]316 satCodeBias._staID = _staID.toStdString();
[6556]317 satCodeBias._time = _lastTime;
318 satCodeBias._updateInt = _codeBias.UpdateInterval;
[6454]319 for (unsigned jj = 0; jj < _codeBias.Sat[ii].NumberOfCodeBiases; jj++) {
[6472]320 const CodeBias::BiasSat::CodeBiasEntry& biasEntry = _codeBias.Sat[ii].Biases[jj];
321 t_frqCodeBias frqCodeBias;
322 frqCodeBias._rnxType2ch = codeTypeToRnxType(sysCh, biasEntry.Type);
323 frqCodeBias._value = biasEntry.Bias;
[6474]324 if (!frqCodeBias._rnxType2ch.empty()) {
325 satCodeBias._bias.push_back(frqCodeBias);
326 }
[6141]327 }
[6497]328 _codeBiases[_lastTime].push_back(satCodeBias);
[3022]329 }
330
[6487]331 // Phase Biases
332 // -----------
333 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _phaseBias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
334 char sysCh = ' ';
335 if (ii < _phaseBias.NumberOfSat[CLOCKORBIT_SATGPS]) {
336 sysCh = 'G';
337 }
338 else if (ii >= CLOCKORBIT_NUMGPS) {
339 sysCh = 'R';
340 }
341 else {
342 continue;
343 }
344 t_satPhaseBias satPhaseBias;
345 satPhaseBias._prn.set(sysCh, _phaseBias.Sat[ii].ID);
[6564]346 satPhaseBias._staID = _staID.toStdString();
[6488]347 satPhaseBias._time = _lastTime;
[6556]348 satPhaseBias._updateInt = _phaseBias.UpdateInterval;
[6488]349 satPhaseBias._yawDeg = _phaseBias.Sat[ii].YawAngle * 180.0 / M_PI;
350 satPhaseBias._yawDegRate = _phaseBias.Sat[ii].YawRate * 180.0 / M_PI;
[6487]351 for (unsigned jj = 0; jj < _phaseBias.Sat[ii].NumberOfPhaseBiases; jj++) {
352 const PhaseBias::PhaseBiasSat::PhaseBiasEntry& biasEntry = _phaseBias.Sat[ii].Biases[jj];
353 t_frqPhaseBias frqPhaseBias;
[6488]354 frqPhaseBias._rnxType2ch = codeTypeToRnxType(sysCh, biasEntry.Type);
355 frqPhaseBias._value = biasEntry.Bias;
356 frqPhaseBias._fixIndicator = biasEntry.SignalIntegerIndicator;
357 frqPhaseBias._fixWideLaneIndicator = biasEntry.SignalsWideLaneIntegerIndicator;
358 frqPhaseBias._jumpCounter = biasEntry.SignalDiscontinuityCounter;
[6487]359 if (!frqPhaseBias._rnxType2ch.empty()) {
360 satPhaseBias._bias.push_back(frqPhaseBias);
361 }
362 }
[6497]363 _phaseBiases[_lastTime].push_back(satPhaseBias);
[6487]364 }
365
[6490]366 // Ionospheric Model
367 // -----------------
368 if (_vTEC.NumLayers > 0) {
[6497]369 _vTecMap[_lastTime]._time = _lastTime;
[6556]370 _vTecMap[_lastTime]._updateInt = _vTEC.UpdateInterval;
[6564]371 _vTecMap[_lastTime]._staID = _staID.toStdString();
[6491]372 for (unsigned ii = 0; ii < _vTEC.NumLayers; ii++) {
373 const VTEC::IonoLayers& ionoLayer = _vTEC.Layers[ii];
374 t_vTecLayer layer;
375 layer._height = ionoLayer.Height;
376 layer._C.ReSize(ionoLayer.Degree, ionoLayer.Order);
377 layer._S.ReSize(ionoLayer.Degree, ionoLayer.Order);
378 for (unsigned iDeg = 0; iDeg < ionoLayer.Degree; iDeg++) {
379 for (unsigned iOrd = 0; iOrd < ionoLayer.Order; iOrd++) {
380 layer._C[iDeg][iOrd] = ionoLayer.Cosinus[iDeg][iOrd];
381 layer._S[iDeg][iOrd] = ionoLayer.Sinus[iDeg][iOrd];
382 }
383 }
[6497]384 _vTecMap[_lastTime]._layers.push_back(layer);
[6491]385 }
[6490]386 }
387
[6455]388 // Dump all older epochs
389 // ---------------------
390 QMutableMapIterator<bncTime, QList<t_orbCorr> > itOrb(_orbCorrections);
391 while (itOrb.hasNext()) {
392 itOrb.next();
393 if (itOrb.key() < _lastTime) {
394 emit newOrbCorrections(itOrb.value());
[6456]395 t_orbCorr::writeEpoch(_out, itOrb.value());
[6455]396 itOrb.remove();
397 }
[6141]398 }
[6455]399 QMutableMapIterator<bncTime, QList<t_clkCorr> > itClk(_clkCorrections);
400 while (itClk.hasNext()) {
401 itClk.next();
402 if (itClk.key() < _lastTime) {
403 emit newClkCorrections(itClk.value());
[6456]404 t_clkCorr::writeEpoch(_out, itClk.value());
[6455]405 itClk.remove();
406 }
[6141]407 }
[6474]408 QMutableMapIterator<bncTime, QList<t_satCodeBias> > itCB(_codeBiases);
409 while (itCB.hasNext()) {
410 itCB.next();
411 if (itCB.key() < _lastTime) {
412 emit newCodeBiases(itCB.value());
[6475]413 t_satCodeBias::writeEpoch(_out, itCB.value());
[6474]414 itCB.remove();
415 }
416 }
[6487]417 QMutableMapIterator<bncTime, QList<t_satPhaseBias> > itPB(_phaseBiases);
418 while (itPB.hasNext()) {
419 itPB.next();
420 if (itPB.key() < _lastTime) {
421 emit newPhaseBiases(itPB.value());
422 t_satPhaseBias::writeEpoch(_out, itPB.value());
423 itPB.remove();
424 }
425 }
[6490]426 QMutableMapIterator<bncTime, t_vTec> itTec(_vTecMap);
427 while (itTec.hasNext()) {
428 itTec.next();
429 if (itTec.key() < _lastTime) {
430 emit newTec(itTec.value());
431 t_vTec::write(_out, itTec.value());
432 itTec.remove();
433 }
434 }
[3022]435}
[5576]436
[6215]437//
[5576]438////////////////////////////////////////////////////////////////////////////
439void RTCM3coDecoder::checkProviderID() {
440
[6454]441 if (_clkOrb.SSRProviderID == 0 && _clkOrb.SSRSolutionID == 0 && _clkOrb.SSRIOD == 0) {
[5576]442 return;
443 }
444
445 int newProviderID[3];
[6454]446 newProviderID[0] = _clkOrb.SSRProviderID;
447 newProviderID[1] = _clkOrb.SSRSolutionID;
448 newProviderID[2] = _clkOrb.SSRIOD;
[5576]449
450 bool alreadySet = false;
451 bool different = false;
452
453 for (unsigned ii = 0; ii < 3; ii++) {
454 if (_providerID[ii] != -1) {
455 alreadySet = true;
456 }
457 if (_providerID[ii] != newProviderID[ii]) {
458 different = true;
459 }
460 _providerID[ii] = newProviderID[ii];
461 }
[6215]462
[5576]463 if (alreadySet && different) {
[5580]464 emit newMessage("RTCM3coDecoder: Provider Changed " + _staID.toAscii() + "\n", true);
[5577]465 emit providerIDChanged(_staID);
[5576]466 }
467}
[6467]468
469//
470////////////////////////////////////////////////////////////////////////////
[6556]471void RTCM3coDecoder::setEpochTime() {
[6467]472
473 _lastTime.reset();
474
[6553]475 double epoSecGPS = -1.0;
476 double epoSecGlo = -1.0;
[6467]477 if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
[6553]478 epoSecGPS = _clkOrb.EpochTime[CLOCKORBIT_SATGPS]; // 0 .. 604799 s
[6467]479 }
480 else if (_codeBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
[6470]481 epoSecGPS = _codeBias.EpochTime[CLOCKORBIT_SATGPS]; // 0 .. 604799 s
[6467]482 }
[6470]483 else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
484 epoSecGPS = _phaseBias.EpochTime[CLOCKORBIT_SATGPS]; // 0 .. 604799 s
485 }
486 else if (_vTEC.NumLayers > 0) {
487 epoSecGPS = _vTEC.EpochTime; // 0 .. 604799 s
488 }
[6467]489 else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
[6470]490 epoSecGlo = _clkOrb.EpochTime[CLOCKORBIT_SATGLONASS]; // 0 .. 86399 s
[6467]491 }
492 else if (_codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
[6470]493 epoSecGlo = _codeBias.EpochTime[CLOCKORBIT_SATGLONASS]; // 0 .. 86399 s
[6467]494 }
[6470]495 else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
496 epoSecGlo = _phaseBias.EpochTime[CLOCKORBIT_SATGLONASS]; // 0 .. 86399 s
497 }
[6467]498
499 // Retrieve current time
500 // ---------------------
501 int currentWeek = 0;
502 double currentSec = 0.0;
503 currentGPSWeeks(currentWeek, currentSec);
504 bncTime currentTime(currentWeek, currentSec);
505
506 // Set _lastTime close to currentTime
507 // ----------------------------------
508 if (epoSecGPS != -1) {
509 _lastTime.set(currentWeek, epoSecGPS);
510 }
511 else if (epoSecGlo != -1) {
512 QDate date = dateAndTimeFromGPSweek(currentTime.gpsw(), currentTime.gpssec()).date();
513 epoSecGlo = epoSecGlo - 3 * 3600 + gnumleap(date.year(), date.month(), date.day());
514 _lastTime.set(currentWeek, epoSecGlo);
[6468]515 }
516
517 if (_lastTime.valid()) {
[6469]518 double maxDiff = 12 * 3600.0;
519 while (_lastTime < currentTime - maxDiff) {
520 _lastTime = _lastTime + maxDiff;
[6467]521 }
[6469]522 while (_lastTime > currentTime + maxDiff) {
523 _lastTime = _lastTime - maxDiff;
[6467]524 }
525 }
526}
[6472]527
528//
529////////////////////////////////////////////////////////////////////////////
530string RTCM3coDecoder::codeTypeToRnxType(char system, CodeType type) const {
531 if (system == 'G') {
532 switch (type) {
[6473]533 case CODETYPEGPS_L1_CA: return "1C";
534 case CODETYPEGPS_L1_P: return "1P";
535 case CODETYPEGPS_L1_Z: return "1W";
536 case CODETYPEGPS_L2_CA: return "2C";
537 case CODETYPEGPS_SEMI_CODELESS: return "?N"; // which carrier ?
538 case CODETYPEGPS_L2_CM: return "2S";
539 case CODETYPEGPS_L2_CL: return "2L";
540 case CODETYPEGPS_L2_CML: return "2X";
541 case CODETYPEGPS_L2_P: return "2P";
542 case CODETYPEGPS_L2_Z: return "2W";
543 case CODETYPEGPS_L5_I: return "5I";
544 case CODETYPEGPS_L5_Q: return "5Q";
[6472]545 default: return "";
546 }
547 }
548 else if (system == 'R') {
549 switch (type) {
[6473]550 case CODETYPEGLONASS_L1_CA: return "1C";
551 case CODETYPEGLONASS_L1_P: return "1P";
552 case CODETYPEGLONASS_L2_CA: return "2C";
553 case CODETYPEGLONASS_L2_P: return "2P";
[6472]554 default: return "";
555 }
556 }
557 else if (system == 'E') {
558 switch (type) {
[6473]559 case CODETYPEGALILEO_E1_A: return "1A";
560 case CODETYPEGALILEO_E1_B: return "1B";
561 case CODETYPEGALILEO_E1_C: return "1C";
562 case CODETYPEGALILEO_E5A_I: return "5I";
563 case CODETYPEGALILEO_E5A_Q: return "5Q";
564 case CODETYPEGALILEO_E5B_I: return "7I";
565 case CODETYPEGALILEO_E5B_Q: return "7Q";
566 case CODETYPEGALILEO_E5_I: return "8I";
567 case CODETYPEGALILEO_E5_Q: return "8Q";
568 case CODETYPEGALILEO_E6_A: return "6A";
569 case CODETYPEGALILEO_E6_B: return "6B";
570 case CODETYPEGALILEO_E6_C: return "6C";
[6472]571 default: return "";
572 }
573 }
574 else if (system == 'J') {
575 switch (type) {
[6473]576 case CODETYPEQZSS_L1_CA: return "1C";
577 case CODETYPEQZSS_L1C_D: return "1S";
578 case CODETYPEQZSS_L1C_P: return "1L";
579 case CODETYPEQZSS_L1C_DP: return "1X";
580 case CODETYPEQZSS_L2_CM: return "2S";
581 case CODETYPEQZSS_L2_CL: return "2L";
582 case CODETYPEQZSS_L2_CML: return "2X";
583 case CODETYPEQZSS_L5_I: return "5I";
584 case CODETYPEQZSS_L5_Q: return "5Q";
585 case CODETYPEQZSS_L5_IQ: return "5X";
586 case CODETYPEQZSS_LEX_S: return "6S";
587 case CODETYPEQZSS_LEX_L: return "6L";
588 case CODETYPEQZSS_LEX_SL: return "6X";
[6472]589 default: return "";
590 }
591 }
592 else if (system == 'S') {
593 switch (type) {
[6473]594 case CODETYPE_SBAS_L1_CA: return "1C";
595 case CODETYPE_SBAS_L5_I: return "5I";
596 case CODETYPE_SBAS_L5_Q: return "5Q";
597 case CODETYPE_SBAS_L5_IQ: return "5X";
[6472]598 default: return "";
599 }
600 }
601 else if (system == 'C') {
602 switch (type) {
[6473]603 case CODETYPE_BDS_B1_I: return "1I";
604 case CODETYPE_BDS_B1_Q: return "1Q";
605 case CODETYPE_BDS_B1_IQ: return "1X";
606 case CODETYPE_BDS_B2_I: return "7I";
607 case CODETYPE_BDS_B2_Q: return "7Q";
608 case CODETYPE_BDS_B2_IQ: return "7X";
609 case CODETYPE_BDS_B3_I: return "6I";
610 case CODETYPE_BDS_B3_Q: return "6Q";
611 case CODETYPE_BDS_B3_IQ: return "6X";
[6472]612 default: return "";
613 }
614 }
615 return "";
616};
Note: See TracBrowser for help on using the repository browser.