Index: /trunk/BNC/src/GPSDecoder.cpp
===================================================================
--- /trunk/BNC/src/GPSDecoder.cpp	(revision 6136)
+++ /trunk/BNC/src/GPSDecoder.cpp	(revision 6137)
@@ -46,8 +46,4 @@
 #include "bncrinex.h"
 
-extern "C" {
-#include "rtcm3torinex.h"
-}
-
 using namespace std;
 
@@ -82,8 +78,8 @@
 // Write RINEX Epoch
 //////////////////////////////////////////////////////////////////////////////
-void GPSDecoder::dumpRinexEpoch(const t_obs& obs, const QByteArray& format) {
+void GPSDecoder::dumpRinexEpoch(const t_satObs& obs, const QByteArray& format) {
   if (_rnx) {
-    long iSec    = long(floor(obs.GPSWeeks+0.5));
-    long obsTime = obs.GPSWeek * 7*24*3600 + iSec;
+    long iSec    = long(floor(obs._time.gpssec()+0.5));
+    long obsTime = obs._time.gpsw() * 7*24*3600 + iSec;
     if (_rnx->samplingRate() == 0 || iSec % _rnx->samplingRate() == 0) {
       _rnx->deepCopy(obs);
@@ -101,163 +97,2 @@
 }
 
-// 
-//////////////////////////////////////////////////////////////////////////////
-void t_obs::setMeasdata(QString rnxStr, float rnxVers, double value) {
-  int ie = iEntry(rnxStr, rnxVers);
-
-  if (ie != -1) {
-    _codetype[ie] = rnxStr.mid(1);
-    _measdata[ie] = value;
-  }
-}
-
-// 
-//////////////////////////////////////////////////////////////////////////////
-double t_obs::measdata(QString rnxStr, float rnxVers) const {
-  int ie = iEntry(rnxStr, rnxVers);
-
-  if (ie != -1) {
-    return _measdata[ie];
-  }
-
-  return 0.0;
-}
-
-// 
-//////////////////////////////////////////////////////////////////////////////
-QString t_obs::rnxStr(int iEntry) const {
-  QString str(1,' ');
-  switch(iEntry & 3) {
-    case GNSSENTRY_CODE:    str[0] = 'C'; break;
-    case GNSSENTRY_PHASE:   str[0] = 'L'; break;
-    case GNSSENTRY_DOPPLER: str[0] = 'D'; break;
-    case GNSSENTRY_SNR:     str[0] = 'S'; break;
-  }
-  str += _codetype[iEntry];
-  return str.trimmed();
-}
-
-// 
-//////////////////////////////////////////////////////////////////////////////
-int t_obs::iEntry(QString rnxStr, float rnxVers, bool cmode) const {
-
-  int res = 0;
-  bool tryagain = false;
-  QString rnxStrOrig = rnxStr;
-  
-  if (rnxVers < 3.0) {
-    if      (rnxStr == "C1") rnxStr = "C1C";
-    else if (rnxStr == "P1") rnxStr = "C1P";
-    else if (rnxStr == "C2") rnxStr = "C2C";
-    else if (rnxStr == "P2") rnxStr = "C2P";
-    if(cmode)
-    {
-      if      (rnxStr == "S1") rnxStr = "S1C";
-      else if (rnxStr == "L1") rnxStr = "L1C";
-      else if (rnxStr == "S2") rnxStr = "S2C";
-      else if (rnxStr == "L2") rnxStr = "L2C";
-    }
-    else
-    {
-      if      (rnxStr == "S1") {rnxStr = "S1P"; tryagain = true; }
-      else if (rnxStr == "L1") {rnxStr = "L1P"; tryagain = true; }
-      else if (rnxStr == "S2") {rnxStr = "S2P"; tryagain = true; }
-      else if (rnxStr == "L2") {rnxStr = "L2P"; tryagain = true; }
-    }
-  }
-
-  // Observation Type (Code, Phase, Doppler, SNR)
-  // --------------------------------------------
-  if      (rnxStr[0] == 'C') {
-    res += GNSSENTRY_CODE;
-  }
-  else if (rnxStr[0] == 'L') {
-    res += GNSSENTRY_PHASE;
-  }
-  else if (rnxStr[0] == 'D') {
-    res += GNSSENTRY_DOPPLER;
-  }
-  else if (rnxStr[0] == 'S') {
-    res += GNSSENTRY_SNR;
-  }
-  else {
-    return -1;
-  }
-
-  // Frequency
-  // ---------
-  if      (rnxStr[1] == '1') {
-    if      (rnxStr.length() < 3) {
-      res += GNSSENTRY_TYPEC1;
-    }
-    else if (QString("ABCIQ").indexOf(rnxStr[2]) != -1) {
-      res += GNSSENTRY_TYPEC1;
-    }
-    else if (QString("SL").indexOf(rnxStr[2]) != -1) {
-      res += GNSSENTRY_TYPEC1N;
-    }
-    else if (QString("PWY").indexOf(rnxStr[2])    != -1) {
-      res += GNSSENTRY_TYPEP1;
-    }
-    else if (rnxStr[2] == 'Z') {
-      res += GNSSENTRY_TYPECSAIF;
-    }
-    else if (rnxStr[2] == 'X') {
-      if (satSys == 'C' || satSys == 'E') {
-        res += GNSSENTRY_TYPEC1;
-      }
-      else {
-        res += GNSSENTRY_TYPEC1N;
-      }
-    }
-    else {
-      return -1;
-    }
-  }
-  else if (rnxStr[1] == '2') {
-    if      (rnxStr.length() < 3) {
-      res += GNSSENTRY_TYPEC2;
-    }
-    else if (QString("PWY").indexOf(rnxStr[2])  != -1) {
-      res += GNSSENTRY_TYPEP2;
-    }
-    else if (QString("CSLX").indexOf(rnxStr[2]) != -1) {
-      res += GNSSENTRY_TYPEC2;
-    }
-    else if (rnxStr[2] == 'I') {
-      if (satSys == 'C') {
-        res += GNSSENTRY_TYPEC1;  // Compass: RINEX 3.01 "2I" corresponds to "1I" RINEX 3.02
-      }
-      else {
-        res += GNSSENTRY_TYPEC2;
-      }
-    }
-    else if (rnxStr[2] == 'Q') {
-      res += GNSSENTRY_TYPEC2;
-    }
-    else {
-      return -1;
-    }
-  }
-  else if (rnxStr[1] == '5') {
-    res += GNSSENTRY_TYPEC5;
-  }
-  else if (rnxStr[1] == '6') {
-    res += GNSSENTRY_TYPEC6;
-  }
-  else if (rnxStr[1] == '7') {
-    res += GNSSENTRY_TYPEC5B;
-  }
-  else if (rnxStr[1] == '8') {
-    res += GNSSENTRY_TYPEC5AB;
-  }
-  else {
-    return -1;
-  }
-
-  /* Note: We prefer P over C for Lx or Sx (i.e. we first try for P values) */
-  if(_codetype[res].isEmpty() && tryagain)
-    res = iEntry(rnxStrOrig, rnxVers, true);
-
-  return res;
-}
Index: /trunk/BNC/src/GPSDecoder.h
===================================================================
--- /trunk/BNC/src/GPSDecoder.h	(revision 6136)
+++ /trunk/BNC/src/GPSDecoder.h	(revision 6137)
@@ -34,70 +34,7 @@
 #include "bncconst.h"
 #include "bnctime.h"
-
-extern "C" {
-#include "rtcm3torinex.h"
-}
+#include "satObs.h"
 
 class bncRinex;
-
-class t_obs {
- public:
-  t_obs() {
-    StatID[0]   = '\x0';
-    satSys      = 'G';
-    satNum      = 0;
-    slotNum     = 0;
-    GPSWeek     = 0;
-    GPSWeeks    = 0.0;
-    _dataflags  = 0;
-    _dataflags2 = 0;
-    for (int ie = 0; ie < GNSSENTRY_NUMBER; ie++) {
-      _measdata[ie] = 0.0;
-    }
-    slip_cnt_L1 = -1;
-    slip_cnt_L2 = -1;
-    slip_cnt_L5 = -1;
-    snrL1 = 0;
-    snrL2 = 0;
-    snrL5 = 0;
-    slipL1 = false;
-    slipL2 = false;
-    slipL5 = false;
-  }
-
-  ~t_obs() {}
-
-  double measdata(QString rnxStr, float rnxVer) const;
-  void   setMeasdata(QString rnxStr, float rnxVer, double value);
-
-  char   StatID[20+1]; // Station ID
-  char   satSys;       // Satellite System ('G' or 'R')
-  int    satNum;       // Satellite Number (PRN for GPS NAVSTAR)
-  int    slotNum;      // Slot Number (for Glonass)
-  int    GPSWeek;      // Week of GPS-Time
-  double GPSWeeks;     // Second of Week (GPS-Time)
-
-  int    slip_cnt_L1;  // L1 cumulative loss of continuity indicator (negative value = undefined)
-  int    slip_cnt_L2;  // L2 cumulative loss of continuity indicator (negative value = undefined)
-  int    slip_cnt_L5;  // L5 cumulative loss of continuity indicator (negative value = undefined)
-
-  int    snrL1;  // signal-to-noise ratio mapped to <1,9>
-  int    snrL2;  // s = int(floor(SNR/6)); if (s > 9) s = 9; if (s < 1) s = 1;
-  int    snrL5;
-
-  bool   slipL1;
-  bool   slipL2;
-  bool   slipL5;
-  
-  double             _measdata[GNSSENTRY_NUMBER];  // data fields */ 
-  unsigned long long _dataflags;                   // GNSSDF_xxx */
-  unsigned int       _dataflags2;                  // GNSSDF2_xxx */
-  QString            _codetype[GNSSENTRY_NUMBER];
-
-  QString rnxStr(int iEntry) const;
-
- private:
-  int iEntry(QString rnxStr, float rnxVers, bool cmode=false) const;
-};
 
 class GPSDecoder {
@@ -116,5 +53,5 @@
                  const QByteArray& nmea, const QByteArray& ntripVersion);
 
-  void dumpRinexEpoch(const t_obs& obs, const QByteArray& format);
+  void dumpRinexEpoch(const t_satObs& obs, const QByteArray& format);
 
   void setRinexReconnectFlag(bool flag);
@@ -139,5 +76,5 @@
   };
 
-  QList<t_obs>     _obsList;
+  QList<t_satObs>  _obsList;
   QList<int>       _typeList;  // RTCM message types
   QStringList      _antType;   // RTCM antenna descriptor
Index: /trunk/BNC/src/RTCM/RTCM2Decoder.cpp
===================================================================
--- /trunk/BNC/src/RTCM/RTCM2Decoder.cpp	(revision 6136)
+++ /trunk/BNC/src/RTCM/RTCM2Decoder.cpp	(revision 6137)
@@ -46,5 +46,4 @@
 #include "../bncutils.h"
 #include "rtcm_utils.h"
-#include "GPSDecoder.h"
 #include "RTCM2Decoder.h"
 
@@ -137,22 +136,37 @@
           
         for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) {
-          t_obs obs;
+          t_satObs obs;
           if (_ObsBlock.PRN[iSat] > 100) {
-            obs.satNum      = _ObsBlock.PRN[iSat] % 100;
-            obs.satSys      = 'R';
+            obs._prn.set('R', _ObsBlock.PRN[iSat] % 100);
 	  }		        
-	  else {	        
-            obs.satNum      = _ObsBlock.PRN[iSat];
-            obs.satSys      = 'G';
+	  else {
+            obs._prn.set('R', _ObsBlock.PRN[iSat]);
 	  }		        
-          obs.GPSWeek       = epochWeek;
-          obs.GPSWeeks      = epochSecs;
-          obs.setMeasdata("C1", 2.0, _ObsBlock.rng_C1[iSat]);
-          obs.setMeasdata("P1", 2.0, _ObsBlock.rng_P1[iSat]);
-          obs.setMeasdata("P2", 2.0, _ObsBlock.rng_P2[iSat]);
-          obs.setMeasdata("L1", 2.0, _ObsBlock.resolvedPhase_L1(iSat));
-          obs.setMeasdata("L2", 2.0, _ObsBlock.resolvedPhase_L2(iSat));
-	  obs.slip_cnt_L1   = _ObsBlock.slip_L1[iSat];
-	  obs.slip_cnt_L2   = _ObsBlock.slip_L2[iSat];
+          obs._time.set(epochWeek, epochSecs);
+          t_frqObs* frqObs1C = new t_frqObs;
+          frqObs1C->_rnxType2ch  = "1C";
+          frqObs1C->_codeValid   = true;
+          frqObs1C->_code        = _ObsBlock.rng_C1[iSat];
+          obs._obs.push_back(frqObs1C);
+
+          t_frqObs* frqObs1P = new t_frqObs;
+          frqObs1P->_rnxType2ch  = "1P";
+          frqObs1P->_codeValid   = true;
+          frqObs1P->_code        = _ObsBlock.rng_P1[iSat];
+          obs._obs.push_back(frqObs1P);
+          frqObs1P->_phaseValid  = true;
+          frqObs1P->_phase       = _ObsBlock.resolvedPhase_L1(iSat);
+          frqObs1P->_slipCounter = _ObsBlock.slip_L1[iSat];
+          obs._obs.push_back(frqObs1P);
+
+          t_frqObs* frqObs2P = new t_frqObs;
+          frqObs2P->_rnxType2ch  = "2P";
+          frqObs2P->_codeValid   = true;
+          frqObs2P->_code        = _ObsBlock.rng_P2[iSat];
+          obs._obs.push_back(frqObs2P);
+          frqObs2P->_phaseValid  = true;
+          frqObs2P->_phase       = _ObsBlock.resolvedPhase_L2(iSat);
+          frqObs2P->_slipCounter = _ObsBlock.slip_L2[iSat];
+          obs._obs.push_back(frqObs2P);
 
           _obsList.push_back(obs);
@@ -283,5 +297,17 @@
 
     // new observation
-    t_obs* new_obs = 0;
+    t_satObs* new_obs = 0;
+
+    t_frqObs* frqObs1C = new t_frqObs;
+    frqObs1C->_rnxType2ch  = "1C";
+    new_obs->_obs.push_back(frqObs1C);
+
+    t_frqObs* frqObs1P = new t_frqObs;
+    frqObs1P->_rnxType2ch  = "1P";
+    new_obs->_obs.push_back(frqObs1P);
+
+    t_frqObs* frqObs2P = new t_frqObs;
+    frqObs2P->_rnxType2ch  = "2P";
+    new_obs->_obs.push_back(frqObs2P);
 
     // missing IOD
@@ -354,12 +380,12 @@
 	// -------------------
 	if ( !new_obs ) {
-	  new_obs = new t_obs();
-
-	  new_obs->StatID[0] = '\x0';
-	  new_obs->satSys    = (corr->PRN < 200 ? 'G'       : 'R');
-	  new_obs->satNum    = (corr->PRN < 200 ? corr->PRN : corr->PRN - 200);
-	  
-	  new_obs->GPSWeek   = GPSWeek_rcv;
-	  new_obs->GPSWeeks  = GPSWeeks_rcv;
+	  new_obs = new t_satObs();
+          if (corr->PRN < 200) {
+            new_obs->_prn.set('G', corr->PRN);
+          }
+          else {
+            new_obs->_prn.set('R', corr->PRN-200);
+          }
+	  new_obs->_time.set(GPSWeek_rcv, GPSWeeks_rcv);
 	}
 	
@@ -368,22 +394,28 @@
 	switch (ii) {
 	case 0: // --- L1 ---
-          new_obs->setMeasdata("L1", 2.0, *obsVal / LAMBDA_1);
-	  new_obs->slip_cnt_L1   = corr->lock1;
+          frqObs1P->_phaseValid  = true;
+          frqObs1P->_phase       = *obsVal / LAMBDA_1;
+          frqObs1P->_slipCounter = corr->lock1;
 	  break;
 	case 1: // --- L2 ---
-          new_obs->setMeasdata("L2", 2.0, *obsVal / LAMBDA_2);
-	  new_obs->slip_cnt_L2   = corr->lock2;
+          frqObs2P->_phaseValid  = true;
+          frqObs2P->_phase       = *obsVal / LAMBDA_2;
+          frqObs2P->_slipCounter = corr->lock2;
 	  break;
 	case 2: // --- C1 / P1 ---
-	  if ( corr->Pind1 )
-            new_obs->setMeasdata("P1", 2.0, *obsVal);
-	  else
-            new_obs->setMeasdata("C1", 2.0, *obsVal);
+	  if ( corr->Pind1 ) {
+            frqObs1P->_codeValid = true;
+            frqObs1P->_code      = *obsVal;
+          }
+	  else {
+            frqObs1C->_codeValid = true;
+            frqObs1C->_code      = *obsVal;
+          }
 	  break;
 	case 3: // --- C2 / P2 ---
-	  if ( corr->Pind2 )
-            new_obs->setMeasdata("P2", 2.0, *obsVal);
-	  else
-            new_obs->setMeasdata("C2", 2.0, *obsVal);
+	  if ( corr->Pind2 ) {
+            frqObs2P->_codeValid = true;
+            frqObs2P->_code      = *obsVal;
+          }
 	  break;
 	default:
Index: /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
===================================================================
--- /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 6136)
+++ /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 6137)
@@ -228,5 +228,5 @@
             for (int iSat = 0; iSat < gnssData.numsats; iSat++) {
 
-              t_obs obs;
+              t_satObs obs;
               int   satID = gnssData.satellites[iSat];
 
@@ -234,6 +234,5 @@
               // ---
               if      (satID >= PRN_GPS_START     && satID <= PRN_GPS_END) {
-                obs.satSys = 'G';
-                obs.satNum = satID;
+                obs._prn.set('G', satID);
               }
 
@@ -241,13 +240,5 @@
               // -------
               else if (satID >= PRN_GLONASS_START && satID <= PRN_GLONASS_END) {
-                obs.satSys = 'R';
-                obs.satNum = satID - PRN_GLONASS_START + 1;
-                if (obs.satNum <= PRN_GLONASS_NUM && 
-                    parser.GLOFreq[obs.satNum-1] != 0) {
-                  obs.slotNum   = parser.GLOFreq[obs.satNum-1] - 100;
-                }
-                else { 
-                  continue;
-                }
+                obs._prn.set('R', satID - PRN_GLONASS_START + 1);
               }
 
@@ -255,6 +246,5 @@
               // -------
               else if (satID >= PRN_GALILEO_START && satID <= PRN_GALILEO_END) {
-                obs.satSys = 'E';
-                obs.satNum = satID - PRN_GALILEO_START + 1;
+                obs._prn.set('E', satID - PRN_GALILEO_START + 1);
               }
 
@@ -262,6 +252,5 @@
               // ----
               else if (satID >= PRN_SBAS_START && satID <= PRN_SBAS_END) {
-                obs.satSys = 'S';
-                obs.satNum = satID - PRN_SBAS_START + 20;
+                obs._prn.set('S', satID - PRN_SBAS_START + 20);
               }
 
@@ -269,6 +258,5 @@
               // -------------
               else if (satID >= PRN_GIOVE_START && satID <= PRN_GIOVE_END) {
-                obs.satSys = 'E';
-                obs.satNum = satID - PRN_GIOVE_START + PRN_GIOVE_OFFSET;
+                obs._prn.set('E', satID - PRN_GIOVE_START + PRN_GIOVE_OFFSET);
               }
 
@@ -276,6 +264,5 @@
               // -------------
               else if (satID >= PRN_QZSS_START && satID <= PRN_QZSS_END) {
-                obs.satSys = 'J';
-                obs.satNum = satID - PRN_QZSS_START + 1;
+                obs._prn.set('J', satID - PRN_QZSS_START + 1);
               }
 
@@ -283,6 +270,5 @@
               // -------------
               else if (satID >= PRN_COMPASS_START && satID <= PRN_COMPASS_END) {
-                obs.satSys = 'C';
-                obs.satNum = satID - PRN_COMPASS_START + 1;
+                obs._prn.set('C', satID - PRN_COMPASS_START + 1);
               }
 
@@ -293,9 +279,11 @@
               }
 
-              obs.GPSWeek  = gnssData.week;
-              obs.GPSWeeks = gnssData.timeofweek / 1000.0;
-
-              QString prn = QString("%1%2").arg(obs.satSys)
-                            .arg(obs.satNum, 2, 10, QChar('0'));
+              obs._time.set(gnssData.week, gnssData.timeofweek / 1000.0);
+
+              QString prn(obs._prn.toString().c_str());
+
+              int obs_slip_cnt_L1 = 0;
+              int obs_slip_cnt_L2 = 0;
+              int obs_slip_cnt_L5 = 0;
 
               // Handle loss-of-lock flags
@@ -314,5 +302,5 @@
                   _slip_cnt_L1[prn] = 1;
                 }
-                obs.slip_cnt_L1 = _slip_cnt_L1[prn];
+                obs_slip_cnt_L1 = _slip_cnt_L1[prn];
               }
               if (GNSSDF2_LOCKLOSSL2 & gnssData.dataflags2[iSat]) {
@@ -323,5 +311,5 @@
                   _slip_cnt_L2[prn] = 1;
                 }
-                obs.slip_cnt_L2 = _slip_cnt_L2[prn];
+                obs_slip_cnt_L2 = _slip_cnt_L2[prn];
               }
               if (GNSSDF2_LOCKLOSSL5 & gnssData.dataflags2[iSat]) {
@@ -332,15 +320,56 @@
                   _slip_cnt_L5[prn] = 1;
                 }
-                obs.slip_cnt_L5 = _slip_cnt_L5[prn];
-              }
-
-              obs._dataflags  = gnssData.dataflags[iSat];
-              obs._dataflags2 = gnssData.dataflags2[iSat];
+                obs_slip_cnt_L5 = _slip_cnt_L5[prn];
+              }
 
               // Loop over all data types
               // ------------------------
               for (int iEntry = 0; iEntry < GNSSENTRY_NUMBER; ++iEntry) {
-                obs._measdata[iEntry] = gnssData.measdata[iSat][iEntry];
-                obs._codetype[iEntry] = gnssData.codetype[iSat][iEntry];
+                if (gnssData.codetype[iSat][iEntry] == 0) {
+                  continue;
+                }
+                string rnxType(gnssData.codetype[iSat][iEntry]);
+                cout << "rnxType " << rnxType << endl;
+
+                t_frqObs* frqObs = 0;
+                for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) {
+                  if (obs._obs[iFrq]->_rnxType2ch == rnxType) {
+                    frqObs = obs._obs[iFrq];
+                    break;
+                  }
+                }
+                if (frqObs == 0) {
+                  frqObs = new t_frqObs;
+                  frqObs->_rnxType2ch = rnxType;
+                  obs._obs.push_back(frqObs);
+                }
+
+                switch(iEntry & 3) {
+                case GNSSENTRY_CODE:
+                  frqObs->_codeValid = true;
+                  frqObs->_code      = gnssData.measdata[iSat][iEntry];
+                  break;
+                case GNSSENTRY_PHASE:
+                  frqObs->_phaseValid = true;
+                  frqObs->_phase      = gnssData.measdata[iSat][iEntry];
+                  if      (rnxType[0] == '1') {
+                    frqObs->_slipCounter = obs_slip_cnt_L1;
+                  }
+                  else if (rnxType[0] == '2') {
+                    frqObs->_slipCounter = obs_slip_cnt_L2;
+                  }
+                  else if (rnxType[0] == '5') {
+                    frqObs->_slipCounter = obs_slip_cnt_L5;
+                  }
+                  break;
+                case GNSSENTRY_DOPPLER: 
+                  frqObs->_dopplerValid = true;
+                  frqObs->_doppler      = gnssData.measdata[iSat][iEntry];
+                  break;
+                case GNSSENTRY_SNR:
+                  frqObs->_snrValid = true;
+                  frqObs->_snr      = gnssData.measdata[iSat][iEntry];
+                  break;
+                }
               }
               _obsList.push_back(obs);
Index: /trunk/BNC/src/bnccaster.cpp
===================================================================
--- /trunk/BNC/src/bnccaster.cpp	(revision 6136)
+++ /trunk/BNC/src/bnccaster.cpp	(revision 6137)
@@ -51,5 +51,4 @@
 #include "bncutils.h"
 #include "bncsettings.h"
-#include "GPSDecoder.h"
 
 using namespace std;
@@ -113,5 +112,5 @@
   }
 
-  _epochs = new QMultiMap<long, t_obs>;
+  _epochs = new QMultiMap<long, t_satObs>;
 
   _samplingRate = settings.value("binSampl").toInt();
@@ -164,5 +163,5 @@
 // New Observations
 ////////////////////////////////////////////////////////////////////////////
-void bncCaster::slotNewObs(const QByteArray staID, QList<t_obs> obsList) {
+void bncCaster::slotNewObs(const QByteArray staID, QList<t_satObs> obsList) {
 
   QMutexLocker locker(&_mutex);
@@ -171,16 +170,15 @@
 
   unsigned index = 0;
-  QMutableListIterator<t_obs> it(obsList);
+  QMutableListIterator<t_satObs> it(obsList);
   while (it.hasNext()) {
     ++index;
-    t_obs& obs = it.next();
-
-    long iSec    = long(floor(obs.GPSWeeks+0.5));
-    long newTime = obs.GPSWeek * 7*24*3600 + iSec;
+    t_satObs& obs = it.next();
+
+    long iSec    = long(floor(obs._time.gpssec()+0.5));
+    long newTime = obs._time.gpsw() * 7*24*3600 + iSec;
     
     // Rename the Station
     // ------------------
-    strncpy(obs.StatID, staID.constData(),sizeof(obs.StatID));
-    obs.StatID[sizeof(obs.StatID)-1] = '\0';
+    obs._staID = staID.data();
     
     // Output into the socket
@@ -190,7 +188,7 @@
       ostringstream oStr;
       oStr.setf(ios::showpoint | ios::fixed);
-      oStr << obs.StatID                                  << " " 
-           << setw(4)  << obs.GPSWeek                     << " "
-           << setw(14) << setprecision(7) << obs.GPSWeeks << " "
+      oStr << obs._staID                                        << " " 
+           << setw(4)  << obs._time.gpsw()                      << " "
+           << setw(14) << setprecision(7) << obs._time.gpssec() << " "
            << bncRinex::asciiSatLine(obs) << endl;
     
@@ -276,15 +274,15 @@
 void bncCaster::addGetThread(bncGetThread* getThread, bool noNewThread) {
 
-  qRegisterMetaType<t_obs>("t_obs");
-  qRegisterMetaType< QList<t_obs> >("QList<t_obs>");
+  qRegisterMetaType<t_satObs>("t_satObs");
+  qRegisterMetaType< QList<t_satObs> >("QList<t_satObs>");
   qRegisterMetaType<gpsephemeris>("gpsephemeris");
   qRegisterMetaType<glonassephemeris>("glonassephemeris");
   qRegisterMetaType<galileoephemeris>("galileoephemeris");
 
-  connect(getThread, SIGNAL(newObs(QByteArray, QList<t_obs>)),
-          this,      SLOT(slotNewObs(QByteArray, QList<t_obs>)));
-
-  connect(getThread, SIGNAL(newObs(QByteArray, QList<t_obs>)),
-          this,      SIGNAL(newObs(QByteArray, QList<t_obs>)));
+  connect(getThread, SIGNAL(newObs(QByteArray, QList<t_satObs>)),
+          this,      SLOT(slotNewObs(QByteArray, QList<t_satObs>)));
+
+  connect(getThread, SIGNAL(newObs(QByteArray, QList<t_satObs>)),
+          this,      SIGNAL(newObs(QByteArray, QList<t_satObs>)));
 
   connect(getThread, SIGNAL(newRawData(QByteArray, QByteArray)),
@@ -336,10 +334,10 @@
          (_samplingRate == 0 || sec % _samplingRate == 0) ) {
 
-      QList<t_obs> allObs = _epochs->values(sec);
+      QList<t_satObs> allObs = _epochs->values(sec);
       
-      QListIterator<t_obs> it(allObs);
+      QListIterator<t_satObs> it(allObs);
       bool firstObs = true;
       while (it.hasNext()) {
-        const t_obs& obs = it.next();
+        const t_satObs& obs = it.next();
 
         ostringstream oStr;
@@ -347,8 +345,8 @@
         if (firstObs) { 
           firstObs = false;
-          oStr << "> " << obs.GPSWeek << ' ' 
-               << setprecision(7) << obs.GPSWeeks << endl;;
+          oStr << "> " << obs._time.gpsw() << ' ' 
+               << setprecision(7) << obs._time.gpssec() << endl;;
         }
-        oStr << obs.StatID << ' ' << bncRinex::asciiSatLine(obs) << endl;
+        oStr << obs._staID << ' ' << bncRinex::asciiSatLine(obs) << endl;
         if (!it.hasNext()) { 
           oStr << endl;
Index: /trunk/BNC/src/bnccaster.h
===================================================================
--- /trunk/BNC/src/bnccaster.h	(revision 6136)
+++ /trunk/BNC/src/bnccaster.h	(revision 6137)
@@ -29,6 +29,5 @@
 #include <QtNetwork>
 #include <QMultiMap>
-
-#include "GPSDecoder.h"
+#include "satObs.h"
 
 class bncGetThread;
@@ -45,5 +44,5 @@
 
  public slots:
-   void slotNewObs(QByteArray staID, QList<t_obs> obsList);
+   void slotNewObs(QByteArray staID, QList<t_satObs> obsList);
    void slotNewRawData(QByteArray staID, QByteArray data);
    void slotNewNMEAstr(QByteArray staID, QByteArray str);
@@ -54,5 +53,5 @@
    void getThreadsFinished();   
    void newMessage(QByteArray msg, bool showOnScreen);
-   void newObs(QByteArray staID, QList<t_obs> obsList);
+   void newObs(QByteArray staID, QList<t_satObs> obsList);
 
  private slots:
@@ -68,25 +67,25 @@
    void reopenOutFile();
 
-   QFile*                   _outFile;
-   int                      _port;
-   QTextStream*             _out;
-   QMultiMap<long, t_obs>*  _epochs;
-   long                     _lastDumpSec;
-   QTcpServer*              _server;
-   QTcpServer*              _uServer;
-   QTcpServer*              _nmeaServer;
-   QList<QTcpSocket*>*      _sockets;
-   QList<QTcpSocket*>*      _uSockets;
-   QList<QTcpSocket*>*      _nmeaSockets;
-   QList<QByteArray>        _staIDs;
-   QList<bncGetThread*>     _threads;
-   int                      _samplingRate;
-   long                     _waitTime;
-   QMutex                   _mutex;
-   int                      _confInterval;
-   QString                  _miscMount;
-   int                      _miscPort;
-   QTcpServer*              _miscServer;
-   QList<QTcpSocket*>*      _miscSockets;
+   QFile*                     _outFile;
+   int                        _port;
+   QTextStream*               _out;
+   QMultiMap<long, t_satObs>* _epochs;
+   long                       _lastDumpSec;
+   QTcpServer*                _server;
+   QTcpServer*                _uServer;
+   QTcpServer*                _nmeaServer;
+   QList<QTcpSocket*>*        _sockets;
+   QList<QTcpSocket*>*        _uSockets;
+   QList<QTcpSocket*>*        _nmeaSockets;
+   QList<QByteArray>          _staIDs;
+   QList<bncGetThread*>       _threads;
+   int                        _samplingRate;
+   long                       _waitTime;
+   QMutex                     _mutex;
+   int                        _confInterval;
+   QString                    _miscMount;
+   int                        _miscPort;
+   QTcpServer*                _miscServer;
+   QList<QTcpSocket*>*        _miscSockets;
 };
 
Index: /trunk/BNC/src/bncgetthread.cpp
===================================================================
--- /trunk/BNC/src/bncgetthread.cpp	(revision 6136)
+++ /trunk/BNC/src/bncgetthread.cpp	(revision 6137)
@@ -471,15 +471,14 @@
       // Loop over all observations (observations output)
       // ------------------------------------------------
-      QListIterator<t_obs> it(decoder()->_obsList);
-
-      QList<t_obs> obsListHlp;
+      QListIterator<t_satObs> it(decoder()->_obsList);
+
+      QList<t_satObs> obsListHlp;
 
       while (it.hasNext()) {
-        const t_obs& obs = it.next();
-
-        QString prn  = QString("%1%2").arg(obs.satSys)
-                                      .arg(obs.satNum, 2, 10, QChar('0'));
-        long iSec    = long(floor(obs.GPSWeeks+0.5));
-        long obsTime = obs.GPSWeek * 7*24*3600 + iSec;
+        const t_satObs& obs = it.next();
+
+        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;
 
         // Check observation epoch
@@ -660,13 +659,12 @@
       // -----------------------
       for (int ii = 0; ii < decoder()->_obsList.size(); ii++) {
-        t_obs& obs = decoder()->_obsList[ii];
-        QVector<QString>& rnxTypes = _rnxTypes[obs.satSys];
+        t_satObs& obs = decoder()->_obsList[ii];
+        QVector<QString>& rnxTypes = _rnxTypes[obs._prn.system()];
         bool allFound = true;
-        for (int iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) {
-          if (obs._measdata[iEntry] != 0.0) {
-            if (rnxTypes.indexOf(obs.rnxStr(iEntry)) == -1) {
-              allFound = false;
-              rnxTypes << obs.rnxStr(iEntry);
-            }
+        for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) {
+          QString rnxStr(obs._obs[iFrq]->_rnxType2ch.c_str());
+          if (rnxTypes.indexOf(rnxStr) == -1) {
+            allFound = false;
+            rnxTypes << rnxStr;
           }
         }
@@ -674,5 +672,5 @@
           QString msg; 
           QTextStream str(&msg);
-          str << obs.satSys << "    " << rnxTypes.size() << "  ";
+          str << obs._prn.system() << "    " << rnxTypes.size() << "  ";
           for (int iType = 0; iType < rnxTypes.size(); iType++) {
             str << " " << rnxTypes[iType];
Index: /trunk/BNC/src/bncgetthread.h
===================================================================
--- /trunk/BNC/src/bncgetthread.h	(revision 6136)
+++ /trunk/BNC/src/bncgetthread.h	(revision 6137)
@@ -31,5 +31,4 @@
 #include <QFile>
 
-#include "GPSDecoder.h"
 #include "rtcm3torinex.h"
 #include "bncconst.h"
@@ -37,5 +36,7 @@
 #include "bnctime.h"
 #include "bncrawfile.h"
+#include "satObs.h"
 
+class GPSDecoder;
 class QextSerialPort;
 class latencyChecker;
@@ -78,5 +79,5 @@
    void newRawData(QByteArray staID, QByteArray data);
    void newLatency(QByteArray staID, double clate);
-   void newObs(QByteArray staID, QList<t_obs> obsList);
+   void newObs(QByteArray staID, QList<t_satObs> obsList);
    void newAntCrd(QByteArray staID, double xx, double yy, double zz, 
                   double hh, QByteArray antType);
Index: /trunk/BNC/src/bncrinex.cpp
===================================================================
--- /trunk/BNC/src/bncrinex.cpp	(revision 6136)
+++ /trunk/BNC/src/bncrinex.cpp	(revision 6137)
@@ -439,5 +439,5 @@
 // Stores Observation into Internal Array
 ////////////////////////////////////////////////////////////////////////////
-void bncRinex::deepCopy(t_obs obs) {
+void bncRinex::deepCopy(t_satObs obs) {
   _obs.push_back(obs);
 }
@@ -449,9 +449,9 @@
   // Select observations older than maxTime
   // --------------------------------------
-  QList<t_obs> dumpList;
-  QMutableListIterator<t_obs> mIt(_obs);
+  QList<t_satObs> dumpList;
+  QMutableListIterator<t_satObs> mIt(_obs);
   while (mIt.hasNext()) {
-    t_obs obs = mIt.next();
-    if (obs.GPSWeek * 7*24*3600 + obs.GPSWeeks < maxTime - 0.05) {
+    t_satObs obs = mIt.next();
+    if (obs._time.gpsw() * 7*24*3600 + obs._time.gpssec() < maxTime - 0.05) {
       dumpList.push_back(obs);
       mIt.remove();
@@ -467,8 +467,8 @@
   // Time of Epoch
   // -------------
-  const t_obs& fObs   = dumpList.first();
-  QDateTime datTim    = dateAndTimeFromGPSweek(fObs.GPSWeek, fObs.GPSWeeks);
-  QDateTime datTimNom = dateAndTimeFromGPSweek(fObs.GPSWeek, 
-                                               floor(fObs.GPSWeeks+0.5));
+  const t_satObs& fObs   = dumpList.first();
+  QDateTime datTim    = dateAndTimeFromGPSweek(fObs._time.gpsw(), fObs._time.gpssec());
+  QDateTime datTimNom = dateAndTimeFromGPSweek(fObs._time.gpsw(), 
+                                               floor(fObs._time.gpssec()+0.5));
 
   // Close the file
@@ -482,5 +482,5 @@
   // ------------------
   if (!_headerWritten) {
-    _header._startTime.set(fObs.GPSWeek, fObs.GPSWeeks);
+    _header._startTime.set(fObs._time.gpsw(), fObs._time.gpssec());
     writeHeader(format, datTimNom);
   }
@@ -488,8 +488,8 @@
   // Check whether observation types available
   // -----------------------------------------
-  QMutableListIterator<t_obs> mItDump(dumpList);
+  QMutableListIterator<t_satObs> mItDump(dumpList);
   while (mItDump.hasNext()) {
-    t_obs& obs = mItDump.next();
-    if (!_header._obsTypes.contains(obs.satSys) && !_header._obsTypes.contains(obs.satSys)) {
+    t_satObs& obs = mItDump.next();
+    if (!_header._obsTypes.contains(obs._prn.system()) && !_header._obsTypes.contains(obs._prn.system())) {
       mItDump.remove();
     }
@@ -499,5 +499,5 @@
   }
 
-  double sec = double(datTim.time().second()) + fmod(fObs.GPSWeeks,1.0);
+  double sec = double(datTim.time().second()) + fmod(fObs._time.gpssec(),1.0);
 
   // Epoch header line: RINEX Version 3
@@ -515,9 +515,9 @@
          << "  " << 0 << setw(3)  << dumpList.size();
 
-    QListIterator<t_obs> it(dumpList); int iSat = 0;
+    QListIterator<t_satObs> it(dumpList); int iSat = 0;
     while (it.hasNext()) {
       iSat++;
-      const t_obs& obs = it.next();
-      _out << obs.satSys << setw(2) << obs.satNum;
+      const t_satObs& obs = it.next();
+      _out << obs._prn;
       if (iSat == 12 && it.hasNext()) {
         _out << endl << "                                ";
@@ -528,40 +528,42 @@
   }
 
-  QListIterator<t_obs> it(dumpList);
+  QListIterator<t_satObs> it(dumpList);
   while (it.hasNext()) {
-    const t_obs& obs = it.next();
+    const t_satObs& obs = it.next();
 
     // Cycle slips detection
     // ---------------------
-    QString prn = QString("%1%2").arg(obs.satSys)
-                            .arg(obs.satNum, 2, 10, QChar('0'));
-
-    char lli1 = ' ';
-    char lli2 = ' ';
-    char lli5 = ' ';
-    if      ( obs.slip_cnt_L1 >= 0 ) {
-      if ( _slip_cnt_L1.find(prn)         != _slip_cnt_L1.end() && 
-           _slip_cnt_L1.find(prn).value() != obs.slip_cnt_L1 ) {
-        lli1 = '1';
-      }
-    }
-
-    if ( obs.slip_cnt_L2 >= 0 ) {
-      if ( _slip_cnt_L2.find(prn)         != _slip_cnt_L2.end() && 
-           _slip_cnt_L2.find(prn).value() != obs.slip_cnt_L2 ) {
-        lli2 = '1';
-      }
-    }
-
-    if ( obs.slip_cnt_L5 >= 0 ) {
-      if ( _slip_cnt_L5.find(prn)         != _slip_cnt_L5.end() && 
-           _slip_cnt_L5.find(prn).value() != obs.slip_cnt_L5 ) {
-        lli5 = '1';
-      }
-    }
-
-    _slip_cnt_L1[prn]   = obs.slip_cnt_L1;
-    _slip_cnt_L2[prn]   = obs.slip_cnt_L2;
-    _slip_cnt_L5[prn]   = obs.slip_cnt_L5;
+    QString prn(obs._prn.toString().c_str());
+    char  lli1 = ' ';
+    char  lli2 = ' ';
+    char  lli5 = ' ';
+    char* lli = 0;
+
+    for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) {
+      const t_frqObs*     frqObs   = obs._obs[iFrq];
+      QMap<QString, int>* slip_cnt = 0;
+      if      (frqObs->_rnxType2ch[0] == '1') {
+        slip_cnt  = &_slip_cnt_L1;
+        lli       = &lli1;
+      }
+      else if (frqObs->_rnxType2ch[0] == '2') {
+        slip_cnt  = &_slip_cnt_L2;
+        lli       = &lli2;
+      }
+      else if (frqObs->_rnxType2ch[0] == '5') {
+        slip_cnt  = &_slip_cnt_L5;
+        lli       = &lli5;
+      }
+      else {
+        continue;
+      }
+      if (frqObs->_slip) {
+        if ( slip_cnt->find(prn)         != slip_cnt->end() && 
+             slip_cnt->find(prn).value() != frqObs->_slipCounter ) {
+          *lli = '1';
+        }
+      }
+      (*slip_cnt)[prn] = frqObs->_slipCounter;
+    }
 
     // Write the data
@@ -594,34 +596,36 @@
 // One Line in RINEX v2 or v3
 ////////////////////////////////////////////////////////////////////////////
-string bncRinex::rinexSatLine(const t_obs& obs, char lli1, char lli2, 
-                              char lli5) {
+string bncRinex::rinexSatLine(const t_satObs& obs, char lli1, char lli2, char lli5) {
   ostringstream str;
-  str.setf(ios::showpoint | ios::fixed);
-
-  if (_header._version >= 3.0) {
-    str << obs.satSys 
-        << setw(2) << setfill('0') << obs.satNum << setfill(' ');
-  }
-
-  const QVector<QString>& types = _header._obsTypes[obs.satSys];
-  for (int ii = 0; ii < types.size(); ii++) {
-    if (_header._version < 3.0 && ii > 0 && ii % 5 == 0) {
-      str << endl;
-    }
-    double value = obs.measdata(types[ii], _header._version);
-    str << setw(14) << setprecision(3) << value;
-    if      (value != 0.0 && types[ii].indexOf("L1") == 0) {
-      str << lli1 << ' ';
-    }
-    else if (value != 0.0 && types[ii].indexOf("L2") == 0) {
-      str << lli2 << ' ';
-    }
-    else if (value != 0.0 && types[ii].indexOf("L5") == 0) {
-      str << lli5 << ' ';
-    }
-    else {
-      str << "  ";
-    }
-  }
+////  str.setf(ios::showpoint | ios::fixed);
+////
+////  if (_header._version >= 3.0) {
+////    str << obs._prn;
+////  }
+////
+////  const QVector<QString>& types = _header._obsTypes[obs._prn.system()];
+////  for (int ii = 0; ii < types.size(); ii++) {
+////    if (_header._version < 3.0 && ii > 0 && ii % 5 == 0) {
+////      str << endl;
+////    }
+////    for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) {
+////      const t_frqObs*     frqObs   = obs._obs[iFrq];
+////
+////
+////    double value = obs.measdata(types[ii], _header._version);
+////    str << setw(14) << setprecision(3) << value;
+////    if      (value != 0.0 && types[ii].indexOf("L1") == 0) {
+////      str << lli1 << ' ';
+////    }
+////    else if (value != 0.0 && types[ii].indexOf("L2") == 0) {
+////      str << lli2 << ' ';
+////    }
+////    else if (value != 0.0 && types[ii].indexOf("L5") == 0) {
+////      str << lli5 << ' ';
+////    }
+////    else {
+////      str << "  ";
+////    }
+////  }
 
   return str.str();
@@ -644,45 +648,38 @@
 // One Line in ASCII (Internal) Format
 ////////////////////////////////////////////////////////////////////////////
-string bncRinex::asciiSatLine(const t_obs& obs) {
+string bncRinex::asciiSatLine(const t_satObs& obs) {
 
   ostringstream str;
-  str.setf(ios::showpoint | ios::fixed);
-
-  str << obs.satSys << setw(2) << setfill('0') << obs.satNum << setfill(' ');
-
-  if (obs.satSys == 'R') { // Glonass
-    str << ' ' << setw(2) << obs.slotNum << ' ';
-  }
-  else {
-    str << "    ";
-  }
-
-  float rnxVers = 3.0;
-
-  for (int ie = 0; ie < GNSSENTRY_NUMBER; ie++) {
-    QString rnxStr = obs.rnxStr(ie);
-    if (rnxStr.length() >= 2) {
-      double data = obs.measdata(rnxStr, rnxVers);
-      if (data != 0.0) {
-        int width = (rnxStr[0] == 'S') ? 8 : 14;
-        int prec  = 3;
-        str << ' ' << rnxStr.toAscii().data() 
-            << ' ' << obsToStr(data, width, prec);
-        if (rnxStr[0] == 'L') {
-          int slipCnt = 0;
-          if      (rnxStr[1] == '1') {
-            slipCnt = obs.slip_cnt_L1;
-          }
-          else if (rnxStr[1] == '2') {
-            slipCnt = obs.slip_cnt_L2;
-          }
-          else if (rnxStr[1] == '5') {
-            slipCnt = obs.slip_cnt_L5;
-          }
-          str << ' ' << setw(3)  << slipCnt;
-        }
-      }
-    }
-  }
+////  str.setf(ios::showpoint | ios::fixed);
+////
+////  str << obs._prn << ' ';
+////
+////  float rnxVers = 3.0;
+////
+////  for (int ie = 0; ie < GNSSENTRY_NUMBER; ie++) {
+////    QString rnxStr = obs.rnxStr(ie);
+////    if (rnxStr.length() >= 2) {
+////      double data = obs.measdata(rnxStr, rnxVers);
+////      if (data != 0.0) {
+////        int width = (rnxStr[0] == 'S') ? 8 : 14;
+////        int prec  = 3;
+////        str << ' ' << rnxStr.toAscii().data() 
+////            << ' ' << obsToStr(data, width, prec);
+////        if (rnxStr[0] == 'L') {
+////          int slipCnt = 0;
+////          if      (rnxStr[1] == '1') {
+////            slipCnt = obs.slip_cnt_L1;
+////          }
+////          else if (rnxStr[1] == '2') {
+////            slipCnt = obs.slip_cnt_L2;
+////          }
+////          else if (rnxStr[1] == '5') {
+////            slipCnt = obs.slip_cnt_L5;
+////          }
+////          str << ' ' << setw(3)  << slipCnt;
+////        }
+////      }
+////    }
+////  }
 
   return str.str();
Index: /trunk/BNC/src/bncrinex.h
===================================================================
--- /trunk/BNC/src/bncrinex.h	(revision 6136)
+++ /trunk/BNC/src/bncrinex.h	(revision 6137)
@@ -30,7 +30,6 @@
 
 #include "bncconst.h"
+#include "satObs.h"
 #include "rinex/rnxobsfile.h"
-
-class t_obs;
 
 class bncRinex {
@@ -42,5 +41,5 @@
 
    int  samplingRate() const {return _samplingRate;}
-   void deepCopy(t_obs obs);
+   void deepCopy(t_satObs obs);
    void dumpEpoch(const QByteArray& format, long maxTime);
    void setReconnectFlag(bool flag){_reconnectFlag = flag;}
@@ -49,8 +48,8 @@
                                const QString& intStr, 
                                QDateTime* nextEpoch = 0);
-   static std::string asciiSatLine(const t_obs& obs);
+   static std::string asciiSatLine(const t_satObs& obs);
 
  private:
-   std::string rinexSatLine(const t_obs& obs, char lli1, char lli2, char lli5);
+   std::string rinexSatLine(const t_satObs& obs, char lli1, char lli2, char lli5);
    static std::string obsToStr(double val, int width = 14, int precision = 3);
    void resolveFileName(const QDateTime& datTim);
@@ -60,23 +59,23 @@
    t_irc downloadSkeleton();
 
-   QByteArray    _statID;
-   QByteArray    _fName;
-   QList<t_obs>  _obs;
-   std::ofstream _out;
-   bool          _headerWritten;
-   QDateTime     _nextCloseEpoch;
-   QString       _rnxScriptName;
-   QUrl          _mountPoint;
-   QString       _pgmName;
-   QString       _userName;
-   QString       _sklName;
-   QByteArray    _latitude;
-   QByteArray    _longitude;
-   QByteArray    _nmea;
-   QByteArray    _ntripVersion;
-   bool          _reconnectFlag;
-   QDate         _skeletonDate;
-   int           _samplingRate;
-   QStringList   _addComments;
+   QByteArray      _statID;
+   QByteArray      _fName;
+   QList<t_satObs> _obs;
+   std::ofstream   _out;
+   bool            _headerWritten;
+   QDateTime       _nextCloseEpoch;
+   QString         _rnxScriptName;
+   QUrl            _mountPoint;
+   QString         _pgmName;
+   QString         _userName;
+   QString         _sklName;
+   QByteArray      _latitude;
+   QByteArray      _longitude;
+   QByteArray      _nmea;
+   QByteArray      _ntripVersion;
+   bool            _reconnectFlag;
+   QDate           _skeletonDate;
+   int             _samplingRate;
+   QStringList     _addComments;
 
    QMap<QString, int>  _slip_cnt_L1;
Index: /trunk/BNC/src/bnctableitem.cpp
===================================================================
--- /trunk/BNC/src/bnctableitem.cpp	(revision 6136)
+++ /trunk/BNC/src/bnctableitem.cpp	(revision 6137)
@@ -41,5 +41,4 @@
 #include "bnctableitem.h"
 #include "bncgetthread.h"
-#include "GPSDecoder.h"
 
 // Constructor
Index: /trunk/BNC/src/latencychecker.cpp
===================================================================
--- /trunk/BNC/src/latencychecker.cpp	(revision 6136)
+++ /trunk/BNC/src/latencychecker.cpp	(revision 6137)
@@ -306,13 +306,13 @@
 // Perform latency checks (observations)
 //////////////////////////////////////////////////////////////////////////////
-void latencyChecker::checkObsLatency(const QList<t_obs>& obsList) {
+void latencyChecker::checkObsLatency(const QList<t_satObs>& obsList) {
 
   if (_perfIntr > 0 ) {
 
-    QListIterator<t_obs> it(obsList);
+    QListIterator<t_satObs> it(obsList);
     while (it.hasNext()) {
-      const t_obs& obs = it.next();
+      const t_satObs& obs = it.next();
       
-      _newSecGPS = static_cast<int>(obs.GPSWeeks);
+      _newSecGPS = static_cast<int>(obs._time.gpssec());
       if (_newSecGPS != _oldSecGPS) {
         if (_newSecGPS % _perfIntr < _oldSecGPS % _perfIntr) {
@@ -363,17 +363,17 @@
         // Compute the observations latency
         // --------------------------------
-        int week;
-        double sec;
+        int      week;
+        double   sec;
         currentGPSWeeks(week, sec);
         const double secPerWeek = 7.0 * 24.0 * 3600.0;
-        if (week < obs.GPSWeek) {
+        if (week < int(obs._time.gpsw())) {
           week += 1;
           sec  -= secPerWeek;
         }
-        if (week > obs.GPSWeek) {
+        if (week > int(obs._time.gpsw())) {
           week -= 1;
           sec  += secPerWeek;
         }
-         _curLat   = sec - obs.GPSWeeks;
+         _curLat   = sec - obs._time.gpssec();
         _sumLat  += _curLat;
         _sumLatQ += _curLat * _curLat;
Index: /trunk/BNC/src/latencychecker.h
===================================================================
--- /trunk/BNC/src/latencychecker.h	(revision 6136)
+++ /trunk/BNC/src/latencychecker.h	(revision 6137)
@@ -27,6 +27,5 @@
 
 #include <QDateTime>
-
-#include "GPSDecoder.h"
+#include "satObs.h"
 
 class latencyChecker : public QObject {
@@ -38,5 +37,5 @@
   void checkReconnect();
   void checkOutage(bool decoded);
-  void checkObsLatency(const QList<t_obs>& obsList);
+  void checkObsLatency(const QList<t_satObs>& obsList);
   void checkCorrLatency(int corrGPSEpochTime);
   double currentLatency() const {return _curLat;}
Index: /trunk/BNC/src/pppRun.cpp
===================================================================
--- /trunk/BNC/src/pppRun.cpp	(revision 6136)
+++ /trunk/BNC/src/pppRun.cpp	(revision 6137)
@@ -90,6 +90,6 @@
     }
 
-    connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_obs>)),
-            this, SLOT(slotNewObs(QByteArray, QList<t_obs>)),conType);
+    connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_satObs>)),
+            this, SLOT(slotNewObs(QByteArray, QList<t_satObs>)),conType);
 
     connect(BNC_CORE, SIGNAL(newEphGPS(gpsephemeris)),
@@ -186,5 +186,5 @@
 //
 ////////////////////////////////////////////////////////////////////////////
-void t_pppRun::slotNewObs(QByteArray staID, QList<t_obs> obsList) {
+void t_pppRun::slotNewObs(QByteArray staID, QList<t_satObs> obsList) {
   QMutexLocker locker(&_mutex);
 
@@ -195,11 +195,8 @@
   // Loop over all obsevations (possible different epochs)
   // -----------------------------------------------------
-  QListIterator<t_obs> it(obsList);
+  QListIterator<t_satObs> it(obsList);
   while (it.hasNext()) {
-    const t_obs& oldObs = it.next();
-    t_satObs* newObs = new t_satObs;
-   
-    newObs->_prn.set(oldObs.satSys, oldObs.satNum);
-    newObs->_time.set(oldObs.GPSWeek, oldObs.GPSWeeks);
+    const t_satObs& oldObs = it.next();
+    t_satObs*       newObs = new t_satObs(oldObs);
 
     // Find the corresponding data epoch or create a new one
@@ -221,36 +218,11 @@
     }
 
-    // Fill the new observation and add it to the corresponding epoch
-    // --------------------------------------------------------------
+    // Put data into the epoch
+    // -----------------------
     if (epoch != 0) {
       epoch->_satObs.push_back(newObs);
-      map<string, t_frqObs*> frqObsMap;
-      for (unsigned iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) {
-        string hlp = oldObs.rnxStr(iEntry).toAscii().data();
-        if (hlp.length() >= 2 && oldObs._measdata[iEntry] != 0.0) {
-          char   obsType    = hlp[0];
-          string rnxType2ch = hlp.substr(1);
-          if (obsType == 'C' || obsType == 'L') {
-            t_frqObs* frqObs = 0;
-            if (frqObsMap.find(rnxType2ch) == frqObsMap.end()) {
-              frqObs                = new t_frqObs();
-              frqObsMap[rnxType2ch] = frqObs;
-              frqObs->_rnxType2ch   = rnxType2ch;
-              newObs->_obs.push_back(frqObs);
-            }
-            else {
-              frqObs = frqObsMap[rnxType2ch];
-            }
-            if      (obsType == 'C') {
-              frqObs->_code      = oldObs._measdata[iEntry];
-              frqObs->_codeValid = true;
-            }
-            else if (obsType == 'L') {
-              frqObs->_phase      = oldObs._measdata[iEntry];
-              frqObs->_phaseValid = true;
-            }
-          }
-        }
-      }
+    }
+    else {
+      delete newObs;
     }
   }
@@ -477,9 +449,9 @@
     // Create list of observations and start epoch processing
     // ------------------------------------------------------
-    QList<t_obs> obsList;
+    QList<t_satObs> obsList;
     for (unsigned iObs = 0; iObs < epo->rnxSat.size(); iObs++) {
       const t_rnxObsFile::t_rnxSat& rnxSat = epo->rnxSat[iObs];
     
-      t_obs obs;
+      t_satObs obs;
       t_rnxObsFile::setObsFromRnx(_rnxObsFile, epo, rnxSat, obs);
       obsList << obs;
Index: /trunk/BNC/src/pppRun.h
===================================================================
--- /trunk/BNC/src/pppRun.h	(revision 6136)
+++ /trunk/BNC/src/pppRun.h	(revision 6137)
@@ -6,5 +6,4 @@
 #include <QtCore>
 
-#include "GPSDecoder.h"
 #include "pppOptions.h"
 #include "pppClient.h"
@@ -39,5 +38,5 @@
   void slotNewEphGalileo(galileoephemeris galeph);
   void slotNewCorrections(QStringList corrList);
-  void slotNewObs(QByteArray staID, QList<t_obs> obsList);
+  void slotNewObs(QByteArray staID, QList<t_satObs> obsList);
   void slotSetSpeed(int speed);
   void slotSetStopFlag();
Index: /trunk/BNC/src/pppThread.h
===================================================================
--- /trunk/BNC/src/pppThread.h	(revision 6136)
+++ /trunk/BNC/src/pppThread.h	(revision 6137)
@@ -6,5 +6,4 @@
 #include <QtCore>
 
-#include "GPSDecoder.h"
 #include "pppOptions.h"
 #include "pppClient.h"
Index: /trunk/BNC/src/rinex/reqcanalyze.cpp
===================================================================
--- /trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 6136)
+++ /trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 6137)
@@ -237,12 +237,12 @@
       for (unsigned iObs = 0; iObs < _currEpo->rnxSat.size(); iObs++) {
         const t_rnxObsFile::t_rnxSat& rnxSat = _currEpo->rnxSat[iObs];
-        t_obs obs;
+        t_satObs obs;
         t_rnxObsFile::setObsFromRnx(obsFile, _currEpo, rnxSat, obs);
   
-        QString prn = QString("%1%2").arg(obs.satSys)
-                                     .arg(obs.satNum, 2, 10, QChar('0'));
+        QString prn(obs._prn.toString().c_str());
   
-        t_ephGlo* ephGlo = 0;
-        if (obs.satSys == 'R') {
+        t_ephGlo* ephGlo  = 0;
+        int       slotNum = 0;
+        if (obs._prn.system() == 'R') {
           for (int ie = 0; ie < _ephs.size(); ie++) {
             if (QString(_ephs[ie]->prn().toString().c_str()) == prn) {
@@ -252,9 +252,9 @@
           }
           if (ephGlo) {
-            obs.slotNum = ephGlo->slotNum();
+            slotNum = ephGlo->slotNum();
           }
         }
   
-        t_irc irc = _allObsMap[prn].addObs(obs);
+        t_irc irc = _allObsMap[prn].addObs(obs, slotNum);
 
         if (irc == success) {
@@ -339,24 +339,45 @@
 //  
 ////////////////////////////////////////////////////////////////////////////
-t_irc t_reqcAnalyze::t_allObs::addObs(const t_obs& obs) { 
-
-  t_oneObs* newObs = new t_oneObs(obs.GPSWeek, obs.GPSWeeks);
+t_irc t_reqcAnalyze::t_allObs::addObs(const t_satObs& obs, int slotNum) { 
+
+  t_oneObs* newObs = new t_oneObs(obs._time.gpsw(), obs._time.gpssec());
   bool      okFlag = false;
 
   // Availability and Slip Flags
   // ---------------------------
-  double L1 = obs.measdata("L1", 3.0);
-  if (L1 != 0) {
-    newObs->_hasL1 = true;
-  }
-  double L2 = obs.satSys == 'E' ? obs.measdata("L5", 3.0) : obs.measdata("L2", 3.0);;
-  if (L2 != 0) {
-    newObs->_hasL2 = true;
-  }
-  if (obs.slipL1) {
-    newObs->_slipL1 = true;
-  }
-  if (obs.slipL2) {
-    newObs->_slipL2 = true;
+  double L1 = 0.0;
+  double L2 = 0.0;
+  double P1 = 0.0;
+  double P2 = 0.0;
+
+  for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) {
+    const t_frqObs* frqObs = obs._obs[iFrq];
+    if      (frqObs->_rnxType2ch[0] == '1') {
+      if (frqObs->_phaseValid) {
+        L1              = frqObs->_phase;
+        newObs->_hasL1  = true;
+        newObs->_slipL1 = frqObs->_slip;
+      }
+      if (frqObs->_codeValid) {
+        P1 = frqObs->_code;   
+      }
+      if (frqObs->_snrValid) {
+        newObs->_SNR1 = frqObs->_snr;   
+      }
+    }
+    else if ( (obs._prn.system() != 'E' && frqObs->_rnxType2ch[0] == '2') ||
+              (obs._prn.system() == 'E' && frqObs->_rnxType2ch[0] == '5') ) {
+      if (frqObs->_phaseValid) {
+        L2             = frqObs->_phase;
+        newObs->_hasL2 = true;
+        newObs->_slipL2 = frqObs->_slip;
+      }
+      if (frqObs->_codeValid) {
+        P2 = frqObs->_code;   
+      }
+      if (frqObs->_snrValid) {
+        newObs->_SNR2 = frqObs->_snr;   
+      }
+    }
   }
 
@@ -366,13 +387,13 @@
     double f1 = 0.0;
     double f2 = 0.0;
-    if      (obs.satSys == 'G') {
+    if      (obs._prn.system() == 'G') {
       f1 = t_CST::freq(t_frequency::G1, 0);
       f2 = t_CST::freq(t_frequency::G2, 0);
     }
-    else if (obs.satSys == 'R') {
-      f1 = t_CST::freq(t_frequency::R1, obs.slotNum);
-      f2 = t_CST::freq(t_frequency::R2, obs.slotNum);
-    }
-    else if (obs.satSys == 'E') {
+    else if (obs._prn.system() == 'R') {
+      f1 = t_CST::freq(t_frequency::R1, slotNum);
+      f2 = t_CST::freq(t_frequency::R2, slotNum);
+    }
+    else if (obs._prn.system() == 'E') {
       f1 = t_CST::freq(t_frequency::E1, 0);
       f2 = t_CST::freq(t_frequency::E5, 0);
@@ -382,49 +403,10 @@
     L2 = L2 * t_CST::c / f2;
 
-    double P1 = obs.measdata("C1", 3.0);
     if (P1 != 0.0) {
       newObs->_MP1 = P1 - L1 - 2.0*f2*f2/(f1*f1-f2*f2) * (L1 - L2);
       okFlag = true;
     }
-    double P2 = obs.satSys == 'E' ? obs.measdata("C5", 3.0) : obs.measdata("C2", 3.0);
     if (P2 != 0.0) {
       newObs->_MP2 = P2 - L2 - 2.0*f1*f1/(f1*f1-f2*f2) * (L1 - L2);
-      okFlag = true;
-    }
-  }
-
-  // Signal-to-Noise
-  // ---------------
-  double S1 = obs.measdata("S1", 3.0);
-  if (S1 != 0.0) {
-    newObs->_SNR1 = floor(S1/6);
-    if (newObs->_SNR1 > 9.0) {
-      newObs->_SNR1 = 9.0; 
-    }
-    if (newObs->_SNR1 < 1.0) {
-      newObs->_SNR1 = 1.0;
-    }
-    okFlag = true;
-  }
-  else {
-    if (obs.snrL1 > 0) {
-      newObs->_SNR1 = obs.snrL1;
-      okFlag = true;
-    }
-  }
-  double S2 = obs.satSys == 'E' ? obs.measdata("S5", 3.0) : obs.measdata("S2", 3.0);
-  if (S2 != 0.0) {
-    newObs->_SNR2 = floor(S2/6);
-    if (newObs->_SNR2 > 9.0) {
-      newObs->_SNR2 = 9.0; 
-    }
-    if (newObs->_SNR2 < 1.0) {
-      newObs->_SNR2 = 1.0;
-    }
-    okFlag = true;
-  }
-  else {
-    if (obs.snrL2 > 0) {
-      newObs->_SNR2 = obs.snrL2;
       okFlag = true;
     }
Index: /trunk/BNC/src/rinex/reqcanalyze.h
===================================================================
--- /trunk/BNC/src/rinex/reqcanalyze.h	(revision 6136)
+++ /trunk/BNC/src/rinex/reqcanalyze.h	(revision 6137)
@@ -29,6 +29,6 @@
 #include "rnxobsfile.h"
 #include "rnxnavfile.h"
-#include "GPSDecoder.h"
 #include "ephemeris.h"
+#include "satObs.h"
 
 class t_polarPoint;
@@ -150,5 +150,5 @@
       }
     }
-    t_irc addObs(const t_obs& obs);
+    t_irc addObs(const t_satObs& obs, int slotNum);
     QVector<t_oneObs*> _oneObsVec;
   };
Index: /trunk/BNC/src/rinex/rnxobsfile.cpp
===================================================================
--- /trunk/BNC/src/rinex/rnxobsfile.cpp	(revision 6136)
+++ /trunk/BNC/src/rinex/rnxobsfile.cpp	(revision 6137)
@@ -1038,35 +1038,54 @@
 // Set Observations from RINEX File
 ////////////////////////////////////////////////////////////////////////////
-void t_rnxObsFile::setObsFromRnx(const t_rnxObsFile* rnxObsFile,
-                                 const t_rnxObsFile::t_rnxEpo* epo, 
-                                 const t_rnxObsFile::t_rnxSat& rnxSat, 
-                                 t_obs& obs) {
-
-  strncpy(obs.StatID, rnxObsFile->markerName().toAscii().constData(), sizeof(obs.StatID));
-
-  obs.satSys   = rnxSat.prn.system();
-  obs.satNum   = rnxSat.prn.number();
-  obs.GPSWeek  = epo->tt.gpsw();
-  obs.GPSWeeks = epo->tt.gpssec();
-
-  for (int iType = 0; iType < rnxObsFile->nTypes(obs.satSys); iType++) {
-    QString type   = rnxObsFile->obsType(obs.satSys, iType);
+void t_rnxObsFile::setObsFromRnx(const t_rnxObsFile* rnxObsFile, const t_rnxObsFile::t_rnxEpo* epo, 
+                                 const t_rnxObsFile::t_rnxSat& rnxSat, t_satObs& obs) {
+
+  obs._staID = rnxObsFile->markerName().toAscii().constData();
+  obs._prn   = rnxSat.prn;
+  obs._time  = epo->tt;
+
+  char sys   = rnxSat.prn.system();
+
+  for (int iType = 0; iType < rnxObsFile->nTypes(sys); iType++) {
+    QString type = rnxObsFile->obsType(sys, iType);
     if (rnxSat.obs.contains(type)) {
       const t_rnxObs& rnxObs = rnxSat.obs[type];
-      obs.setMeasdata(type, rnxObsFile->version(), rnxObs.value);
-      if      (type.indexOf("L1") == 0) {
-        obs.snrL1  = rnxObs.snr;
-        obs.slipL1 = (rnxObs.lli & 1);
-      }
-      else if (type.indexOf("L2") == 0) {
-        obs.snrL2  = rnxObs.snr;
-        obs.slipL2 = (rnxObs.lli & 1);
-      }
-      else if (type.indexOf("L5") == 0) {
-        obs.snrL5  = rnxObs.snr;
-        obs.slipL5 = (rnxObs.lli & 1);
-      }
-    }
-  }
-}
-
+      string type2ch(type.mid(1).toAscii().data());
+
+
+      t_frqObs* frqObs = 0;
+      for (unsigned iFrq = 0; iFrq < obs._obs.size(); iFrq++) {
+        if (obs._obs[iFrq]->_rnxType2ch == type2ch) {
+          frqObs = obs._obs[iFrq];
+          break;
+        }
+      }
+      if (frqObs == 0) {
+        frqObs = new t_frqObs;
+        frqObs->_rnxType2ch = type2ch;
+        obs._obs.push_back(frqObs);
+      }
+
+      switch( type.toAscii().data()[0] ) {
+      case 'C':
+        frqObs->_codeValid = true;
+        frqObs->_code      = rnxObs.value;
+        break;
+      case 'L':
+        frqObs->_phaseValid = true;
+        frqObs->_phase      = rnxObs.value;
+        frqObs->_slip       = (rnxObs.lli & 1);
+        break;
+      case 'D':
+        frqObs->_dopplerValid = true;
+        frqObs->_doppler      = rnxObs.value;
+        break;
+      case 'S':
+        frqObs->_snrValid = true;
+        frqObs->_snr      = rnxObs.value;
+        break;
+      }
+    }
+  }
+}
+
Index: /trunk/BNC/src/rinex/rnxobsfile.h
===================================================================
--- /trunk/BNC/src/rinex/rnxobsfile.h	(revision 6136)
+++ /trunk/BNC/src/rinex/rnxobsfile.h	(revision 6137)
@@ -36,5 +36,5 @@
 #include "bnctime.h"
 #include "t_prn.h"
-#include "GPSDecoder.h"
+#include "satObs.h"
 
 class t_rnxObsHeader {
@@ -163,5 +163,5 @@
                             const t_rnxObsFile::t_rnxEpo* epo, 
                             const t_rnxObsFile::t_rnxSat& rnxSat, 
-                            t_obs& obs);
+                            t_satObs& obs);
 
   static QString type2to3(char sys, const QString& typeV2);
Index: /trunk/BNC/src/satObs.h
===================================================================
--- /trunk/BNC/src/satObs.h	(revision 6136)
+++ /trunk/BNC/src/satObs.h	(revision 6137)
@@ -42,5 +42,14 @@
  public:
   t_satObs() {}
+  t_satObs(const t_satObs& old) { // copy constructor (deep copy)
+    _staID = old._staID;
+    _prn   = old._prn;
+    _time  = old._time;
+    for (unsigned ii = 0; ii < old._obs.size(); ii++) {
+      _obs.push_back(new t_frqObs(*old._obs[ii]));
+    }
+  }
   ~t_satObs() {for (unsigned ii = 0; ii < _obs.size(); ii++) delete _obs[ii];}
+  std::string            _staID;
   t_prn                  _prn;
   bncTime                _time;
Index: /trunk/BNC/src/src.pro
===================================================================
--- /trunk/BNC/src/src.pro	(revision 6136)
+++ /trunk/BNC/src/src.pro	(revision 6137)
@@ -2,6 +2,6 @@
 TARGET = ../bnc
 
-CONFIG -= debug
-CONFIG += release
+CONFIG -= release
+CONFIG += debug
 
 include(src.pri)
