Index: /trunk/BNC/RTCM3/RTCM3Decoder.cpp
===================================================================
--- /trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 2686)
+++ /trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 2687)
@@ -300,4 +300,43 @@
               obs->_o.GPSWeeks = gnssData.timeofweek / 1000.0;
 
+              QString prn = QString("%1%2").arg(obs->_o.satSys)
+                            .arg(obs->_o.satNum, 2, 10, QChar('0'));
+
+              // Handle loss-of-lock flags
+              // -------------------------
+              const int maxSlipCnt = 100;
+              if (!_slip_cnt_L1.contains(prn)) {
+                _slip_cnt_L1[prn] = 0;
+                _slip_cnt_L2[prn] = 0;
+                _slip_cnt_L5[prn] = 0;
+              }
+              if (GNSSDF2_LOCKLOSSL1 & gnssData.dataflags2[iSat]) {
+                if (_slip_cnt_L1[prn] < maxSlipCnt) {
+                  ++_slip_cnt_L1[prn];
+                }
+                else {
+                  _slip_cnt_L1[prn] = 1;
+                }
+                obs->_o.slip_cnt_L1 = _slip_cnt_L1[prn];
+              }
+              if (GNSSDF2_LOCKLOSSL2 & gnssData.dataflags2[iSat]) {
+                if (_slip_cnt_L2[prn] < maxSlipCnt) {
+                  ++_slip_cnt_L2[prn];
+                }
+                else {
+                  _slip_cnt_L2[prn] = 1;
+                }
+                obs->_o.slip_cnt_L2 = _slip_cnt_L2[prn];
+              }
+              if (GNSSDF2_LOCKLOSSL5 & gnssData.dataflags2[iSat]) {
+                if (_slip_cnt_L5[prn] < maxSlipCnt) {
+                  ++_slip_cnt_L5[prn];
+                }
+                else {
+                  _slip_cnt_L5[prn] = 1;
+                }
+                obs->_o.slip_cnt_L5 = _slip_cnt_L5[prn];
+              }
+
               // Loop over all data types
               // ------------------------
@@ -307,10 +346,10 @@
 
                 //// beg test
-                cout << obs->_o.satSys << obs->_o.satNum << " "
-                     << iEntry << " " << df;
-                if (df & gnssData.dataflags[iSat]) {
-                  cout << " present";
-                }
-                cout << endl;
+                ////  cout << prn.toAscii().data() << " "
+                ////       << iEntry << " " << df;
+                ////  if (df & gnssData.dataflags[iSat]) {
+                ////    cout << " present";
+                ////  }
+                ////  cout << endl;
                 //// end test
 
@@ -333,7 +372,4 @@
                     obs->_o.L1   = gnssData.measdata[iSat][iEntry];
                     obs->_o.SNR1 = gnssData.snrL1[iSat];
-                    if (GNSSDF2_LOCKLOSSL1 & gnssData.dataflags2[iSat]) {
-                      ++obs->_o.slip_cnt_L1;
-                    }
                   }
                   else if (iEntry == GNSSENTRY_L2CDATA || 
@@ -341,7 +377,4 @@
                     obs->_o.L2   = gnssData.measdata[iSat][iEntry];
                     obs->_o.SNR2 = gnssData.snrL2[iSat];
-                    if (GNSSDF2_LOCKLOSSL2 & gnssData.dataflags2[iSat]) {
-                      ++obs->_o.slip_cnt_L2;
-                    }
                   }
                   else if (iEntry == GNSSENTRY_S1CDATA ||
@@ -361,7 +394,4 @@
                   else if (iEntry == GNSSENTRY_L5DATA) {
                     obs->_o.L5 = gnssData.measdata[iSat][iEntry];
-                    if (GNSSDF2_LOCKLOSSL5 & gnssData.dataflags2[iSat]) {
-                      ++obs->_o.slip_cnt_L5;
-                    }
                   }
                   else if (iEntry == GNSSENTRY_S5DATA) {
Index: /trunk/BNC/RTCM3/RTCM3Decoder.h
===================================================================
--- /trunk/BNC/RTCM3/RTCM3Decoder.h	(revision 2686)
+++ /trunk/BNC/RTCM3/RTCM3Decoder.h	(revision 2687)
@@ -70,4 +70,8 @@
   bncRawFile*            _rawFile;
   QString                _staID_corrections;
+
+  QMap<QString, int>  _slip_cnt_L1;
+  QMap<QString, int>  _slip_cnt_L2;
+  QMap<QString, int>  _slip_cnt_L5;
 };
 
