Changeset 3560 in ntrip
- Timestamp:
- Dec 24, 2011, 10:55:51 AM (13 years ago)
- Location:
- trunk/BNC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/bncgetthread.cpp
r3559 r3560 129 129 _PPPclient = 0; 130 130 _miscMount = settings.value("miscMount").toString(); 131 _decoder = 0; 131 132 132 133 // Serial Port … … 277 278 t_irc bncGetThread::initDecoder() { 278 279 280 _decoder = 0; 281 279 282 if (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1 || 280 283 _format.indexOf("RTCM 2") != -1 ) { 281 284 emit(newMessage(_staID + ": Get data in RTCM 2.x format", true)); 282 _decoder s[_staID]= new RTCM2Decoder(_staID.data());285 _decoder = new RTCM2Decoder(_staID.data()); 283 286 } 284 287 else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1 || … … 286 289 emit(newMessage(_staID + ": Get data in RTCM 3.x format", true)); 287 290 RTCM3Decoder* newDecoder = new RTCM3Decoder(_staID, _rawFile); 288 _decoder s[_staID]= newDecoder;291 _decoder = newDecoder; 289 292 connect((RTCM3Decoder*) newDecoder, SIGNAL(newMessage(QByteArray,bool)), 290 293 this, SIGNAL(newMessage(QByteArray,bool))); … … 292 295 else if (_format.indexOf("GPSS") != -1 || _format.indexOf("BNC") != -1) { 293 296 emit(newMessage(_staID + ": Get Data in GPSS format", true)); 294 _decoder s[_staID]= new gpssDecoder();297 _decoder = new gpssDecoder(); 295 298 } 296 299 else if (_format.indexOf("ZERO") != -1) { 297 300 emit(newMessage(_staID + ": Get data in original format", true)); 298 _decoder s[_staID]= new bncZeroDecoder(_staID);301 _decoder = new bncZeroDecoder(_staID); 299 302 } 300 303 else if (_format.indexOf("RTNET") != -1) { 301 304 emit(newMessage(_staID + ": Get data in RTNet format", true)); 302 _decoder s[_staID]= new bncRtnetDecoder();305 _decoder = new bncRtnetDecoder(); 303 306 } 304 307 else if (_format.indexOf("HASS2ASCII") != -1) { 305 308 emit(newMessage(_staID + ": Get data in HASS2ASCII format", true)); 306 _decoder s[_staID]= new hassDecoder(_staID);309 _decoder = new hassDecoder(_staID); 307 310 } 308 311 else { … … 314 317 msleep(100); //sleep 0.1 sec 315 318 316 if (_decoders.contains(_staID)) { 317 _decoders[_staID]->initRinex(_staID, _mountPoint, _latitude, _longitude, 318 _nmea, _ntripVersion); 319 } 320 else { 321 emit(newMessage(_staID + ": no decoder initialized " + _format, true)); 322 _isToBeDeleted = true; 323 return failure; 319 _decoder->initRinex(_staID, _mountPoint, _latitude, _longitude, 320 _nmea, _ntripVersion); 321 322 if (_rawFile) { 323 _decodersRaw[_staID] = _decoder; 324 324 } 325 325 … … 348 348 QMutexLocker locker(&_mutexDecoder); 349 349 350 if ( _decoders.contains(_staID) || initDecoder() == success) {351 return _decoder s[_staID];350 if (!_rawFile) { 351 return _decoder; 352 352 } 353 353 else { 354 return 0; 355 } 354 if (_decodersRaw.contains(_staID) || initDecoder() == success) { 355 return _decodersRaw[_staID]; 356 } 357 } 358 359 return 0; 356 360 } 357 361 … … 367 371 } 368 372 delete _PPPclient; 369 QMapIterator<QString, GPSDecoder*> it(_decoders); 370 while (it.hasNext()) { 371 it.next(); 372 delete it.value(); 373 if (_rawFile) { 374 QMapIterator<QString, GPSDecoder*> it(_decodersRaw); 375 while (it.hasNext()) { 376 it.next(); 377 delete it.value(); 378 } 379 } 380 else { 381 delete _decoder; 373 382 } 374 383 delete _rawFile; … … 409 418 // Delete old observations 410 419 // ----------------------- 411 QMapIterator<QString, GPSDecoder*> itDec(_decoders); 412 while (itDec.hasNext()) { 413 itDec.next(); 414 GPSDecoder* decoder = itDec.value(); 415 decoder->_obsList.clear(); 420 if (_rawFile) { 421 QMapIterator<QString, GPSDecoder*> itDec(_decodersRaw); 422 while (itDec.hasNext()) { 423 itDec.next(); 424 GPSDecoder* decoder = itDec.value(); 425 decoder->_obsList.clear(); 426 } 427 } 428 else { 429 _decoder->_obsList.clear(); 416 430 } 417 431 … … 569 583 if (_query && _query->status() == bncNetQuery::running) { 570 584 _nextSleep = 0; 571 QMapIterator<QString, GPSDecoder*> itDec(_decoders); 585 if (_rawFile) { 586 QMapIterator<QString, GPSDecoder*> itDec(_decodersRaw); 587 while (itDec.hasNext()) { 588 itDec.next(); 589 GPSDecoder* decoder = itDec.value(); 590 decoder->setRinexReconnectFlag(false); 591 } 592 } 593 else { 594 _decoder->setRinexReconnectFlag(false); 595 } 596 return success; 597 } 598 599 // Start a new query 600 // ----------------- 601 if (!_rawFile) { 602 603 sleep(_nextSleep); 604 if (_nextSleep == 0) { 605 _nextSleep = 1; 606 } 607 else { 608 _nextSleep = 2 * _nextSleep; 609 if (_nextSleep > 256) { 610 _nextSleep = 256; 611 } 612 #ifdef MLS_SOFTWARE 613 if (_nextSleep > 4) { 614 _nextSleep = 4; 615 } 616 #endif 617 } 618 619 delete _query; 620 if (_ntripVersion == "U") { 621 _query = new bncNetQueryUdp(); 622 } 623 else if (_ntripVersion == "R") { 624 _query = new bncNetQueryRtp(); 625 } 626 else if (_ntripVersion == "S") { 627 _query = new bncNetQueryS(); 628 } 629 else if (_ntripVersion == "N") { 630 _query = new bncNetQueryV0(); 631 } 632 else if (_ntripVersion == "UN") { 633 _query = new bncNetQueryUdp0(); 634 } 635 else if (_ntripVersion == "2") { 636 _query = new bncNetQueryV2(false); 637 } 638 else if (_ntripVersion == "2s") { 639 _query = new bncNetQueryV2(true); 640 } 641 else { 642 _query = new bncNetQueryV1(); 643 } 644 if (_nmea == "yes" && _serialNMEA != AUTO_NMEA) { 645 QByteArray gga = ggaString(_latitude, _longitude, "100.0"); 646 _query->startRequest(_mountPoint, gga); 647 } 648 else { 649 _query->startRequest(_mountPoint, ""); 650 } 651 if (_query->status() != bncNetQuery::running) { 652 return failure; 653 } 654 } 655 656 if (_rawFile) { 657 QMapIterator<QString, GPSDecoder*> itDec(_decodersRaw); 572 658 while (itDec.hasNext()) { 573 659 itDec.next(); … … 575 661 decoder->setRinexReconnectFlag(false); 576 662 } 577 return success; 578 } 579 580 // Start a new query 581 // ----------------- 582 if (!_rawFile) { 583 584 sleep(_nextSleep); 585 if (_nextSleep == 0) { 586 _nextSleep = 1; 587 } 588 else { 589 _nextSleep = 2 * _nextSleep; 590 if (_nextSleep > 256) { 591 _nextSleep = 256; 592 } 593 #ifdef MLS_SOFTWARE 594 if (_nextSleep > 4) { 595 _nextSleep = 4; 596 } 597 #endif 598 } 599 600 delete _query; 601 if (_ntripVersion == "U") { 602 _query = new bncNetQueryUdp(); 603 } 604 else if (_ntripVersion == "R") { 605 _query = new bncNetQueryRtp(); 606 } 607 else if (_ntripVersion == "S") { 608 _query = new bncNetQueryS(); 609 } 610 else if (_ntripVersion == "N") { 611 _query = new bncNetQueryV0(); 612 } 613 else if (_ntripVersion == "UN") { 614 _query = new bncNetQueryUdp0(); 615 } 616 else if (_ntripVersion == "2") { 617 _query = new bncNetQueryV2(false); 618 } 619 else if (_ntripVersion == "2s") { 620 _query = new bncNetQueryV2(true); 621 } 622 else { 623 _query = new bncNetQueryV1(); 624 } 625 if (_nmea == "yes" && _serialNMEA != AUTO_NMEA) { 626 QByteArray gga = ggaString(_latitude, _longitude, "100.0"); 627 _query->startRequest(_mountPoint, gga); 628 } 629 else { 630 _query->startRequest(_mountPoint, ""); 631 } 632 if (_query->status() != bncNetQuery::running) { 633 return failure; 634 } 635 } 636 637 QMapIterator<QString, GPSDecoder*> itDec(_decoders); 638 while (itDec.hasNext()) { 639 itDec.next(); 640 GPSDecoder* decoder = itDec.value(); 641 decoder->setRinexReconnectFlag(false); 663 } 664 else { 665 _decoder->setRinexReconnectFlag(false); 642 666 } 643 667 -
trunk/BNC/bncgetthread.h
r3559 r3560 104 104 void scanRTCM(); 105 105 106 QMap<QString, GPSDecoder*> _decoders; 106 QMap<QString, GPSDecoder*> _decodersRaw; 107 GPSDecoder* _decoder; 107 108 bncNetQuery* _query; 108 109 QUrl _mountPoint;
Note:
See TracChangeset
for help on using the changeset viewer.