| [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)
|
|---|
| [11024] | 6 | // http://bkg.bund.de
|
|---|
| [866] | 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>
|
|---|
| [11010] | 43 | #include <climits>
|
|---|
| [868] | 44 |
|
|---|
| [866] | 45 | #include "RTCM3coDecoder.h"
|
|---|
| [918] | 46 | #include "bncutils.h"
|
|---|
| [934] | 47 | #include "bncrinex.h"
|
|---|
| [5070] | 48 | #include "bnccore.h"
|
|---|
| [1535] | 49 | #include "bncsettings.h"
|
|---|
| [4428] | 50 | #include "bnctime.h"
|
|---|
| [866] | 51 |
|
|---|
| 52 | using namespace std;
|
|---|
| 53 |
|
|---|
| 54 | // Constructor
|
|---|
| 55 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| [9048] | 56 | RTCM3coDecoder::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 |
|
|---|
| [11008] | 88 | connect(this, SIGNAL(newMetaData(t_metaData)),
|
|---|
| 89 | BNC_CORE, SLOT(slotNewMetaData(t_metaData)));
|
|---|
| 90 |
|
|---|
| [6215] | 91 | connect(this, SIGNAL(providerIDChanged(QString)),
|
|---|
| [5577] | 92 | BNC_CORE, SIGNAL(providerIDChanged(QString)));
|
|---|
| 93 |
|
|---|
| [6215] | 94 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
|---|
| [5068] | 95 | BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
|
|---|
| [4428] | 96 |
|
|---|
| [6467] | 97 | reset();
|
|---|
| [5576] | 98 |
|
|---|
| 99 | _providerID[0] = -1;
|
|---|
| 100 | _providerID[1] = -1;
|
|---|
| 101 | _providerID[2] = -1;
|
|---|
| [9025] | 102 |
|
|---|
| 103 | _ssrCorr = 0;
|
|---|
| [10534] | 104 |
|
|---|
| [866] | 105 | }
|
|---|
| 106 |
|
|---|
| 107 | // Destructor
|
|---|
| 108 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 109 | RTCM3coDecoder::~RTCM3coDecoder() {
|
|---|
| [935] | 110 | delete _out;
|
|---|
| [9025] | 111 | delete _ssrCorr;
|
|---|
| [7641] | 112 | _IODs.clear();
|
|---|
| 113 | _orbCorrections.clear();
|
|---|
| 114 | _clkCorrections.clear();
|
|---|
| 115 | _lastClkCorrections.clear();
|
|---|
| 116 | _codeBiases.clear();
|
|---|
| 117 | _phaseBiases.clear();
|
|---|
| 118 | _vTecMap.clear();
|
|---|
| [11008] | 119 | _metaDataMap.clear();
|
|---|
| [866] | 120 | }
|
|---|
| 121 |
|
|---|
| [7641] | 122 | //
|
|---|
| [6467] | 123 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| [11002] | 124 | void RTCM3coDecoder::reset(bool resetPhaseBias) {
|
|---|
| [6467] | 125 | memset(&_clkOrb, 0, sizeof(_clkOrb));
|
|---|
| 126 | memset(&_codeBias, 0, sizeof(_codeBias));
|
|---|
| [11002] | 127 | if (resetPhaseBias) {
|
|---|
| 128 | memset(&_phaseBias, 0, sizeof(_phaseBias));
|
|---|
| [11010] | 129 | for (unsigned s = 0; s < CLOCKORBIT_SATNUM; s++) {
|
|---|
| 130 | _phaseBiasSentEpoch[s] = UINT_MAX; // "never sent"
|
|---|
| 131 | }
|
|---|
| [11002] | 132 | }
|
|---|
| [6467] | 133 | memset(&_vTEC, 0, sizeof(_vTEC));
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| [934] | 136 | // Reopen Output File
|
|---|
| [6215] | 137 | ////////////////////////////////////////////////////////////////////////
|
|---|
| [6141] | 138 | void RTCM3coDecoder::reopen() {
|
|---|
| [934] | 139 |
|
|---|
| [6141] | 140 | if (!_fileNameSkl.isEmpty()) {
|
|---|
| [934] | 141 |
|
|---|
| [1535] | 142 | bncSettings settings;
|
|---|
| [934] | 143 |
|
|---|
| [1154] | 144 | QDateTime datTim = currentDateAndTimeGPS();
|
|---|
| [934] | 145 |
|
|---|
| 146 | QString hlpStr = bncRinex::nextEpochStr(datTim,
|
|---|
| [9771] | 147 | settings.value("corrIntr").toString(), 3);
|
|---|
| [934] | 148 |
|
|---|
| [9941] | 149 | QString cntStr = (_fileNameSkl.contains("ION")) ? "_ION.ssr" : "_MC.ssr";
|
|---|
| 150 |
|
|---|
| [9771] | 151 | QString fileNameHlp = _fileNameSkl +
|
|---|
| 152 | "_S_" + // stream
|
|---|
| 153 | QString("%1").arg(datTim.date().year()) +
|
|---|
| 154 | QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
|
|---|
| [9941] | 155 | hlpStr + // HM_period
|
|---|
| 156 | cntStr; // mixed ION or CLK
|
|---|
| [934] | 157 |
|
|---|
| [6141] | 158 | if (_fileName == fileNameHlp) {
|
|---|
| [934] | 159 | return;
|
|---|
| 160 | }
|
|---|
| 161 | else {
|
|---|
| [6141] | 162 | _fileName = fileNameHlp;
|
|---|
| [934] | 163 | }
|
|---|
| 164 |
|
|---|
| [6141] | 165 | delete _out;
|
|---|
| [1727] | 166 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
|
|---|
| [8204] | 167 | _out = new ofstream( _fileName.toLatin1().data(), ios_base::out | ios_base::app );
|
|---|
| [1727] | 168 | }
|
|---|
| 169 | else {
|
|---|
| [8204] | 170 | _out = new ofstream( _fileName.toLatin1().data() );
|
|---|
| [1727] | 171 | }
|
|---|
| [934] | 172 | }
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| [6215] | 175 | //
|
|---|
| [866] | 176 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| [1227] | 177 | t_irc RTCM3coDecoder::Decode(char* buffer, int bufLen, vector<string>& errmsg) {
|
|---|
| [868] | 178 |
|
|---|
| [1218] | 179 | errmsg.clear();
|
|---|
| 180 |
|
|---|
| [1227] | 181 | _buffer.append(QByteArray(buffer,bufLen));
|
|---|
| [868] | 182 |
|
|---|
| [1023] | 183 | t_irc retCode = failure;
|
|---|
| 184 |
|
|---|
| [1832] | 185 | while(_buffer.size()) {
|
|---|
| 186 |
|
|---|
| [9025] | 187 | struct SsrCorr::ClockOrbit clkOrbSav;
|
|---|
| 188 | struct SsrCorr::CodeBias codeBiasSav;
|
|---|
| 189 | struct SsrCorr::PhaseBias phaseBiasSav;
|
|---|
| 190 | struct SsrCorr::VTEC vTECSav;
|
|---|
| [11004] | 191 | struct SsrCorr::MetaData metaDataSav;
|
|---|
| [11031] | 192 | struct SsrCorr::Antenna antennaSav;
|
|---|
| [11004] | 193 | // save state
|
|---|
| 194 | memcpy(&clkOrbSav, &_clkOrb, sizeof(clkOrbSav));
|
|---|
| [10534] | 195 | memcpy(&codeBiasSav, &_codeBias, sizeof(codeBiasSav));
|
|---|
| 196 | memcpy(&phaseBiasSav, &_phaseBias, sizeof(phaseBiasSav));
|
|---|
| 197 | memcpy(&vTECSav, &_vTEC, sizeof(vTECSav));
|
|---|
| [11004] | 198 | memcpy(&metaDataSav, &_metaData, sizeof(metaDataSav));
|
|---|
| [11031] | 199 | memcpy(&antennaSav, &_antenna, sizeof(antennaSav));
|
|---|
| [6454] | 200 |
|
|---|
| [879] | 201 | int bytesused = 0;
|
|---|
| [9306] | 202 |
|
|---|
| [11031] | 203 | GCOB_RETURN irc = _ssrCorr->GetSSR(&_clkOrb, &_codeBias, &_vTEC, &_phaseBias, &_metaData, &_antenna,
|
|---|
| [9306] | 204 | _buffer.data(), _buffer.size(), &bytesused);
|
|---|
| [1829] | 205 |
|
|---|
| [1833] | 206 | if (irc <= -30) { // not enough data - restore state and exit loop
|
|---|
| [11004] | 207 | memcpy(&_clkOrb, &clkOrbSav, sizeof(clkOrbSav));
|
|---|
| 208 | memcpy(&_codeBias, &codeBiasSav, sizeof(codeBiasSav));
|
|---|
| 209 | memcpy(&_phaseBias, &phaseBiasSav, sizeof(phaseBiasSav));
|
|---|
| 210 | memcpy(&_vTEC, &vTECSav, sizeof(vTECSav));
|
|---|
| [11011] | 211 | memcpy(&_metaData, &metaDataSav, sizeof(metaDataSav));
|
|---|
| [1833] | 212 | break;
|
|---|
| [869] | 213 | }
|
|---|
| [1832] | 214 |
|
|---|
| [11003] | 215 | else if (irc < 0) { // error - skip this message (or 1 byte if the
|
|---|
| [11004] | 216 | // frame itself couldn't be recognized) and retry
|
|---|
| [11003] | 217 | if (irc != GCOBR_UNKNOWNTYPE) {
|
|---|
| 218 | // A recognized-but-unimplemented message (e.g. Tropospheric or
|
|---|
| 219 | // Regional Ionospheric Correction) leaves _clkOrb/_codeBias/
|
|---|
| 220 | // _phaseBias/_vTEC untouched, and bytesused is already reliably set
|
|---|
| 221 | // from its CRC-validated frame length, so there is nothing to
|
|---|
| 222 | // discard. Every other error code may have left inconsistent
|
|---|
| 223 | // partial state (e.g. mid-satellite-loop) or an unreliable frame
|
|---|
| 224 | // boundary, so reset defensively there. Without this, streams with
|
|---|
| 225 | // frequent unimplemented messages (e.g. dense grid-based Regional
|
|---|
| 226 | // Ionospheric traffic) would wipe unrelated, still-valid orbit/
|
|---|
| 227 | // clock/bias/phase-bias state every time one is skipped.
|
|---|
| 228 | reset();
|
|---|
| 229 | }
|
|---|
| [1842] | 230 | _buffer = _buffer.mid(bytesused ? bytesused : 1);
|
|---|
| [1833] | 231 | }
|
|---|
| 232 |
|
|---|
| 233 | else { // OK or MESSAGEFOLLOWS
|
|---|
| [1828] | 234 | _buffer = _buffer.mid(bytesused);
|
|---|
| 235 |
|
|---|
| [6467] | 236 | if (irc == GCOBR_OK || irc == GCOBR_MESSAGEFOLLOWS ) {
|
|---|
| [6556] | 237 | setEpochTime(); // sets _lastTime
|
|---|
| [7641] | 238 |
|
|---|
| 239 | if (_lastTime.valid()) {
|
|---|
| [6467] | 240 | reopen();
|
|---|
| 241 | checkProviderID();
|
|---|
| 242 | sendResults();
|
|---|
| 243 | retCode = success;
|
|---|
| [919] | 244 | }
|
|---|
| [6467] | 245 | else {
|
|---|
| [10527] | 246 | emit newMessage("RTCM3coDecoder: _lastTime invalid: " + _staID.toLatin1(), true);
|
|---|
| [6467] | 247 | retCode = failure;
|
|---|
| [1829] | 248 | }
|
|---|
| [11002] | 249 | // Keep _phaseBias intact: an Extended Phase Bias message (COBOFS_PBEXT)
|
|---|
| 250 | // arriving later needs to correlate against the satellite/signal list
|
|---|
| 251 | // just published by this Phase Bias message. clock_orbit_rtcm_new.cpp's
|
|---|
| 252 | // COBOFS_PBIAS handling resets pb->NumberOfSat[s] itself before decoding
|
|---|
| 253 | // a fresh message, so this doesn't cause stale data to accumulate.
|
|---|
| 254 | reset(false);
|
|---|
| [869] | 255 | }
|
|---|
| [1829] | 256 | }
|
|---|
| [1833] | 257 | }
|
|---|
| [1832] | 258 |
|
|---|
| [1829] | 259 | return retCode;
|
|---|
| [866] | 260 | }
|
|---|
| [934] | 261 |
|
|---|
| [6215] | 262 | //
|
|---|
| [934] | 263 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| [6141] | 264 | void RTCM3coDecoder::sendResults() {
|
|---|
| [934] | 265 |
|
|---|
| [6455] | 266 | // Orbit and clock corrections of all satellites
|
|---|
| 267 | // ---------------------------------------------
|
|---|
| [6854] | 268 | for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS
|
|---|
| 269 | + CLOCKORBIT_NUMGLONASS
|
|---|
| 270 | + CLOCKORBIT_NUMGALILEO
|
|---|
| 271 | + CLOCKORBIT_NUMQZSS
|
|---|
| 272 | + CLOCKORBIT_NUMSBAS
|
|---|
| 273 | + _clkOrb.NumberOfSat[CLOCKORBIT_SATBDS];
|
|---|
| 274 | ii++) {
|
|---|
| [10572] | 275 | if (corrIsOutOfRange(_clkOrb.Sat[ii])) {
|
|---|
| 276 | continue;
|
|---|
| 277 | }
|
|---|
| [10599] | 278 | char sys = ' ';
|
|---|
| 279 | int num = _clkOrb.Sat[ii].ID;
|
|---|
| 280 | int flag = 0; // to force NAV type usage according SSR standard
|
|---|
| [6454] | 281 | if (ii < _clkOrb.NumberOfSat[CLOCKORBIT_SATGPS]) {
|
|---|
| [10599] | 282 | sys = 'G';
|
|---|
| 283 | flag = t_eph::LNAV;
|
|---|
| [3022] | 284 | }
|
|---|
| [6854] | 285 | else if (ii >= CLOCKORBIT_OFFSETGLONASS &&
|
|---|
| [6855] | 286 | ii < CLOCKORBIT_OFFSETGLONASS + _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]) {
|
|---|
| [10599] | 287 | sys = 'R';
|
|---|
| 288 | flag = t_eph::FDMA_M;
|
|---|
| [3022] | 289 | }
|
|---|
| [6854] | 290 | else if (ii >= CLOCKORBIT_OFFSETGALILEO &&
|
|---|
| [6855] | 291 | ii < CLOCKORBIT_OFFSETGALILEO + _clkOrb.NumberOfSat[CLOCKORBIT_SATGALILEO]) {
|
|---|
| [10599] | 292 | sys = 'E';
|
|---|
| 293 | flag = t_eph::INAV;
|
|---|
| [6854] | 294 | }
|
|---|
| 295 | else if (ii >= CLOCKORBIT_OFFSETQZSS &&
|
|---|
| [6855] | 296 | ii < CLOCKORBIT_OFFSETQZSS + _clkOrb.NumberOfSat[CLOCKORBIT_SATQZSS]) {
|
|---|
| [10599] | 297 | sys = 'J';
|
|---|
| 298 | flag = t_eph::LNAV;
|
|---|
| [6854] | 299 | }
|
|---|
| 300 | else if (ii >= CLOCKORBIT_OFFSETSBAS &&
|
|---|
| [6855] | 301 | ii < CLOCKORBIT_OFFSETSBAS + _clkOrb.NumberOfSat[CLOCKORBIT_SATSBAS]) {
|
|---|
| [10599] | 302 | sys = 'S';
|
|---|
| 303 | flag = t_eph::SBASL1;
|
|---|
| [6854] | 304 | }
|
|---|
| 305 | else if (ii >= CLOCKORBIT_OFFSETBDS &&
|
|---|
| [6855] | 306 | ii < CLOCKORBIT_OFFSETBDS + _clkOrb.NumberOfSat[CLOCKORBIT_SATBDS]) {
|
|---|
| [10599] | 307 | sys = 'C';
|
|---|
| 308 | if (num < 6) {// GEO
|
|---|
| 309 | flag = t_eph::D2;
|
|---|
| 310 | }
|
|---|
| 311 | else if (num > 58 && num < 63) { // GEO
|
|---|
| 312 | flag = t_eph::D2;
|
|---|
| 313 | }
|
|---|
| 314 | else {
|
|---|
| 315 | flag = t_eph::D1;
|
|---|
| 316 | }
|
|---|
| [6854] | 317 | }
|
|---|
| [6141] | 318 | else {
|
|---|
| 319 | continue;
|
|---|
| 320 | }
|
|---|
| [9025] | 321 |
|
|---|
| [6141] | 322 | // Orbit correction
|
|---|
| 323 | // ----------------
|
|---|
| [9025] | 324 | if ( _clkOrb.messageType == _ssrCorr->COTYPE_GPSCOMBINED ||
|
|---|
| 325 | _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSCOMBINED ||
|
|---|
| 326 | _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOCOMBINED ||
|
|---|
| 327 | _clkOrb.messageType == _ssrCorr->COTYPE_QZSSCOMBINED ||
|
|---|
| 328 | _clkOrb.messageType == _ssrCorr->COTYPE_SBASCOMBINED ||
|
|---|
| 329 | _clkOrb.messageType == _ssrCorr->COTYPE_BDSCOMBINED ||
|
|---|
| 330 | _clkOrb.messageType == _ssrCorr->COTYPE_GPSORBIT ||
|
|---|
| 331 | _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSORBIT ||
|
|---|
| 332 | _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOORBIT ||
|
|---|
| 333 | _clkOrb.messageType == _ssrCorr->COTYPE_QZSSORBIT ||
|
|---|
| 334 | _clkOrb.messageType == _ssrCorr->COTYPE_SBASORBIT ||
|
|---|
| 335 | _clkOrb.messageType == _ssrCorr->COTYPE_BDSORBIT ) {
|
|---|
| [3022] | 336 |
|
|---|
| [6141] | 337 | t_orbCorr orbCorr;
|
|---|
| [10599] | 338 | orbCorr._prn.set(sys, num, flag);
|
|---|
| [6564] | 339 | orbCorr._staID = _staID.toStdString();
|
|---|
| [6556] | 340 | orbCorr._iod = _clkOrb.Sat[ii].IOD;
|
|---|
| 341 | orbCorr._time = _lastTime;
|
|---|
| 342 | orbCorr._updateInt = _clkOrb.UpdateInterval;
|
|---|
| [10599] | 343 | orbCorr._system = sys;
|
|---|
| [6556] | 344 | orbCorr._xr[0] = _clkOrb.Sat[ii].Orbit.DeltaRadial;
|
|---|
| 345 | orbCorr._xr[1] = _clkOrb.Sat[ii].Orbit.DeltaAlongTrack;
|
|---|
| 346 | orbCorr._xr[2] = _clkOrb.Sat[ii].Orbit.DeltaCrossTrack;
|
|---|
| 347 | orbCorr._dotXr[0] = _clkOrb.Sat[ii].Orbit.DotDeltaRadial;
|
|---|
| 348 | orbCorr._dotXr[1] = _clkOrb.Sat[ii].Orbit.DotDeltaAlongTrack;
|
|---|
| 349 | orbCorr._dotXr[2] = _clkOrb.Sat[ii].Orbit.DotDeltaCrossTrack;
|
|---|
| [10998] | 350 | orbCorr._ssrFormat = (_type == RTCMssr) ? ssrRtcmOld :
|
|---|
| 351 | (_type == RTCMnewssr) ? ssrRtcmNew : ssrUnknown;
|
|---|
| [3022] | 352 |
|
|---|
| [7652] | 353 | _orbCorrections[_lastTime].append(orbCorr);
|
|---|
| [3022] | 354 |
|
|---|
| [6471] | 355 | _IODs[orbCorr._prn] = _clkOrb.Sat[ii].IOD;
|
|---|
| [6141] | 356 | }
|
|---|
| [3022] | 357 |
|
|---|
| [6455] | 358 | // Clock Corrections
|
|---|
| 359 | // -----------------
|
|---|
| [9025] | 360 | if ( _clkOrb.messageType == _ssrCorr->COTYPE_GPSCOMBINED ||
|
|---|
| 361 | _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSCOMBINED ||
|
|---|
| 362 | _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOCOMBINED ||
|
|---|
| 363 | _clkOrb.messageType == _ssrCorr->COTYPE_QZSSCOMBINED ||
|
|---|
| 364 | _clkOrb.messageType == _ssrCorr->COTYPE_SBASCOMBINED ||
|
|---|
| 365 | _clkOrb.messageType == _ssrCorr->COTYPE_BDSCOMBINED ||
|
|---|
| 366 | _clkOrb.messageType == _ssrCorr->COTYPE_GPSCLOCK ||
|
|---|
| 367 | _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSCLOCK ||
|
|---|
| 368 | _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOCLOCK ||
|
|---|
| 369 | _clkOrb.messageType == _ssrCorr->COTYPE_QZSSCLOCK ||
|
|---|
| 370 | _clkOrb.messageType == _ssrCorr->COTYPE_SBASCLOCK ||
|
|---|
| 371 | _clkOrb.messageType == _ssrCorr->COTYPE_BDSCLOCK) {
|
|---|
| [3022] | 372 |
|
|---|
| [6141] | 373 | t_clkCorr clkCorr;
|
|---|
| [10599] | 374 | clkCorr._prn.set(sys, _clkOrb.Sat[ii].ID, flag);
|
|---|
| [6564] | 375 | clkCorr._staID = _staID.toStdString();
|
|---|
| [6141] | 376 | clkCorr._time = _lastTime;
|
|---|
| [6556] | 377 | clkCorr._updateInt = _clkOrb.UpdateInterval;
|
|---|
| [7014] | 378 | clkCorr._dClk = _clkOrb.Sat[ii].Clock.DeltaA0 / t_CST::c;
|
|---|
| 379 | clkCorr._dotDClk = _clkOrb.Sat[ii].Clock.DeltaA1 / t_CST::c;
|
|---|
| 380 | clkCorr._dotDotDClk = _clkOrb.Sat[ii].Clock.DeltaA2 / t_CST::c;
|
|---|
| [3022] | 381 |
|
|---|
| [6471] | 382 | _lastClkCorrections[clkCorr._prn] = clkCorr;
|
|---|
| 383 |
|
|---|
| 384 | if (_IODs.contains(clkCorr._prn)) {
|
|---|
| 385 | clkCorr._iod = _IODs[clkCorr._prn];
|
|---|
| [7652] | 386 | _clkCorrections[_lastTime].append(clkCorr);
|
|---|
| [3022] | 387 | }
|
|---|
| 388 | }
|
|---|
| [6141] | 389 |
|
|---|
| 390 | // High-Resolution Clocks
|
|---|
| 391 | // ----------------------
|
|---|
| [9025] | 392 | if ( _clkOrb.messageType == _ssrCorr->COTYPE_GPSHR ||
|
|---|
| 393 | _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSHR ||
|
|---|
| 394 | _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOHR ||
|
|---|
| 395 | _clkOrb.messageType == _ssrCorr->COTYPE_QZSSHR ||
|
|---|
| 396 | _clkOrb.messageType == _ssrCorr->COTYPE_SBASHR ||
|
|---|
| 397 | _clkOrb.messageType == _ssrCorr->COTYPE_BDSHR) {
|
|---|
| [10599] | 398 | t_prn prn(sys, _clkOrb.Sat[ii].ID, flag);
|
|---|
| [6471] | 399 | if (_lastClkCorrections.contains(prn)) {
|
|---|
| 400 | t_clkCorr clkCorr;
|
|---|
| [6556] | 401 | clkCorr = _lastClkCorrections[prn];
|
|---|
| 402 | clkCorr._time = _lastTime;
|
|---|
| 403 | clkCorr._updateInt = _clkOrb.UpdateInterval;
|
|---|
| 404 | clkCorr._dClk += _clkOrb.Sat[ii].hrclock / t_CST::c;
|
|---|
| [6471] | 405 | if (_IODs.contains(clkCorr._prn)) {
|
|---|
| 406 | clkCorr._iod = _IODs[clkCorr._prn];
|
|---|
| [10536] | 407 | _clkCorrections[_lastTime].append(clkCorr);
|
|---|
| [6471] | 408 | }
|
|---|
| 409 | }
|
|---|
| [6141] | 410 | }
|
|---|
| [3022] | 411 | }
|
|---|
| 412 |
|
|---|
| [6455] | 413 | // Code Biases
|
|---|
| 414 | // -----------
|
|---|
| [6854] | 415 | for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS
|
|---|
| 416 | + CLOCKORBIT_NUMGLONASS
|
|---|
| 417 | + CLOCKORBIT_NUMGALILEO
|
|---|
| 418 | + CLOCKORBIT_NUMQZSS
|
|---|
| 419 | + CLOCKORBIT_NUMSBAS
|
|---|
| 420 | + _codeBias.NumberOfSat[CLOCKORBIT_SATBDS];
|
|---|
| 421 | ii++) {
|
|---|
| [10599] | 422 | char sys = ' ';
|
|---|
| 423 | int num = _codeBias.Sat[ii].ID;
|
|---|
| 424 | int flag = 0;
|
|---|
| [6454] | 425 | if (ii < _codeBias.NumberOfSat[CLOCKORBIT_SATGPS]) {
|
|---|
| [10599] | 426 | sys = 'G';
|
|---|
| 427 | flag = t_eph::LNAV;
|
|---|
| [3022] | 428 | }
|
|---|
| [6854] | 429 | else if (ii >= CLOCKORBIT_OFFSETGLONASS &&
|
|---|
| [6855] | 430 | ii < CLOCKORBIT_OFFSETGLONASS + _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS]) {
|
|---|
| [10599] | 431 | sys = 'R';
|
|---|
| 432 | flag = t_eph::FDMA_M;
|
|---|
| [3022] | 433 | }
|
|---|
| [6854] | 434 | else if (ii >= CLOCKORBIT_OFFSETGALILEO &&
|
|---|
| [6855] | 435 | ii < CLOCKORBIT_OFFSETGALILEO + _codeBias.NumberOfSat[CLOCKORBIT_SATGALILEO]) {
|
|---|
| [10599] | 436 | sys = 'E';
|
|---|
| 437 | flag = t_eph::INAV;
|
|---|
| [6854] | 438 | }
|
|---|
| 439 | else if (ii >= CLOCKORBIT_OFFSETQZSS &&
|
|---|
| [6855] | 440 | ii < CLOCKORBIT_OFFSETQZSS + _codeBias.NumberOfSat[CLOCKORBIT_SATQZSS]) {
|
|---|
| [10599] | 441 | sys = 'J';
|
|---|
| 442 | flag = t_eph::LNAV;
|
|---|
| [6854] | 443 | }
|
|---|
| 444 | else if (ii >= CLOCKORBIT_OFFSETSBAS &&
|
|---|
| [6855] | 445 | ii < CLOCKORBIT_OFFSETSBAS + _codeBias.NumberOfSat[CLOCKORBIT_SATSBAS]) {
|
|---|
| [10599] | 446 | sys = 'S';
|
|---|
| 447 | flag = t_eph::SBASL1;
|
|---|
| [6854] | 448 | }
|
|---|
| 449 | else if (ii >= CLOCKORBIT_OFFSETBDS &&
|
|---|
| [6855] | 450 | ii < CLOCKORBIT_OFFSETBDS + _codeBias.NumberOfSat[CLOCKORBIT_SATBDS]) {
|
|---|
| [10599] | 451 | sys = 'C';
|
|---|
| 452 | if (num < 6) {// GEO
|
|---|
| 453 | flag = t_eph::D2;
|
|---|
| 454 | }
|
|---|
| 455 | else if (num > 58 && num < 63) { // GEO
|
|---|
| 456 | flag = t_eph::D2;
|
|---|
| 457 | }
|
|---|
| 458 | else {
|
|---|
| 459 | flag = t_eph::D1;
|
|---|
| 460 | }
|
|---|
| [6854] | 461 | }
|
|---|
| [6141] | 462 | else {
|
|---|
| 463 | continue;
|
|---|
| 464 | }
|
|---|
| [6463] | 465 | t_satCodeBias satCodeBias;
|
|---|
| [10599] | 466 | satCodeBias._prn.set(sys, num, flag);
|
|---|
| [6564] | 467 | satCodeBias._staID = _staID.toStdString();
|
|---|
| [6556] | 468 | satCodeBias._time = _lastTime;
|
|---|
| 469 | satCodeBias._updateInt = _codeBias.UpdateInterval;
|
|---|
| [6454] | 470 | for (unsigned jj = 0; jj < _codeBias.Sat[ii].NumberOfCodeBiases; jj++) {
|
|---|
| [9025] | 471 | const SsrCorr::CodeBias::BiasSat::CodeBiasEntry& biasEntry = _codeBias.Sat[ii].Biases[jj];
|
|---|
| [6472] | 472 | t_frqCodeBias frqCodeBias;
|
|---|
| [10599] | 473 | frqCodeBias._rnxType2ch.assign(_ssrCorr->codeTypeToRnxType(sys, biasEntry.Type));
|
|---|
| [6472] | 474 | frqCodeBias._value = biasEntry.Bias;
|
|---|
| [6474] | 475 | if (!frqCodeBias._rnxType2ch.empty()) {
|
|---|
| 476 | satCodeBias._bias.push_back(frqCodeBias);
|
|---|
| 477 | }
|
|---|
| [6141] | 478 | }
|
|---|
| [7652] | 479 | _codeBiases[_lastTime].append(satCodeBias);
|
|---|
| [3022] | 480 | }
|
|---|
| 481 |
|
|---|
| [6487] | 482 | // Phase Biases
|
|---|
| 483 | // -----------
|
|---|
| [11010] | 484 | // _phaseBias is no longer wiped between messages (kept alive so a later
|
|---|
| 485 | // Extended Phase Bias message can correlate against it - see
|
|---|
| 486 | // COBOFS_PBEXT), so without this guard the block below would re-append
|
|---|
| 487 | // the same system's satellites into the output on every other message
|
|---|
| 488 | // decoded in between two actual phase-bias messages. Only emit a
|
|---|
| 489 | // system's satellites once per epoch, tracked per system by comparing
|
|---|
| 490 | // against the epoch we last actually sent for it.
|
|---|
| 491 | bool phaseBiasFresh[CLOCKORBIT_SATNUM];
|
|---|
| 492 | for (unsigned s = 0; s < CLOCKORBIT_SATNUM; s++) {
|
|---|
| 493 | phaseBiasFresh[s] = _phaseBias.NumberOfSat[s] > 0 &&
|
|---|
| 494 | _phaseBias.EpochTime[s] != _phaseBiasSentEpoch[s];
|
|---|
| 495 | if (phaseBiasFresh[s]) {
|
|---|
| 496 | _phaseBiasSentEpoch[s] = _phaseBias.EpochTime[s];
|
|---|
| 497 | }
|
|---|
| 498 | }
|
|---|
| [6854] | 499 | for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS
|
|---|
| 500 | + CLOCKORBIT_NUMGLONASS
|
|---|
| 501 | + CLOCKORBIT_NUMGALILEO
|
|---|
| 502 | + CLOCKORBIT_NUMQZSS
|
|---|
| 503 | + CLOCKORBIT_NUMSBAS
|
|---|
| 504 | + _phaseBias.NumberOfSat[CLOCKORBIT_SATBDS];
|
|---|
| 505 | ii++) {
|
|---|
| [10599] | 506 | char sys = ' ';
|
|---|
| 507 | int num = _phaseBias.Sat[ii].ID;
|
|---|
| 508 | int flag = 0;
|
|---|
| [6487] | 509 | if (ii < _phaseBias.NumberOfSat[CLOCKORBIT_SATGPS]) {
|
|---|
| [11010] | 510 | if (!phaseBiasFresh[CLOCKORBIT_SATGPS]) continue;
|
|---|
| [10599] | 511 | sys = 'G';
|
|---|
| 512 | flag = t_eph::LNAV;
|
|---|
| [6487] | 513 | }
|
|---|
| [6854] | 514 | else if (ii >= CLOCKORBIT_OFFSETGLONASS &&
|
|---|
| [6855] | 515 | ii < CLOCKORBIT_OFFSETGLONASS + _phaseBias.NumberOfSat[CLOCKORBIT_SATGLONASS]) {
|
|---|
| [11010] | 516 | if (!phaseBiasFresh[CLOCKORBIT_SATGLONASS]) continue;
|
|---|
| [10599] | 517 | sys = 'R';
|
|---|
| 518 | flag = t_eph::FDMA_M;
|
|---|
| [6487] | 519 | }
|
|---|
| [6854] | 520 | else if (ii >= CLOCKORBIT_OFFSETGALILEO &&
|
|---|
| [6855] | 521 | ii < CLOCKORBIT_OFFSETGALILEO + _phaseBias.NumberOfSat[CLOCKORBIT_SATGALILEO]) {
|
|---|
| [11010] | 522 | if (!phaseBiasFresh[CLOCKORBIT_SATGALILEO]) continue;
|
|---|
| [10599] | 523 | sys = 'E';
|
|---|
| 524 | flag = t_eph::INAV;
|
|---|
| [6854] | 525 | }
|
|---|
| 526 | else if (ii >= CLOCKORBIT_OFFSETQZSS &&
|
|---|
| [6855] | 527 | ii < CLOCKORBIT_OFFSETQZSS + _phaseBias.NumberOfSat[CLOCKORBIT_SATQZSS]) {
|
|---|
| [11010] | 528 | if (!phaseBiasFresh[CLOCKORBIT_SATQZSS]) continue;
|
|---|
| [10599] | 529 | sys = 'J';
|
|---|
| 530 | flag = t_eph::LNAV;
|
|---|
| [6854] | 531 | }
|
|---|
| 532 | else if (ii >= CLOCKORBIT_OFFSETSBAS &&
|
|---|
| [6855] | 533 | ii < CLOCKORBIT_OFFSETSBAS + _phaseBias.NumberOfSat[CLOCKORBIT_SATSBAS]) {
|
|---|
| [11010] | 534 | if (!phaseBiasFresh[CLOCKORBIT_SATSBAS]) continue;
|
|---|
| [10599] | 535 | sys = 'S';
|
|---|
| 536 | flag = t_eph::SBASL1;
|
|---|
| [6854] | 537 | }
|
|---|
| 538 | else if (ii >= CLOCKORBIT_OFFSETBDS &&
|
|---|
| [6855] | 539 | ii < CLOCKORBIT_OFFSETBDS + _phaseBias.NumberOfSat[CLOCKORBIT_SATBDS]) {
|
|---|
| [11010] | 540 | if (!phaseBiasFresh[CLOCKORBIT_SATBDS]) continue;
|
|---|
| [10599] | 541 | sys = 'C';
|
|---|
| 542 | if (num < 6) {// GEO
|
|---|
| 543 | flag = t_eph::D2;
|
|---|
| 544 | }
|
|---|
| 545 | else if (num > 58 && num < 63) { // GEO
|
|---|
| 546 | flag = t_eph::D2;
|
|---|
| 547 | }
|
|---|
| 548 | else {
|
|---|
| 549 | flag = t_eph::D1;
|
|---|
| 550 | }
|
|---|
| [6854] | 551 | }
|
|---|
| [6487] | 552 | else {
|
|---|
| 553 | continue;
|
|---|
| 554 | }
|
|---|
| 555 | t_satPhaseBias satPhaseBias;
|
|---|
| [10599] | 556 | satPhaseBias._prn.set(sys, num, flag);
|
|---|
| [6564] | 557 | satPhaseBias._staID = _staID.toStdString();
|
|---|
| [6488] | 558 | satPhaseBias._time = _lastTime;
|
|---|
| [6556] | 559 | satPhaseBias._updateInt = _phaseBias.UpdateInterval;
|
|---|
| [10998] | 560 | satPhaseBias._ssrFormat = (_type == RTCMssr) ? ssrRtcmOld :
|
|---|
| [10999] | 561 | (_type == RTCMnewssr) ? ssrRtcmNew : ssrUnknown;
|
|---|
| [11000] | 562 | if (satPhaseBias._ssrFormat == e_ssrFormat::ssrRtcmNew) {
|
|---|
| 563 | satPhaseBias._satYawInfoInd = _phaseBias.SatelliteYawInformationIndicator;
|
|---|
| 564 | satPhaseBias._extPBPhaseInd = _phaseBias.ExtendedPhaseBiasPropertyID;
|
|---|
| 565 | }
|
|---|
| 566 | else {
|
|---|
| 567 | satPhaseBias._dispBiasConsistInd = _phaseBias.DispersiveBiasConsistencyIndicator;
|
|---|
| 568 | satPhaseBias._MelbWuebConsistInd = _phaseBias.MWConsistencyIndicator;
|
|---|
| 569 | }
|
|---|
| [8617] | 570 | satPhaseBias._yaw = _phaseBias.Sat[ii].YawAngle;
|
|---|
| 571 | satPhaseBias._yawRate = _phaseBias.Sat[ii].YawRate;
|
|---|
| [6487] | 572 | for (unsigned jj = 0; jj < _phaseBias.Sat[ii].NumberOfPhaseBiases; jj++) {
|
|---|
| [9025] | 573 | const SsrCorr::PhaseBias::PhaseBiasSat::PhaseBiasEntry& biasEntry = _phaseBias.Sat[ii].Biases[jj];
|
|---|
| [6487] | 574 | t_frqPhaseBias frqPhaseBias;
|
|---|
| [10599] | 575 | frqPhaseBias._rnxType2ch.assign(_ssrCorr->codeTypeToRnxType(sys, biasEntry.Type));
|
|---|
| [11000] | 576 | frqPhaseBias._value = biasEntry.Bias;
|
|---|
| 577 | frqPhaseBias._fixIndicator = biasEntry.IntegerIndicator;
|
|---|
| 578 | if (satPhaseBias._ssrFormat == e_ssrFormat::ssrRtcmNew) {
|
|---|
| 579 | if (satPhaseBias._extPBPhaseInd) {
|
|---|
| 580 | frqPhaseBias._fixWideLaneIndicator = biasEntry.WidelaneGroupIndicator;
|
|---|
| 581 | }
|
|---|
| 582 | }
|
|---|
| 583 | else {
|
|---|
| 584 | frqPhaseBias._fixWideLaneIndicator = biasEntry.WidelaneGroupIndicator;
|
|---|
| 585 | }
|
|---|
| 586 | frqPhaseBias._jumpCounter = biasEntry.DiscontinuityCounter;
|
|---|
| [6487] | 587 | if (!frqPhaseBias._rnxType2ch.empty()) {
|
|---|
| 588 | satPhaseBias._bias.push_back(frqPhaseBias);
|
|---|
| 589 | }
|
|---|
| 590 | }
|
|---|
| [7652] | 591 | _phaseBiases[_lastTime].append(satPhaseBias);
|
|---|
| [6487] | 592 | }
|
|---|
| 593 |
|
|---|
| [6490] | 594 | // Ionospheric Model
|
|---|
| 595 | // -----------------
|
|---|
| 596 | if (_vTEC.NumLayers > 0) {
|
|---|
| [6497] | 597 | _vTecMap[_lastTime]._time = _lastTime;
|
|---|
| [6556] | 598 | _vTecMap[_lastTime]._updateInt = _vTEC.UpdateInterval;
|
|---|
| [6564] | 599 | _vTecMap[_lastTime]._staID = _staID.toStdString();
|
|---|
| [6491] | 600 | for (unsigned ii = 0; ii < _vTEC.NumLayers; ii++) {
|
|---|
| [9025] | 601 | const SsrCorr::VTEC::IonoLayers& ionoLayer = _vTEC.Layers[ii];
|
|---|
| [6491] | 602 | t_vTecLayer layer;
|
|---|
| 603 | layer._height = ionoLayer.Height;
|
|---|
| [6878] | 604 | layer._C.ReSize(ionoLayer.Degree+1, ionoLayer.Order+1);
|
|---|
| 605 | layer._S.ReSize(ionoLayer.Degree+1, ionoLayer.Order+1);
|
|---|
| 606 | for (unsigned iDeg = 0; iDeg <= ionoLayer.Degree; iDeg++) {
|
|---|
| 607 | for (unsigned iOrd = 0; iOrd <= ionoLayer.Order; iOrd++) {
|
|---|
| [6491] | 608 | layer._C[iDeg][iOrd] = ionoLayer.Cosinus[iDeg][iOrd];
|
|---|
| 609 | layer._S[iDeg][iOrd] = ionoLayer.Sinus[iDeg][iOrd];
|
|---|
| 610 | }
|
|---|
| 611 | }
|
|---|
| [6497] | 612 | _vTecMap[_lastTime]._layers.push_back(layer);
|
|---|
| [6491] | 613 | }
|
|---|
| [6490] | 614 | }
|
|---|
| 615 |
|
|---|
| [11008] | 616 | // Metadata (model correction information)
|
|---|
| 617 | // ----------------------------------------
|
|---|
| 618 | if (_metaData.NumEntries > 0) {
|
|---|
| 619 | // Metadata carries no epoch field of its own (it is keyed here by
|
|---|
| 620 | // _lastTime, inherited from whichever other message last set it), so a
|
|---|
| 621 | // fresh, complete message must replace rather than accumulate onto
|
|---|
| 622 | // whatever a previous message at the same _lastTime already stored.
|
|---|
| 623 | _metaDataMap[_lastTime] = t_metaData();
|
|---|
| 624 | _metaDataMap[_lastTime]._time = _lastTime;
|
|---|
| 625 | _metaDataMap[_lastTime]._staID = _staID.toStdString();
|
|---|
| 626 | _metaDataMap[_lastTime]._ssrIOD = _metaData.SSRIOD;
|
|---|
| 627 | _metaDataMap[_lastTime]._providerID = _metaData.SSRProviderID;
|
|---|
| 628 | _metaDataMap[_lastTime]._solutionID = _metaData.SSRSolutionID;
|
|---|
| 629 | for (unsigned ii = 0; ii < _metaData.NumEntries; ii++) {
|
|---|
| 630 | const SsrCorr::MetaData::ModelPart& part = _metaData.Entries[ii];
|
|---|
| 631 | t_metaDataEntry entry;
|
|---|
| 632 | entry._typeIndicator = part.TypeIndicator;
|
|---|
| 633 | entry._applicationIndicator = part.ApplicationIndicator;
|
|---|
| 634 | entry._nonDefaultIndicator = part.nonDefaultIndicator;
|
|---|
| 635 | entry._nonDefaultIdentifier = part.nonDefaultIdentifier;
|
|---|
| 636 | entry._dataIODIndicator = part.DataIODIndicator;
|
|---|
| 637 | entry._dataIOD = part.DataIOD;
|
|---|
| 638 | _metaDataMap[_lastTime]._entries.push_back(entry);
|
|---|
| 639 | }
|
|---|
| 640 | }
|
|---|
| 641 |
|
|---|
| [6455] | 642 | // Dump all older epochs
|
|---|
| 643 | // ---------------------
|
|---|
| 644 | QMutableMapIterator<bncTime, QList<t_orbCorr> > itOrb(_orbCorrections);
|
|---|
| 645 | while (itOrb.hasNext()) {
|
|---|
| 646 | itOrb.next();
|
|---|
| 647 | if (itOrb.key() < _lastTime) {
|
|---|
| 648 | emit newOrbCorrections(itOrb.value());
|
|---|
| [6456] | 649 | t_orbCorr::writeEpoch(_out, itOrb.value());
|
|---|
| [6455] | 650 | itOrb.remove();
|
|---|
| [7641] | 651 | }
|
|---|
| [6141] | 652 | }
|
|---|
| [6455] | 653 | QMutableMapIterator<bncTime, QList<t_clkCorr> > itClk(_clkCorrections);
|
|---|
| 654 | while (itClk.hasNext()) {
|
|---|
| 655 | itClk.next();
|
|---|
| 656 | if (itClk.key() < _lastTime) {
|
|---|
| 657 | emit newClkCorrections(itClk.value());
|
|---|
| [6456] | 658 | t_clkCorr::writeEpoch(_out, itClk.value());
|
|---|
| [6455] | 659 | itClk.remove();
|
|---|
| [7641] | 660 | }
|
|---|
| [6141] | 661 | }
|
|---|
| [6474] | 662 | QMutableMapIterator<bncTime, QList<t_satCodeBias> > itCB(_codeBiases);
|
|---|
| 663 | while (itCB.hasNext()) {
|
|---|
| 664 | itCB.next();
|
|---|
| 665 | if (itCB.key() < _lastTime) {
|
|---|
| 666 | emit newCodeBiases(itCB.value());
|
|---|
| [6475] | 667 | t_satCodeBias::writeEpoch(_out, itCB.value());
|
|---|
| [6474] | 668 | itCB.remove();
|
|---|
| [7641] | 669 | }
|
|---|
| [6474] | 670 | }
|
|---|
| [6487] | 671 | QMutableMapIterator<bncTime, QList<t_satPhaseBias> > itPB(_phaseBiases);
|
|---|
| 672 | while (itPB.hasNext()) {
|
|---|
| 673 | itPB.next();
|
|---|
| 674 | if (itPB.key() < _lastTime) {
|
|---|
| 675 | emit newPhaseBiases(itPB.value());
|
|---|
| 676 | t_satPhaseBias::writeEpoch(_out, itPB.value());
|
|---|
| 677 | itPB.remove();
|
|---|
| [7641] | 678 | }
|
|---|
| [6487] | 679 | }
|
|---|
| [6490] | 680 | QMutableMapIterator<bncTime, t_vTec> itTec(_vTecMap);
|
|---|
| 681 | while (itTec.hasNext()) {
|
|---|
| 682 | itTec.next();
|
|---|
| 683 | if (itTec.key() < _lastTime) {
|
|---|
| 684 | emit newTec(itTec.value());
|
|---|
| 685 | t_vTec::write(_out, itTec.value());
|
|---|
| 686 | itTec.remove();
|
|---|
| [7641] | 687 | }
|
|---|
| [6490] | 688 | }
|
|---|
| [11008] | 689 | QMutableMapIterator<bncTime, t_metaData> itMD(_metaDataMap);
|
|---|
| 690 | while (itMD.hasNext()) {
|
|---|
| 691 | itMD.next();
|
|---|
| 692 | if (itMD.key() < _lastTime) {
|
|---|
| 693 | emit newMetaData(itMD.value());
|
|---|
| 694 | t_metaData::write(_out, itMD.value());
|
|---|
| 695 | itMD.remove();
|
|---|
| 696 | }
|
|---|
| 697 | }
|
|---|
| [3022] | 698 | }
|
|---|
| [5576] | 699 |
|
|---|
| [6215] | 700 | //
|
|---|
| [5576] | 701 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 702 | void RTCM3coDecoder::checkProviderID() {
|
|---|
| 703 |
|
|---|
| [10553] | 704 | if (_clkOrb.SSRProviderID == 0 && _clkOrb.SSRSolutionID == 0 && _clkOrb.SSRIOD == 0) {
|
|---|
| 705 | return;
|
|---|
| 706 | }
|
|---|
| 707 |
|
|---|
| [5576] | 708 | int newProviderID[3];
|
|---|
| [6454] | 709 | newProviderID[0] = _clkOrb.SSRProviderID;
|
|---|
| 710 | newProviderID[1] = _clkOrb.SSRSolutionID;
|
|---|
| 711 | newProviderID[2] = _clkOrb.SSRIOD;
|
|---|
| [10534] | 712 | QString newProviderIDStr = QString(" [SSR Provider ID: %1 SSR Solution ID: %2 SSR IOD: %3]: ")
|
|---|
| 713 | .arg(newProviderID[0]).arg(newProviderID[1]).arg(newProviderID[2]);
|
|---|
| [5576] | 714 |
|
|---|
| 715 | bool alreadySet = false;
|
|---|
| 716 | bool different = false;
|
|---|
| 717 |
|
|---|
| 718 | for (unsigned ii = 0; ii < 3; ii++) {
|
|---|
| 719 | if (_providerID[ii] != -1) {
|
|---|
| 720 | alreadySet = true;
|
|---|
| 721 | }
|
|---|
| 722 | if (_providerID[ii] != newProviderID[ii]) {
|
|---|
| 723 | different = true;
|
|---|
| 724 | }
|
|---|
| 725 | _providerID[ii] = newProviderID[ii];
|
|---|
| 726 | }
|
|---|
| [6215] | 727 |
|
|---|
| [5576] | 728 | if (alreadySet && different) {
|
|---|
| [10768] | 729 | emit newMessage("RTCM3coDecoder: SSR Provider or Service changed " + newProviderIDStr.toLatin1() + _staID.toLatin1(), true);
|
|---|
| [5577] | 730 | emit providerIDChanged(_staID);
|
|---|
| [5576] | 731 | }
|
|---|
| 732 | }
|
|---|
| [6467] | 733 |
|
|---|
| [10572] | 734 | // Check corrections
|
|---|
| 735 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 736 | bool RTCM3coDecoder::corrIsOutOfRange(const SsrCorr::ClockOrbit::SatData& coSat) {
|
|---|
| 737 |
|
|---|
| [10617] | 738 | QString ssrParStr;
|
|---|
| 739 | QString ssrParValue;
|
|---|
| 740 | bool corrIsOutOfRange = false;
|
|---|
| [10572] | 741 |
|
|---|
| [10617] | 742 | switch (_type) {
|
|---|
| 743 | // ======== //
|
|---|
| 744 | // IGS SSR //
|
|---|
| 745 | // ======== //
|
|---|
| 746 | case IGSssr:
|
|---|
| 747 | if (coSat.Clock.DeltaA0 < -209.7151 ||
|
|---|
| 748 | coSat.Clock.DeltaA0 > +209.7151) {
|
|---|
| 749 | ssrParStr = "Clock::DeltaA0";
|
|---|
| 750 | ssrParValue = QString::number(coSat.Clock.DeltaA0, 'f', 4);
|
|---|
| 751 | corrIsOutOfRange = true;
|
|---|
| 752 | }
|
|---|
| 753 | if (coSat.Clock.DeltaA1 < -1.048575 ||
|
|---|
| 754 | coSat.Clock.DeltaA1 > +1.048575) {
|
|---|
| 755 | ssrParStr = "Clock::DeltaA1";
|
|---|
| 756 | ssrParValue = QString::number(coSat.Clock.DeltaA1, 'f', 6);
|
|---|
| 757 | corrIsOutOfRange = true;
|
|---|
| 758 | }
|
|---|
| 759 | if (coSat.Clock.DeltaA2 < -1.3421772 ||
|
|---|
| 760 | coSat.Clock.DeltaA2 > +1.3421772) {
|
|---|
| 761 | ssrParStr = "Clock::DeltaA2";
|
|---|
| 762 | ssrParValue = QString::number(coSat.Clock.DeltaA2, 'f', 7);
|
|---|
| 763 | corrIsOutOfRange = true;
|
|---|
| 764 | }
|
|---|
| [10572] | 765 |
|
|---|
| [10617] | 766 | if (coSat.Orbit.DeltaRadial < -209.7151 ||
|
|---|
| 767 | coSat.Orbit.DeltaRadial > +209.7151) {
|
|---|
| 768 | ssrParStr = "Orbit::DeltaRadial";
|
|---|
| 769 | ssrParValue = QString::number(coSat.Orbit.DeltaRadial, 'f', 4);
|
|---|
| 770 | corrIsOutOfRange = true;
|
|---|
| 771 | }
|
|---|
| 772 |
|
|---|
| 773 | if (coSat.Orbit.DeltaAlongTrack < -209.7148 ||
|
|---|
| 774 | coSat.Orbit.DeltaAlongTrack > +209.7148) {
|
|---|
| 775 | ssrParStr = "Orbit::DeltaAlongTrack";
|
|---|
| 776 | ssrParValue = QString::number(coSat.Orbit.DeltaAlongTrack, 'f', 4);
|
|---|
| 777 | corrIsOutOfRange = true;
|
|---|
| 778 | }
|
|---|
| 779 | if (coSat.Orbit.DeltaCrossTrack < -209.7148 ||
|
|---|
| 780 | coSat.Orbit.DeltaCrossTrack > +209.7148) {
|
|---|
| 781 | ssrParStr = "Orbit::DeltaCrossTrack";
|
|---|
| 782 | ssrParValue = QString::number(coSat.Orbit.DeltaCrossTrack, 'f', 4);
|
|---|
| 783 | corrIsOutOfRange = true;
|
|---|
| 784 | }
|
|---|
| 785 |
|
|---|
| 786 | if (coSat.Orbit.DotDeltaRadial < -1.048575 ||
|
|---|
| 787 | coSat.Orbit.DotDeltaRadial > +1.048575) {
|
|---|
| 788 | ssrParStr = "Orbit::DotDeltaRadial";
|
|---|
| 789 | ssrParValue = QString::number(coSat.Orbit.DotDeltaRadial, 'f', 6);
|
|---|
| 790 | corrIsOutOfRange = true;
|
|---|
| 791 | }
|
|---|
| 792 | if (coSat.Orbit.DotDeltaAlongTrack < -1.048572 ||
|
|---|
| 793 | coSat.Orbit.DotDeltaAlongTrack > +1.048572) {
|
|---|
| 794 | ssrParStr = "Orbit::DotDeltaAlongTrack";
|
|---|
| 795 | ssrParValue = QString::number(coSat.Orbit.DotDeltaAlongTrack, 'f', 6);
|
|---|
| 796 | corrIsOutOfRange = true;
|
|---|
| 797 | }
|
|---|
| 798 | if (coSat.Orbit.DotDeltaCrossTrack < -1.048572 ||
|
|---|
| 799 | coSat.Orbit.DotDeltaCrossTrack > +1.048572) {
|
|---|
| 800 | ssrParStr = "Orbit::DotDeltaCrossTrack";
|
|---|
| 801 | ssrParValue = QString::number(coSat.Orbit.DotDeltaCrossTrack, 'f', 6);
|
|---|
| 802 | corrIsOutOfRange = true;
|
|---|
| 803 | }
|
|---|
| 804 | break;
|
|---|
| 805 | //==========//
|
|---|
| 806 | // RTCM SSR //
|
|---|
| 807 | // =========//
|
|---|
| 808 | case RTCMssr:
|
|---|
| [10754] | 809 | case RTCMnewssr:
|
|---|
| [10617] | 810 | if (coSat.Clock.DeltaA0 < -209.7151 ||
|
|---|
| 811 | coSat.Clock.DeltaA0 > +209.7151) {
|
|---|
| 812 | ssrParStr = "Clock::DeltaA0";
|
|---|
| 813 | ssrParValue = QString::number(coSat.Clock.DeltaA0, 'f', 4);
|
|---|
| 814 | corrIsOutOfRange = true;
|
|---|
| 815 | }
|
|---|
| 816 | if (coSat.Clock.DeltaA1 < -1.048575 ||
|
|---|
| 817 | coSat.Clock.DeltaA1 > +1.048575) {
|
|---|
| 818 | ssrParStr = "Clock::DeltaA1";
|
|---|
| 819 | ssrParValue = QString::number(coSat.Clock.DeltaA1, 'f', 6);
|
|---|
| 820 | corrIsOutOfRange = true;
|
|---|
| 821 | }
|
|---|
| 822 | if (coSat.Clock.DeltaA2 < -1.34217726 ||
|
|---|
| 823 | coSat.Clock.DeltaA2 > +1.34217726) {
|
|---|
| 824 | ssrParStr = "Clock::DeltaA2";
|
|---|
| 825 | ssrParValue = QString::number(coSat.Clock.DeltaA2, 'f', 8);
|
|---|
| 826 | corrIsOutOfRange = true;
|
|---|
| 827 | }
|
|---|
| 828 |
|
|---|
| 829 | if (coSat.Orbit.DeltaRadial < -209.7151 ||
|
|---|
| 830 | coSat.Orbit.DeltaRadial > +209.7151) {
|
|---|
| 831 | ssrParStr = "Orbit::DeltaRadial";
|
|---|
| 832 | ssrParValue = QString::number(coSat.Orbit.DeltaRadial, 'f', 4);
|
|---|
| 833 | corrIsOutOfRange = true;
|
|---|
| 834 | }
|
|---|
| 835 |
|
|---|
| 836 | if (coSat.Orbit.DeltaAlongTrack < -209.7148 ||
|
|---|
| 837 | coSat.Orbit.DeltaAlongTrack > +209.7148) {
|
|---|
| 838 | ssrParStr = "Orbit::DeltaAlongTrack";
|
|---|
| 839 | ssrParValue = QString::number(coSat.Orbit.DeltaAlongTrack, 'f', 4);
|
|---|
| 840 | corrIsOutOfRange = true;
|
|---|
| 841 | }
|
|---|
| 842 | if (coSat.Orbit.DeltaCrossTrack < -209.7148 ||
|
|---|
| 843 | coSat.Orbit.DeltaCrossTrack > +209.7148) {
|
|---|
| 844 | ssrParStr = "Orbit::DeltaCrossTrack";
|
|---|
| 845 | ssrParValue = QString::number(coSat.Orbit.DeltaCrossTrack, 'f', 4);
|
|---|
| 846 | corrIsOutOfRange = true;
|
|---|
| 847 | }
|
|---|
| 848 |
|
|---|
| 849 | if (coSat.Orbit.DotDeltaRadial < -1.048575 ||
|
|---|
| 850 | coSat.Orbit.DotDeltaRadial > +1.048575) {
|
|---|
| 851 | ssrParStr = "Orbit::DotDeltaRadial";
|
|---|
| 852 | ssrParValue = QString::number(coSat.Orbit.DotDeltaRadial, 'f', 6);
|
|---|
| 853 | corrIsOutOfRange = true;
|
|---|
| 854 | }
|
|---|
| 855 | if (coSat.Orbit.DotDeltaAlongTrack < -1.048572 ||
|
|---|
| 856 | coSat.Orbit.DotDeltaAlongTrack > +1.048572) {
|
|---|
| 857 | ssrParStr = "Orbit::DotDeltaAlongTrack";
|
|---|
| 858 | ssrParValue = QString::number(coSat.Orbit.DotDeltaAlongTrack, 'f', 6);
|
|---|
| 859 | corrIsOutOfRange = true;
|
|---|
| 860 | }
|
|---|
| 861 | if (coSat.Orbit.DotDeltaCrossTrack < -1.048572 ||
|
|---|
| 862 | coSat.Orbit.DotDeltaCrossTrack > +1.048572) {
|
|---|
| 863 | ssrParStr = "Orbit::DotDeltaCrossTrack";
|
|---|
| 864 | ssrParValue = QString::number(coSat.Orbit.DotDeltaCrossTrack, 'f', 6);
|
|---|
| 865 | corrIsOutOfRange = true;
|
|---|
| 866 | }
|
|---|
| 867 | break;
|
|---|
| 868 | }
|
|---|
| 869 |
|
|---|
| 870 | if (corrIsOutOfRange) {
|
|---|
| 871 | emit newMessage("RTCM3coDecoder: Correction " + ssrParStr.toLatin1()
|
|---|
| 872 | + " (" + ssrParValue.toLatin1() + ") "
|
|---|
| 873 | + "is out of range " + _staID.toLatin1(), true);
|
|---|
| 874 | }
|
|---|
| 875 |
|
|---|
| 876 | return corrIsOutOfRange;
|
|---|
| [10572] | 877 | }
|
|---|
| 878 |
|
|---|
| [6467] | 879 | //
|
|---|
| 880 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| [6556] | 881 | void RTCM3coDecoder::setEpochTime() {
|
|---|
| [6467] | 882 |
|
|---|
| [11010] | 883 | // _phaseBias is no longer wiped between messages (kept alive so a later
|
|---|
| 884 | // Extended Phase Bias message can correlate against it), so
|
|---|
| 885 | // NumberOfSat[s] > 0 alone no longer means "phase bias was just decoded
|
|---|
| 886 | // this cycle" - it can be stale from many messages ago. Gate each
|
|---|
| 887 | // phase-bias fallback below on the same per-system freshness tracking
|
|---|
| 888 | // sendResults() uses (_phaseBiasSentEpoch), so a stale leftover value
|
|---|
| 889 | // never gets picked as this cycle's epoch.
|
|---|
| 890 | bncTime prevTime = _lastTime;
|
|---|
| [6467] | 891 | _lastTime.reset();
|
|---|
| 892 |
|
|---|
| [6854] | 893 | double epoSecGPS = -1.0;
|
|---|
| 894 | double epoSecGlo = -1.0;
|
|---|
| 895 | double epoSecGal = -1.0;
|
|---|
| 896 | double epoSecQzss = -1.0;
|
|---|
| 897 | double epoSecSbas = -1.0;
|
|---|
| 898 | double epoSecBds = -1.0;
|
|---|
| [6467] | 899 | if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
|
|---|
| [6553] | 900 | epoSecGPS = _clkOrb.EpochTime[CLOCKORBIT_SATGPS]; // 0 .. 604799 s
|
|---|
| [6467] | 901 | }
|
|---|
| 902 | else if (_codeBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
|
|---|
| [7641] | 903 | epoSecGPS = _codeBias.EpochTime[CLOCKORBIT_SATGPS]; // 0 .. 604799 s
|
|---|
| [6467] | 904 | }
|
|---|
| [11010] | 905 | else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0 &&
|
|---|
| 906 | _phaseBias.EpochTime[CLOCKORBIT_SATGPS] != _phaseBiasSentEpoch[CLOCKORBIT_SATGPS]) {
|
|---|
| [7641] | 907 | epoSecGPS = _phaseBias.EpochTime[CLOCKORBIT_SATGPS]; // 0 .. 604799 s
|
|---|
| [6470] | 908 | }
|
|---|
| 909 | else if (_vTEC.NumLayers > 0) {
|
|---|
| [7641] | 910 | epoSecGPS = _vTEC.EpochTime; // 0 .. 604799 s
|
|---|
| [6470] | 911 | }
|
|---|
| [6467] | 912 | else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
|
|---|
| [6470] | 913 | epoSecGlo = _clkOrb.EpochTime[CLOCKORBIT_SATGLONASS]; // 0 .. 86399 s
|
|---|
| [6467] | 914 | }
|
|---|
| 915 | else if (_codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) {
|
|---|
| [6470] | 916 | epoSecGlo = _codeBias.EpochTime[CLOCKORBIT_SATGLONASS]; // 0 .. 86399 s
|
|---|
| [6467] | 917 | }
|
|---|
| [11010] | 918 | else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 &&
|
|---|
| 919 | _phaseBias.EpochTime[CLOCKORBIT_SATGLONASS] != _phaseBiasSentEpoch[CLOCKORBIT_SATGLONASS]) {
|
|---|
| [6470] | 920 | epoSecGlo = _phaseBias.EpochTime[CLOCKORBIT_SATGLONASS]; // 0 .. 86399 s
|
|---|
| 921 | }
|
|---|
| [6854] | 922 | else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0) {
|
|---|
| 923 | epoSecGal = _clkOrb.EpochTime[CLOCKORBIT_SATGALILEO];
|
|---|
| 924 | }
|
|---|
| 925 | else if (_codeBias.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0) {
|
|---|
| 926 | epoSecGal = _codeBias.EpochTime[CLOCKORBIT_SATGALILEO];
|
|---|
| 927 | }
|
|---|
| [11010] | 928 | else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATGALILEO] > 0 &&
|
|---|
| 929 | _phaseBias.EpochTime[CLOCKORBIT_SATGALILEO] != _phaseBiasSentEpoch[CLOCKORBIT_SATGALILEO]) {
|
|---|
| [6854] | 930 | epoSecGal = _phaseBias.EpochTime[CLOCKORBIT_SATGALILEO];
|
|---|
| 931 | }
|
|---|
| 932 | else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATQZSS] > 0) {
|
|---|
| 933 | epoSecQzss = _clkOrb.EpochTime[CLOCKORBIT_SATQZSS];
|
|---|
| 934 | }
|
|---|
| 935 | else if (_codeBias.NumberOfSat[CLOCKORBIT_SATQZSS] > 0) {
|
|---|
| 936 | epoSecQzss = _codeBias.EpochTime[CLOCKORBIT_SATQZSS];
|
|---|
| 937 | }
|
|---|
| [11010] | 938 | else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATQZSS] > 0 &&
|
|---|
| 939 | _phaseBias.EpochTime[CLOCKORBIT_SATQZSS] != _phaseBiasSentEpoch[CLOCKORBIT_SATQZSS]) {
|
|---|
| [6854] | 940 | epoSecQzss = _phaseBias.EpochTime[CLOCKORBIT_SATQZSS];
|
|---|
| 941 | }
|
|---|
| 942 | else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATSBAS] > 0) {
|
|---|
| 943 | epoSecSbas = _clkOrb.EpochTime[CLOCKORBIT_SATSBAS];
|
|---|
| 944 | }
|
|---|
| 945 | else if (_codeBias.NumberOfSat[CLOCKORBIT_SATSBAS] > 0) {
|
|---|
| 946 | epoSecSbas = _codeBias.EpochTime[CLOCKORBIT_SATSBAS];
|
|---|
| 947 | }
|
|---|
| [11010] | 948 | else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATSBAS] > 0 &&
|
|---|
| 949 | _phaseBias.EpochTime[CLOCKORBIT_SATSBAS] != _phaseBiasSentEpoch[CLOCKORBIT_SATSBAS]) {
|
|---|
| [6854] | 950 | epoSecSbas = _phaseBias.EpochTime[CLOCKORBIT_SATSBAS];
|
|---|
| 951 | }
|
|---|
| 952 | else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
|---|
| 953 | epoSecBds = _clkOrb.EpochTime[CLOCKORBIT_SATBDS];
|
|---|
| 954 | }
|
|---|
| 955 | else if (_codeBias.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
|
|---|
| 956 | epoSecBds = _codeBias.EpochTime[CLOCKORBIT_SATBDS];
|
|---|
| 957 | }
|
|---|
| [11010] | 958 | else if (_phaseBias.NumberOfSat[CLOCKORBIT_SATBDS] > 0 &&
|
|---|
| 959 | _phaseBias.EpochTime[CLOCKORBIT_SATBDS] != _phaseBiasSentEpoch[CLOCKORBIT_SATBDS]) {
|
|---|
| [6854] | 960 | epoSecBds = _phaseBias.EpochTime[CLOCKORBIT_SATBDS];
|
|---|
| 961 | }
|
|---|
| [6467] | 962 |
|
|---|
| 963 | // Retrieve current time
|
|---|
| 964 | // ---------------------
|
|---|
| 965 | int currentWeek = 0;
|
|---|
| 966 | double currentSec = 0.0;
|
|---|
| 967 | currentGPSWeeks(currentWeek, currentSec);
|
|---|
| 968 | bncTime currentTime(currentWeek, currentSec);
|
|---|
| 969 |
|
|---|
| 970 | // Set _lastTime close to currentTime
|
|---|
| 971 | // ----------------------------------
|
|---|
| 972 | if (epoSecGPS != -1) {
|
|---|
| 973 | _lastTime.set(currentWeek, epoSecGPS);
|
|---|
| 974 | }
|
|---|
| 975 | else if (epoSecGlo != -1) {
|
|---|
| [10534] | 976 | QDate date = dateAndTimeFromGPSweek(currentTime.gpsw(), currentTime.gpssec()).date();
|
|---|
| 977 | if (_type == IGSssr) {
|
|---|
| [10826] | 978 | epoSecGlo = epoSecGlo + gnumleap(date.year(), date.month(), date.day());
|
|---|
| [10534] | 979 | }
|
|---|
| [11011] | 980 | if (_type == RTCMssr || _type == RTCMnewssr) {
|
|---|
| 981 | // Same GLONASS epoch wire convention (UTC+3h) as RTCMssr
|
|---|
| [9025] | 982 | epoSecGlo = epoSecGlo - 3 * 3600 + gnumleap(date.year(), date.month(), date.day());
|
|---|
| 983 | }
|
|---|
| [6467] | 984 | _lastTime.set(currentWeek, epoSecGlo);
|
|---|
| [6468] | 985 | }
|
|---|
| [6854] | 986 | else if (epoSecGal != -1) {
|
|---|
| 987 | _lastTime.set(currentWeek, epoSecGal);
|
|---|
| 988 | }
|
|---|
| 989 | else if (epoSecQzss != -1) {
|
|---|
| 990 | _lastTime.set(currentWeek, epoSecQzss);
|
|---|
| 991 | }
|
|---|
| 992 | else if (epoSecSbas != -1) {
|
|---|
| 993 | _lastTime.set(currentWeek, epoSecSbas);
|
|---|
| 994 | }
|
|---|
| 995 | else if (epoSecBds != -1) {
|
|---|
| [10826] | 996 | epoSecBds += 14.0;
|
|---|
| 997 | if (epoSecBds > 604800.0) {
|
|---|
| 998 | epoSecBds -= 7.0*24.0*60.0*60.0;
|
|---|
| [7711] | 999 | }
|
|---|
| [6854] | 1000 | _lastTime.set(currentWeek, epoSecBds);
|
|---|
| 1001 | }
|
|---|
| [11011] | 1002 | // Some message types (e.g. Metadata) carry no epoch field of their own,
|
|---|
| 1003 | // and none of the above found anything fresh to use either - fall back
|
|---|
| 1004 | // to the last known valid time rather than leaving _lastTime invalid
|
|---|
| 1005 | // (which would silently drop the message's output entirely).
|
|---|
| 1006 | else if (prevTime.valid()) {
|
|---|
| 1007 | _lastTime = prevTime;
|
|---|
| 1008 | }
|
|---|
| [6468] | 1009 |
|
|---|
| 1010 | if (_lastTime.valid()) {
|
|---|
| [6469] | 1011 | double maxDiff = 12 * 3600.0;
|
|---|
| 1012 | while (_lastTime < currentTime - maxDiff) {
|
|---|
| 1013 | _lastTime = _lastTime + maxDiff;
|
|---|
| [6467] | 1014 | }
|
|---|
| [6469] | 1015 | while (_lastTime > currentTime + maxDiff) {
|
|---|
| 1016 | _lastTime = _lastTime - maxDiff;
|
|---|
| [6467] | 1017 | }
|
|---|
| 1018 | }
|
|---|
| 1019 | }
|
|---|