Changeset 2527 in ntrip for trunk/BNC/RTCM3
- Timestamp:
- Aug 3, 2010, 3:16:59 PM (15 years ago)
- Location:
- trunk/BNC/RTCM3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/RTCM3Decoder.cpp
r2492 r2527 65 65 // Constructor 66 66 //////////////////////////////////////////////////////////////////////////// 67 RTCM3Decoder::RTCM3Decoder(const QString& staID, b ool inputFromFile) :67 RTCM3Decoder::RTCM3Decoder(const QString& staID, bncRawFile* rawFile) : 68 68 GPSDecoder() { 69 69 70 _staID 71 _ inputFromFile = inputFromFile;70 _staID = staID; 71 _rawFile = rawFile; 72 72 73 73 bncSettings settings; 74 74 _checkMountPoint = settings.value("miscMount").toString(); 75 76 // Ensure, that the Decoder uses the "old" convention for the data structure for Rinex2. Perlt77 _Parser.rinex3 = 0;78 79 memset(&_Parser, 0, sizeof(_Parser));80 81 double secGPS;82 currentGPSWeeks(_Parser.GPSWeek, secGPS);83 _Parser.GPSTOW = int(secGPS);84 75 85 76 connect(this, SIGNAL(newGPSEph(gpsephemeris*)), … … 121 112 if ( _coDecoder->Decode(buffer, bufLen, errmsg) == success ) { 122 113 decoded = true; 123 if (!_ inputFromFile && _mode == unknown) {114 if (!_rawFile && _mode == unknown) { 124 115 _mode = corrections; 125 116 } … … 127 118 } 128 119 120 // Find the corresponding parser 121 // ----------------------------- 122 QByteArray staID("default"); 123 if (_rawFile) { 124 staID = _rawFile->staID(); 125 } 126 127 bool newParser = !_parsers.contains(staID); 128 129 RTCM3ParserData& parser = _parsers[staID]; 130 131 // Initialize a new parser 132 // ----------------------- 133 if (newParser) { 134 parser.rinex3 = 0; 135 memset(&parser, 0, sizeof(parser)); 136 double secGPS; 137 currentGPSWeeks(parser.GPSWeek, secGPS); 138 parser.GPSTOW = int(secGPS); 139 } 140 129 141 // Remaining part decodes the Observations 130 142 // --------------------------------------- … … 132 144 133 145 for (int ii = 0; ii < bufLen; ii++) { 134 _Parser.Message[_Parser.MessageSize++] = buffer[ii];135 136 if ( _Parser.MessageSize >= _Parser.NeedBytes) {137 138 while(int rr = RTCM3Parser(& _Parser)) {146 parser.Message[parser.MessageSize++] = buffer[ii]; 147 148 if (parser.MessageSize >= parser.NeedBytes) { 149 150 while(int rr = RTCM3Parser(&parser)) { 139 151 140 152 // RTCMv3 message types 141 153 // -------------------- 142 _typeList.push_back( _Parser.blocktype);154 _typeList.push_back(parser.blocktype); 143 155 144 156 // RTCMv3 antenna descriptor … … 146 158 if(rr == 1007 || rr == 1008 || rr == 1033) 147 159 { 148 _antType.push_back( _Parser.antenna); /* correct ? */160 _antType.push_back(parser.antenna); /* correct ? */ 149 161 } 150 162 … … 155 167 _antList.push_back(t_antInfo()); 156 168 _antList.back().type = t_antInfo::ARP; 157 _antList.back().xx = _Parser.antX * 1e-4;158 _antList.back().yy = _Parser.antY * 1e-4;159 _antList.back().zz = _Parser.antZ * 1e-4;169 _antList.back().xx = parser.antX * 1e-4; 170 _antList.back().yy = parser.antY * 1e-4; 171 _antList.back().zz = parser.antZ * 1e-4; 160 172 _antList.back().message = rr; 161 173 162 174 // Remember station position for 1003 message decoding 163 _antXYZ[0] = _Parser.antX * 1e-4;164 _antXYZ[1] = _Parser.antY * 1e-4;165 _antXYZ[2] = _Parser.antZ * 1e-4;175 _antXYZ[0] = parser.antX * 1e-4; 176 _antXYZ[1] = parser.antY * 1e-4; 177 _antXYZ[2] = parser.antZ * 1e-4; 166 178 } 167 179 … … 172 184 _antList.push_back(t_antInfo()); 173 185 _antList.back().type = t_antInfo::ARP; 174 _antList.back().xx = _Parser.antX * 1e-4;175 _antList.back().yy = _Parser.antY * 1e-4;176 _antList.back().zz = _Parser.antZ * 1e-4;177 _antList.back().height = _Parser.antH * 1e-4;186 _antList.back().xx = parser.antX * 1e-4; 187 _antList.back().yy = parser.antY * 1e-4; 188 _antList.back().zz = parser.antZ * 1e-4; 189 _antList.back().height = parser.antH * 1e-4; 178 190 _antList.back().height_f = true; 179 191 _antList.back().message = rr; 180 192 181 193 // Remember station position for 1003 message decoding 182 _antXYZ[0] = _Parser.antX * 1e-4;183 _antXYZ[1] = _Parser.antY * 1e-4;184 _antXYZ[2] = _Parser.antZ * 1e-4;194 _antXYZ[0] = parser.antX * 1e-4; 195 _antXYZ[1] = parser.antY * 1e-4; 196 _antXYZ[2] = parser.antZ * 1e-4; 185 197 } 186 198 … … 190 202 decoded = true; 191 203 192 if (! _Parser.init) {193 HandleHeader(& _Parser);194 _Parser.init = 1;204 if (!parser.init) { 205 HandleHeader(&parser); 206 parser.init = 1; 195 207 } 196 208 … … 205 217 } 206 218 207 for (int ii = 0; ii < _Parser.Data.numsats; ii++) {219 for (int ii = 0; ii < parser.Data.numsats; ii++) { 208 220 p_obs obs = new t_obs(); 209 221 _obsList.push_back(obs); 210 if ( _Parser.Data.satellites[ii] <= PRN_GPS_END) {222 if (parser.Data.satellites[ii] <= PRN_GPS_END) { 211 223 obs->_o.satSys = 'G'; 212 obs->_o.satNum = _Parser.Data.satellites[ii];224 obs->_o.satNum = parser.Data.satellites[ii]; 213 225 } 214 else if ( _Parser.Data.satellites[ii] <= PRN_GLONASS_END) {226 else if (parser.Data.satellites[ii] <= PRN_GLONASS_END) { 215 227 obs->_o.satSys = 'R'; 216 obs->_o.satNum = _Parser.Data.satellites[ii] - PRN_GLONASS_START + 1;217 obs->_o.slot = _Parser.Data.channels[ii];228 obs->_o.satNum = parser.Data.satellites[ii] - PRN_GLONASS_START + 1; 229 obs->_o.slot = parser.Data.channels[ii]; 218 230 } 219 231 else { 220 232 obs->_o.satSys = 'S'; 221 obs->_o.satNum = _Parser.Data.satellites[ii] - PRN_WAAS_START + 20;233 obs->_o.satNum = parser.Data.satellites[ii] - PRN_WAAS_START + 20; 222 234 } 223 obs->_o.GPSWeek = _Parser.Data.week;224 obs->_o.GPSWeeks = _Parser.Data.timeofweek / 1000.0;235 obs->_o.GPSWeek = parser.Data.week; 236 obs->_o.GPSWeeks = parser.Data.timeofweek / 1000.0; 225 237 226 238 // Estimate "GPS Integer L1 Pseudorange Modulus Ambiguity" … … 261 273 // Loop over all data types 262 274 // ------------------------ 263 for (int jj = 0; jj < _Parser.numdatatypesGPS; jj++) {275 for (int jj = 0; jj < parser.numdatatypesGPS; jj++) { 264 276 int v = 0; 265 277 // sepearated declaration and initalization of df and pos. Perlt 266 278 int df; 267 279 int pos; 268 df = _Parser.dataflag[jj];269 pos = _Parser.datapos[jj];270 if ( ( _Parser.Data.dataflags[ii] & df)271 && !isnan( _Parser.Data.measdata[ii][pos])272 && !isinf( _Parser.Data.measdata[ii][pos])) {280 df = parser.dataflag[jj]; 281 pos = parser.datapos[jj]; 282 if ( (parser.Data.dataflags[ii] & df) 283 && !isnan(parser.Data.measdata[ii][pos]) 284 && !isinf(parser.Data.measdata[ii][pos])) { 273 285 v = 1; 274 286 } 275 287 else { 276 df = _Parser.dataflagGPS[jj];277 pos = _Parser.dataposGPS[jj];278 if ( ( _Parser.Data.dataflags[ii] & df)279 && !isnan( _Parser.Data.measdata[ii][pos])280 && !isinf( _Parser.Data.measdata[ii][pos])) {288 df = parser.dataflagGPS[jj]; 289 pos = parser.dataposGPS[jj]; 290 if ( (parser.Data.dataflags[ii] & df) 291 && !isnan(parser.Data.measdata[ii][pos]) 292 && !isinf(parser.Data.measdata[ii][pos])) { 281 293 v = 1; 282 294 } … … 287 299 else 288 300 { 289 int isat = ( _Parser.Data.satellites[ii] < 120290 ? _Parser.Data.satellites[ii]291 : _Parser.Data.satellites[ii] - 80);301 int isat = (parser.Data.satellites[ii] < 120 302 ? parser.Data.satellites[ii] 303 : parser.Data.satellites[ii] - 80); 292 304 293 305 // variables df and pos are used consequently. Perlt 294 306 if (df & GNSSDF_C1DATA) { 295 obs->_o.C1 = _Parser.Data.measdata[ii][pos] + modulusAmb;307 obs->_o.C1 = parser.Data.measdata[ii][pos] + modulusAmb; 296 308 } 297 309 else if (df & GNSSDF_C2DATA) { 298 obs->_o.C2 = _Parser.Data.measdata[ii][pos] + modulusAmb;310 obs->_o.C2 = parser.Data.measdata[ii][pos] + modulusAmb; 299 311 } 300 312 else if (df & GNSSDF_P1DATA) { 301 obs->_o.P1 = _Parser.Data.measdata[ii][pos] + modulusAmb;313 obs->_o.P1 = parser.Data.measdata[ii][pos] + modulusAmb; 302 314 } 303 315 else if (df & GNSSDF_P2DATA) { 304 obs->_o.P2 = _Parser.Data.measdata[ii][pos] + modulusAmb;316 obs->_o.P2 = parser.Data.measdata[ii][pos] + modulusAmb; 305 317 } 306 318 else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) { 307 obs->_o.L1 = _Parser.Data.measdata[ii][pos] + modulusAmb;308 obs->_o.SNR1 = _Parser.Data.snrL1[ii];309 obs->_o.lock_timei_L1 = _Parser.lastlockGPSl1[isat];319 obs->_o.L1 = parser.Data.measdata[ii][pos] + modulusAmb; 320 obs->_o.SNR1 = parser.Data.snrL1[ii]; 321 obs->_o.lock_timei_L1 = parser.lastlockGPSl1[isat]; 310 322 } 311 323 else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) { 312 obs->_o.L2 = _Parser.Data.measdata[ii][pos] + modulusAmb;313 obs->_o.SNR2 = _Parser.Data.snrL2[ii];314 obs->_o.lock_timei_L2 = _Parser.lastlockGPSl2[isat];324 obs->_o.L2 = parser.Data.measdata[ii][pos] + modulusAmb; 325 obs->_o.SNR2 = parser.Data.snrL2[ii]; 326 obs->_o.lock_timei_L2 = parser.lastlockGPSl2[isat]; 315 327 } 316 328 else if (df & (GNSSDF_S1CDATA|GNSSDF_S1PDATA)) { 317 obs->_o.S1 = _Parser.Data.measdata[ii][pos];329 obs->_o.S1 = parser.Data.measdata[ii][pos]; 318 330 } 319 331 else if (df & (GNSSDF_S2CDATA|GNSSDF_S2PDATA)) { 320 obs->_o.S2 = _Parser.Data.measdata[ii][pos];332 obs->_o.S2 = parser.Data.measdata[ii][pos]; 321 333 } 322 334 } … … 329 341 else if (rr == 1019) { 330 342 decoded = true; 331 gpsephemeris* ep = new gpsephemeris( _Parser.ephemerisGPS);343 gpsephemeris* ep = new gpsephemeris(parser.ephemerisGPS); 332 344 emit newGPSEph(ep); 333 345 } … … 337 349 else if (rr == 1020) { 338 350 decoded = true; 339 glonassephemeris* ep = new glonassephemeris( _Parser.ephemerisGLONASS);351 glonassephemeris* ep = new glonassephemeris(parser.ephemerisGLONASS); 340 352 emit newGlonassEph(ep); 341 353 } … … 343 355 } 344 356 } 345 if (!_ inputFromFile && _mode == unknown && decoded) {357 if (!_rawFile && _mode == unknown && decoded) { 346 358 _mode = observations; 347 359 } -
trunk/BNC/RTCM3/RTCM3Decoder.h
r2387 r2527 33 33 #include "RTCM3coDecoder.h" 34 34 #include "ephemeris.h" 35 #include "bncrawfile.h" 35 36 36 37 extern "C" { … … 41 42 Q_OBJECT 42 43 public: 43 RTCM3Decoder(const QString& staID, b ool inputFromFile);44 RTCM3Decoder(const QString& staID, bncRawFile* rawFile); 44 45 virtual ~RTCM3Decoder(); 45 46 virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg); … … 61 62 QString _staID; 62 63 QString _checkMountPoint; 63 struct RTCM3ParserData _Parser;64 QMap<QByteArray, RTCM3ParserData> _parsers; 64 65 RTCM3coDecoder* _coDecoder; 65 66 t_mode _mode; … … 67 68 std::map<std::string, t_ephGPS> _ephList; 68 69 double _antXYZ[3]; 69 b ool _inputFromFile;70 bncRawFile* _rawFile; 70 71 }; 71 72
Note:
See TracChangeset
for help on using the changeset viewer.