Changeset 8082 in ntrip for trunk


Ignore:
Timestamp:
Mar 9, 2017, 12:31:17 PM (7 years ago)
Author:
stuerze
Message:

the latency checker is now able to check ssr data streams with messages containing different update rates

Location:
trunk/BNC/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncgetthread.cpp

    r8021 r8082  
    7474bncGetThread::bncGetThread(bncRawFile* rawFile) {
    7575
    76   _rawFile      = rawFile;
    77   _format       = rawFile->format();
    78   _staID        = rawFile->staID();
    79   _rawOutput    = false;
     76  _rawFile = rawFile;
     77  _format = rawFile->format();
     78  _staID = rawFile->staID();
     79  _rawOutput = false;
    8080  _ntripVersion = "N";
    8181
     
    8585// Constructor 2
    8686////////////////////////////////////////////////////////////////////////////
    87 bncGetThread::bncGetThread(const QUrl& mountPoint,
    88                            const QByteArray& format,
    89                            const QByteArray& latitude,
    90                            const QByteArray& longitude,
    91                            const QByteArray& nmea,
    92                            const QByteArray& ntripVersion) {
    93   _rawFile      = 0;
    94   _mountPoint   = mountPoint;
    95   _staID        = mountPoint.path().mid(1).toAscii();
    96   _format       = format;
    97   _latitude     = latitude;
    98   _longitude    = longitude;
    99   _nmea         = nmea;
     87bncGetThread::bncGetThread(const QUrl& mountPoint, const QByteArray& format,
     88    const QByteArray& latitude, const QByteArray& longitude,
     89    const QByteArray& nmea, const QByteArray& ntripVersion) {
     90  _rawFile = 0;
     91  _mountPoint = mountPoint;
     92  _staID = mountPoint.path().mid(1).toAscii();
     93  _format = format;
     94  _latitude = latitude;
     95  _longitude = longitude;
     96  _nmea = nmea;
    10097  _ntripVersion = ntripVersion;
    10198
     
    120117
    121118  connect(this, SIGNAL(newMessage(QByteArray,bool)),
    122           BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
     119  BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
    123120
    124121  _isToBeDeleted = false;
    125   _query         = 0;
    126   _nextSleep     = 0;
    127   _miscMount     = settings.value("miscMount").toString();
    128   _decoder   = 0;
     122  _query = 0;
     123  _nextSleep = 0;
     124  _miscMount = settings.value("miscMount").toString();
     125  _decoder = 0;
    129126
    130127  // NMEA Port
     
    134131  while (iSta.hasNext()) {
    135132    QStringList hlp = iSta.next().split(",");
    136     if (hlp.size() < 10) {continue;}
     133    if (hlp.size() < 10) {
     134      continue;
     135    }
    137136    QByteArray mp = hlp[0].toAscii();
    138137    if (_staID == mp) {
     
    142141  if (nmeaPort != 0) {
    143142    _nmeaServer = new QTcpServer;
    144     if ( !_nmeaServer->listen(QHostAddress::Any, nmeaPort) ) {
     143    if (!_nmeaServer->listen(QHostAddress::Any, nmeaPort)) {
    145144      emit newMessage("bncCaster: Cannot listen on port", true);
    146     }
    147     else {
    148       connect(_nmeaServer, SIGNAL(newConnection()), this, SLOT(slotNewNMEAConnection()));
    149       connect(BNC_CORE, SIGNAL(newNMEAstr(QByteArray, QByteArray)),
    150               this, SLOT(slotNewNMEAstr(QByteArray, QByteArray)));
     145    } else {
     146      connect(_nmeaServer, SIGNAL(newConnection()), this,
     147          SLOT(slotNewNMEAConnection()));
     148      connect(BNC_CORE, SIGNAL(newNMEAstr(QByteArray, QByteArray)), this,
     149          SLOT(slotNewNMEAstr(QByteArray, QByteArray)));
    151150      _nmeaSockets = new QList<QTcpSocket*>;
    152151      _nmeaPortsMap[_staID] = nmeaPort;
     
    159158  // Serial Port
    160159  // -----------
    161   _serialNMEA    = NO_NMEA;
     160  _serialNMEA = NO_NMEA;
    162161  _serialOutFile = 0;
    163   _serialPort    = 0;
    164 
    165   if (!_staID.isEmpty() &&
    166       settings.value("serialMountPoint").toString() == _staID) {
    167     _serialPort = new QextSerialPort(settings.value("serialPortName").toString() );
    168     _serialPort->setTimeout(0,100);
     162  _serialPort = 0;
     163
     164  if (!_staID.isEmpty()
     165      && settings.value("serialMountPoint").toString() == _staID) {
     166    _serialPort = new QextSerialPort(
     167        settings.value("serialPortName").toString());
     168    _serialPort->setTimeout(0, 100);
    169169
    170170    // Baud Rate
    171171    // ---------
    172172    QString hlp = settings.value("serialBaudRate").toString();
    173     if      (hlp == "110") {
     173    if (hlp == "110") {
    174174      _serialPort->setBaudRate(BAUD110);
    175     }
    176     else if (hlp == "300") {
     175    } else if (hlp == "300") {
    177176      _serialPort->setBaudRate(BAUD300);
    178     }
    179     else if (hlp == "600") {
     177    } else if (hlp == "600") {
    180178      _serialPort->setBaudRate(BAUD600);
    181     }
    182     else if (hlp == "1200") {
     179    } else if (hlp == "1200") {
    183180      _serialPort->setBaudRate(BAUD1200);
    184     }
    185     else if (hlp == "2400") {
     181    } else if (hlp == "2400") {
    186182      _serialPort->setBaudRate(BAUD2400);
    187     }
    188     else if (hlp == "4800") {
     183    } else if (hlp == "4800") {
    189184      _serialPort->setBaudRate(BAUD4800);
    190     }
    191     else if (hlp == "9600") {
     185    } else if (hlp == "9600") {
    192186      _serialPort->setBaudRate(BAUD9600);
    193     }
    194     else if (hlp == "19200") {
     187    } else if (hlp == "19200") {
    195188      _serialPort->setBaudRate(BAUD19200);
    196     }
    197     else if (hlp == "38400") {
     189    } else if (hlp == "38400") {
    198190      _serialPort->setBaudRate(BAUD38400);
    199     }
    200     else if (hlp == "57600") {
     191    } else if (hlp == "57600") {
    201192      _serialPort->setBaudRate(BAUD57600);
    202     }
    203     else if (hlp == "115200") {
     193    } else if (hlp == "115200") {
    204194      _serialPort->setBaudRate(BAUD115200);
    205195    }
     
    208198    // ------
    209199    hlp = settings.value("serialParity").toString();
    210     if      (hlp == "NONE") {
     200    if (hlp == "NONE") {
    211201      _serialPort->setParity(PAR_NONE);
    212     }
    213     else if (hlp == "ODD") {
     202    } else if (hlp == "ODD") {
    214203      _serialPort->setParity(PAR_ODD);
    215     }
    216     else if (hlp == "EVEN") {
     204    } else if (hlp == "EVEN") {
    217205      _serialPort->setParity(PAR_EVEN);
    218     }
    219     else if (hlp == "SPACE") {
     206    } else if (hlp == "SPACE") {
    220207      _serialPort->setParity(PAR_SPACE);
    221208    }
     
    224211    // ---------
    225212    hlp = settings.value("serialDataBits").toString();
    226     if      (hlp == "5") {
     213    if (hlp == "5") {
    227214      _serialPort->setDataBits(DATA_5);
    228     }
    229     else if (hlp == "6") {
     215    } else if (hlp == "6") {
    230216      _serialPort->setDataBits(DATA_6);
    231     }
    232     else if (hlp == "7") {
     217    } else if (hlp == "7") {
    233218      _serialPort->setDataBits(DATA_7);
    234     }
    235     else if (hlp == "8") {
     219    } else if (hlp == "8") {
    236220      _serialPort->setDataBits(DATA_8);
    237221    }
    238222    hlp = settings.value("serialStopBits").toString();
    239     if      (hlp == "1") {
     223    if (hlp == "1") {
    240224      _serialPort->setStopBits(STOP_1);
    241     }
    242     else if (hlp == "2") {
     225    } else if (hlp == "2") {
    243226      _serialPort->setStopBits(STOP_2);
    244227    }
     
    249232    if (hlp == "XONXOFF") {
    250233      _serialPort->setFlowControl(FLOW_XONXOFF);
    251     }
    252     else if (hlp == "HARDWARE") {
     234    } else if (hlp == "HARDWARE") {
    253235      _serialPort->setFlowControl(FLOW_HARDWARE);
    254     }
    255     else {
     236    } else {
    256237      _serialPort->setFlowControl(FLOW_OFF);
    257238    }
     
    259240    // Open Serial Port
    260241    // ----------------
    261     _serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered);
     242    _serialPort->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
    262243    if (!_serialPort->isOpen()) {
    263244      delete _serialPort;
     
    265246      emit(newMessage((_staID + ": Cannot open serial port\n"), true));
    266247    }
    267     connect(_serialPort, SIGNAL(readyRead()),
    268             this, SLOT(slotSerialReadyRead()));
     248    connect(_serialPort, SIGNAL(readyRead()), this,
     249        SLOT(slotSerialReadyRead()));
    269250
    270251    // Automatic NMEA
     
    276257      if (!fName.isEmpty()) {
    277258        _serialOutFile = new QFile(fName);
    278         if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
     259        if (Qt::CheckState(settings.value("rnxAppend").toInt())
     260            == Qt::Checked) {
    279261          _serialOutFile->open(QIODevice::WriteOnly | QIODevice::Append);
    280         }
    281         else {
     262        } else {
    282263          _serialOutFile->open(QIODevice::WriteOnly);
    283264        }
     
    286267    // Manual NMEA
    287268    // -----------
    288     if ((nmeaMode == "Manual GPGGA") ||(nmeaMode == "Manual GNGGA")) {
     269    if ((nmeaMode == "Manual GPGGA") || (nmeaMode == "Manual GNGGA")) {
    289270      _serialNMEA = MANUAL_NMEA;
    290271      bncSettings settings;
    291272      _manualNMEASampl = settings.value("serialManualNMEASampling").toInt();
    292       QString hlp      = settings.value("serialHeightNMEA").toString();
     273      QString hlp = settings.value("serialHeightNMEA").toString();
    293274      if (hlp.isEmpty()) {
    294275        hlp = "0.0";
    295276      }
    296277      QByteArray _serialHeightNMEA = hlp.toAscii();
    297       _manualNMEAString = ggaString(_latitude, _longitude, _serialHeightNMEA, nmeaMode);
     278      _manualNMEAString = ggaString(_latitude, _longitude, _serialHeightNMEA,
     279          nmeaMode);
    298280    }
    299281  }
     
    301283  if (!_staID.isEmpty()) {
    302284    _latencyChecker = new latencyChecker(_staID);
    303   }
    304   else {
     285    obs = false;
     286    ssrOrb = false;
     287    ssrClk = false;
     288    ssrOrbClk = false;
     289    ssrCbi = false;
     290    ssrPbi = false;
     291    ssrVtec = false;
     292    ssrUra = false;
     293    ssrHr = false;
     294    _oldSsrEpoch = 0;
     295    _ssrEpoch = 0;
     296  } else {
    305297    _latencyChecker = 0;
    306298  }
     
    313305  _decoder = 0;
    314306
    315   if      (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1 ||
    316            _format.indexOf("RTCM 2") != -1 ) {
     307  if (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1
     308      || _format.indexOf("RTCM 2") != -1) {
    317309    emit(newMessage(_staID + ": Get data in RTCM 2.x format", true));
    318310    _decoder = new RTCM2Decoder(_staID.data());
    319   }
    320   else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1 ||
    321            _format.indexOf("RTCM 3") != -1 ) {
     311  } else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1
     312      || _format.indexOf("RTCM 3") != -1) {
    322313    emit(newMessage(_staID + ": Get data in RTCM 3.x format", true));
    323314    RTCM3Decoder* newDecoder = new RTCM3Decoder(_staID, _rawFile);
    324315    _decoder = newDecoder;
    325316    connect((RTCM3Decoder*) newDecoder, SIGNAL(newMessage(QByteArray,bool)),
    326             this, SIGNAL(newMessage(QByteArray,bool)));
    327   }
    328   else if (_format.indexOf("ZERO") != -1) {
     317        this, SIGNAL(newMessage(QByteArray,bool)));
     318  } else if (_format.indexOf("ZERO") != -1) {
    329319    emit(newMessage(_staID + ": Get data in original format", true));
    330320    _decoder = new bncZeroDecoder(_staID);
    331   }
    332   else if (_format.indexOf("RTNET") != -1) {
     321  } else if (_format.indexOf("RTNET") != -1) {
    333322    emit(newMessage(_staID + ": Get data in RTNet format", true));
    334323    _decoder = new bncRtnetDecoder();
    335   }
    336   else {
     324  } else {
    337325    emit(newMessage(_staID + ": Unknown data format " + _format, true));
    338326    _isToBeDeleted = true;
     
    342330  msleep(100); //sleep 0.1 sec
    343331
    344   _decoder->initRinex(_staID, _mountPoint, _latitude, _longitude,
    345                                _nmea, _ntripVersion);
     332  _decoder->initRinex(_staID, _mountPoint, _latitude, _longitude, _nmea,
     333      _ntripVersion);
    346334
    347335  if (_rawFile) {
     
    357345  if (!_rawFile) {
    358346    return _decoder;
    359   }
    360   else {
     347  } else {
    361348    if (_decodersRaw.contains(_staID) || initDecoder() == success) {
    362349      return _decodersRaw[_staID];
     
    382369      delete it.value();
    383370    }
    384   }
    385   else {
     371  } else {
    386372    delete _decoder;
    387373  }
     
    398384  _isToBeDeleted = true;
    399385
    400   if(_nmeaPortsMap.contains(_staID)) {
     386  if (_nmeaPortsMap.contains(_staID)) {
    401387    _nmeaPortsMap.remove(_staID);
    402388  }
     
    410396#ifdef BNC_DEBUG
    411397  if (BNC_CORE->mode() != t_bncCore::interactive) {
    412     while (!isFinished()) {wait();}
     398    while (!isFinished()) {
     399      wait();
     400    }
    413401    delete this;
    414   }
    415   else {
    416     if (!isRunning()) {delete this;}
     402  } else {
     403    if (!isRunning()) {
     404      delete this;
     405    }
    417406  }
    418407#else
    419     if (!isRunning()) {delete this;}
     408  if (!isRunning()) {delete this;}
    420409#endif
    421410
     
    450439          decoder->_obsList.clear();
    451440        }
    452       }
    453       else {
     441      } else {
    454442        _decoder->_obsList.clear();
    455443      }
     
    458446      // ---------
    459447      QByteArray data;
    460       if      (_query) {
     448      if (_query) {
    461449        _query->waitForReadyRead(data);
    462       }
    463       else if (_rawFile) {
     450      } else if (_rawFile) {
    464451        data = _rawFile->readChunk();
    465452        _format = _rawFile->format();
    466         _staID  = _rawFile->staID();
     453        _staID = _rawFile->staID();
    467454
    468455        QCoreApplication::processEvents();
     
    486473        msleep(10000); //sleep 10 sec, G. Weber
    487474        continue;
    488       }
    489       else {
     475      } else {
    490476        emit newBytes(_staID, nBytes);
    491477        emit newRawData(_staID, data);
     
    520506      if (_latencyChecker) {
    521507        _latencyChecker->checkOutage(irc == success);
    522         _latencyChecker->checkObsLatency(decoder()->_obsList);
    523         _latencyChecker->checkCorrLatency(decoder()->corrGPSEpochTime());
    524 
     508        QListIterator<int> it(decoder()->_typeList);
     509        _ssrEpoch = decoder()->corrGPSEpochTime();
     510        if (_oldSsrEpoch > 0 && _ssrEpoch && _ssrEpoch > _oldSsrEpoch) {
     511          if (ssrOrb) {
     512            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1057);
     513            ssrOrb = false;
     514          }
     515          if (ssrClk) {
     516            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1058);
     517            ssrClk = false;
     518          }
     519          if (ssrOrbClk) {
     520            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1060);
     521            ssrOrbClk = false;
     522          }
     523          if (ssrCbi) {
     524            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1059);
     525            ssrCbi = false;
     526          }
     527          if (ssrPbi) {
     528            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1265);
     529            ssrPbi = false;
     530          }
     531          if (ssrVtec) {
     532            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1264);
     533            ssrVtec = false;
     534          }
     535          if (ssrUra) {
     536            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1061);
     537            ssrUra = false;
     538          }
     539          if (ssrHr) {
     540            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1062);
     541            ssrHr = false;
     542          }
     543        }
     544        while (it.hasNext()) {
     545          int rtcmType = it.next();
     546          if ((rtcmType >= 1001 && rtcmType <= 1004) || // legacy RTCM OBS
     547              (rtcmType >= 1009 && rtcmType <= 1012) || // legacy RTCM OBS
     548              (rtcmType >= 1071 && rtcmType <= 1127)) { // MSM RTCM OBS
     549            obs = true;
     550          } else if ((rtcmType >= 1057 && rtcmType <= 1068) ||
     551                     (rtcmType >= 1240 && rtcmType <= 1270)) {
     552            switch (rtcmType) {
     553              case 1057: case 1063: case 1240: case 1246: case 1252: case 1258:
     554                ssrOrb = true;
     555                break;
     556              case 1058: case 1064: case 1241: case 1247: case 1253: case 1259:
     557                ssrClk = true;
     558                break;
     559              case 1060: case 1066: case 1243: case 1249: case 1255: case 1261:
     560                ssrOrbClk = true;
     561                break;
     562              case 1059: case 1065: case 1242:   case 1248: case 1254: case 1260:
     563                ssrCbi = true;
     564                break;
     565              case 1265: case 1266: case 1267: case 1268: case 1269: case 1270:
     566                ssrPbi = true;
     567                break;
     568              case 1264:
     569                ssrVtec = true;
     570                break;
     571              case 1061: case 1067: case 1244: case 1250: case 1256: case 1262:
     572                ssrUra = true;
     573                break;
     574              case 1062: case 1068: case 1245: case 1251: case 1257: case 1263:
     575                ssrHr = true;
     576                break;
     577            }
     578          }
     579        }
     580        if (obs) {
     581          _latencyChecker->checkObsLatency(decoder()->_obsList);
     582        }
     583        _oldSsrEpoch = _ssrEpoch;
    525584        emit newLatency(_staID, _latencyChecker->currentLatency());
    526585      }
    527 
    528586      miscScanRTCM();
    529587
     
    543601          if (wrongObservationEpoch) {
    544602            QString prn(obs._prn.toString().c_str());
    545             emit( newMessage(_staID + " (" + prn.toAscii() + ")" + ": Wrong observation epoch(s)", false) );
     603            emit(newMessage(
     604                _staID + " (" + prn.toAscii() + ")"
     605                    + ": Wrong observation epoch(s)", false));
    546606            continue;
    547607          }
     
    552612        if (!_rawFile) {
    553613          QString prn(obs._prn.toString().c_str());
    554           long iSec    = long(floor(obs._time.gpssec()+0.5));
    555           long obsTime = obs._time.gpsw()*7*24*3600 + iSec;
     614          long iSec = long(floor(obs._time.gpssec() + 0.5));
     615          long obsTime = obs._time.gpsw() * 7 * 24 * 3600 + iSec;
    556616          QMap<QString, long>::const_iterator it = _prnLastEpo.find(prn);
    557617          if (it != _prnLastEpo.end()) {
    558618            long oldTime = it.value();
    559             if      (obsTime < oldTime) {
    560               emit( newMessage(_staID +
    561                  ": old observation " + prn.toAscii(), false));
     619            if (obsTime < oldTime) {
     620              emit(newMessage(_staID + ": old observation " + prn.toAscii(),
     621                  false));
    562622              continue;
    563             }
    564             else if (obsTime == oldTime) {
    565               emit( newMessage(_staID +
    566                  ": observation coming more than once " + prn.toAscii(), false));
     623            } else if (obsTime == oldTime) {
     624              emit(newMessage(
     625                  _staID + ": observation coming more than once "
     626                     + prn.toAscii(), false));
    567627              continue;
    568628            }
     
    584644      }
    585645
    586     }
    587     catch (Exception& exc) {
     646    } catch (Exception& exc) {
    588647      emit(newMessage(_staID + " " + exc.what(), true));
    589648      _isToBeDeleted = true;
    590     }
    591     catch (...) {
     649    } catch (...) {
    592650      emit(newMessage(_staID + " bncGetThread exception", true));
    593651      _isToBeDeleted = true;
     
    611669        decoder->setRinexReconnectFlag(false);
    612670      }
    613     }
    614     else {
     671    } else {
    615672      _decoder->setRinexReconnectFlag(false);
    616673    }
     
    625682    if (_nextSleep == 0) {
    626683      _nextSleep = 1;
    627     }
    628     else {
     684    } else {
    629685      _nextSleep = 2 * _nextSleep;
    630686      if (_nextSleep > 256) {
     
    640696      delete _query;
    641697    }
    642     if      (_ntripVersion == "U") {
     698    if (_ntripVersion == "U") {
    643699      _query = new bncNetQueryUdp();
    644     }
    645     else if (_ntripVersion == "R") {
     700    } else if (_ntripVersion == "R") {
    646701      _query = new bncNetQueryRtp();
    647     }
    648     else if (_ntripVersion == "S") {
     702    } else if (_ntripVersion == "S") {
    649703      _query = new bncNetQueryS();
    650     }
    651     else if (_ntripVersion == "N") {
     704    } else if (_ntripVersion == "N") {
    652705      _query = new bncNetQueryV0();
    653     }
    654     else if (_ntripVersion == "UN") {
     706    } else if (_ntripVersion == "UN") {
    655707      _query = new bncNetQueryUdp0();
    656     }
    657     else if (_ntripVersion == "2") {
     708    } else if (_ntripVersion == "2") {
    658709      _query = new bncNetQueryV2(false);
    659     }
    660     else if (_ntripVersion == "2s") {
     710    } else if (_ntripVersion == "2s") {
    661711      _query = new bncNetQueryV2(true);
    662     }
    663     else {
     712    } else {
    664713      _query = new bncNetQueryV1();
    665714    }
     
    668717        _query->startRequest(_mountPoint, _manualNMEAString);
    669718        _lastManualNMEA = QDateTime::currentDateTime();
    670       }
    671       else if (_serialNMEA == AUTO_NMEA) {
     719      } else if (_serialNMEA == AUTO_NMEA) {
    672720        if (_serialPort) {
    673721          int nb = _serialPort->bytesAvailable();
     
    688736        }
    689737      }
    690     }
    691     else {
     738    } else {
    692739      _query->startRequest(_mountPoint, "");
    693740    }
     
    705752      decoder->setRinexReconnectFlag(false);
    706753    }
    707   }
    708   else {
    709    _decoder->setRinexReconnectFlag(false);
     754  } else {
     755    _decoder->setRinexReconnectFlag(false);
    710756  }
    711757
     
    717763void bncGetThread::miscScanRTCM() {
    718764
    719   if ( !decoder() ) {
     765  if (!decoder()) {
    720766    return;
    721767  }
    722768
    723769  bncSettings settings;
    724   if ( Qt::CheckState(settings.value("miscScanRTCM").toInt()) == Qt::Checked ) {
    725 
    726     if ( _miscMount == _staID || _miscMount == "ALL" ) {
     770  if (Qt::CheckState(settings.value("miscScanRTCM").toInt()) == Qt::Checked) {
     771
     772    if (_miscMount == _staID || _miscMount == "ALL") {
    727773      // RTCM message types
    728774      // ------------------
    729775      for (int ii = 0; ii < decoder()->_typeList.size(); ii++) {
    730         QString type =  QString("%1 ").arg(decoder()->_typeList[ii]);
    731         emit(newMessage(_staID + ": Received message type " + type.toAscii(), true));
     776        QString type = QString("%1 ").arg(decoder()->_typeList[ii]);
     777        emit(newMessage(_staID + ": Received message type " + type.toAscii(),
     778            true));
    732779      }
    733780
     
    742789            QString rnxStr('C');
    743790            rnxStr.append(obs._obs[iFrq]->_rnxType2ch.c_str());
    744             if (_format.indexOf("RTCM_2") != -1 ||
    745                 _format.indexOf("RTCM2") != -1 ||
    746                 _format.indexOf("RTCM 2") != -1 ) {
     791            if (_format.indexOf("RTCM_2") != -1
     792                || _format.indexOf("RTCM2") != -1
     793                || _format.indexOf("RTCM 2") != -1) {
    747794              rnxStr = t_rnxObsFile::type3to2(obs._prn.system(), rnxStr);
    748795            }
     
    755802            QString rnxStr('L');
    756803            rnxStr.append(obs._obs[iFrq]->_rnxType2ch.c_str());
    757             if (_format.indexOf("RTCM_2") != -1 ||
    758                 _format.indexOf("RTCM2") != -1 ||
    759                 _format.indexOf("RTCM 2") != -1 ) {
     804            if (_format.indexOf("RTCM_2") != -1
     805                || _format.indexOf("RTCM2") != -1
     806                || _format.indexOf("RTCM 2") != -1) {
    760807              rnxStr = t_rnxObsFile::type3to2(obs._prn.system(), rnxStr);
    761808            }
     
    765812            }
    766813          }
    767           if (obs._obs[iFrq]->_dopplerValid){
     814          if (obs._obs[iFrq]->_dopplerValid) {
    768815            QString rnxStr('D');
    769816            rnxStr.append(obs._obs[iFrq]->_rnxType2ch.c_str());
    770             if (_format.indexOf("RTCM_2") != -1 ||
    771                 _format.indexOf("RTCM2") != -1 ||
    772                 _format.indexOf("RTCM 2") != -1 ) {
     817            if (_format.indexOf("RTCM_2") != -1
     818                || _format.indexOf("RTCM2") != -1
     819                || _format.indexOf("RTCM 2") != -1) {
    773820              rnxStr = t_rnxObsFile::type3to2(obs._prn.system(), rnxStr);
    774821            }
     
    778825            }
    779826          }
    780           if (obs._obs[iFrq]->_snrValid){
     827          if (obs._obs[iFrq]->_snrValid) {
    781828            QString rnxStr('S');
    782829            rnxStr.append(obs._obs[iFrq]->_rnxType2ch.c_str());
    783             if (_format.indexOf("RTCM_2") != -1 ||
    784                 _format.indexOf("RTCM2") != -1 ||
    785                 _format.indexOf("RTCM 2") != -1 ) {
     830            if (_format.indexOf("RTCM_2") != -1
     831                || _format.indexOf("RTCM2") != -1
     832                || _format.indexOf("RTCM 2") != -1) {
    786833              rnxStr = t_rnxObsFile::type3to2(obs._prn.system(), rnxStr);
    787834            }
     
    796843          QTextStream str(&msg);
    797844          QString s;
    798           str << obs._prn.system() << "    " << s.sprintf("%2d", rnxTypes.size()) << "  ";
     845          str << obs._prn.system() << "    "
     846              << s.sprintf("%2d", rnxTypes.size()) << "  ";
    799847          for (int iType = 0; iType < rnxTypes.size(); iType++) {
    800848            str << " " << rnxTypes[iType];
    801849          }
    802           emit(newMessage(_staID + ": Observation Types: " + msg.toAscii(), true));
     850          emit(newMessage(_staID + ": Observation Types: " + msg.toAscii(),
     851              true));
    803852        }
    804853      }
     
    807856      // -------------------------
    808857      for (int ii = 0; ii < decoder()->_antType.size(); ii++) {
    809         QString ant1 =  QString("%1 ").arg(decoder()->_antType[ii]);
     858        QString ant1 = QString("%1 ").arg(decoder()->_antType[ii]);
    810859        emit(newMessage(_staID + ": Antenna descriptor " + ant1.toAscii(), true));
    811860      }
     
    813862      // RTCM Antenna Coordinates
    814863      // ------------------------
    815       for (int ii=0; ii < decoder()->_antList.size(); ii++) {
     864      for (int ii = 0; ii < decoder()->_antList.size(); ii++) {
    816865        QByteArray antT;
    817         if      (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
     866        if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
    818867          antT = "ARP";
    819         }
    820         else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
     868        } else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
    821869          antT = "APC";
    822870        }
    823871        QByteArray ant1, ant2, ant3;
    824         ant1 = QString("%1 ").arg(decoder()->_antList[ii].xx,0,'f',4).toAscii();
    825         ant2 = QString("%1 ").arg(decoder()->_antList[ii].yy,0,'f',4).toAscii();
    826         ant3 = QString("%1 ").arg(decoder()->_antList[ii].zz,0,'f',4).toAscii();
     872        ant1 =
     873            QString("%1 ").arg(decoder()->_antList[ii].xx, 0, 'f', 4).toAscii();
     874        ant2 =
     875            QString("%1 ").arg(decoder()->_antList[ii].yy, 0, 'f', 4).toAscii();
     876        ant3 =
     877            QString("%1 ").arg(decoder()->_antList[ii].zz, 0, 'f', 4).toAscii();
    827878        emit(newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true));
    828879        emit(newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true));
     
    831882        if (decoder()->_antList[ii].height_f) {
    832883          hh = decoder()->_antList[ii].height;
    833           QByteArray ant4 = QString("%1 ").arg(hh,0,'f',4).toAscii();
    834           emit(newMessage(_staID + ": Antenna height above marker "  + ant4 + "m", true));
     884          QByteArray ant4 = QString("%1 ").arg(hh, 0, 'f', 4).toAscii();
     885          emit(newMessage(
     886              _staID + ": Antenna height above marker " + ant4 + "m", true));
    835887        }
    836888        emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
    837                        decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
    838                        hh, antT));
     889            decoder()->_antList[ii].yy, decoder()->_antList[ii].zz, hh, antT));
    839890      }
    840891
     
    844895        bool allFound = true;
    845896        QString slot = decoder()->_gloFrq;
    846         slot.replace("  "," ").replace(" ",":");
     897        slot.replace("  ", " ").replace(" ", ":");
    847898        if (_gloSlots.indexOf(slot) == -1) {
    848899          _gloSlots.append(slot);
     
    851902        if (!allFound) {
    852903          _gloSlots.sort();
    853           emit(newMessage(_staID + ": GLONASS Slot:Freq "  + _gloSlots.join(" ").toAscii(), true));
     904          emit(newMessage(
     905              _staID + ": GLONASS Slot:Freq " + _gloSlots.join(" ").toAscii(),
     906              true));
    854907        }
    855908      }
     
    859912#ifdef MLS_SOFTWARE
    860913  for (int ii=0; ii <decoder()->_antList.size(); ii++) {
    861         QByteArray antT;
    862         if      (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
    863           antT = "ARP";
    864         }
    865         else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
    866           antT = "APC";
    867         }
    868         double hh = 0.0;
    869         if (decoder()->_antList[ii].height_f) {
    870           hh = decoder()->_antList[ii].height;
    871         }
    872         emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
    873                        decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
    874                        hh, antT));
     914    QByteArray antT;
     915    if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
     916      antT = "ARP";
     917    }
     918    else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
     919      antT = "APC";
     920    }
     921    double hh = 0.0;
     922    if (decoder()->_antList[ii].height_f) {
     923      hh = decoder()->_antList[ii].height;
     924    }
     925    emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
     926            decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
     927            hh, antT));
    875928  }
    876929
     
    930983void bncGetThread::slotNewNMEAConnection() {
    931984  _nmeaSockets->push_back(_nmeaServer->nextPendingConnection());
    932   emit( newMessage(QString("New PPP client on port: # %1")
    933                    .arg(_nmeaSockets->size()).toAscii(), true) );
     985  emit(newMessage(
     986      QString("New PPP client on port: # %1").arg(_nmeaSockets->size()).toAscii(),
     987      true));
    934988}
    935989
     
    945999        if (sock->state() == QAbstractSocket::ConnectedState) {
    9461000          sock->write(str);
    947         }
    948         else if (sock->state() != QAbstractSocket::ConnectingState) {
     1001        } else if (sock->state() != QAbstractSocket::ConnectingState) {
    9491002          delete sock;
    9501003          is.remove();
  • trunk/BNC/src/bncgetthread.h

    r7424 r8082  
    4747 public:
    4848   bncGetThread(bncRawFile* rawFile);
    49    bncGetThread(const QUrl& mountPoint, 
     49   bncGetThread(const QUrl& mountPoint,
    5050                const QByteArray& format,
    5151                const QByteArray& latitude,
    5252                const QByteArray& longitude,
    53                 const QByteArray& nmea, 
     53                const QByteArray& nmea,
    5454                const QByteArray& ntripVersion);
    5555
     
    8080   void newLatency(QByteArray staID, double clate);
    8181   void newObs(QByteArray staID, QList<t_satObs> obsList);
    82    void newAntCrd(QByteArray staID, double xx, double yy, double zz, 
     82   void newAntCrd(QByteArray staID, double xx, double yy, double zz,
    8383                  double hh, QByteArray antType);
    8484   void newMessage(QByteArray msg, bool showOnScreen);
     
    121121   int                        _nextSleep;
    122122   int                        _iMount;
     123   int                        _ssrEpoch;
     124   int                        _oldSsrEpoch;
    123125   bncRawFile*                _rawFile;
    124126   QextSerialPort*            _serialPort;
    125127   bool                       _isToBeDeleted;
     128   bool obs;
     129   bool ssrOrb, ssrClk, ssrOrbClk;
     130   bool ssrCbi, ssrPbi;
     131   bool ssrVtec;
     132   bool ssrUra;
     133   bool ssrHr;
    126134   latencyChecker*            _latencyChecker;
    127135   QString                    _miscMount;
  • trunk/BNC/src/latencychecker.cpp

    r8011 r8082  
    130130  // Initialize private members
    131131  // --------------------------
    132   _maxDt      = 1000.0;
    133132  _wrongEpoch = false;
    134133  _checkSeg   = false;
     
    138137  _initPause  = 0;
    139138  _currPause  = 0;
    140   _followSec  = false;
    141   _oldSecGPS  = 0;
    142   _newSecGPS  = 0;
    143   _numGaps    = 0;
    144   _diffSecGPS = 0;
    145   _numLat     = 0;
    146   _sumLat     = 0.0;
    147   _sumLatQ    = 0.0;
    148   _meanDiff   = 0.0;
    149   _minLat     =  _maxDt;
    150   _maxLat     = -_maxDt;
    151   _curLat     = 0.0;
     139  _endCorrupt = false;
     140  _begCorrupt = false;
     141  _fromCorrupt = false;
    152142
    153143  _checkTime = QDateTime::currentDateTime();
     
    162152  _begDateTimeCorr = QDateTime::currentDateTime();
    163153  _endDateTimeCorr = QDateTime::currentDateTime();
    164 
    165154}
    166155
     
    332321
    333322  if (_miscIntr > 0 ) {
    334 
     323    t_latency& l = _lObs; l._type =  "Observations";
    335324    QListIterator<t_satObs> it(obsList);
    336325    while (it.hasNext()) {
    337326      const t_satObs& obs = it.next();
    338327      bool wrongObservationEpoch = checkForWrongObsEpoch(obs._time);
    339       _newSecGPS = static_cast<int>(obs._time.gpssec());
    340       if (_newSecGPS != _oldSecGPS && !wrongObservationEpoch) {
    341         if (_newSecGPS % _miscIntr < _oldSecGPS % _miscIntr) {
    342           if (_numLat > 0) {
    343             if (_meanDiff > 0.0) {
     328      l._newSec = static_cast<int>(obs._time.gpssec());
     329      if (l._newSec > l._oldSec && !wrongObservationEpoch) {
     330        if (l._newSec % _miscIntr < l._oldSec % _miscIntr) {
     331          if (l._numLat > 0) {
     332            if (l._meanDiff > 0.0) {
    344333              if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
    345                 emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs, %7 gaps")
     334                emit( newMessage(QString("%1 %2: Mean latency %3 sec, min %4, max %5, rms %6, %7 epochs, %8 gaps")
    346335                  .arg(_staID.data())
    347                   .arg(int(_sumLat/_numLat*100)/100.)
    348                   .arg(int(_minLat*100)/100.)
    349                   .arg(int(_maxLat*100)/100.)
    350                   .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
    351                   .arg(_numLat)
    352                   .arg(_numGaps)
     336                  .arg(l._type.data())
     337                  .arg(int(l._sumLat/l._numLat*100)/100.)
     338                  .arg(int(l._minLat*100)/100.)
     339                  .arg(int(l._maxLat*100)/100.)
     340                  .arg(int((sqrt((l._sumLatQ - l._sumLat * l._sumLat / l._numLat)/l._numLat))*100)/100.)
     341                  .arg(l._numLat)
     342                  .arg(l._numGaps)
    353343                  .toAscii(), true) );
    354344              }
    355345            } else {
    356346              if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
    357                 emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs")
     347                emit( newMessage(QString("%1 %2: Mean latency %3 sec, min %4, max %5, rms %6, %7 epochs")
    358348                  .arg(_staID.data())
    359                   .arg(int(_sumLat/_numLat*100)/100.)
    360                   .arg(int(_minLat*100)/100.)
    361                   .arg(int(_maxLat*100)/100.)
    362                   .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
    363                   .arg(_numLat)
     349                  .arg(l._type.data())
     350                  .arg(int(l._sumLat/l._numLat*100)/100.)
     351                  .arg(int(l._minLat*100)/100.)
     352                  .arg(int(l._maxLat*100)/100.)
     353                  .arg(int((sqrt((l._sumLatQ - l._sumLat * l._sumLat / l._numLat)/l._numLat))*100)/100.)
     354                  .arg(l._numLat)
    364355                  .toAscii(), true) );
    365356              }
    366357            }
    367358          }
    368           _meanDiff  = _diffSecGPS / _numLat;
    369           _diffSecGPS = 0;
    370           _numGaps    = 0;
    371           _sumLat     = 0.0;
    372           _sumLatQ    = 0.0;
    373           _numLat     = 0;
    374           _minLat     = _maxDt;
    375           _maxLat     = -_maxDt;
    376         }
    377         if (_followSec) {
    378           _diffSecGPS += _newSecGPS - _oldSecGPS;
    379           if (_meanDiff>0.) {
    380             if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) {
    381               _numGaps += 1;
     359          l._meanDiff  = l._diffSec / l._numLat;
     360          l.init();
     361        }
     362        if (l._followSec) {
     363          l._diffSec += l._newSec - l._oldSec;
     364          if (l._meanDiff>0.) {
     365            if (l._newSec - l._oldSec > 1.5 * l._meanDiff) {
     366              l._numGaps += 1;
    382367            }
    383368          }
     
    398383          sec  += secPerWeek;
    399384        }
    400          _curLat   = sec - obs._time.gpssec();
    401         _sumLat  += _curLat;
    402         _sumLatQ += _curLat * _curLat;
    403         if (_curLat < _minLat) {
    404           _minLat = _curLat;
    405         }
    406         if (_curLat >= _maxLat) {
    407           _maxLat = _curLat;
    408         }
    409         _numLat += 1;
    410         _oldSecGPS = _newSecGPS;
    411         _followSec = true;
    412       }
    413     }
     385        l._curLat   = sec - obs._time.gpssec();
     386        l._sumLat  += l._curLat;
     387        l._sumLatQ += l._curLat * l._curLat;
     388        if (l._curLat < l._minLat) {
     389          l._minLat = l._curLat;
     390        }
     391        if (l._curLat >= l._maxLat) {
     392          l._maxLat = l._curLat;
     393        }
     394        l._numLat += 1;
     395        l._oldSec    = l._newSec;
     396        l._followSec = true;
     397      }
     398    }
     399    _lObs = l;
     400    setCurrentLatency(l._curLat);
    414401  }
    415402}
     
    417404// Perform latency checks (corrections)
    418405//////////////////////////////////////////////////////////////////////////////
    419 void latencyChecker::checkCorrLatency(int corrGPSEpochTime) {
    420 
     406void latencyChecker::checkCorrLatency(int corrGPSEpochTime, int type) {
    421407  if (corrGPSEpochTime < 0) {
    422     return;
     408    return ;
     409  }
     410  t_latency& l = _lOrb; // init
     411  switch (type) {
     412    case 1057: case 1063: case 1240: case 1246: case 1252: case 1258:
     413      l = _lOrb; l._type =  "Orbit";
     414      break;
     415    case 1058: case 1064: case 1241: case 1247: case 1253: case 1259:
     416      l = _lClk; l._type =  "Clock";
     417      break;
     418    case 1060: case 1066: case 1243: case 1249: case 1255: case 1261:
     419      l = _lClkOrb; l._type = "Clock&Orbit";
     420      break;
     421    case 1059: case 1065: case 1242: case 1248: case 1254: case 1260:
     422      l = _lCb; l._type = "Code Biases";
     423      break;
     424    case 1265: case 1266: case 1267: case 1268: case 1269: case 1270:
     425      l = _lPb; l._type = "Phase Biases";
     426      break;
     427    case 1264:
     428      l = _lVtec; l._type = "VTEC";
     429      break;
     430    case 1061: case 1067: case 1244: case 1250: case 1256: case 1262:
     431      l = _lUra; l._type = "URA";
     432      break;
     433    case 1062: case 1068: case 1245: case 1251: case 1257: case 1263:
     434      l = _lHr; l._type = "Hr Clock";
     435      break;
     436    default:
     437      return;
    423438  }
    424439
    425440  if (_miscIntr > 0) {
    426 
    427     _newSecGPS = corrGPSEpochTime;
    428 
     441    l._newSec = corrGPSEpochTime;
    429442    int week;
    430443    double sec;
    431444    currentGPSWeeks(week, sec);
    432     double dt = fabs(sec - _newSecGPS);
     445    double dt = fabs(sec - l._newSec);
    433446    const double secPerWeek = 7.0 * 24.0 * 3600.0;
    434447    if (dt > 0.5 * secPerWeek) {
    435       if (sec > _newSecGPS) {
     448      if (sec > l._newSec) {
    436449        sec  -= secPerWeek;
    437450      } else {
     
    439452      }
    440453    }
    441     if (_newSecGPS != _oldSecGPS) {
    442       if (int(_newSecGPS) % _miscIntr < int(_oldSecGPS) % _miscIntr) {
    443         if (_numLat>0) {
     454    if (l._newSec > l._oldSec) {
     455      if (int(l._newSec) % _miscIntr < int(l._oldSec) % _miscIntr) {
     456        if (l._numLat>0) {
    444457          QString late;
    445           if (_meanDiff>0.) {
    446             late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs, %6 gaps")
    447             .arg(int(_sumLat/_numLat*100)/100.)
    448             .arg(int(_minLat*100)/100.)
    449             .arg(int(_maxLat*100)/100.)
    450             .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
    451             .arg(_numLat)
    452             .arg(_numGaps);
     458          if (l._meanDiff>0.) {
     459            late = QString(" %1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs, %7 gaps")
     460            .arg(l._type.data())
     461            .arg(int(l._sumLat/l._numLat*100)/100.)
     462            .arg(int(l._minLat*100)/100.)
     463            .arg(int(l._maxLat*100)/100.)
     464            .arg(int((sqrt((l._sumLatQ - l._sumLat * l._sumLat / l._numLat)/l._numLat))*100)/100.)
     465            .arg(l._numLat)
     466            .arg(l._numGaps);
    453467            if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
    454468              emit(newMessage(QString(_staID + late ).toAscii(), true) );
     
    456470          }
    457471          else {
    458             late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs")
    459             .arg(int(_sumLat/_numLat*100)/100.)
    460             .arg(int(_minLat*100)/100.)
    461             .arg(int(_maxLat*100)/100.)
    462             .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
    463             .arg(_numLat);
     472            late = QString(" %1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs")
     473            .arg(l._type.data())
     474            .arg(int(l._sumLat/l._numLat*100)/100.)
     475            .arg(int(l._minLat*100)/100.)
     476            .arg(int(l._maxLat*100)/100.)
     477            .arg(int((sqrt((l._sumLatQ - l._sumLat * l._sumLat / l._numLat)/l._numLat))*100)/100.)
     478            .arg(l._numLat);
    464479            if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
    465480            emit(newMessage(QString(_staID + late ).toAscii(), true) );
     
    467482          }
    468483        }
    469         _meanDiff = int(_diffSecGPS)/_numLat;
    470         _diffSecGPS = 0;
    471         _numGaps    = 0;
    472         _sumLat     = 0.0;
    473         _sumLatQ    = 0.0;
    474         _numLat     = 0;
    475         _minLat     = 1000.;
    476         _maxLat     = -1000.;
    477       }
    478       if (_followSec) {
    479         _diffSecGPS += _newSecGPS - _oldSecGPS;
    480         if (_meanDiff>0.) {
    481           if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) {
    482             _numGaps += 1;
    483           }
    484         }
    485       }
    486       _curLat   = sec - _newSecGPS;
    487       _sumLat  += _curLat;
    488       _sumLatQ += _curLat * _curLat;
    489       if (_curLat < _minLat) {
    490         _minLat = _curLat;
    491       }
    492       if (_curLat >= _maxLat) {
    493         _maxLat = _curLat;
    494       }
    495       _numLat += 1;
    496       _oldSecGPS = _newSecGPS;
    497       _followSec = true;
    498     }
     484        l._meanDiff = int(l._diffSec)/l._numLat;
     485        l.init();
     486      }
     487
     488      if (l._followSec) {
     489        l._diffSec += l._newSec - l._oldSec;
     490        if (l._meanDiff>0.) {
     491          if (l._newSec - l._oldSec > 1.5 * l._meanDiff) {
     492            l._numGaps += 1;
     493          }
     494        }
     495      }
     496      l._curLat   = sec - l._newSec;
     497      l._sumLat  += l._curLat;
     498      l._sumLatQ += l._curLat * l._curLat;
     499      if (l._curLat < l._minLat) {
     500        l._minLat = l._curLat;
     501      }
     502      if (l._curLat >= l._maxLat) {
     503        l._maxLat = l._curLat;
     504      }
     505      l._numLat += 1;
     506      l._oldSec = l._newSec;
     507      l._followSec = true;
     508      setCurrentLatency(l._curLat);
     509    }
     510    switch (type) {
     511       case 1057: case 1063: case 1240: case 1246: case 1252: case 1258:
     512         _lOrb = l;
     513         break;
     514       case 1058: case 1064: case 1241: case 1247: case 1253: case 1259:
     515         _lClk = l;
     516         break;
     517       case 1060: case 1066: case 1243: case 1249: case 1255: case 1261:
     518         _lClkOrb = l;
     519         break;
     520       case 1059: case 1065: case 1242: case 1248: case 1254: case 1260:
     521         _lCb = l;
     522         break;
     523       case 1265: case 1266: case 1267: case 1268: case 1269: case 1270:
     524         _lPb = l;
     525         break;
     526       case 1264:
     527         _lVtec = l;
     528         break;
     529       case 1061: case 1067: case 1244: case 1250: case 1256: case 1262:
     530         _lUra = l;
     531         break;
     532       case 1062: case 1068: case 1245: case 1251: case 1257: case 1263:
     533         _lHr = l;
     534         break;
     535     }
    499536  }
    500537}
  • trunk/BNC/src/latencychecker.h

    r7421 r8082  
    3838  void checkOutage(bool decoded);
    3939  void checkObsLatency(const QList<t_satObs>& obsList);
    40   void checkCorrLatency(int corrGPSEpochTime);
    41   double currentLatency() const {return _curLat;}
     40  void checkCorrLatency(int corrGPSEpochTime, int type);
     41  double currentLatency() { return _curLat;}
     42  //QByteArray currentLatencyType() {return l._type;}
    4243
     44  class t_latency  {
     45   public:
     46    t_latency() {
     47      _oldSec     = 0;
     48      _newSec     = 0;
     49      _numGaps    = 0;
     50      _diffSec    = 0;
     51      _numLat     = 0;
     52      _sumLat     = 0.0;
     53      _sumLatQ    = 0.0;
     54      _meanDiff   = 0.0;
     55      _minLat     =  1000.0;
     56      _maxLat     = -1000.0;
     57      _curLat     = 0.0;
     58      _type       = "";
     59      _followSec  = false;
     60    }
     61    void init() {
     62      _diffSec = 0;
     63      _numGaps    = 0;
     64      _sumLat     = 0.0;
     65      _sumLatQ    = 0.0;
     66      _numLat     = 0;
     67      _minLat     =  1000.0;
     68      _maxLat     = -1000.0;
     69    };
     70    void print() {
     71      qDebug() << _type;
     72      qDebug() << "_oldSec: " << _oldSec;
     73      qDebug() << "_newSec: " << _newSec;
     74      qDebug() << "_numGaps: " << _numGaps;
     75      qDebug() << "_diffSec: " << _diffSec;
     76      qDebug() << "_numLat: " << _numLat;
     77      qDebug() << "_sumLat: " << _sumLat;
     78      qDebug() << "_sumLatQ: " << _sumLatQ;
     79      qDebug() << "_meanDiff: " << _meanDiff;
     80      qDebug() << "_minLat: " << _minLat;
     81      qDebug() << "_maxLat: " << _maxLat;
     82      qDebug() << "_curLat: " << _curLat;
     83      qDebug() << "_followSec" << _followSec;
     84    };
     85    int        _oldSec;
     86    int        _newSec;
     87    int        _numGaps;
     88    int        _diffSec;
     89    int        _numLat;
     90    double     _sumLat;
     91    double     _sumLatQ;
     92    double     _meanDiff;
     93    double     _minLat;
     94    double     _maxLat;
     95    double     _curLat;
     96    QByteArray _type;
     97    bool _followSec;
     98
     99  };
     100
     101  t_latency _lObs;
     102  t_latency _lOrb;
     103  t_latency _lClk;
     104  t_latency _lClkOrb;
     105  t_latency _lPb;
     106  t_latency _lCb;
     107  t_latency _lVtec;
     108  t_latency _lUra;
     109  t_latency _lHr;
     110  void setCurrentLatency(double lat) {
     111    _curLat = lat;
     112  }
     113  /*
     114  void setLatencyObjekt(t_latency& lat, QByteArray type) {
     115    qDebug() << "set " << type;
     116    l= lat;
     117    l._type = type;
     118    l.print();
     119  }
     120
     121  void getLatencyObjekt(t_latency& lat) {
     122    lat =l;
     123  }
     124
     125*/
    43126 signals:
    44127  void newMessage(QByteArray msg, bool showOnScreen);
     
    55138  int        _initPause;
    56139  int        _currPause;
    57   int        _oldSecGPS;
    58   int        _newSecGPS;
    59   int        _numGaps;
    60   int        _diffSecGPS;
    61   int        _numLat;
    62140  bool       _wrongEpoch;
    63141  bool       _checkSeg;
    64142  bool       _begCorrupt;
    65143  bool       _endCorrupt;
    66   bool       _followSec;
    67144  bool       _fromReconnect;
    68145  bool       _fromCorrupt;
    69   double     _maxDt;
    70   double     _sumLat;
    71   double     _sumLatQ;
    72   double     _meanDiff;
    73   double     _minLat;
    74   double     _maxLat;
    75   double     _curLat;
    76146  QByteArray _staID;
    77147  QString    _adviseScript;
     
    97167  QDateTime  _begDateTimeCorr;
    98168  QDateTime  _endDateTimeCorr;
     169  double     _curLat;
    99170};
    100171
Note: See TracChangeset for help on using the changeset viewer.