Changeset 3532 in ntrip


Ignore:
Timestamp:
Dec 16, 2011, 6:29:59 PM (13 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/bncgetthread.cpp

    r3530 r3532  
    136136  _serialPort    = 0;
    137137
    138   if (settings.value("serialMountPoint").toString() == _staID) {
     138  if (!_staID.isEmpty() &&
     139      settings.value("serialMountPoint").toString() == _staID) {
    139140    _serialPort = new QextSerialPort(settings.value("serialPortName").toString() );
    140141    _serialPort->setTimeout(0,100);
     
    264265  }
    265266
     267  if (!_staID.isEmpty()) {
     268    _latencyChecker = new latencyChecker(_staID);
     269  }
     270  else {
     271    _latencyChecker = 0;
     272  }
     273}
     274
     275// Instantiate the decoder
     276//////////////////////////////////////////////////////////////////////////////
     277t_irc bncGetThread::initDecoder() {
     278
     279  if      (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1 ||
     280           _format.indexOf("RTCM 2") != -1 ) {
     281    emit(newMessage(_staID + ": Get data in RTCM 2.x format", true));
     282    _decoders[_staID] = new RTCM2Decoder(_staID.data());
     283  }
     284  else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1 ||
     285           _format.indexOf("RTCM 3") != -1 ) {
     286    emit(newMessage(_staID + ": Get data in RTCM 3.x format", true));
     287    _decoders[_staID] = new RTCM3Decoder(_staID, _rawFile);
     288    connect((RTCM3Decoder*) decoder(), SIGNAL(newMessage(QByteArray,bool)),
     289            this, SIGNAL(newMessage(QByteArray,bool)));
     290  }
     291  else if (_format.indexOf("GPSS") != -1 || _format.indexOf("BNC") != -1) {
     292    emit(newMessage(_staID + ": Get Data in GPSS format", true));
     293    _decoders[_staID] = new gpssDecoder();
     294  }
     295  else if (_format.indexOf("ZERO") != -1) {
     296    emit(newMessage(_staID + ": Get data in original format", true));
     297    _decoders[_staID] = new bncZeroDecoder(_staID);
     298  }
     299  else if (_format.indexOf("RTNET") != -1) {
     300    emit(newMessage(_staID + ": Get data in RTNet format", true));
     301    _decoders[_staID] = new bncRtnetDecoder();
     302  }
     303  else if (_format.indexOf("HASS2ASCII") != -1) {
     304    emit(newMessage(_staID + ": Get data in HASS2ASCII format", true));
     305    _decoders[_staID] = new hassDecoder(_staID);
     306  }
     307  else {
     308    emit(newMessage(_staID + ": Unknown data format " + _format, true));
     309    _isToBeDeleted = true;
     310    return failure;
     311  }
     312
     313  msleep(100); //sleep 0.1 sec
     314 
     315  if (decoder()) {
     316    decoder()->initRinex(_staID, _mountPoint, _latitude, _longitude,
     317                         _nmea, _ntripVersion);
     318
     319  }
     320
    266321  // Initialize PPP Client?
    267322  // ----------------------
    268323#ifndef MLS_SOFTWARE
     324  bncSettings settings;
    269325  if (settings.value("pppMount").toString() == _staID) {
    270326    _PPPclient = new bncPPPclient(_staID);
     327    bncApp* app = (bncApp*) qApp;
    271328    app->_bncPPPclient = _PPPclient;
    272329    qRegisterMetaType<bncTime>("bncTime");
     
    278335#endif
    279336
    280   _latencyChecker = new latencyChecker(_staID);
    281 }
    282 
    283 // Instantiate the decoder
    284 //////////////////////////////////////////////////////////////////////////////
    285 t_irc bncGetThread::initDecoder() {
    286 
    287   if      (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1 ||
    288            _format.indexOf("RTCM 2") != -1 ) {
    289     emit(newMessage(_staID + ": Get data in RTCM 2.x format", true));
    290     _decoders[_staID] = new RTCM2Decoder(_staID.data());
    291   }
    292   else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1 ||
    293            _format.indexOf("RTCM 3") != -1 ) {
    294     emit(newMessage(_staID + ": Get data in RTCM 3.x format", true));
    295     _decoders[_staID] = new RTCM3Decoder(_staID, _rawFile);
    296     connect((RTCM3Decoder*) decoder(), SIGNAL(newMessage(QByteArray,bool)),
    297             this, SIGNAL(newMessage(QByteArray,bool)));
    298   }
    299   else if (_format.indexOf("GPSS") != -1 || _format.indexOf("BNC") != -1) {
    300     emit(newMessage(_staID + ": Get Data in GPSS format", true));
    301     _decoders[_staID] = new gpssDecoder();
    302   }
    303   else if (_format.indexOf("ZERO") != -1) {
    304     emit(newMessage(_staID + ": Get data in original format", true));
    305     _decoders[_staID] = new bncZeroDecoder(_staID);
    306   }
    307   else if (_format.indexOf("RTNET") != -1) {
    308     emit(newMessage(_staID + ": Get data in RTNet format", true));
    309     _decoders[_staID] = new bncRtnetDecoder();
    310   }
    311   else if (_format.indexOf("HASS2ASCII") != -1) {
    312     emit(newMessage(_staID + ": Get data in HASS2ASCII format", true));
    313     _decoders[_staID] = new hassDecoder(_staID);
    314   }
    315   else {
    316     emit(newMessage(_staID + ": Unknown data format " + _format, true));
    317     _isToBeDeleted = true;
    318     return failure;
    319   }
    320 
    321   msleep(100); //sleep 0.1 sec
    322  
    323   if (decoder()) {
    324     decoder()->initRinex(_staID, _mountPoint, _latitude, _longitude,
    325                          _nmea, _ntripVersion);
    326 
    327   }
    328 
    329337  return success;
    330338}
     
    386394
    387395      if (tryReconnect() != success) {
    388         _latencyChecker->checkReconnect();
     396        if (_latencyChecker) {
     397          _latencyChecker->checkReconnect();
     398        }
    389399        continue;
    390400      }
     
    422432      // ------------------
    423433      if (nBytes == 0) {
    424         _latencyChecker->checkReconnect();
     434        if (_latencyChecker) {
     435          _latencyChecker->checkReconnect();
     436        }
    425437        emit(newMessage(_staID + ": Data timeout, reconnecting", true));
    426438        msleep(10000); //sleep 10 sec, G. Weber
     
    455467      // Perform various scans and checks
    456468      // --------------------------------
    457       _latencyChecker->checkOutage(irc == success);
    458       _latencyChecker->checkObsLatency(decoder()->_obsList);
    459       _latencyChecker->checkCorrLatency(decoder()->corrGPSEpochTime());
    460 
    461       emit newLatency(_staID, _latencyChecker->currentLatency());
     469      if (_latencyChecker) {
     470        _latencyChecker->checkOutage(irc == success);
     471        _latencyChecker->checkObsLatency(decoder()->_obsList);
     472        _latencyChecker->checkCorrLatency(decoder()->corrGPSEpochTime());
     473       
     474        emit newLatency(_staID, _latencyChecker->currentLatency());
     475      }
    462476
    463477      scanRTCM();           
Note: See TracChangeset for help on using the changeset viewer.