Changeset 1832 in ntrip
- Timestamp:
- May 7, 2009, 10:07:52 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/RTCM3coDecoder.cpp
r1829 r1832 123 123 errmsg.clear(); 124 124 125 //printf("Start with %d new bytes and %d old bytes\n", bufLen, _buffer.size());126 127 125 _buffer.append(QByteArray(buffer,bufLen)); 128 126 129 127 t_irc retCode = failure; 130 128 131 while(_buffer.size()) 132 { 129 while(_buffer.size()) { 130 133 131 int bytesused = 0; 134 struct ClockOrbit co x;135 memcpy(&co x, &_co, sizeof(cox)); /* save state */132 struct ClockOrbit co_sav; 133 memcpy(&co_sav, &_co, sizeof(co_sav)); // save state 136 134 137 135 GCOB_RETURN irc = GetClockOrbitBias(&_co, &_bias, _buffer.data(), 138 136 _buffer.size(), &bytesused); 139 137 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)); 146 140 if (retCode != success) { 147 141 _GPSweeks = -1.0; … … 149 143 return retCode; 150 144 } 151 else if(irc >= 0) 152 {145 146 else if (irc >= 0) { // OK or MESSAGEFOLLOWS 153 147 _buffer = _buffer.mid(bytesused); 154 148 155 if(irc == GCOBR_OK) /* correctly and complete decoded */ 156 { 149 if (irc == GCOBR_OK) { 157 150 reopen(); 158 159 //printf("TIME: gps %d glonass %d gps_tod %d\n", _co.GPSEpochTime, _co.GLONASSEpochTime, _co.GPSEpochTime%86400);160 161 151 int GPSweek; 162 152 currentGPSWeeks(GPSweek, _GPSweeks); … … 217 207 } 218 208 } 219 else /* error - skip 1 byte and retry */ 220 {209 210 else { // error - skip 1 byte and retry 221 211 memset(&_co, 0, sizeof(_co)); 222 212 _buffer = _buffer.mid(1); 223 213 } 224 214 } 225 //printf("Return with %d (success = %d) bytes %d\n", retCode, success, _buffer.size()); 215 226 216 return retCode; 227 217 }
Note:
See TracChangeset
for help on using the changeset viewer.