Changeset 1832 in ntrip


Ignore:
Timestamp:
May 7, 2009, 10:07:52 AM (15 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

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

    r1829 r1832  
    123123  errmsg.clear();
    124124
    125 //printf("Start with %d new bytes and %d old bytes\n", bufLen, _buffer.size());
    126 
    127125  _buffer.append(QByteArray(buffer,bufLen));
    128126
    129127  t_irc retCode = failure;
    130128
    131   while(_buffer.size())
    132   {
     129  while(_buffer.size()) {
     130
    133131    int bytesused = 0;
    134     struct ClockOrbit cox;
    135     memcpy(&cox, &_co, sizeof(cox)); /* save state */
     132    struct ClockOrbit co_sav;
     133    memcpy(&co_sav, &_co, sizeof(co_sav)); // save state
    136134
    137135    GCOB_RETURN irc = GetClockOrbitBias(&_co, &_bias, _buffer.data(),
    138136                                        _buffer.size(), &bytesused);
    139137
    140 //printf("used %4d buffer %4d return %4d first byte %2x\n", bytesused, _buffer.size(), irc, (unsigned char)_buffer.data()[0]);
    141     if(irc <= -30) /* not enough data found */
    142     {
    143       /* copy previous state back - necessary in case of MESSAGEFOLLOWS with
    144          incomplete second block */
    145       memcpy(&_co, &cox, sizeof(cox));
     138    if      (irc <= -30) { // not enough data
     139      memcpy(&_co, &co_sav, sizeof(co_sav));
    146140      if (retCode != success) {
    147141        _GPSweeks = -1.0;
     
    149143      return retCode;
    150144    }
    151     else if(irc >= 0)
    152     {
     145
     146    else if (irc >= 0) {  // OK or MESSAGEFOLLOWS
    153147      _buffer = _buffer.mid(bytesused);
    154148
    155       if(irc == GCOBR_OK) /* correctly and complete decoded */
    156       {
     149      if (irc == GCOBR_OK) {
    157150        reopen();
    158 
    159 //printf("TIME: gps %d glonass %d gps_tod %d\n", _co.GPSEpochTime, _co.GLONASSEpochTime, _co.GPSEpochTime%86400);
    160 
    161151        int    GPSweek;
    162152        currentGPSWeeks(GPSweek, _GPSweeks);
     
    217207      }
    218208    }
    219     else /* error  - skip 1 byte and retry */
    220     {
     209
     210    else { // error  - skip 1 byte and retry
    221211      memset(&_co, 0, sizeof(_co));
    222212      _buffer = _buffer.mid(1);
    223213    }
    224214  }
    225 //printf("Return with %d (success = %d) bytes %d\n", retCode, success, _buffer.size());
     215
    226216  return retCode;
    227217}
Note: See TracChangeset for help on using the changeset viewer.