Changeset 3523 in ntrip
- Timestamp:
- Dec 14, 2011, 1:19:13 PM (13 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncgetthread.cpp
r3517 r3523 111 111 112 112 initialize(); 113 initDecoder(); 113 114 } 114 115 … … 125 126 126 127 _isToBeDeleted = false; 127 _decoder = 0;128 _decoderAux = 0;129 128 _query = 0; 130 129 _nextSleep = 0; … … 294 293 #endif 295 294 296 // Instantiate the decoder 297 // ----------------------- 295 _latencyChecker = new latencyChecker(_staID); 296 } 297 298 // Instantiate the decoder 299 ////////////////////////////////////////////////////////////////////////////// 300 t_irc bncGetThread::initDecoder() { 301 298 302 if (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1 || 299 303 _format.indexOf("RTCM 2") != -1 ) { 300 304 emit(newMessage(_staID + ": Get data in RTCM 2.x format", true)); 301 _decoder = new RTCM2Decoder(_staID.data());305 _decoders[_staID] = new RTCM2Decoder(_staID.data()); 302 306 } 303 307 else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1 || 304 308 _format.indexOf("RTCM 3") != -1 ) { 305 309 emit(newMessage(_staID + ": Get data in RTCM 3.x format", true)); 306 _decoder = new RTCM3Decoder(_staID, _rawFile);307 connect((RTCM3Decoder*) _decoder, SIGNAL(newMessage(QByteArray,bool)),310 _decoders[_staID] = new RTCM3Decoder(_staID, _rawFile); 311 connect((RTCM3Decoder*) decoder(), SIGNAL(newMessage(QByteArray,bool)), 308 312 this, SIGNAL(newMessage(QByteArray,bool))); 309 313 } 310 314 else if (_format.indexOf("GPSS") != -1 || _format.indexOf("BNC") != -1) { 311 315 emit(newMessage(_staID + ": Get Data in GPSS format", true)); 312 _decoder = new gpssDecoder();316 _decoders[_staID] = new gpssDecoder(); 313 317 } 314 318 else if (_format.indexOf("ZERO") != -1) { 315 319 emit(newMessage(_staID + ": Get data in original format", true)); 316 _decoder = new bncZeroDecoder(_staID);320 _decoders[_staID] = new bncZeroDecoder(_staID); 317 321 } 318 322 else if (_format.indexOf("RTNET") != -1) { 319 323 emit(newMessage(_staID + ": Get data in RTNet format", true)); 320 _decoder = new bncRtnetDecoder();324 _decoders[_staID] = new bncRtnetDecoder(); 321 325 } 322 326 else if (_format.indexOf("HASS2ASCII") != -1) { 323 327 emit(newMessage(_staID + ": Get data in HASS2ASCII format", true)); 324 _decoder = new hassDecoder(_staID);328 _decoders[_staID] = new hassDecoder(_staID); 325 329 } 326 330 else { 327 331 emit(newMessage(_staID + ": Unknown data format " + _format, true)); 328 332 _isToBeDeleted = true; 329 } 330 331 _latencyChecker = new latencyChecker(_staID); 333 return failure; 334 } 332 335 333 336 msleep(100); //sleep 0.1 sec 337 338 return success; 339 } 340 341 // Current decoder in use 342 //////////////////////////////////////////////////////////////////////////// 343 GPSDecoder* bncGetThread::decoder() { 344 if (_decoders.contains(_staID) || initDecoder() == success) { 345 return _decoders.value(_staID); 346 } 347 else { 348 return 0; 349 } 334 350 } 335 351 … … 345 361 } 346 362 delete _PPPclient; 347 delete _decoder; 348 delete _decoderAux; 363 QMapIterator<QString, GPSDecoder*> it(_decoders); 364 while (it.hasNext()) { 365 it.next(); 366 delete it.value(); 367 } 349 368 delete _rnx; 350 369 delete _rawFile; … … 383 402 // Delete old observations 384 403 // ----------------------- 385 _decoder->_obsList.clear();386 if (_decoderAux) {387 _decoderAux->_obsList.clear();388 }389 390 GPSDecoder* decoderUsed = _decoder;404 QMapIterator<QString, GPSDecoder*> itDec(_decoders); 405 while (itDec.hasNext()) { 406 itDec.next(); 407 GPSDecoder* decoder = itDec.value(); 408 decoder->_obsList.clear(); 409 } 391 410 392 411 // Read Data … … 398 417 else if (_rawFile) { 399 418 data = _rawFile->readChunk(); 400 if (_rawFile->format() == "HASS2ASCII") { 401 if (_decoderAux == 0) { 402 emit(newMessage(_rawFile->staID() + ": Get data in HASS2ASCII format", true)); 403 _decoderAux = new hassDecoder(_rawFile->staID()); 404 } 405 decoderUsed = _decoderAux; 406 } 419 _format = _rawFile->format(); 420 _staID = _rawFile->staID(); 407 421 408 422 if (data.isEmpty()) { … … 442 456 // ----------- 443 457 vector<string> errmsg; 444 decoder Used->_obsList.clear();445 t_irc irc = decoder Used->Decode(data.data(), data.size(), errmsg);458 decoder()->_obsList.clear(); 459 t_irc irc = decoder()->Decode(data.data(), data.size(), errmsg); 446 460 447 461 // Perform various scans and checks 448 462 // -------------------------------- 449 463 _latencyChecker->checkOutage(irc == success); 450 _latencyChecker->checkObsLatency(decoder Used->_obsList);451 _latencyChecker->checkCorrLatency(decoder Used->corrGPSEpochTime());464 _latencyChecker->checkObsLatency(decoder()->_obsList); 465 _latencyChecker->checkCorrLatency(decoder()->corrGPSEpochTime()); 452 466 453 467 emit newLatency(_staID, _latencyChecker->currentLatency()); … … 457 471 // Loop over all observations (observations output) 458 472 // ------------------------------------------------ 459 QListIterator<t_obs> it(decoder Used->_obsList);473 QListIterator<t_obs> it(decoder()->_obsList); 460 474 bool firstObs = true; 461 475 while (it.hasNext()) { … … 469 483 // Check observation epoch 470 484 // ----------------------- 471 if (!_rawFile && !dynamic_cast<gpssDecoder*>(decoder Used)) {485 if (!_rawFile && !dynamic_cast<gpssDecoder*>(decoder())) { 472 486 int week; 473 487 double sec; … … 523 537 firstObs = false; 524 538 } 525 decoder Used->_obsList.clear();539 decoder()->_obsList.clear(); 526 540 } 527 541 catch (Exception& exc) { … … 625 639 // RTCM message types 626 640 // ------------------ 627 for (int ii = 0; ii < _decoder->_typeList.size(); ii++) {628 QString type = QString("%1 ").arg( _decoder->_typeList[ii]);641 for (int ii = 0; ii <decoder()->_typeList.size(); ii++) { 642 QString type = QString("%1 ").arg(decoder()->_typeList[ii]); 629 643 emit(newMessage(_staID + ": Received message type " + type.toAscii(), true)); 630 644 } … … 632 646 // RTCMv3 antenna descriptor 633 647 // ------------------------- 634 for (int ii=0;ii< _decoder->_antType.size();ii++) {635 QString ant1 = QString("%1 ").arg( _decoder->_antType[ii]);648 for (int ii=0;ii<decoder()->_antType.size();ii++) { 649 QString ant1 = QString("%1 ").arg(decoder()->_antType[ii]); 636 650 emit(newMessage(_staID + ": Antenna descriptor " + ant1.toAscii(), true)); 637 651 } … … 639 653 // RTCM Antenna Coordinates 640 654 // ------------------------ 641 for (int ii=0; ii < _decoder->_antList.size(); ii++) {655 for (int ii=0; ii <decoder()->_antList.size(); ii++) { 642 656 QByteArray antT; 643 if ( _decoder->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {657 if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) { 644 658 antT = "ARP"; 645 659 } 646 else if ( _decoder->_antList[ii].type == GPSDecoder::t_antInfo::APC) {660 else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) { 647 661 antT = "APC"; 648 662 } 649 663 QByteArray ant1, ant2, ant3; 650 ant1 = QString("%1 ").arg( _decoder->_antList[ii].xx,0,'f',4).toAscii();651 ant2 = QString("%1 ").arg( _decoder->_antList[ii].yy,0,'f',4).toAscii();652 ant3 = QString("%1 ").arg( _decoder->_antList[ii].zz,0,'f',4).toAscii();664 ant1 = QString("%1 ").arg(decoder()->_antList[ii].xx,0,'f',4).toAscii(); 665 ant2 = QString("%1 ").arg(decoder()->_antList[ii].yy,0,'f',4).toAscii(); 666 ant3 = QString("%1 ").arg(decoder()->_antList[ii].zz,0,'f',4).toAscii(); 653 667 emit(newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true)); 654 668 emit(newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true)); 655 669 emit(newMessage(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true)); 656 if ( _decoder->_antList[ii].height_f) {657 QByteArray ant4 = QString("%1 ").arg( _decoder->_antList[ii].height,0,'f',4).toAscii();670 if (decoder()->_antList[ii].height_f) { 671 QByteArray ant4 = QString("%1 ").arg(decoder()->_antList[ii].height,0,'f',4).toAscii(); 658 672 emit(newMessage(_staID + ": Antenna height above marker " + ant4 + "m", true)); 659 673 } 660 emit(newAntCrd(_staID, _decoder->_antList[ii].xx,661 _decoder->_antList[ii].yy, _decoder->_antList[ii].zz,674 emit(newAntCrd(_staID, decoder()->_antList[ii].xx, 675 decoder()->_antList[ii].yy, decoder()->_antList[ii].zz, 662 676 antT)); 663 677 } … … 666 680 667 681 #ifdef MLS_SOFTWARE 668 for (int ii=0; ii < _decoder->_antList.size(); ii++) {682 for (int ii=0; ii <decoder()->_antList.size(); ii++) { 669 683 QByteArray antT; 670 if ( _decoder->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {684 if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) { 671 685 antT = "ARP"; 672 686 } 673 else if ( _decoder->_antList[ii].type == GPSDecoder::t_antInfo::APC) {687 else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) { 674 688 antT = "APC"; 675 689 } 676 emit(newAntCrd(_staID, _decoder->_antList[ii].xx,677 _decoder->_antList[ii].yy, _decoder->_antList[ii].zz,690 emit(newAntCrd(_staID, decoder()->_antList[ii].xx, 691 decoder()->_antList[ii].yy, decoder()->_antList[ii].zz, 678 692 antT)); 679 693 } 680 694 681 for (int ii = 0; ii < _decoder->_typeList.size(); ii++) {682 emit(newRTCMMessage(_staID, _decoder->_typeList[ii]));695 for (int ii = 0; ii <decoder()->_typeList.size(); ii++) { 696 emit(newRTCMMessage(_staID, decoder()->_typeList[ii])); 683 697 } 684 698 #endif … … 687 701 688 702 689 _decoder->_typeList.clear();690 _decoder->_antType.clear();691 _decoder->_antList.clear();703 decoder()->_typeList.clear(); 704 decoder()->_antType.clear(); 705 decoder()->_antList.clear(); 692 706 } 693 707 … … 722 736 ////////////////////////////////////////////////////////////////////////////// 723 737 void bncGetThread::slotNewEphGPS(gpsephemeris gpseph) { 724 RTCM2Decoder* decoder2 = dynamic_cast<RTCM2Decoder*>( _decoder);725 RTCM3Decoder* decoder3 = dynamic_cast<RTCM3Decoder*>( _decoder);738 RTCM2Decoder* decoder2 = dynamic_cast<RTCM2Decoder*>(decoder()); 739 RTCM3Decoder* decoder3 = dynamic_cast<RTCM3Decoder*>(decoder()); 726 740 727 741 if ( decoder2 ) { -
trunk/BNC/bncgetthread.h
r3515 r3523 100 100 private: 101 101 enum t_serialNMEA {NO_NMEA, MANUAL_NMEA, AUTO_NMEA}; 102 t_irc initDecoder(); 103 GPSDecoder* decoder(); 102 104 103 105 void initialize(); … … 105 107 void scanRTCM(); 106 108 107 GPSDecoder* _decoder; 108 GPSDecoder* _decoderAux; 109 bncNetQuery* _query; 110 QUrl _mountPoint; 111 QByteArray _staID; 112 QByteArray _staID_extra; 113 QByteArray _format; 114 QByteArray _latitude; 115 QByteArray _longitude; 116 QByteArray _height; 117 QByteArray _nmea; 118 QByteArray _ntripVersion; 119 int _nextSleep; 120 int _iMount; 121 int _samplingRate; 122 bncRinex* _rnx; 123 bncRawFile* _rawFile; 124 QextSerialPort* _serialPort; 125 bool _isToBeDeleted; 126 latencyChecker* _latencyChecker; 127 QString _miscMount; 128 QFile* _serialOutFile; 129 t_serialNMEA _serialNMEA; 130 QMutex _mutex; 131 bncPPPclient* _PPPclient; 132 bool _rawOutput; 133 QMap<QString, long> _prnLastEpo; 109 QMap<QString, GPSDecoder*> _decoders; 110 bncNetQuery* _query; 111 QUrl _mountPoint; 112 QByteArray _staID; 113 QByteArray _staID_extra; 114 QByteArray _format; 115 QByteArray _latitude; 116 QByteArray _longitude; 117 QByteArray _height; 118 QByteArray _nmea; 119 QByteArray _ntripVersion; 120 int _nextSleep; 121 int _iMount; 122 int _samplingRate; 123 bncRinex* _rnx; 124 bncRawFile* _rawFile; 125 QextSerialPort* _serialPort; 126 bool _isToBeDeleted; 127 latencyChecker* _latencyChecker; 128 QString _miscMount; 129 QFile* _serialOutFile; 130 t_serialNMEA _serialNMEA; 131 QMutex _mutex; 132 bncPPPclient* _PPPclient; 133 bool _rawOutput; 134 QMap<QString, long> _prnLastEpo; 134 135 }; 135 136
Note:
See TracChangeset
for help on using the changeset viewer.