Changeset 254 in ntrip for trunk/BNC/RTCM
- Timestamp:
- Oct 18, 2006, 8:46:26 AM (18 years ago)
- Location:
- trunk/BNC/RTCM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/BNC/RTCM/RTCM2.cpp ¶
r253 r254 6 6 // 7 7 // Module for extraction of RTCM2 messages 8 // 9 // References: 10 // 11 // RTCM 10402.3 Recommended Standards for Differential GNSS (Global 12 // Navigation Satellite Systems) Service; RTCM Paper 136-2001/SC104-STD, 13 // Version 2.3, 20 Aug. 2001; Radio Technical Commission For Maritime 14 // Services, Alexandria, Virgina (2001). 15 // ICD-GPS-200; Navstar GPS Space Segment / Navigation User Interfaces; 16 // Revison C; 25 Sept. 1997; Arinc Research Corp., El Segundo (1997). 17 // Jensen M.; RTCM2ASC Documentation; 18 // URL http://kom.aau.dk/~borre/masters/receiver/rtcm2asc.htm; 19 // last accessed 17 Sep. 2006 20 // Sager J.; Decoder for RTCM SC-104 data from a DGPS beacon receiver; 21 // URL http://www.wsrcc.com/wolfgang/ftp/rtcm-0.3.tar.gz; 22 // last accessed 17 Sep. 2006 8 23 // 9 24 // Notes: … … 21 36 // 2006/10/14 LMV Exception handling 22 37 // 2006/10/17 OMO Removed obsolete check of multiple message indicator 38 // 2006/10/17 OMO Fixed parity handling 23 39 // 24 40 // (c) DLR/GSOC … … 26 42 //------------------------------------------------------------------------------ 27 43 44 #include <bitset> 28 45 #include <cmath> 29 46 #include <fstream> … … 35 52 #include "RTCM2.h" 36 53 54 // Activate (1) or deactivate (0) debug output for tracing parity errors and 55 // undersized packets in get(Unsigned)Bits 56 57 #define DEBUG 0 37 58 38 59 using namespace std; … … 166 187 byteParity[(t>>16)&0xff] ^ byteParity[(t>>24) ] ); 167 188 168 return ( (W !=0) && ((W &0x3f) == p));189 return ( (W & 0x3f) == p); 169 190 170 191 }; … … 256 277 buf.erase(0,5); 257 278 279 #if (DEBUG>0) 280 if (!validParity()) { 281 cout << "Parity error " 282 << bitset<32>(all()) << endl; 283 }; 284 #endif 258 285 failure = false; 259 286 … … 272 299 }; 273 300 301 #if (DEBUG>0) 302 if (!validParity()) { 303 cout << "Parity error " 304 << bitset<32>(all()) << endl; 305 }; 306 #endif 274 307 failure = false; 275 308 … … 299 332 buf.erase(0,i); 300 333 334 #if (DEBUG>0) 335 if (!validParity()) { 336 cout << "Parity error " 337 << bitset<32>(all()) << endl; 338 }; 339 #endif 301 340 failure = false; 302 341 … … 317 356 }; 318 357 358 #if (DEBUG>0) 359 if (!validParity()) { 360 cout << "Parity error " 361 << bitset<32>(all()) << endl; 362 }; 363 #endif 319 364 failure = false; 320 365 … … 383 428 W.getHeader(buf); 384 429 H1 = W.value(); 385 if (W.fail()) { clear(); W=W_old; buf=buf_old; return; } 430 if (W.fail()) { clear(); W=W_old; buf=buf_old; return; }; 431 if (!W.validParity()) { clear(); return; }; 386 432 387 433 W.get(buf); 388 434 H2 = W.value(); 389 if (W.fail()) { clear(); W=W_old; buf=buf_old; return; } 435 if (W.fail()) { clear(); W=W_old; buf=buf_old; return; }; 436 if (!W.validParity()) { clear(); return; }; 390 437 391 438 n = nDataWords(); … … 394 441 W.get(buf); 395 442 DW[i] = W.value(); 396 if (W.fail()) { clear(); W=W_old; buf=buf_old; return; } 443 if (W.fail()) { clear(); W=W_old; buf=buf_old; return; }; 444 if (!W.validParity()) { clear(); return; }; 397 445 }; 398 446 … … 412 460 W.getHeader(inp); 413 461 H1 = W.value(); 414 if (W.fail()) { clear(); return; } 462 if (W.fail() || !W.validParity()) { clear(); return; } 415 463 416 464 W.get(inp); 417 465 H2 = W.value(); 418 if (W.fail()) { clear(); return; } 466 if (W.fail() || !W.validParity()) { clear(); return; } 419 467 420 468 n = nDataWords(); … … 423 471 W.get(inp); 424 472 DW[i] = W.value(); 425 if (W.fail()) { clear(); return; } 473 if (W.fail() || !W.validParity()) { clear(); return; } 426 474 }; 427 475 … … 433 481 // Input operator 434 482 // 435 // Reads an RTCM 3packet from the input stream.483 // Reads an RTCM2 packet from the input stream. 436 484 // 437 485 … … 509 557 510 558 if ( 24*DW.size() < start+n-1 ) { 559 #if (DEBUG>0) 560 cerr << "Debug output RTCM2packet::getUnsignedBits" << endl 561 << " P.msgType: " << setw(5) << msgType() << endl 562 << " P.nDataWords: " << setw(5) << nDataWords() << endl 563 << " start: " << setw(5) << start << endl 564 << " n: " << setw(5) << n << endl 565 << " P.H1: " << setw(5) << bitset<32>(H1) << endl 566 << " P.H2: " << setw(5) << bitset<32>(H2) << endl 567 << endl 568 << flush; 569 #endif 511 570 throw("Error: Packet too short in RTCM2packet::getUnsignedBits"); 512 571 } … … 558 617 559 618 if ( 24*DW.size() < start+n-1 ) { 619 #if (DEBUG>0) 620 cerr << "Debug output RTCM2packet::getUnsignedBits" << endl 621 << " P.msgType: " << setw(5) << msgType() << endl 622 << " P.nDataWords: " << setw(5) << nDataWords() << endl 623 << " start: " << setw(5) << start << endl 624 << " n: " << setw(5) << n << endl 625 << " P.H1: " << setw(5) << bitset<32>(H1) << endl 626 << " P.H2: " << setw(5) << bitset<32>(H2) << endl 627 << endl 628 << flush; 629 #endif 560 630 throw("Error: Packet too short in RTCM2packet::getBits"); 561 631 } -
TabularUnified trunk/BNC/RTCM/RTCM2.h ¶
r253 r254 18 18 // URL http://kom.aau.dk/~borre/masters/receiver/rtcm2asc.htm; 19 19 // last accessed 17 Sep. 2006 20 // Sager J.;Decoder for RTCM SC-104 data from a DGPS beacon receiver; 20 // Sager J.; Decoder for RTCM SC-104 data from a DGPS beacon receiver; 21 21 // URL http://www.wsrcc.com/wolfgang/ftp/rtcm-0.3.tar.gz; 22 22 // last accessed 17 Sep. 2006
Note:
See TracChangeset
for help on using the changeset viewer.