Index: trunk/BNC/src/bncgetthread.cpp
===================================================================
--- trunk/BNC/src/bncgetthread.cpp	(revision 8080)
+++ trunk/BNC/src/bncgetthread.cpp	(revision 8082)
@@ -74,8 +74,8 @@
 bncGetThread::bncGetThread(bncRawFile* rawFile) {
 
-  _rawFile      = rawFile;
-  _format       = rawFile->format();
-  _staID        = rawFile->staID();
-  _rawOutput    = false;
+  _rawFile = rawFile;
+  _format = rawFile->format();
+  _staID = rawFile->staID();
+  _rawOutput = false;
   _ntripVersion = "N";
 
@@ -85,17 +85,14 @@
 // Constructor 2
 ////////////////////////////////////////////////////////////////////////////
-bncGetThread::bncGetThread(const QUrl& mountPoint,
-                           const QByteArray& format,
-                           const QByteArray& latitude,
-                           const QByteArray& longitude,
-                           const QByteArray& nmea,
-                           const QByteArray& ntripVersion) {
-  _rawFile      = 0;
-  _mountPoint   = mountPoint;
-  _staID        = mountPoint.path().mid(1).toAscii();
-  _format       = format;
-  _latitude     = latitude;
-  _longitude    = longitude;
-  _nmea         = nmea;
+bncGetThread::bncGetThread(const QUrl& mountPoint, const QByteArray& format,
+    const QByteArray& latitude, const QByteArray& longitude,
+    const QByteArray& nmea, const QByteArray& ntripVersion) {
+  _rawFile = 0;
+  _mountPoint = mountPoint;
+  _staID = mountPoint.path().mid(1).toAscii();
+  _format = format;
+  _latitude = latitude;
+  _longitude = longitude;
+  _nmea = nmea;
   _ntripVersion = ntripVersion;
 
@@ -120,11 +117,11 @@
 
   connect(this, SIGNAL(newMessage(QByteArray,bool)),
-          BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
+  BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
 
   _isToBeDeleted = false;
-  _query         = 0;
-  _nextSleep     = 0;
-  _miscMount     = settings.value("miscMount").toString();
-  _decoder   = 0;
+  _query = 0;
+  _nextSleep = 0;
+  _miscMount = settings.value("miscMount").toString();
+  _decoder = 0;
 
   // NMEA Port
@@ -134,5 +131,7 @@
   while (iSta.hasNext()) {
     QStringList hlp = iSta.next().split(",");
-    if (hlp.size() < 10) {continue;}
+    if (hlp.size() < 10) {
+      continue;
+    }
     QByteArray mp = hlp[0].toAscii();
     if (_staID == mp) {
@@ -142,11 +141,11 @@
   if (nmeaPort != 0) {
     _nmeaServer = new QTcpServer;
-    if ( !_nmeaServer->listen(QHostAddress::Any, nmeaPort) ) {
+    if (!_nmeaServer->listen(QHostAddress::Any, nmeaPort)) {
       emit newMessage("bncCaster: Cannot listen on port", true);
-    }
-    else {
-      connect(_nmeaServer, SIGNAL(newConnection()), this, SLOT(slotNewNMEAConnection()));
-      connect(BNC_CORE, SIGNAL(newNMEAstr(QByteArray, QByteArray)),
-              this, SLOT(slotNewNMEAstr(QByteArray, QByteArray)));
+    } else {
+      connect(_nmeaServer, SIGNAL(newConnection()), this,
+          SLOT(slotNewNMEAConnection()));
+      connect(BNC_CORE, SIGNAL(newNMEAstr(QByteArray, QByteArray)), this,
+          SLOT(slotNewNMEAstr(QByteArray, QByteArray)));
       _nmeaSockets = new QList<QTcpSocket*>;
       _nmeaPortsMap[_staID] = nmeaPort;
@@ -159,47 +158,38 @@
   // Serial Port
   // -----------
-  _serialNMEA    = NO_NMEA;
+  _serialNMEA = NO_NMEA;
   _serialOutFile = 0;
-  _serialPort    = 0;
-
-  if (!_staID.isEmpty() &&
-      settings.value("serialMountPoint").toString() == _staID) {
-    _serialPort = new QextSerialPort(settings.value("serialPortName").toString() );
-    _serialPort->setTimeout(0,100);
+  _serialPort = 0;
+
+  if (!_staID.isEmpty()
+      && settings.value("serialMountPoint").toString() == _staID) {
+    _serialPort = new QextSerialPort(
+        settings.value("serialPortName").toString());
+    _serialPort->setTimeout(0, 100);
 
     // Baud Rate
     // ---------
     QString hlp = settings.value("serialBaudRate").toString();
-    if      (hlp == "110") {
+    if (hlp == "110") {
       _serialPort->setBaudRate(BAUD110);
-    }
-    else if (hlp == "300") {
+    } else if (hlp == "300") {
       _serialPort->setBaudRate(BAUD300);
-    }
-    else if (hlp == "600") {
+    } else if (hlp == "600") {
       _serialPort->setBaudRate(BAUD600);
-    }
-    else if (hlp == "1200") {
+    } else if (hlp == "1200") {
       _serialPort->setBaudRate(BAUD1200);
-    }
-    else if (hlp == "2400") {
+    } else if (hlp == "2400") {
       _serialPort->setBaudRate(BAUD2400);
-    }
-    else if (hlp == "4800") {
+    } else if (hlp == "4800") {
       _serialPort->setBaudRate(BAUD4800);
-    }
-    else if (hlp == "9600") {
+    } else if (hlp == "9600") {
       _serialPort->setBaudRate(BAUD9600);
-    }
-    else if (hlp == "19200") {
+    } else if (hlp == "19200") {
       _serialPort->setBaudRate(BAUD19200);
-    }
-    else if (hlp == "38400") {
+    } else if (hlp == "38400") {
       _serialPort->setBaudRate(BAUD38400);
-    }
-    else if (hlp == "57600") {
+    } else if (hlp == "57600") {
       _serialPort->setBaudRate(BAUD57600);
-    }
-    else if (hlp == "115200") {
+    } else if (hlp == "115200") {
       _serialPort->setBaudRate(BAUD115200);
     }
@@ -208,14 +198,11 @@
     // ------
     hlp = settings.value("serialParity").toString();
-    if      (hlp == "NONE") {
+    if (hlp == "NONE") {
       _serialPort->setParity(PAR_NONE);
-    }
-    else if (hlp == "ODD") {
+    } else if (hlp == "ODD") {
       _serialPort->setParity(PAR_ODD);
-    }
-    else if (hlp == "EVEN") {
+    } else if (hlp == "EVEN") {
       _serialPort->setParity(PAR_EVEN);
-    }
-    else if (hlp == "SPACE") {
+    } else if (hlp == "SPACE") {
       _serialPort->setParity(PAR_SPACE);
     }
@@ -224,21 +211,17 @@
     // ---------
     hlp = settings.value("serialDataBits").toString();
-    if      (hlp == "5") {
+    if (hlp == "5") {
       _serialPort->setDataBits(DATA_5);
-    }
-    else if (hlp == "6") {
+    } else if (hlp == "6") {
       _serialPort->setDataBits(DATA_6);
-    }
-    else if (hlp == "7") {
+    } else if (hlp == "7") {
       _serialPort->setDataBits(DATA_7);
-    }
-    else if (hlp == "8") {
+    } else if (hlp == "8") {
       _serialPort->setDataBits(DATA_8);
     }
     hlp = settings.value("serialStopBits").toString();
-    if      (hlp == "1") {
+    if (hlp == "1") {
       _serialPort->setStopBits(STOP_1);
-    }
-    else if (hlp == "2") {
+    } else if (hlp == "2") {
       _serialPort->setStopBits(STOP_2);
     }
@@ -249,9 +232,7 @@
     if (hlp == "XONXOFF") {
       _serialPort->setFlowControl(FLOW_XONXOFF);
-    }
-    else if (hlp == "HARDWARE") {
+    } else if (hlp == "HARDWARE") {
       _serialPort->setFlowControl(FLOW_HARDWARE);
-    }
-    else {
+    } else {
       _serialPort->setFlowControl(FLOW_OFF);
     }
@@ -259,5 +240,5 @@
     // Open Serial Port
     // ----------------
-    _serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered);
+    _serialPort->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
     if (!_serialPort->isOpen()) {
       delete _serialPort;
@@ -265,6 +246,6 @@
       emit(newMessage((_staID + ": Cannot open serial port\n"), true));
     }
-    connect(_serialPort, SIGNAL(readyRead()),
-            this, SLOT(slotSerialReadyRead()));
+    connect(_serialPort, SIGNAL(readyRead()), this,
+        SLOT(slotSerialReadyRead()));
 
     // Automatic NMEA
@@ -276,8 +257,8 @@
       if (!fName.isEmpty()) {
         _serialOutFile = new QFile(fName);
-        if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
+        if (Qt::CheckState(settings.value("rnxAppend").toInt())
+            == Qt::Checked) {
           _serialOutFile->open(QIODevice::WriteOnly | QIODevice::Append);
-        }
-        else {
+        } else {
           _serialOutFile->open(QIODevice::WriteOnly);
         }
@@ -286,14 +267,15 @@
     // Manual NMEA
     // -----------
-    if ((nmeaMode == "Manual GPGGA") ||(nmeaMode == "Manual GNGGA")) {
+    if ((nmeaMode == "Manual GPGGA") || (nmeaMode == "Manual GNGGA")) {
       _serialNMEA = MANUAL_NMEA;
       bncSettings settings;
       _manualNMEASampl = settings.value("serialManualNMEASampling").toInt();
-      QString hlp      = settings.value("serialHeightNMEA").toString();
+      QString hlp = settings.value("serialHeightNMEA").toString();
       if (hlp.isEmpty()) {
         hlp = "0.0";
       }
       QByteArray _serialHeightNMEA = hlp.toAscii();
-      _manualNMEAString = ggaString(_latitude, _longitude, _serialHeightNMEA, nmeaMode);
+      _manualNMEAString = ggaString(_latitude, _longitude, _serialHeightNMEA,
+          nmeaMode);
     }
   }
@@ -301,6 +283,16 @@
   if (!_staID.isEmpty()) {
     _latencyChecker = new latencyChecker(_staID);
-  }
-  else {
+    obs = false;
+    ssrOrb = false;
+    ssrClk = false;
+    ssrOrbClk = false;
+    ssrCbi = false;
+    ssrPbi = false;
+    ssrVtec = false;
+    ssrUra = false;
+    ssrHr = false;
+    _oldSsrEpoch = 0;
+    _ssrEpoch = 0;
+  } else {
     _latencyChecker = 0;
   }
@@ -313,26 +305,22 @@
   _decoder = 0;
 
-  if      (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1 ||
-           _format.indexOf("RTCM 2") != -1 ) {
+  if (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1
+      || _format.indexOf("RTCM 2") != -1) {
     emit(newMessage(_staID + ": Get data in RTCM 2.x format", true));
     _decoder = new RTCM2Decoder(_staID.data());
-  }
-  else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1 ||
-           _format.indexOf("RTCM 3") != -1 ) {
+  } else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1
+      || _format.indexOf("RTCM 3") != -1) {
     emit(newMessage(_staID + ": Get data in RTCM 3.x format", true));
     RTCM3Decoder* newDecoder = new RTCM3Decoder(_staID, _rawFile);
     _decoder = newDecoder;
     connect((RTCM3Decoder*) newDecoder, SIGNAL(newMessage(QByteArray,bool)),
-            this, SIGNAL(newMessage(QByteArray,bool)));
-  }
-  else if (_format.indexOf("ZERO") != -1) {
+        this, SIGNAL(newMessage(QByteArray,bool)));
+  } else if (_format.indexOf("ZERO") != -1) {
     emit(newMessage(_staID + ": Get data in original format", true));
     _decoder = new bncZeroDecoder(_staID);
-  }
-  else if (_format.indexOf("RTNET") != -1) {
+  } else if (_format.indexOf("RTNET") != -1) {
     emit(newMessage(_staID + ": Get data in RTNet format", true));
     _decoder = new bncRtnetDecoder();
-  }
-  else {
+  } else {
     emit(newMessage(_staID + ": Unknown data format " + _format, true));
     _isToBeDeleted = true;
@@ -342,6 +330,6 @@
   msleep(100); //sleep 0.1 sec
 
-  _decoder->initRinex(_staID, _mountPoint, _latitude, _longitude,
-                               _nmea, _ntripVersion);
+  _decoder->initRinex(_staID, _mountPoint, _latitude, _longitude, _nmea,
+      _ntripVersion);
 
   if (_rawFile) {
@@ -357,6 +345,5 @@
   if (!_rawFile) {
     return _decoder;
-  }
-  else {
+  } else {
     if (_decodersRaw.contains(_staID) || initDecoder() == success) {
       return _decodersRaw[_staID];
@@ -382,6 +369,5 @@
       delete it.value();
     }
-  }
-  else {
+  } else {
     delete _decoder;
   }
@@ -398,5 +384,5 @@
   _isToBeDeleted = true;
 
-  if(_nmeaPortsMap.contains(_staID)) {
+  if (_nmeaPortsMap.contains(_staID)) {
     _nmeaPortsMap.remove(_staID);
   }
@@ -410,12 +396,15 @@
 #ifdef BNC_DEBUG
   if (BNC_CORE->mode() != t_bncCore::interactive) {
-    while (!isFinished()) {wait();}
+    while (!isFinished()) {
+      wait();
+    }
     delete this;
-  }
-  else {
-    if (!isRunning()) {delete this;}
+  } else {
+    if (!isRunning()) {
+      delete this;
+    }
   }
 #else
-    if (!isRunning()) {delete this;}
+  if (!isRunning()) {delete this;}
 #endif
 
@@ -450,6 +439,5 @@
           decoder->_obsList.clear();
         }
-      }
-      else {
+      } else {
         _decoder->_obsList.clear();
       }
@@ -458,11 +446,10 @@
       // ---------
       QByteArray data;
-      if      (_query) {
+      if (_query) {
         _query->waitForReadyRead(data);
-      }
-      else if (_rawFile) {
+      } else if (_rawFile) {
         data = _rawFile->readChunk();
         _format = _rawFile->format();
-        _staID  = _rawFile->staID();
+        _staID = _rawFile->staID();
 
         QCoreApplication::processEvents();
@@ -486,6 +473,5 @@
         msleep(10000); //sleep 10 sec, G. Weber
         continue;
-      }
-      else {
+      } else {
         emit newBytes(_staID, nBytes);
         emit newRawData(_staID, data);
@@ -520,10 +506,82 @@
       if (_latencyChecker) {
         _latencyChecker->checkOutage(irc == success);
-        _latencyChecker->checkObsLatency(decoder()->_obsList);
-        _latencyChecker->checkCorrLatency(decoder()->corrGPSEpochTime());
-
+        QListIterator<int> it(decoder()->_typeList);
+        _ssrEpoch = decoder()->corrGPSEpochTime();
+        if (_oldSsrEpoch > 0 && _ssrEpoch && _ssrEpoch > _oldSsrEpoch) {
+          if (ssrOrb) {
+            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1057);
+            ssrOrb = false;
+          }
+          if (ssrClk) {
+            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1058);
+            ssrClk = false;
+          }
+          if (ssrOrbClk) {
+            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1060);
+            ssrOrbClk = false;
+          }
+          if (ssrCbi) {
+            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1059);
+            ssrCbi = false;
+          }
+          if (ssrPbi) {
+            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1265);
+            ssrPbi = false;
+          }
+          if (ssrVtec) {
+            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1264);
+            ssrVtec = false;
+          }
+          if (ssrUra) {
+            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1061);
+            ssrUra = false;
+          }
+          if (ssrHr) {
+            _latencyChecker->checkCorrLatency(_oldSsrEpoch, 1062);
+            ssrHr = false;
+          }
+        }
+        while (it.hasNext()) {
+          int rtcmType = it.next();
+          if ((rtcmType >= 1001 && rtcmType <= 1004) || // legacy RTCM OBS
+              (rtcmType >= 1009 && rtcmType <= 1012) || // legacy RTCM OBS
+              (rtcmType >= 1071 && rtcmType <= 1127)) { // MSM RTCM OBS
+            obs = true;
+          } else if ((rtcmType >= 1057 && rtcmType <= 1068) ||
+                     (rtcmType >= 1240 && rtcmType <= 1270)) {
+            switch (rtcmType) {
+              case 1057: case 1063: case 1240: case 1246: case 1252: case 1258:
+                ssrOrb = true;
+                break;
+              case 1058: case 1064: case 1241: case 1247: case 1253: case 1259:
+                ssrClk = true;
+                break;
+              case 1060: case 1066: case 1243: case 1249: case 1255: case 1261:
+                ssrOrbClk = true;
+                break;
+              case 1059: case 1065: case 1242:   case 1248: case 1254: case 1260:
+                ssrCbi = true;
+                break;
+              case 1265: case 1266: case 1267: case 1268: case 1269: case 1270:
+                ssrPbi = true;
+                break;
+              case 1264:
+                ssrVtec = true;
+                break;
+              case 1061: case 1067: case 1244: case 1250: case 1256: case 1262:
+                ssrUra = true;
+                break;
+              case 1062: case 1068: case 1245: case 1251: case 1257: case 1263:
+                ssrHr = true;
+                break;
+            }
+          }
+        }
+        if (obs) {
+          _latencyChecker->checkObsLatency(decoder()->_obsList);
+        }
+        _oldSsrEpoch = _ssrEpoch;
         emit newLatency(_staID, _latencyChecker->currentLatency());
       }
-
       miscScanRTCM();
 
@@ -543,5 +601,7 @@
           if (wrongObservationEpoch) {
             QString prn(obs._prn.toString().c_str());
-            emit( newMessage(_staID + " (" + prn.toAscii() + ")" + ": Wrong observation epoch(s)", false) );
+            emit(newMessage(
+                _staID + " (" + prn.toAscii() + ")"
+                    + ": Wrong observation epoch(s)", false));
             continue;
           }
@@ -552,17 +612,17 @@
         if (!_rawFile) {
           QString prn(obs._prn.toString().c_str());
-          long iSec    = long(floor(obs._time.gpssec()+0.5));
-          long obsTime = obs._time.gpsw()*7*24*3600 + iSec;
+          long iSec = long(floor(obs._time.gpssec() + 0.5));
+          long obsTime = obs._time.gpsw() * 7 * 24 * 3600 + iSec;
           QMap<QString, long>::const_iterator it = _prnLastEpo.find(prn);
           if (it != _prnLastEpo.end()) {
             long oldTime = it.value();
-            if      (obsTime <  oldTime) {
-              emit( newMessage(_staID +
-                 ": old observation " + prn.toAscii(), false));
+            if (obsTime < oldTime) {
+              emit(newMessage(_staID + ": old observation " + prn.toAscii(),
+                  false));
               continue;
-            }
-            else if (obsTime == oldTime) {
-              emit( newMessage(_staID +
-                 ": observation coming more than once " + prn.toAscii(), false));
+            } else if (obsTime == oldTime) {
+              emit(newMessage(
+                  _staID + ": observation coming more than once "
+                      + prn.toAscii(), false));
               continue;
             }
@@ -584,10 +644,8 @@
       }
 
-    }
-    catch (Exception& exc) {
+    } catch (Exception& exc) {
       emit(newMessage(_staID + " " + exc.what(), true));
       _isToBeDeleted = true;
-    }
-    catch (...) {
+    } catch (...) {
       emit(newMessage(_staID + " bncGetThread exception", true));
       _isToBeDeleted = true;
@@ -611,6 +669,5 @@
         decoder->setRinexReconnectFlag(false);
       }
-    }
-    else {
+    } else {
       _decoder->setRinexReconnectFlag(false);
     }
@@ -625,6 +682,5 @@
     if (_nextSleep == 0) {
       _nextSleep = 1;
-    }
-    else {
+    } else {
       _nextSleep = 2 * _nextSleep;
       if (_nextSleep > 256) {
@@ -640,26 +696,19 @@
       delete _query;
     }
-    if      (_ntripVersion == "U") {
+    if (_ntripVersion == "U") {
       _query = new bncNetQueryUdp();
-    }
-    else if (_ntripVersion == "R") {
+    } else if (_ntripVersion == "R") {
       _query = new bncNetQueryRtp();
-    }
-    else if (_ntripVersion == "S") {
+    } else if (_ntripVersion == "S") {
       _query = new bncNetQueryS();
-    }
-    else if (_ntripVersion == "N") {
+    } else if (_ntripVersion == "N") {
       _query = new bncNetQueryV0();
-    }
-    else if (_ntripVersion == "UN") {
+    } else if (_ntripVersion == "UN") {
       _query = new bncNetQueryUdp0();
-    }
-    else if (_ntripVersion == "2") {
+    } else if (_ntripVersion == "2") {
       _query = new bncNetQueryV2(false);
-    }
-    else if (_ntripVersion == "2s") {
+    } else if (_ntripVersion == "2s") {
       _query = new bncNetQueryV2(true);
-    }
-    else {
+    } else {
       _query = new bncNetQueryV1();
     }
@@ -668,6 +717,5 @@
         _query->startRequest(_mountPoint, _manualNMEAString);
         _lastManualNMEA = QDateTime::currentDateTime();
-      }
-      else if (_serialNMEA == AUTO_NMEA) {
+      } else if (_serialNMEA == AUTO_NMEA) {
         if (_serialPort) {
           int nb = _serialPort->bytesAvailable();
@@ -688,6 +736,5 @@
         }
       }
-    }
-    else {
+    } else {
       _query->startRequest(_mountPoint, "");
     }
@@ -705,7 +752,6 @@
       decoder->setRinexReconnectFlag(false);
     }
-  }
-  else {
-   _decoder->setRinexReconnectFlag(false);
+  } else {
+    _decoder->setRinexReconnectFlag(false);
   }
 
@@ -717,17 +763,18 @@
 void bncGetThread::miscScanRTCM() {
 
-  if ( !decoder() ) {
+  if (!decoder()) {
     return;
   }
 
   bncSettings settings;
-  if ( Qt::CheckState(settings.value("miscScanRTCM").toInt()) == Qt::Checked ) {
-
-    if ( _miscMount == _staID || _miscMount == "ALL" ) {
+  if (Qt::CheckState(settings.value("miscScanRTCM").toInt()) == Qt::Checked) {
+
+    if (_miscMount == _staID || _miscMount == "ALL") {
       // RTCM message types
       // ------------------
       for (int ii = 0; ii < decoder()->_typeList.size(); ii++) {
-        QString type =  QString("%1 ").arg(decoder()->_typeList[ii]);
-        emit(newMessage(_staID + ": Received message type " + type.toAscii(), true));
+        QString type = QString("%1 ").arg(decoder()->_typeList[ii]);
+        emit(newMessage(_staID + ": Received message type " + type.toAscii(),
+            true));
       }
 
@@ -742,7 +789,7 @@
             QString rnxStr('C');
             rnxStr.append(obs._obs[iFrq]->_rnxType2ch.c_str());
-            if (_format.indexOf("RTCM_2") != -1 ||
-                _format.indexOf("RTCM2") != -1 ||
-                _format.indexOf("RTCM 2") != -1 ) {
+            if (_format.indexOf("RTCM_2") != -1
+                || _format.indexOf("RTCM2") != -1
+                || _format.indexOf("RTCM 2") != -1) {
               rnxStr = t_rnxObsFile::type3to2(obs._prn.system(), rnxStr);
             }
@@ -755,7 +802,7 @@
             QString rnxStr('L');
             rnxStr.append(obs._obs[iFrq]->_rnxType2ch.c_str());
-            if (_format.indexOf("RTCM_2") != -1 ||
-                _format.indexOf("RTCM2") != -1 ||
-                _format.indexOf("RTCM 2") != -1 ) {
+            if (_format.indexOf("RTCM_2") != -1
+                || _format.indexOf("RTCM2") != -1
+                || _format.indexOf("RTCM 2") != -1) {
               rnxStr = t_rnxObsFile::type3to2(obs._prn.system(), rnxStr);
             }
@@ -765,10 +812,10 @@
             }
           }
-          if (obs._obs[iFrq]->_dopplerValid){
+          if (obs._obs[iFrq]->_dopplerValid) {
             QString rnxStr('D');
             rnxStr.append(obs._obs[iFrq]->_rnxType2ch.c_str());
-            if (_format.indexOf("RTCM_2") != -1 ||
-                _format.indexOf("RTCM2") != -1 ||
-                _format.indexOf("RTCM 2") != -1 ) {
+            if (_format.indexOf("RTCM_2") != -1
+                || _format.indexOf("RTCM2") != -1
+                || _format.indexOf("RTCM 2") != -1) {
               rnxStr = t_rnxObsFile::type3to2(obs._prn.system(), rnxStr);
             }
@@ -778,10 +825,10 @@
             }
           }
-          if (obs._obs[iFrq]->_snrValid){
+          if (obs._obs[iFrq]->_snrValid) {
             QString rnxStr('S');
             rnxStr.append(obs._obs[iFrq]->_rnxType2ch.c_str());
-            if (_format.indexOf("RTCM_2") != -1 ||
-                _format.indexOf("RTCM2") != -1 ||
-                _format.indexOf("RTCM 2") != -1 ) {
+            if (_format.indexOf("RTCM_2") != -1
+                || _format.indexOf("RTCM2") != -1
+                || _format.indexOf("RTCM 2") != -1) {
               rnxStr = t_rnxObsFile::type3to2(obs._prn.system(), rnxStr);
             }
@@ -796,9 +843,11 @@
           QTextStream str(&msg);
           QString s;
-          str << obs._prn.system() << "    " << s.sprintf("%2d", rnxTypes.size()) << "  ";
+          str << obs._prn.system() << "    "
+              << s.sprintf("%2d", rnxTypes.size()) << "  ";
           for (int iType = 0; iType < rnxTypes.size(); iType++) {
             str << " " << rnxTypes[iType];
           }
-          emit(newMessage(_staID + ": Observation Types: " + msg.toAscii(), true));
+          emit(newMessage(_staID + ": Observation Types: " + msg.toAscii(),
+              true));
         }
       }
@@ -807,5 +856,5 @@
       // -------------------------
       for (int ii = 0; ii < decoder()->_antType.size(); ii++) {
-        QString ant1 =  QString("%1 ").arg(decoder()->_antType[ii]);
+        QString ant1 = QString("%1 ").arg(decoder()->_antType[ii]);
         emit(newMessage(_staID + ": Antenna descriptor " + ant1.toAscii(), true));
       }
@@ -813,16 +862,18 @@
       // RTCM Antenna Coordinates
       // ------------------------
-      for (int ii=0; ii < decoder()->_antList.size(); ii++) {
+      for (int ii = 0; ii < decoder()->_antList.size(); ii++) {
         QByteArray antT;
-        if      (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
+        if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
           antT = "ARP";
-        }
-        else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
+        } else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
           antT = "APC";
         }
         QByteArray ant1, ant2, ant3;
-        ant1 = QString("%1 ").arg(decoder()->_antList[ii].xx,0,'f',4).toAscii();
-        ant2 = QString("%1 ").arg(decoder()->_antList[ii].yy,0,'f',4).toAscii();
-        ant3 = QString("%1 ").arg(decoder()->_antList[ii].zz,0,'f',4).toAscii();
+        ant1 =
+            QString("%1 ").arg(decoder()->_antList[ii].xx, 0, 'f', 4).toAscii();
+        ant2 =
+            QString("%1 ").arg(decoder()->_antList[ii].yy, 0, 'f', 4).toAscii();
+        ant3 =
+            QString("%1 ").arg(decoder()->_antList[ii].zz, 0, 'f', 4).toAscii();
         emit(newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true));
         emit(newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true));
@@ -831,10 +882,10 @@
         if (decoder()->_antList[ii].height_f) {
           hh = decoder()->_antList[ii].height;
-          QByteArray ant4 = QString("%1 ").arg(hh,0,'f',4).toAscii();
-          emit(newMessage(_staID + ": Antenna height above marker "  + ant4 + "m", true));
+          QByteArray ant4 = QString("%1 ").arg(hh, 0, 'f', 4).toAscii();
+          emit(newMessage(
+              _staID + ": Antenna height above marker " + ant4 + "m", true));
         }
         emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
-                       decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
-                       hh, antT));
+            decoder()->_antList[ii].yy, decoder()->_antList[ii].zz, hh, antT));
       }
 
@@ -844,5 +895,5 @@
         bool allFound = true;
         QString slot = decoder()->_gloFrq;
-        slot.replace("  "," ").replace(" ",":");
+        slot.replace("  ", " ").replace(" ", ":");
         if (_gloSlots.indexOf(slot) == -1) {
           _gloSlots.append(slot);
@@ -851,5 +902,7 @@
         if (!allFound) {
           _gloSlots.sort();
-          emit(newMessage(_staID + ": GLONASS Slot:Freq "  + _gloSlots.join(" ").toAscii(), true));
+          emit(newMessage(
+              _staID + ": GLONASS Slot:Freq " + _gloSlots.join(" ").toAscii(),
+              true));
         }
       }
@@ -859,18 +912,18 @@
 #ifdef MLS_SOFTWARE
   for (int ii=0; ii <decoder()->_antList.size(); ii++) {
-        QByteArray antT;
-        if      (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
-          antT = "ARP";
-        }
-        else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
-          antT = "APC";
-        }
-        double hh = 0.0;
-        if (decoder()->_antList[ii].height_f) {
-          hh = decoder()->_antList[ii].height;
-        }
-        emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
-                       decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
-                       hh, antT));
+    QByteArray antT;
+    if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
+      antT = "ARP";
+    }
+    else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
+      antT = "APC";
+    }
+    double hh = 0.0;
+    if (decoder()->_antList[ii].height_f) {
+      hh = decoder()->_antList[ii].height;
+    }
+    emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
+            decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
+            hh, antT));
   }
 
@@ -930,6 +983,7 @@
 void bncGetThread::slotNewNMEAConnection() {
   _nmeaSockets->push_back(_nmeaServer->nextPendingConnection());
-  emit( newMessage(QString("New PPP client on port: # %1")
-                   .arg(_nmeaSockets->size()).toAscii(), true) );
+  emit(newMessage(
+      QString("New PPP client on port: # %1").arg(_nmeaSockets->size()).toAscii(),
+      true));
 }
 
@@ -945,6 +999,5 @@
         if (sock->state() == QAbstractSocket::ConnectedState) {
           sock->write(str);
-        }
-        else if (sock->state() != QAbstractSocket::ConnectingState) {
+        } else if (sock->state() != QAbstractSocket::ConnectingState) {
           delete sock;
           is.remove();
Index: trunk/BNC/src/bncgetthread.h
===================================================================
--- trunk/BNC/src/bncgetthread.h	(revision 8080)
+++ trunk/BNC/src/bncgetthread.h	(revision 8082)
@@ -47,9 +47,9 @@
  public:
    bncGetThread(bncRawFile* rawFile);
-   bncGetThread(const QUrl& mountPoint, 
+   bncGetThread(const QUrl& mountPoint,
                 const QByteArray& format,
                 const QByteArray& latitude,
                 const QByteArray& longitude,
-                const QByteArray& nmea, 
+                const QByteArray& nmea,
                 const QByteArray& ntripVersion);
 
@@ -80,5 +80,5 @@
    void newLatency(QByteArray staID, double clate);
    void newObs(QByteArray staID, QList<t_satObs> obsList);
-   void newAntCrd(QByteArray staID, double xx, double yy, double zz, 
+   void newAntCrd(QByteArray staID, double xx, double yy, double zz,
                   double hh, QByteArray antType);
    void newMessage(QByteArray msg, bool showOnScreen);
@@ -121,7 +121,15 @@
    int                        _nextSleep;
    int                        _iMount;
+   int                        _ssrEpoch;
+   int                        _oldSsrEpoch;
    bncRawFile*                _rawFile;
    QextSerialPort*            _serialPort;
    bool                       _isToBeDeleted;
+   bool obs;
+   bool ssrOrb, ssrClk, ssrOrbClk;
+   bool ssrCbi, ssrPbi;
+   bool ssrVtec;
+   bool ssrUra;
+   bool ssrHr;
    latencyChecker*            _latencyChecker;
    QString                    _miscMount;
Index: trunk/BNC/src/latencychecker.cpp
===================================================================
--- trunk/BNC/src/latencychecker.cpp	(revision 8080)
+++ trunk/BNC/src/latencychecker.cpp	(revision 8082)
@@ -130,5 +130,4 @@
   // Initialize private members
   // --------------------------
-  _maxDt      = 1000.0;
   _wrongEpoch = false;
   _checkSeg   = false;
@@ -138,16 +137,7 @@
   _initPause  = 0;
   _currPause  = 0;
-  _followSec  = false;
-  _oldSecGPS  = 0;
-  _newSecGPS  = 0;
-  _numGaps    = 0;
-  _diffSecGPS = 0;
-  _numLat     = 0;
-  _sumLat     = 0.0;
-  _sumLatQ    = 0.0;
-  _meanDiff   = 0.0;
-  _minLat     =  _maxDt;
-  _maxLat     = -_maxDt;
-  _curLat     = 0.0;
+  _endCorrupt = false;
+  _begCorrupt = false;
+  _fromCorrupt = false;
 
   _checkTime = QDateTime::currentDateTime();
@@ -162,5 +152,4 @@
   _begDateTimeCorr = QDateTime::currentDateTime();
   _endDateTimeCorr = QDateTime::currentDateTime();
-
 }
 
@@ -332,52 +321,48 @@
 
   if (_miscIntr > 0 ) {
-
+    t_latency& l = _lObs; l._type =  "Observations";
     QListIterator<t_satObs> it(obsList);
     while (it.hasNext()) {
       const t_satObs& obs = it.next();
       bool wrongObservationEpoch = checkForWrongObsEpoch(obs._time);
-      _newSecGPS = static_cast<int>(obs._time.gpssec());
-      if (_newSecGPS != _oldSecGPS && !wrongObservationEpoch) {
-        if (_newSecGPS % _miscIntr < _oldSecGPS % _miscIntr) {
-          if (_numLat > 0) {
-            if (_meanDiff > 0.0) {
+      l._newSec = static_cast<int>(obs._time.gpssec());
+      if (l._newSec > l._oldSec && !wrongObservationEpoch) {
+        if (l._newSec % _miscIntr < l._oldSec % _miscIntr) {
+          if (l._numLat > 0) {
+            if (l._meanDiff > 0.0) {
               if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
-                emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs, %7 gaps")
+                emit( newMessage(QString("%1 %2: Mean latency %3 sec, min %4, max %5, rms %6, %7 epochs, %8 gaps")
                   .arg(_staID.data())
-                  .arg(int(_sumLat/_numLat*100)/100.)
-                  .arg(int(_minLat*100)/100.)
-                  .arg(int(_maxLat*100)/100.)
-                  .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
-                  .arg(_numLat)
-                  .arg(_numGaps)
+                  .arg(l._type.data())
+                  .arg(int(l._sumLat/l._numLat*100)/100.)
+                  .arg(int(l._minLat*100)/100.)
+                  .arg(int(l._maxLat*100)/100.)
+                  .arg(int((sqrt((l._sumLatQ - l._sumLat * l._sumLat / l._numLat)/l._numLat))*100)/100.)
+                  .arg(l._numLat)
+                  .arg(l._numGaps)
                   .toAscii(), true) );
               }
             } else {
               if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
-                emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs")
+                emit( newMessage(QString("%1 %2: Mean latency %3 sec, min %4, max %5, rms %6, %7 epochs")
                   .arg(_staID.data())
-                  .arg(int(_sumLat/_numLat*100)/100.)
-                  .arg(int(_minLat*100)/100.)
-                  .arg(int(_maxLat*100)/100.)
-                  .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
-                  .arg(_numLat)
+                  .arg(l._type.data())
+                  .arg(int(l._sumLat/l._numLat*100)/100.)
+                  .arg(int(l._minLat*100)/100.)
+                  .arg(int(l._maxLat*100)/100.)
+                  .arg(int((sqrt((l._sumLatQ - l._sumLat * l._sumLat / l._numLat)/l._numLat))*100)/100.)
+                  .arg(l._numLat)
                   .toAscii(), true) );
               }
             }
           }
-          _meanDiff  = _diffSecGPS / _numLat;
-          _diffSecGPS = 0;
-          _numGaps    = 0;
-          _sumLat     = 0.0;
-          _sumLatQ    = 0.0;
-          _numLat     = 0;
-          _minLat     = _maxDt;
-          _maxLat     = -_maxDt;
-        }
-        if (_followSec) {
-          _diffSecGPS += _newSecGPS - _oldSecGPS;
-          if (_meanDiff>0.) {
-            if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) {
-              _numGaps += 1;
+          l._meanDiff  = l._diffSec / l._numLat;
+          l.init();
+        }
+        if (l._followSec) {
+          l._diffSec += l._newSec - l._oldSec;
+          if (l._meanDiff>0.) {
+            if (l._newSec - l._oldSec > 1.5 * l._meanDiff) {
+              l._numGaps += 1;
             }
           }
@@ -398,18 +383,20 @@
           sec  += secPerWeek;
         }
-         _curLat   = sec - obs._time.gpssec();
-        _sumLat  += _curLat;
-        _sumLatQ += _curLat * _curLat;
-        if (_curLat < _minLat) {
-          _minLat = _curLat;
-        }
-        if (_curLat >= _maxLat) {
-          _maxLat = _curLat;
-        }
-        _numLat += 1;
-        _oldSecGPS = _newSecGPS;
-        _followSec = true;
-      }
-    }
+        l._curLat   = sec - obs._time.gpssec();
+        l._sumLat  += l._curLat;
+        l._sumLatQ += l._curLat * l._curLat;
+        if (l._curLat < l._minLat) {
+          l._minLat = l._curLat;
+        }
+        if (l._curLat >= l._maxLat) {
+          l._maxLat = l._curLat;
+        }
+        l._numLat += 1;
+        l._oldSec    = l._newSec;
+        l._followSec = true;
+      }
+    }
+    _lObs = l;
+    setCurrentLatency(l._curLat);
   }
 }
@@ -417,21 +404,47 @@
 // Perform latency checks (corrections)
 //////////////////////////////////////////////////////////////////////////////
-void latencyChecker::checkCorrLatency(int corrGPSEpochTime) {
-
+void latencyChecker::checkCorrLatency(int corrGPSEpochTime, int type) {
   if (corrGPSEpochTime < 0) {
-    return;
+    return ;
+  }
+  t_latency& l = _lOrb; // init
+  switch (type) {
+    case 1057: case 1063: case 1240: case 1246: case 1252: case 1258:
+      l = _lOrb; l._type =  "Orbit";
+      break;
+    case 1058: case 1064: case 1241: case 1247: case 1253: case 1259:
+      l = _lClk; l._type =  "Clock";
+      break;
+    case 1060: case 1066: case 1243: case 1249: case 1255: case 1261:
+      l = _lClkOrb; l._type = "Clock&Orbit";
+      break;
+    case 1059: case 1065: case 1242: case 1248: case 1254: case 1260:
+      l = _lCb; l._type = "Code Biases";
+      break;
+    case 1265: case 1266: case 1267: case 1268: case 1269: case 1270:
+      l = _lPb; l._type = "Phase Biases";
+      break;
+    case 1264:
+      l = _lVtec; l._type = "VTEC";
+      break;
+    case 1061: case 1067: case 1244: case 1250: case 1256: case 1262:
+      l = _lUra; l._type = "URA";
+      break;
+    case 1062: case 1068: case 1245: case 1251: case 1257: case 1263:
+      l = _lHr; l._type = "Hr Clock";
+      break;
+    default:
+      return;
   }
 
   if (_miscIntr > 0) {
-
-    _newSecGPS = corrGPSEpochTime;
-
+    l._newSec = corrGPSEpochTime;
     int week;
     double sec;
     currentGPSWeeks(week, sec);
-    double dt = fabs(sec - _newSecGPS);
+    double dt = fabs(sec - l._newSec);
     const double secPerWeek = 7.0 * 24.0 * 3600.0;
     if (dt > 0.5 * secPerWeek) {
-      if (sec > _newSecGPS) {
+      if (sec > l._newSec) {
         sec  -= secPerWeek;
       } else {
@@ -439,16 +452,17 @@
       }
     }
-    if (_newSecGPS != _oldSecGPS) {
-      if (int(_newSecGPS) % _miscIntr < int(_oldSecGPS) % _miscIntr) {
-        if (_numLat>0) {
+    if (l._newSec > l._oldSec) {
+      if (int(l._newSec) % _miscIntr < int(l._oldSec) % _miscIntr) {
+        if (l._numLat>0) {
           QString late;
-          if (_meanDiff>0.) {
-            late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs, %6 gaps")
-            .arg(int(_sumLat/_numLat*100)/100.)
-            .arg(int(_minLat*100)/100.)
-            .arg(int(_maxLat*100)/100.)
-            .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
-            .arg(_numLat)
-            .arg(_numGaps);
+          if (l._meanDiff>0.) {
+            late = QString(" %1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs, %7 gaps")
+            .arg(l._type.data())
+            .arg(int(l._sumLat/l._numLat*100)/100.)
+            .arg(int(l._minLat*100)/100.)
+            .arg(int(l._maxLat*100)/100.)
+            .arg(int((sqrt((l._sumLatQ - l._sumLat * l._sumLat / l._numLat)/l._numLat))*100)/100.)
+            .arg(l._numLat)
+            .arg(l._numGaps);
             if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
               emit(newMessage(QString(_staID + late ).toAscii(), true) );
@@ -456,10 +470,11 @@
           }
           else {
-            late = QString(": Mean latency %1 sec, min %2, max %3, rms %4, %5 epochs")
-            .arg(int(_sumLat/_numLat*100)/100.)
-            .arg(int(_minLat*100)/100.)
-            .arg(int(_maxLat*100)/100.)
-            .arg(int((sqrt((_sumLatQ - _sumLat * _sumLat / _numLat)/_numLat))*100)/100.)
-            .arg(_numLat);
+            late = QString(" %1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs")
+            .arg(l._type.data())
+            .arg(int(l._sumLat/l._numLat*100)/100.)
+            .arg(int(l._minLat*100)/100.)
+            .arg(int(l._maxLat*100)/100.)
+            .arg(int((sqrt((l._sumLatQ - l._sumLat * l._sumLat / l._numLat)/l._numLat))*100)/100.)
+            .arg(l._numLat);
             if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
             emit(newMessage(QString(_staID + late ).toAscii(), true) );
@@ -467,34 +482,56 @@
           }
         }
-        _meanDiff = int(_diffSecGPS)/_numLat;
-        _diffSecGPS = 0;
-        _numGaps    = 0;
-        _sumLat     = 0.0;
-        _sumLatQ    = 0.0;
-        _numLat     = 0;
-        _minLat     = 1000.;
-        _maxLat     = -1000.;
-      }
-      if (_followSec) {
-        _diffSecGPS += _newSecGPS - _oldSecGPS;
-        if (_meanDiff>0.) {
-          if (_newSecGPS - _oldSecGPS > 1.5 * _meanDiff) {
-            _numGaps += 1;
-          }
-        }
-      }
-      _curLat   = sec - _newSecGPS;
-      _sumLat  += _curLat;
-      _sumLatQ += _curLat * _curLat;
-      if (_curLat < _minLat) {
-        _minLat = _curLat;
-      }
-      if (_curLat >= _maxLat) {
-        _maxLat = _curLat;
-      }
-      _numLat += 1;
-      _oldSecGPS = _newSecGPS;
-      _followSec = true;
-    }
+        l._meanDiff = int(l._diffSec)/l._numLat;
+        l.init();
+      }
+
+      if (l._followSec) {
+        l._diffSec += l._newSec - l._oldSec;
+        if (l._meanDiff>0.) {
+          if (l._newSec - l._oldSec > 1.5 * l._meanDiff) {
+            l._numGaps += 1;
+          }
+        }
+      }
+      l._curLat   = sec - l._newSec;
+      l._sumLat  += l._curLat;
+      l._sumLatQ += l._curLat * l._curLat;
+      if (l._curLat < l._minLat) {
+        l._minLat = l._curLat;
+      }
+      if (l._curLat >= l._maxLat) {
+        l._maxLat = l._curLat;
+      }
+      l._numLat += 1;
+      l._oldSec = l._newSec;
+      l._followSec = true;
+      setCurrentLatency(l._curLat);
+    }
+    switch (type) {
+       case 1057: case 1063: case 1240: case 1246: case 1252: case 1258:
+         _lOrb = l;
+         break;
+       case 1058: case 1064: case 1241: case 1247: case 1253: case 1259:
+         _lClk = l;
+         break;
+       case 1060: case 1066: case 1243: case 1249: case 1255: case 1261:
+         _lClkOrb = l;
+         break;
+       case 1059: case 1065: case 1242: case 1248: case 1254: case 1260:
+         _lCb = l;
+         break;
+       case 1265: case 1266: case 1267: case 1268: case 1269: case 1270:
+         _lPb = l;
+         break;
+       case 1264:
+         _lVtec = l;
+         break;
+       case 1061: case 1067: case 1244: case 1250: case 1256: case 1262:
+         _lUra = l;
+         break;
+       case 1062: case 1068: case 1245: case 1251: case 1257: case 1263:
+         _lHr = l;
+         break;
+     }
   }
 }
Index: trunk/BNC/src/latencychecker.h
===================================================================
--- trunk/BNC/src/latencychecker.h	(revision 8080)
+++ trunk/BNC/src/latencychecker.h	(revision 8082)
@@ -38,7 +38,90 @@
   void checkOutage(bool decoded);
   void checkObsLatency(const QList<t_satObs>& obsList);
-  void checkCorrLatency(int corrGPSEpochTime);
-  double currentLatency() const {return _curLat;}
+  void checkCorrLatency(int corrGPSEpochTime, int type);
+  double currentLatency() { return _curLat;}
+  //QByteArray currentLatencyType() {return l._type;}
 
+  class t_latency  {
+   public:
+    t_latency() {
+      _oldSec     = 0;
+      _newSec     = 0;
+      _numGaps    = 0;
+      _diffSec    = 0;
+      _numLat     = 0;
+      _sumLat     = 0.0;
+      _sumLatQ    = 0.0;
+      _meanDiff   = 0.0;
+      _minLat     =  1000.0;
+      _maxLat     = -1000.0;
+      _curLat     = 0.0;
+      _type       = "";
+      _followSec  = false;
+    }
+    void init() {
+      _diffSec = 0;
+      _numGaps    = 0;
+      _sumLat     = 0.0;
+      _sumLatQ    = 0.0;
+      _numLat     = 0;
+      _minLat     =  1000.0;
+      _maxLat     = -1000.0;
+    };
+    void print() {
+      qDebug() << _type;
+      qDebug() << "_oldSec: " << _oldSec;
+      qDebug() << "_newSec: " << _newSec;
+      qDebug() << "_numGaps: " << _numGaps;
+      qDebug() << "_diffSec: " << _diffSec;
+      qDebug() << "_numLat: " << _numLat;
+      qDebug() << "_sumLat: " << _sumLat;
+      qDebug() << "_sumLatQ: " << _sumLatQ;
+      qDebug() << "_meanDiff: " << _meanDiff;
+      qDebug() << "_minLat: " << _minLat;
+      qDebug() << "_maxLat: " << _maxLat;
+      qDebug() << "_curLat: " << _curLat;
+      qDebug() << "_followSec" << _followSec;
+    };
+    int        _oldSec;
+    int        _newSec;
+    int        _numGaps;
+    int        _diffSec;
+    int        _numLat;
+    double     _sumLat;
+    double     _sumLatQ;
+    double     _meanDiff;
+    double     _minLat;
+    double     _maxLat;
+    double     _curLat;
+    QByteArray _type;
+    bool _followSec;
+
+  };
+
+  t_latency _lObs;
+  t_latency _lOrb;
+  t_latency _lClk;
+  t_latency _lClkOrb;
+  t_latency _lPb;
+  t_latency _lCb;
+  t_latency _lVtec;
+  t_latency _lUra;
+  t_latency _lHr;
+  void setCurrentLatency(double lat) {
+    _curLat = lat;
+  }
+  /*
+  void setLatencyObjekt(t_latency& lat, QByteArray type) {
+    qDebug() << "set " << type;
+    l= lat;
+    l._type = type;
+    l.print();
+  }
+
+  void getLatencyObjekt(t_latency& lat) {
+    lat =l;
+  }
+
+*/
  signals:
   void newMessage(QByteArray msg, bool showOnScreen);
@@ -55,23 +138,10 @@
   int        _initPause;
   int        _currPause;
-  int        _oldSecGPS;
-  int        _newSecGPS;
-  int        _numGaps;
-  int        _diffSecGPS;
-  int        _numLat;
   bool       _wrongEpoch;
   bool       _checkSeg;
   bool       _begCorrupt;
   bool       _endCorrupt;
-  bool       _followSec;
   bool       _fromReconnect;
   bool       _fromCorrupt;
-  double     _maxDt;
-  double     _sumLat;
-  double     _sumLatQ;
-  double     _meanDiff;
-  double     _minLat;
-  double     _maxLat;
-  double     _curLat;
   QByteArray _staID;
   QString    _adviseScript;
@@ -97,4 +167,5 @@
   QDateTime  _begDateTimeCorr;
   QDateTime  _endDateTimeCorr;
+  double     _curLat;
 };
 
