Changeset 6454 in ntrip


Ignore:
Timestamp:
Dec 27, 2014, 3:07:19 PM (9 years ago)
Author:
mervart
Message:
 
Location:
trunk/BNC/src/RTCM3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp

    r6215 r6454  
    8787          BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
    8888
    89   memset(&_co, 0, sizeof(_co));
    90   memset(&_bias, 0, sizeof(_bias));
     89  memset(&_clkOrb,    0, sizeof(_clkOrb));
     90  memset(&_codeBias,  0, sizeof(_codeBias));
     91  memset(&_phaseBias, 0, sizeof(_phaseBias));
     92  memset(&_vTEC,      0, sizeof(_vTEC));
    9193
    9294  _providerID[0] = -1;
     
    147149  while(_buffer.size()) {
    148150
     151    struct ClockOrbit clkOrbSav;
     152    struct CodeBias   codeBiasSav;
     153    struct PhaseBias  phaseBiasSav;
     154    struct VTEC       vTECSav;
     155    memcpy(&clkOrbSav,    &_clkOrb,    sizeof(clkOrbSav)); // save state
     156    memcpy(&codeBiasSav,  &_codeBias,  sizeof(codeBiasSav));
     157    memcpy(&phaseBiasSav, &_phaseBias, sizeof(phaseBiasSav));
     158    memcpy(&vTECSav,      &_vTEC,      sizeof(vTECSav));
     159
    149160    int bytesused = 0;
    150     struct ClockOrbit co_sav;
    151     memcpy(&co_sav, &_co, sizeof(co_sav)); // save state
    152 
    153     GCOB_RETURN irc = GetSSR(&_co, &_bias, 0, 0, _buffer.data(),
    154                                         _buffer.size(), &bytesused);
     161    GCOB_RETURN irc = GetSSR(&_clkOrb, &_codeBias, &_vTEC, &_phaseBias,
     162                             _buffer.data(), _buffer.size(), &bytesused);
    155163
    156164    if      (irc <= -30) { // not enough data - restore state and exit loop
    157       memcpy(&_co, &co_sav, sizeof(co_sav));
     165      memcpy(&_clkOrb,    &clkOrbSav,    sizeof(clkOrbSav));
     166      memcpy(&_codeBias,  &codeBiasSav,  sizeof(codeBiasSav));
     167      memcpy(&_phaseBias, &phaseBiasSav, sizeof(phaseBiasSav));
     168      memcpy(&_vTEC,      &vTECSav,      sizeof(vTECSav));
    158169      break;
    159170    }
    160171
    161172    else if (irc < 0) {    // error  - skip 1 byte and retry
    162       memset(&_co, 0, sizeof(_co));
    163       memset(&_bias, 0, sizeof(_bias));
     173      memset(&_clkOrb,    0, sizeof(_clkOrb));
     174      memset(&_codeBias,  0, sizeof(_codeBias));
     175      memset(&_phaseBias, 0, sizeof(_phaseBias));
     176      memset(&_vTEC,      0, sizeof(_vTEC));
    164177      _buffer = _buffer.mid(bytesused ? bytesused : 1);
    165178    }
     
    168181      _buffer = _buffer.mid(bytesused);
    169182
    170       if ( (irc == GCOBR_OK          || irc == GCOBR_MESSAGEFOLLOWS ) &&
    171            (_co.NumberOfSat[CLOCKORBIT_SATGPS]   > 0 || _co.NumberOfSat[CLOCKORBIT_SATGLONASS]   > 0 ||
    172             _bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ) {
     183      if ( (irc == GCOBR_OK || irc == GCOBR_MESSAGEFOLLOWS ) &&
     184           (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS]   > 0 || _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]   > 0 ||
     185            _codeBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ) {
    173186
    174187        reopen();
     
    182195        // Correction Epoch from GPSEpochTime
    183196        // ----------------------------------
    184         if (_co.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
    185           int GPSEpochTime = (_co.NumberOfSat[CLOCKORBIT_SATGPS] > 0) ?
    186                              _co.EpochTime[CLOCKORBIT_SATGPS] : _bias.EpochTime[CLOCKORBIT_SATGPS];
     197        if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _codeBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
     198          int GPSEpochTime = (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0) ?
     199                             _clkOrb.EpochTime[CLOCKORBIT_SATGPS] : _codeBias.EpochTime[CLOCKORBIT_SATGPS];
    187200          if      (GPSweeksHlp > GPSEpochTime + 86400.0) {
    188201            GPSweek += 1;
     
    196209        // Correction Epoch from Glonass Epoch
    197210        // -----------------------------------
    198         else if (_co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0){
    199           int GLONASSEpochTime = (_co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ?
    200                               _co.EpochTime[CLOCKORBIT_SATGLONASS] : _bias.EpochTime[CLOCKORBIT_SATGLONASS];
     211        else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 || _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0){
     212          int GLONASSEpochTime = (_clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ?
     213                              _clkOrb.EpochTime[CLOCKORBIT_SATGLONASS] : _codeBias.EpochTime[CLOCKORBIT_SATGLONASS];
    201214
    202215          // Second of day (GPS time) from Glonass Epoch
     
    234247        retCode = success;
    235248
    236         memset(&_co, 0, sizeof(_co));
    237         memset(&_bias, 0, sizeof(_bias));
     249        memset(&_clkOrb,    0, sizeof(_clkOrb));
     250        memset(&_codeBias,  0, sizeof(_codeBias));
     251        memset(&_phaseBias, 0, sizeof(_phaseBias));
     252        memset(&_vTEC,      0, sizeof(_vTEC));
    238253      }
    239254    }
     
    252267  // Loop over all satellites (GPS and Glonass)
    253268  // ------------------------------------------
    254   for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _co.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
     269  for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
    255270    char sysCh = ' ';
    256     if      (ii < _co.NumberOfSat[CLOCKORBIT_SATGPS]) {
     271    if      (ii < _clkOrb.NumberOfSat[CLOCKORBIT_SATGPS]) {
    257272      sysCh = 'G';
    258273    }
     
    266281    // Orbit correction
    267282    // ----------------
    268     if ( _co.messageType == COTYPE_GPSCOMBINED     ||
    269          _co.messageType == COTYPE_GLONASSCOMBINED ||
    270          _co.messageType == COTYPE_GPSORBIT        ||
    271          _co.messageType == COTYPE_GLONASSORBIT    ) {
     283    if ( _clkOrb.messageType == COTYPE_GPSCOMBINED     ||
     284         _clkOrb.messageType == COTYPE_GLONASSCOMBINED ||
     285         _clkOrb.messageType == COTYPE_GPSORBIT        ||
     286         _clkOrb.messageType == COTYPE_GLONASSORBIT    ) {
    272287
    273288      t_orbCorr orbCorr;
    274       orbCorr._prn.set(sysCh, _co.Sat[ii].ID);
     289      orbCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID);
    275290      orbCorr._staID    = _staID.toAscii().data();
    276       orbCorr._iod      = _co.Sat[ii].IOD;
     291      orbCorr._iod      = _clkOrb.Sat[ii].IOD;
    277292      orbCorr._time     = _lastTime;
    278293      orbCorr._system   = 'R';
    279       orbCorr._xr[0]    = _co.Sat[ii].Orbit.DeltaRadial;
    280       orbCorr._xr[1]    = _co.Sat[ii].Orbit.DeltaAlongTrack;
    281       orbCorr._xr[2]    = _co.Sat[ii].Orbit.DeltaCrossTrack;
    282       orbCorr._dotXr[0] = _co.Sat[ii].Orbit.DotDeltaRadial;
    283       orbCorr._dotXr[1] = _co.Sat[ii].Orbit.DotDeltaAlongTrack;
    284       orbCorr._dotXr[2] = _co.Sat[ii].Orbit.DotDeltaCrossTrack;
     294      orbCorr._xr[0]    = _clkOrb.Sat[ii].Orbit.DeltaRadial;
     295      orbCorr._xr[1]    = _clkOrb.Sat[ii].Orbit.DeltaAlongTrack;
     296      orbCorr._xr[2]    = _clkOrb.Sat[ii].Orbit.DeltaCrossTrack;
     297      orbCorr._dotXr[0] = _clkOrb.Sat[ii].Orbit.DotDeltaRadial;
     298      orbCorr._dotXr[1] = _clkOrb.Sat[ii].Orbit.DotDeltaAlongTrack;
     299      orbCorr._dotXr[2] = _clkOrb.Sat[ii].Orbit.DotDeltaCrossTrack;
    285300
    286301      orbCorrections.push_back(orbCorr);
    287302
    288       _IODs[orbCorr._prn.toString()] = _co.Sat[ii].IOD;
    289     }
    290 
    291     if ( _co.messageType == COTYPE_GPSCOMBINED     ||
    292          _co.messageType == COTYPE_GLONASSCOMBINED ||
    293          _co.messageType == COTYPE_GPSCLOCK        ||
    294          _co.messageType == COTYPE_GLONASSCLOCK    ) {
     303      _IODs[orbCorr._prn.toString()] = _clkOrb.Sat[ii].IOD;
     304    }
     305
     306    if ( _clkOrb.messageType == COTYPE_GPSCOMBINED     ||
     307         _clkOrb.messageType == COTYPE_GLONASSCOMBINED ||
     308         _clkOrb.messageType == COTYPE_GPSCLOCK        ||
     309         _clkOrb.messageType == COTYPE_GLONASSCLOCK    ) {
    295310
    296311      t_clkCorr clkCorr;
    297       clkCorr._prn.set(sysCh, _co.Sat[ii].ID);
     312      clkCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID);
    298313      clkCorr._staID      = _staID.toAscii().data();
    299314      clkCorr._time       = _lastTime;
    300       clkCorr._dClk       = _co.Sat[ii].Clock.DeltaA0 / t_CST::c;
    301       clkCorr._dotDClk    = _co.Sat[ii].Clock.DeltaA1 / t_CST::c;
    302       clkCorr._dotDotDClk = _co.Sat[ii].Clock.DeltaA2 / t_CST::c;
     315      clkCorr._dClk       = _clkOrb.Sat[ii].Clock.DeltaA0 / t_CST::c;
     316      clkCorr._dotDClk    = _clkOrb.Sat[ii].Clock.DeltaA1 / t_CST::c;
     317      clkCorr._dotDotDClk = _clkOrb.Sat[ii].Clock.DeltaA2 / t_CST::c;
    303318      clkCorr._clkPartial = 0.0;
    304319
     
    311326    // High-Resolution Clocks
    312327    // ----------------------
    313     if ( _co.messageType == COTYPE_GPSHR     ||
    314          _co.messageType == COTYPE_GLONASSHR ) {
     328    if ( _clkOrb.messageType == COTYPE_GPSHR     ||
     329         _clkOrb.messageType == COTYPE_GLONASSHR ) {
    315330    }
    316331  }
     
    319334  // ------------------------------------------
    320335  QList<t_satBias> satBiases;
    321   for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _bias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
     336  for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
    322337    char sysCh = ' ';
    323     if      (ii < _bias.NumberOfSat[CLOCKORBIT_SATGPS]) {
     338    if      (ii < _codeBias.NumberOfSat[CLOCKORBIT_SATGPS]) {
    324339      sysCh = 'G';
    325340    }
     
    331346    }
    332347    t_satBias satBias;
    333     satBias._prn.set(sysCh, _bias.Sat[ii].ID);
     348    satBias._prn.set(sysCh, _codeBias.Sat[ii].ID);
    334349    satBias._time      = _lastTime;
    335350    satBias._nx        = 0;
    336351    satBias._jumpCount = 0;
    337     for (unsigned jj = 0; jj < _bias.Sat[ii].NumberOfCodeBiases; jj++) {
     352    for (unsigned jj = 0; jj < _codeBias.Sat[ii].NumberOfCodeBiases; jj++) {
    338353    }
    339354  }
     
    364379void RTCM3coDecoder::checkProviderID() {
    365380
    366   if (_co.SSRProviderID == 0 && _co.SSRSolutionID == 0 && _co.SSRIOD == 0) {
     381  if (_clkOrb.SSRProviderID == 0 && _clkOrb.SSRSolutionID == 0 && _clkOrb.SSRIOD == 0) {
    367382    return;
    368383  }
    369384
    370385  int newProviderID[3];
    371   newProviderID[0] = _co.SSRProviderID;
    372   newProviderID[1] = _co.SSRSolutionID;
    373   newProviderID[2] = _co.SSRIOD;
     386  newProviderID[0] = _clkOrb.SSRProviderID;
     387  newProviderID[1] = _clkOrb.SSRSolutionID;
     388  newProviderID[2] = _clkOrb.SSRIOD;
    374389
    375390  bool alreadySet = false;
  • trunk/BNC/src/RTCM3/RTCM3coDecoder.h

    r6141 r6454  
    5959  QString        _fileName;
    6060  QByteArray     _buffer;
    61   ClockOrbit     _co;
    62   CodeBias       _bias;
     61  ClockOrbit     _clkOrb;
     62  CodeBias       _codeBias;
     63  PhaseBias      _phaseBias;
     64  VTEC           _vTEC;
    6365  int            _providerID[3];
    6466  bncTime        _lastTime;
Note: See TracChangeset for help on using the changeset viewer.