Index: trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 6453)
+++ trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 6454)
@@ -87,6 +87,8 @@
           BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
 
-  memset(&_co, 0, sizeof(_co));
-  memset(&_bias, 0, sizeof(_bias));
+  memset(&_clkOrb,    0, sizeof(_clkOrb));
+  memset(&_codeBias,  0, sizeof(_codeBias));
+  memset(&_phaseBias, 0, sizeof(_phaseBias));
+  memset(&_vTEC,      0, sizeof(_vTEC));
 
   _providerID[0] = -1;
@@ -147,19 +149,30 @@
   while(_buffer.size()) {
 
+    struct ClockOrbit clkOrbSav;
+    struct CodeBias   codeBiasSav;
+    struct PhaseBias  phaseBiasSav;
+    struct VTEC       vTECSav;
+    memcpy(&clkOrbSav,    &_clkOrb,    sizeof(clkOrbSav)); // save state
+    memcpy(&codeBiasSav,  &_codeBias,  sizeof(codeBiasSav));
+    memcpy(&phaseBiasSav, &_phaseBias, sizeof(phaseBiasSav));
+    memcpy(&vTECSav,      &_vTEC,      sizeof(vTECSav));
+
     int bytesused = 0;
-    struct ClockOrbit co_sav;
-    memcpy(&co_sav, &_co, sizeof(co_sav)); // save state
-
-    GCOB_RETURN irc = GetSSR(&_co, &_bias, 0, 0, _buffer.data(),
-                                        _buffer.size(), &bytesused);
+    GCOB_RETURN irc = GetSSR(&_clkOrb, &_codeBias, &_vTEC, &_phaseBias, 
+                             _buffer.data(), _buffer.size(), &bytesused);
 
     if      (irc <= -30) { // not enough data - restore state and exit loop
-      memcpy(&_co, &co_sav, sizeof(co_sav));
+      memcpy(&_clkOrb,    &clkOrbSav,    sizeof(clkOrbSav));
+      memcpy(&_codeBias,  &codeBiasSav,  sizeof(codeBiasSav));
+      memcpy(&_phaseBias, &phaseBiasSav, sizeof(phaseBiasSav));
+      memcpy(&_vTEC,      &vTECSav,      sizeof(vTECSav));
       break;
     }
 
     else if (irc < 0) {    // error  - skip 1 byte and retry
-      memset(&_co, 0, sizeof(_co));
-      memset(&_bias, 0, sizeof(_bias));
+      memset(&_clkOrb,    0, sizeof(_clkOrb));
+      memset(&_codeBias,  0, sizeof(_codeBias));
+      memset(&_phaseBias, 0, sizeof(_phaseBias));
+      memset(&_vTEC,      0, sizeof(_vTEC));
       _buffer = _buffer.mid(bytesused ? bytesused : 1);
     }
@@ -168,7 +181,7 @@
       _buffer = _buffer.mid(bytesused);
 
-      if ( (irc == GCOBR_OK          || irc == GCOBR_MESSAGEFOLLOWS ) &&
-           (_co.NumberOfSat[CLOCKORBIT_SATGPS]   > 0 || _co.NumberOfSat[CLOCKORBIT_SATGLONASS]   > 0 ||
-            _bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ) {
+      if ( (irc == GCOBR_OK || irc == GCOBR_MESSAGEFOLLOWS ) &&
+           (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS]   > 0 || _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]   > 0 ||
+            _codeBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ) {
 
         reopen();
@@ -182,7 +195,7 @@
         // Correction Epoch from GPSEpochTime
         // ----------------------------------
-        if (_co.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
-          int GPSEpochTime = (_co.NumberOfSat[CLOCKORBIT_SATGPS] > 0) ?
-                             _co.EpochTime[CLOCKORBIT_SATGPS] : _bias.EpochTime[CLOCKORBIT_SATGPS];
+        if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _codeBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {
+          int GPSEpochTime = (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0) ?
+                             _clkOrb.EpochTime[CLOCKORBIT_SATGPS] : _codeBias.EpochTime[CLOCKORBIT_SATGPS];
           if      (GPSweeksHlp > GPSEpochTime + 86400.0) {
             GPSweek += 1;
@@ -196,7 +209,7 @@
         // Correction Epoch from Glonass Epoch
         // -----------------------------------
-        else if (_co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0){
-          int GLONASSEpochTime = (_co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ?
-                              _co.EpochTime[CLOCKORBIT_SATGLONASS] : _bias.EpochTime[CLOCKORBIT_SATGLONASS];
+        else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 || _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0){
+          int GLONASSEpochTime = (_clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ?
+                              _clkOrb.EpochTime[CLOCKORBIT_SATGLONASS] : _codeBias.EpochTime[CLOCKORBIT_SATGLONASS];
 
           // Second of day (GPS time) from Glonass Epoch
@@ -234,6 +247,8 @@
         retCode = success;
 
-        memset(&_co, 0, sizeof(_co));
-        memset(&_bias, 0, sizeof(_bias));
+        memset(&_clkOrb,    0, sizeof(_clkOrb));
+        memset(&_codeBias,  0, sizeof(_codeBias));
+        memset(&_phaseBias, 0, sizeof(_phaseBias));
+        memset(&_vTEC,      0, sizeof(_vTEC));
       }
     }
@@ -252,7 +267,7 @@
   // Loop over all satellites (GPS and Glonass)
   // ------------------------------------------
-  for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _co.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
+  for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
     char sysCh = ' ';
-    if      (ii < _co.NumberOfSat[CLOCKORBIT_SATGPS]) {
+    if      (ii < _clkOrb.NumberOfSat[CLOCKORBIT_SATGPS]) {
       sysCh = 'G';
     }
@@ -266,39 +281,39 @@
     // Orbit correction
     // ----------------
-    if ( _co.messageType == COTYPE_GPSCOMBINED     ||
-         _co.messageType == COTYPE_GLONASSCOMBINED ||
-         _co.messageType == COTYPE_GPSORBIT        ||
-         _co.messageType == COTYPE_GLONASSORBIT    ) {
+    if ( _clkOrb.messageType == COTYPE_GPSCOMBINED     ||
+         _clkOrb.messageType == COTYPE_GLONASSCOMBINED ||
+         _clkOrb.messageType == COTYPE_GPSORBIT        ||
+         _clkOrb.messageType == COTYPE_GLONASSORBIT    ) {
 
       t_orbCorr orbCorr;
-      orbCorr._prn.set(sysCh, _co.Sat[ii].ID);
+      orbCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID);
       orbCorr._staID    = _staID.toAscii().data();
-      orbCorr._iod      = _co.Sat[ii].IOD;
+      orbCorr._iod      = _clkOrb.Sat[ii].IOD;
       orbCorr._time     = _lastTime;
       orbCorr._system   = 'R';
-      orbCorr._xr[0]    = _co.Sat[ii].Orbit.DeltaRadial;
-      orbCorr._xr[1]    = _co.Sat[ii].Orbit.DeltaAlongTrack;
-      orbCorr._xr[2]    = _co.Sat[ii].Orbit.DeltaCrossTrack;
-      orbCorr._dotXr[0] = _co.Sat[ii].Orbit.DotDeltaRadial;
-      orbCorr._dotXr[1] = _co.Sat[ii].Orbit.DotDeltaAlongTrack;
-      orbCorr._dotXr[2] = _co.Sat[ii].Orbit.DotDeltaCrossTrack;
+      orbCorr._xr[0]    = _clkOrb.Sat[ii].Orbit.DeltaRadial;
+      orbCorr._xr[1]    = _clkOrb.Sat[ii].Orbit.DeltaAlongTrack;
+      orbCorr._xr[2]    = _clkOrb.Sat[ii].Orbit.DeltaCrossTrack;
+      orbCorr._dotXr[0] = _clkOrb.Sat[ii].Orbit.DotDeltaRadial;
+      orbCorr._dotXr[1] = _clkOrb.Sat[ii].Orbit.DotDeltaAlongTrack;
+      orbCorr._dotXr[2] = _clkOrb.Sat[ii].Orbit.DotDeltaCrossTrack;
 
       orbCorrections.push_back(orbCorr);
 
-      _IODs[orbCorr._prn.toString()] = _co.Sat[ii].IOD;
-    }
-
-    if ( _co.messageType == COTYPE_GPSCOMBINED     ||
-         _co.messageType == COTYPE_GLONASSCOMBINED ||
-         _co.messageType == COTYPE_GPSCLOCK        ||
-         _co.messageType == COTYPE_GLONASSCLOCK    ) {
+      _IODs[orbCorr._prn.toString()] = _clkOrb.Sat[ii].IOD;
+    }
+
+    if ( _clkOrb.messageType == COTYPE_GPSCOMBINED     ||
+         _clkOrb.messageType == COTYPE_GLONASSCOMBINED ||
+         _clkOrb.messageType == COTYPE_GPSCLOCK        ||
+         _clkOrb.messageType == COTYPE_GLONASSCLOCK    ) {
 
       t_clkCorr clkCorr;
-      clkCorr._prn.set(sysCh, _co.Sat[ii].ID);
+      clkCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID);
       clkCorr._staID      = _staID.toAscii().data();
       clkCorr._time       = _lastTime;
-      clkCorr._dClk       = _co.Sat[ii].Clock.DeltaA0 / t_CST::c;
-      clkCorr._dotDClk    = _co.Sat[ii].Clock.DeltaA1 / t_CST::c;
-      clkCorr._dotDotDClk = _co.Sat[ii].Clock.DeltaA2 / t_CST::c;
+      clkCorr._dClk       = _clkOrb.Sat[ii].Clock.DeltaA0 / t_CST::c;
+      clkCorr._dotDClk    = _clkOrb.Sat[ii].Clock.DeltaA1 / t_CST::c;
+      clkCorr._dotDotDClk = _clkOrb.Sat[ii].Clock.DeltaA2 / t_CST::c;
       clkCorr._clkPartial = 0.0;
 
@@ -311,6 +326,6 @@
     // High-Resolution Clocks
     // ----------------------
-    if ( _co.messageType == COTYPE_GPSHR     ||
-         _co.messageType == COTYPE_GLONASSHR ) {
+    if ( _clkOrb.messageType == COTYPE_GPSHR     ||
+         _clkOrb.messageType == COTYPE_GLONASSHR ) {
     }
   }
@@ -319,7 +334,7 @@
   // ------------------------------------------
   QList<t_satBias> satBiases;
-  for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _bias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
+  for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {
     char sysCh = ' ';
-    if      (ii < _bias.NumberOfSat[CLOCKORBIT_SATGPS]) {
+    if      (ii < _codeBias.NumberOfSat[CLOCKORBIT_SATGPS]) {
       sysCh = 'G';
     }
@@ -331,9 +346,9 @@
     }
     t_satBias satBias;
-    satBias._prn.set(sysCh, _bias.Sat[ii].ID);
+    satBias._prn.set(sysCh, _codeBias.Sat[ii].ID);
     satBias._time      = _lastTime;
     satBias._nx        = 0;
     satBias._jumpCount = 0;
-    for (unsigned jj = 0; jj < _bias.Sat[ii].NumberOfCodeBiases; jj++) {
+    for (unsigned jj = 0; jj < _codeBias.Sat[ii].NumberOfCodeBiases; jj++) {
     }
   }
@@ -364,12 +379,12 @@
 void RTCM3coDecoder::checkProviderID() {
 
-  if (_co.SSRProviderID == 0 && _co.SSRSolutionID == 0 && _co.SSRIOD == 0) {
+  if (_clkOrb.SSRProviderID == 0 && _clkOrb.SSRSolutionID == 0 && _clkOrb.SSRIOD == 0) {
     return;
   }
 
   int newProviderID[3];
-  newProviderID[0] = _co.SSRProviderID;
-  newProviderID[1] = _co.SSRSolutionID;
-  newProviderID[2] = _co.SSRIOD;
+  newProviderID[0] = _clkOrb.SSRProviderID;
+  newProviderID[1] = _clkOrb.SSRSolutionID;
+  newProviderID[2] = _clkOrb.SSRIOD;
 
   bool alreadySet = false;
Index: trunk/BNC/src/RTCM3/RTCM3coDecoder.h
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3coDecoder.h	(revision 6453)
+++ trunk/BNC/src/RTCM3/RTCM3coDecoder.h	(revision 6454)
@@ -59,6 +59,8 @@
   QString        _fileName;
   QByteArray     _buffer;
-  ClockOrbit     _co;
-  CodeBias       _bias;
+  ClockOrbit     _clkOrb;
+  CodeBias       _codeBias;
+  PhaseBias      _phaseBias;
+  VTEC           _vTEC;
   int            _providerID[3];
   bncTime        _lastTime;
