Index: /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
===================================================================
--- /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 9024)
+++ /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 9025)
@@ -1631,8 +1631,12 @@
        * else. */
       if ((id >= 1057 && id <= 1068) ||
-    	  (id >= 1240 && id <= 1270) ||
-		  (id == 4076)) {
+    	    (id >= 1240 && id <= 1270) ||
+		      (id == 4076)) {
+        RTCM3coDecoder::e_type type = RTCM3coDecoder::e_type::RTCMssr;
+        if (id == 4076) {
+          type = RTCM3coDecoder::e_type::IGSssr;
+        }
         if (!_coDecoders.contains(_staID.toLatin1()))
-          _coDecoders[_staID.toLatin1()] = new RTCM3coDecoder(_staID);
+          _coDecoders[_staID.toLatin1()] = new RTCM3coDecoder(_staID, type);
         RTCM3coDecoder* coDecoder = _coDecoders[_staID.toLatin1()];
         if (coDecoder->Decode(reinterpret_cast<char *>(_Message), _BlockSize,
@@ -1719,10 +1723,8 @@
 uint32_t RTCM3Decoder::CRC24(long size, const unsigned char *buf) {
   uint32_t crc = 0;
-  int i;
-
+  int ii;
   while (size--) {
     crc ^= (*buf++) << (16);
-    for (i = 0; i < 8; i++)
-        {
+    for (ii = 0; ii < 8; ii++) {
       crc <<= 1;
       if (crc & 0x1000000)
Index: /trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
===================================================================
--- /trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 9024)
+++ /trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 9025)
@@ -53,5 +53,5 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
-RTCM3coDecoder::RTCM3coDecoder(const QString& staID) {
+RTCM3coDecoder::RTCM3coDecoder(const QString& staID, const e_type type) {
 
   _staID = staID;
@@ -96,4 +96,7 @@
   _providerID[1] = -1;
   _providerID[2] = -1;
+
+  _type = type;
+  _ssrCorr = 0;
 }
 
@@ -102,4 +105,5 @@
 RTCM3coDecoder::~RTCM3coDecoder() {
   delete _out;
+  delete _ssrCorr;
   _IODs.clear();
   _orbCorrections.clear();
@@ -166,8 +170,8 @@
   while(_buffer.size()) {
 
-    struct ClockOrbit clkOrbSav;
-    struct CodeBias   codeBiasSav;
-    struct PhaseBias  phaseBiasSav;
-    struct VTEC       vTECSav;
+    struct SsrCorr::ClockOrbit clkOrbSav;
+    struct SsrCorr::CodeBias   codeBiasSav;
+    struct SsrCorr::PhaseBias  phaseBiasSav;
+    struct SsrCorr::VTEC       vTECSav;
     memcpy(&clkOrbSav,    &_clkOrb,    sizeof(clkOrbSav)); // save state
     memcpy(&codeBiasSav,  &_codeBias,  sizeof(codeBiasSav));
@@ -176,5 +180,11 @@
 
     int bytesused = 0;
-    GCOB_RETURN irc = GetSSR(&_clkOrb, &_codeBias, &_vTEC, &_phaseBias,
+    if (_type == e_type::RTCMssr) {
+      _ssrCorr = new SsrCorrRtcm();
+    }
+    else {
+      _ssrCorr = new SsrCorrIgs();
+    }
+    GCOB_RETURN irc = _ssrCorr->GetSSR(&_clkOrb, &_codeBias, &_vTEC, &_phaseBias,
                              _buffer.data(), _buffer.size(), &bytesused);
 
@@ -259,18 +269,19 @@
       continue;
     }
+
     // Orbit correction
     // ----------------
-    if ( _clkOrb.messageType == COTYPE_GPSCOMBINED     ||
-         _clkOrb.messageType == COTYPE_GLONASSCOMBINED ||
-         _clkOrb.messageType == COTYPE_GALILEOCOMBINED ||
-         _clkOrb.messageType == COTYPE_QZSSCOMBINED ||
-         _clkOrb.messageType == COTYPE_SBASCOMBINED ||
-         _clkOrb.messageType == COTYPE_BDSCOMBINED ||
-         _clkOrb.messageType == COTYPE_GPSORBIT ||
-         _clkOrb.messageType == COTYPE_GLONASSORBIT ||
-         _clkOrb.messageType == COTYPE_GALILEOORBIT ||
-         _clkOrb.messageType == COTYPE_QZSSORBIT ||
-         _clkOrb.messageType == COTYPE_SBASORBIT ||
-         _clkOrb.messageType == COTYPE_BDSORBIT ) {
+    if ( _clkOrb.messageType == _ssrCorr->COTYPE_GPSCOMBINED     ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_QZSSCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_SBASCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_BDSCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GPSORBIT ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSORBIT ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOORBIT ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_QZSSORBIT ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_SBASORBIT ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_BDSORBIT ) {
 
       t_orbCorr orbCorr;
@@ -295,16 +306,16 @@
     // Clock Corrections
     // -----------------
-    if ( _clkOrb.messageType == COTYPE_GPSCOMBINED     ||
-         _clkOrb.messageType == COTYPE_GLONASSCOMBINED ||
-         _clkOrb.messageType == COTYPE_GALILEOCOMBINED ||
-         _clkOrb.messageType == COTYPE_QZSSCOMBINED ||
-         _clkOrb.messageType == COTYPE_SBASCOMBINED ||
-         _clkOrb.messageType == COTYPE_BDSCOMBINED ||
-         _clkOrb.messageType == COTYPE_GPSCLOCK ||
-         _clkOrb.messageType == COTYPE_GLONASSCLOCK ||
-         _clkOrb.messageType == COTYPE_GALILEOCLOCK ||
-         _clkOrb.messageType == COTYPE_QZSSCLOCK ||
-         _clkOrb.messageType == COTYPE_SBASCLOCK ||
-         _clkOrb.messageType == COTYPE_BDSCLOCK) {
+    if ( _clkOrb.messageType == _ssrCorr->COTYPE_GPSCOMBINED     ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_QZSSCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_SBASCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_BDSCOMBINED ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GPSCLOCK ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSCLOCK ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOCLOCK ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_QZSSCLOCK ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_SBASCLOCK ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_BDSCLOCK) {
 
       t_clkCorr clkCorr;
@@ -327,10 +338,10 @@
     // High-Resolution Clocks
     // ----------------------
-    if ( _clkOrb.messageType == COTYPE_GPSHR     ||
-         _clkOrb.messageType == COTYPE_GLONASSHR ||
-         _clkOrb.messageType == COTYPE_GALILEOHR ||
-         _clkOrb.messageType == COTYPE_QZSSHR ||
-         _clkOrb.messageType == COTYPE_SBASHR ||
-         _clkOrb.messageType == COTYPE_BDSHR) {
+    if ( _clkOrb.messageType == _ssrCorr->COTYPE_GPSHR     ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GLONASSHR ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_GALILEOHR ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_QZSSHR ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_SBASHR ||
+         _clkOrb.messageType == _ssrCorr->COTYPE_BDSHR) {
       t_prn prn(sysCh, _clkOrb.Sat[ii].ID, flag);
       if (_lastClkCorrections.contains(prn)) {
@@ -390,7 +401,7 @@
     satCodeBias._updateInt = _codeBias.UpdateInterval;
     for (unsigned jj = 0; jj < _codeBias.Sat[ii].NumberOfCodeBiases; jj++) {
-      const CodeBias::BiasSat::CodeBiasEntry& biasEntry = _codeBias.Sat[ii].Biases[jj];
+      const SsrCorr::CodeBias::BiasSat::CodeBiasEntry& biasEntry = _codeBias.Sat[ii].Biases[jj];
       t_frqCodeBias frqCodeBias;
-      frqCodeBias._rnxType2ch.assign(codeTypeToRnxType(sysCh, biasEntry.Type));
+      frqCodeBias._rnxType2ch.assign(_ssrCorr->codeTypeToRnxType(sysCh, biasEntry.Type));
       frqCodeBias._value      = biasEntry.Bias;
       if (!frqCodeBias._rnxType2ch.empty()) {
@@ -447,7 +458,7 @@
     satPhaseBias._yawRate = _phaseBias.Sat[ii].YawRate;
     for (unsigned jj = 0; jj < _phaseBias.Sat[ii].NumberOfPhaseBiases; jj++) {
-      const PhaseBias::PhaseBiasSat::PhaseBiasEntry& biasEntry = _phaseBias.Sat[ii].Biases[jj];
+      const SsrCorr::PhaseBias::PhaseBiasSat::PhaseBiasEntry& biasEntry = _phaseBias.Sat[ii].Biases[jj];
       t_frqPhaseBias frqPhaseBias;
-      frqPhaseBias._rnxType2ch.assign(codeTypeToRnxType(sysCh, biasEntry.Type));
+      frqPhaseBias._rnxType2ch.assign(_ssrCorr->codeTypeToRnxType(sysCh, biasEntry.Type));
       frqPhaseBias._value                = biasEntry.Bias;
       frqPhaseBias._fixIndicator         = biasEntry.SignalIntegerIndicator;
@@ -468,5 +479,5 @@
     _vTecMap[_lastTime]._staID = _staID.toStdString();
     for (unsigned ii = 0; ii < _vTEC.NumLayers; ii++) {
-      const VTEC::IonoLayers& ionoLayer = _vTEC.Layers[ii];
+      const SsrCorr::VTEC::IonoLayers& ionoLayer = _vTEC.Layers[ii];
       t_vTecLayer layer;
       layer._height = ionoLayer.Height;
@@ -647,8 +658,8 @@
   }
   else if (epoSecGlo != -1) {
-#ifdef USE_SSR_RTCM
-    QDate date = dateAndTimeFromGPSweek(currentTime.gpsw(), currentTime.gpssec()).date();
-    epoSecGlo = epoSecGlo - 3 * 3600 + gnumleap(date.year(), date.month(), date.day());
-#endif
+    if (_type == e_type::RTCMssr) {
+      QDate date = dateAndTimeFromGPSweek(currentTime.gpsw(), currentTime.gpssec()).date();
+      epoSecGlo = epoSecGlo - 3 * 3600 + gnumleap(date.year(), date.month(), date.day());
+    }
     _lastTime.set(currentWeek, epoSecGlo);
   }
@@ -663,10 +674,10 @@
   }
   else if (epoSecBds != -1) {
-#ifdef USE_SSR_RTCM
-    epoSecBds += 14.0;
-    if (epoSecBds > 604800.0) {
-      epoSecBds -= 7.0*24.0*60.0*60.0;
-    }
-#endif
+    if (_type == e_type::RTCMssr) {
+      epoSecBds += 14.0;
+      if (epoSecBds > 604800.0) {
+        epoSecBds -= 7.0*24.0*60.0*60.0;
+      }
+    }
     _lastTime.set(currentWeek, epoSecBds);
   }
@@ -682,176 +693,2 @@
   }
 }
-
-//
-////////////////////////////////////////////////////////////////////////////
-string RTCM3coDecoder::codeTypeToRnxType(char system, CodeType type) const {
-  if      (system == 'G') {
-    switch (type) {
-      case CODETYPEGPS_L1_CA:         return "1C";
-      case CODETYPEGPS_L1_P:          return "1P";
-      case CODETYPEGPS_L1_Z:          return "1W";
-
-      case CODETYPEGPS_SEMI_CODELESS: return "2D";
-      case CODETYPEGPS_L2_CA:         return "2C";
-      case CODETYPEGPS_L2_P:          return "2P";
-      case CODETYPEGPS_L2_Z:          return "2W";
-
-      case CODETYPEGPS_L2C_M:         return "2S";
-      case CODETYPEGPS_L2C_L:         return "2L";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGPS_L2C_ML:        return "2X";
-#endif
-
-      case CODETYPEGPS_L5_I:          return "5I";
-      case CODETYPEGPS_L5_Q:          return "5Q";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGPS_L5_IQ:         return "5X";
-#endif
-      case CODETYPEGPS_L1C_D:         return "1S";
-      case CODETYPEGPS_L1C_P:         return "1L";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGPS_L1C_DP:        return "1X";
-#endif
-      default: return "";
-    }
-  }
-  else if (system == 'R') {
-    switch (type) {
-      case CODETYPEGLONASS_L1_CA:     return "1C";
-      case CODETYPEGLONASS_L1_P:      return "1P";
-      case CODETYPEGLONASS_L2_CA:     return "2C";
-      case CODETYPEGLONASS_L2_P:      return "2P";
-      case CODETYPEGLONASS_L1a_OCd:   return "4A";
-      case CODETYPEGLONASS_L1a_OCp:   return "4B";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGLONASS_L1a_OCdp:  return "4X";
-#endif
-      case CODETYPEGLONASS_L2a_CSI:   return "6A";
-      case CODETYPEGLONASS_L2a_OCp:   return "6B";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGLONASS_L2a_CSIOCp:return "6X";
-#endif
-      case CODETYPEGLONASS_L3_I:      return "3I";
-      case CODETYPEGLONASS_L3_Q:      return "3Q";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGLONASS_L3_IQ:     return "3X";
-#endif
-      default: return "";
-    }
-  }
-  else if (system == 'E') {
-    switch (type) {
-      case CODETYPEGALILEO_E1_A:       return "1A";
-      case CODETYPEGALILEO_E1_B:       return "1B";
-      case CODETYPEGALILEO_E1_C:       return "1C";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGALILEO_E1_BC:      return "1X";
-      case CODETYPEGALILEO_E1_ABC:     return "1Z";
-#endif
-      case CODETYPEGALILEO_E5A_I:      return "5I";
-      case CODETYPEGALILEO_E5A_Q:      return "5Q";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGALILEO_E5A_IQ:     return "5X";
-#endif
-      case CODETYPEGALILEO_E5B_I:      return "7I";
-      case CODETYPEGALILEO_E5B_Q:      return "7Q";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGALILEO_E5B_IQ:     return "7X";
-
-      case CODETYPEGALILEO_E5_I:       return "8I";
-      case CODETYPEGALILEO_E5_Q:       return "8Q";
-      case CODETYPEGALILEO_E5_IQ:      return "8X";
-#endif
-      case CODETYPEGALILEO_E6_A:       return "6A";
-      case CODETYPEGALILEO_E6_B:       return "6B";
-      case CODETYPEGALILEO_E6_C:       return "6C";
-#ifdef USE_SSR_RTCM
-      case CODETYPEGALILEO_E6_BC:      return "6X";
-      case CODETYPEGALILEO_E6_ABC:     return "6Z";
-#endif
-      default: return "";
-    }
-  }
-   else if (system == 'J') {
-    switch (type) {
-      case CODETYPEQZSS_L1_CA:         return "1C";
-      case CODETYPEQZSS_L1C_D:         return "1S";
-      case CODETYPEQZSS_L1C_P:         return "1L";
-
-      case CODETYPEQZSS_L2C_M:         return "2S";
-      case CODETYPEQZSS_L2C_L:         return "2L";
-#ifdef USE_SSR_RTCM
-      case CODETYPEQZSS_L2C_ML:        return "2X";
-#endif
-      case CODETYPEQZSS_L5_I:          return "5I";
-      case CODETYPEQZSS_L5_Q:          return "5Q";
-#ifdef USE_SSR_RTCM
-      case CODETYPEQZSS_L5_IQ:         return "5X";
-#endif
-      case CODETYPEQZSS_L6_D:          return "6S";
-      case CODETYPEQZSS_L6_P:          return "6L";
-#ifdef USE_SSR_RTCM
-      case CODETYPEQZSS_L6_DP:         return "6X";
-
-      case CODETYPEQZSS_L1C_DP:        return "1X";
-      case CODETYPEQZSS_L1_S:          return "1Z";
-
-      case CODETYPEQZSS_L5_D:          return "5D";
-      case CODETYPEQZSS_L5_P:          return "5P";
-      case CODETYPEQZSS_L5_DP:         return "5Z";
-#endif
-
-      case CODETYPEQZSS_L6_E:          return "6E";
-#ifdef USE_SSR_RTCM
-      case CODETYPEQZSS_L6_DE:         return "6Z";
-#endif
-      default: return "";
-    }
-  }
-  else if (system == 'C') {
-    switch (type) {
-      case CODETYPE_BDS_B1_I:         return "2I";
-      case CODETYPE_BDS_B1_Q:         return "2Q";
-#ifdef USE_SSR_RTCM
-      case CODETYPE_BDS_B1_IQ:        return "2X";
-#endif
-      case CODETYPE_BDS_B3_I:         return "6I";
-      case CODETYPE_BDS_B3_Q:         return "6Q";
-#ifdef USE_SSR_RTCM
-      case CODETYPE_BDS_B3_IQ:        return "6X";
-#endif
-      case CODETYPE_BDS_B2_I:         return "7I";
-      case CODETYPE_BDS_B2_Q:         return "7Q";
-#ifdef USE_SSR_RTCM
-      case CODETYPE_BDS_B2_IQ:        return "7X";
-#endif
-      case CODETYPE_BDS_B1a_D:        return "1D";
-      case CODETYPE_BDS_B1a_P:        return "1P";
-#ifdef USE_SSR_RTCM
-      case CODETYPE_BDS_B1a_DP:       return "1X";
-#endif
-      case CODETYPE_BDS_B2a_D:        return "5D";
-      case CODETYPE_BDS_B2a_P:        return "5P";
-#ifdef USE_SSR_RTCM
-      case CODETYPE_BDS_B2a_DP:       return "5X";
-#elif USE_SSR_IGS
-      case CODETYPE_BDS_B1_A:         return "1A";
-      case CODETYPE_BDS_B3_A:         return "6A";
-#endif
-      default: return "";
-    }
-  }
-  else if (system == 'S') {
-    switch (type) {
-      case CODETYPE_SBAS_L1_CA:       return "1C";
-
-      case CODETYPE_SBAS_L5_I:        return "5I";
-      case CODETYPE_SBAS_L5_Q:        return "5Q";
-#ifdef USE_SSR_RTCM
-      case CODETYPE_SBAS_L5_IQ:       return "5X";
-#endif
-      default: return "";
-    }
-  }
-  return "";
-};
Index: /trunk/BNC/src/RTCM3/RTCM3coDecoder.h
===================================================================
--- /trunk/BNC/src/RTCM3/RTCM3coDecoder.h	(revision 9024)
+++ /trunk/BNC/src/RTCM3/RTCM3coDecoder.h	(revision 9025)
@@ -33,17 +33,14 @@
 
 #include "GPSDecoder.h"
+#include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
+#include "../RTCM3/clock_and_orbit/clock_orbit_rtcm.h"
 
-extern "C" {
-#ifdef USE_SSR_RTCM
-#include "../RTCM3/clock_and_orbit/clock_orbit_rtcm.h"
-#elif  USE_SSR_IGS
-#include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
-#endif
-}
+//class SsrCorr;
 
-class RTCM3coDecoder : public QObject, public GPSDecoder {
+  class RTCM3coDecoder : public QObject, public GPSDecoder{
 Q_OBJECT
  public:
-  RTCM3coDecoder(const QString& staID);
+  enum e_type {RTCMssr, IGSssr};
+  RTCM3coDecoder(const QString& staID, const e_type type);
   virtual ~RTCM3coDecoder();
   virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg);
@@ -65,5 +62,4 @@
   void reopen();
   void checkProviderID();
-  std::string codeTypeToRnxType(char system, CodeType type) const;
 
   std::ofstream*                        _out;
@@ -72,10 +68,12 @@
   QString                               _fileName;
   QByteArray                            _buffer;
-  ClockOrbit                            _clkOrb;
-  CodeBias                              _codeBias;
-  PhaseBias                             _phaseBias;
-  VTEC                                  _vTEC;
+  SsrCorr::ClockOrbit                   _clkOrb;
+  SsrCorr::CodeBias                     _codeBias;
+  SsrCorr::PhaseBias                    _phaseBias;
+  SsrCorr::VTEC                         _vTEC;
   int                                   _providerID[3];
+  e_type                                _type;
   bncTime                               _lastTime;
+  SsrCorr*                              _ssrCorr;
   QMap<t_prn, unsigned int>             _IODs;
   QMap<bncTime, QList<t_orbCorr> >      _orbCorrections;
Index: /trunk/BNC/src/RTCM3/bits.h
===================================================================
--- /trunk/BNC/src/RTCM3/bits.h	(revision 9024)
+++ /trunk/BNC/src/RTCM3/bits.h	(revision 9025)
@@ -26,8 +26,6 @@
 #define BITS_H
 
-#define LOADBITS(a) \
-{ \
-  while((a) > numbits) \
-  { \
+#define LOADBITS(a) { \
+  while((a) > numbits) { \
     if(!size--) return false; \
     bitfield = (bitfield<<8)|*(data++); \
@@ -38,8 +36,6 @@
 /* extract bits from data stream
    b = variable to store result, a = number of bits */
-#define GETBITS64(b, a) \
-{ \
-  if(((a) > 56) && ((a)-56) > numbits) \
-  { \
+#define GETBITS64(b, a) { \
+  if(((a) > 56) && ((a)-56) > numbits) { \
     uint64_t x; \
     GETBITS(x, 56) \
@@ -49,6 +45,5 @@
     numbits -= ((a)-56); \
   } \
-  else \
-  { \
+  else { \
     GETBITS(b, a) \
   } \
@@ -57,6 +52,5 @@
 /* extract bits from data stream
    b = variable to store result, a = number of bits */
-#define GETBITS(b, a) \
-{ \
+#define GETBITS(b, a) { \
   LOADBITS(a) \
   b = (bitfield<<(64-numbits))>>(64-(a)); \
@@ -66,6 +60,5 @@
 /* extract bits from data stream
    b = variable to store result, a = number of bits */
-#define GETBITSFACTOR(b, a, c) \
-{ \
+#define GETBITSFACTOR(b, a, c) { \
   LOADBITS(a) \
   b = ((bitfield<<(sizeof(bitfield)*8-numbits))>>(sizeof(bitfield)*8-(a)))*(c); \
@@ -75,6 +68,5 @@
 /* extract floating value from data stream
    b = variable to store result, a = number of bits */
-#define GETFLOAT(b, a, c) \
-{ \
+#define GETFLOAT(b, a, c) { \
   LOADBITS(a) \
   b = ((double)((bitfield<<(64-numbits))>>(64-(a))))*(c); \
@@ -84,6 +76,5 @@
 /* extract signed floating value from data stream
    b = variable to store result, a = number of bits */
-#define GETFLOATSIGN(b, a, c) \
-{ \
+#define GETFLOATSIGN(b, a, c) { \
   LOADBITS(a) \
   b = ((double)(((int64_t)(bitfield<<(64-numbits)))>>(64-(a))))*(c); \
@@ -93,6 +84,5 @@
 /* extract bits from data stream
    b = variable to store result, a = number of bits */
-#define GETBITSSIGN(b, a) \
-{ \
+#define GETBITSSIGN(b, a) { \
   LOADBITS(a) \
   b = ((int64_t)(bitfield<<(64-numbits)))>>(64-(a)); \
@@ -100,6 +90,6 @@
 }
 
-#define GETFLOATSIGNM(b, a, c) \
-{ int l; \
+#define GETFLOATSIGNM(b, a, c) { \
+int l; \
   LOADBITS(a) \
   l = (bitfield<<(64-numbits))>>(64-1); \
@@ -113,6 +103,5 @@
 /* extract byte-aligned byte from data stream,
    b = variable to store size, s = variable to store string pointer */
-#define GETSTRING(b, s) \
-{ \
+#define GETSTRING(b, s) { \
   b = *(data++); \
   s = (char *) data; \
Index: /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit.h
===================================================================
--- /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit.h	(revision 9025)
+++ /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit.h	(revision 9025)
@@ -0,0 +1,685 @@
+#ifndef RTCM3_CLOCK_ORBIT_H
+#define RTCM3_CLOCK_ORBIT_H
+
+/* Programheader
+
+ Name:           clock_orbit.h
+ Project:        RTCM3
+ Version:        $Id: clock_orbit_igs.h 8966 2020-07-01 07:48:35Z stuerze $
+ Authors:        Dirk Stöcker, Andrea Stürze
+ Description:    state space approach
+ */
+
+#include <QList>
+#include <string.h>
+#include <math.h>
+#include "t_prn.h"
+
+enum IGS_NUMBERS {
+  RTCM_MESSAGE_NUMBER_IGS = 4076,
+  IGS_SSR_VERSION = 3
+};
+
+/* if some systems aren't supported at all, change the following numbers to zero
+ for these systems to save space */
+enum COR_CONSTANTS {
+  CLOCKORBIT_BUFFERSIZE    = 8192,
+  CLOCKORBIT_NUMGPS        = t_prn::MAXPRN_GPS,
+  CLOCKORBIT_NUMGLONASS    = t_prn::MAXPRN_GLONASS,
+  CLOCKORBIT_NUMGALILEO    = t_prn::MAXPRN_GALILEO,
+  CLOCKORBIT_NUMQZSS       = t_prn::MAXPRN_QZSS,
+  CLOCKORBIT_NUMSBAS       = t_prn::MAXPRN_SBAS,
+  CLOCKORBIT_NUMBDS        = t_prn::MAXPRN_BDS,
+  CLOCKORBIT_NUMBIAS       = 100,
+  CLOCKORBIT_NUMIONOLAYERS =   4,
+  CLOCKORBIT_MAXIONOORDER  =  16,
+  CLOCKORBIT_MAXIONODEGREE =  16
+};
+
+enum COR_SATSYSTEM {
+  CLOCKORBIT_SATGPS = 0,
+  CLOCKORBIT_SATGLONASS,
+  CLOCKORBIT_SATGALILEO,
+  CLOCKORBIT_SATQZSS,
+  CLOCKORBIT_SATSBAS,
+  CLOCKORBIT_SATBDS,
+  CLOCKORBIT_SATNUM
+};
+
+enum COR_OFFSETS {
+  CLOCKORBIT_OFFSETGPS     = 0,
+  CLOCKORBIT_OFFSETGLONASS = CLOCKORBIT_NUMGPS,
+  CLOCKORBIT_OFFSETGALILEO = CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS,
+  CLOCKORBIT_OFFSETQZSS    = CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
+                           + CLOCKORBIT_NUMGALILEO,
+  CLOCKORBIT_OFFSETSBAS    = CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
+                           + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS,
+  CLOCKORBIT_OFFSETBDS     = CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
+                           + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
+                           + CLOCKORBIT_NUMSBAS,
+  CLOCKORBIT_COUNTSAT      = CLOCKORBIT_NUMGPS + CLOCKORBIT_NUMGLONASS
+                           + CLOCKORBIT_NUMGALILEO + CLOCKORBIT_NUMQZSS
+                           + CLOCKORBIT_NUMSBAS + CLOCKORBIT_NUMBDS
+};
+
+enum GCOB_RETURN {
+  /* all well */
+  GCOBR_MESSAGEFOLLOWS = 1,
+  GCOBR_OK = 0,
+  /* unknown data, a warning */
+  GCOBR_UNKNOWNTYPE           = -1,
+  GCOBR_UNKNOWNDATA           = -2,
+  GCOBR_CRCMISMATCH           = -3,
+  GCOBR_SHORTMESSAGE          = -4,
+  /* failed to do the work */
+  GCOBR_NOCLOCKORBITPARAMETER = -10,
+  GCOBR_NOCODEBIASPARAMETER   = -11,
+  GCOBR_NOPHASEBIASPARAMETER  = -12,
+  GCOBR_NOVTECPARAMETER       = -13,
+  /* data mismatch - data in storage does not match new data */
+  GCOBR_TIMEMISMATCH          = -20,
+  GCOBR_DATAMISMATCH          = -21,
+  /* not enough data - can decode the block completely */
+  GCOBR_SHORTBUFFER           = -30,
+  GCOBR_MESSAGEEXCEEDSBUFFER  = -31
+/* NOTE: When an error message has been emitted, the output structures may have been modified.
+ * Make a copy of the previous variant before calling the
+ function to have a clean state. */
+};
+
+class SsrCorr {
+
+public:
+  SsrCorr() {};
+  virtual ~SsrCorr() {};
+  virtual void setCorBase() = 0;
+  virtual void setCorOffset() = 0;
+  virtual void setCoType() = 0;
+  virtual void setCbType() = 0;
+  virtual void setPbType() = 0;
+  virtual void setVtecType() = 0;
+  virtual void setCodeType() = 0;
+
+  typedef unsigned int SatelliteReferenceDatum;
+  SatelliteReferenceDatum DATUM_ITRF;
+  SatelliteReferenceDatum DATUM_LOCAL;
+
+  typedef unsigned int CorBase;
+  CorBase COBBASE_GPS;
+  CorBase COBBASE_GLONASS;
+  CorBase COBBASE_GALILEO;
+  CorBase COBBASE_QZSS;
+  CorBase COBBASE_BDS;
+  CorBase COBBASE_SBAS;
+  CorBase COBBASE_NUM;
+
+  typedef unsigned int CorOffset;
+  CorOffset COBOFS_ORBIT;
+  CorOffset COBOFS_CLOCK;
+  CorOffset COBOFS_COMBINED;
+  CorOffset COBOFS_HR;
+  CorOffset COBOFS_CBIAS;
+  CorOffset COBOFS_PBIAS;
+  CorOffset COBOFS_URA;
+  CorOffset COBOFS_NUM;
+
+  typedef unsigned int ClockOrbitType;
+  ClockOrbitType COTYPE_GPSORBIT;
+  ClockOrbitType COTYPE_GPSCLOCK;
+  ClockOrbitType COTYPE_GPSCOMBINED;
+  ClockOrbitType COTYPE_GPSHR;
+  ClockOrbitType COTYPE_GPSURA;
+
+  ClockOrbitType COTYPE_GLONASSORBIT;
+  ClockOrbitType COTYPE_GLONASSCLOCK;
+  ClockOrbitType COTYPE_GLONASSCOMBINED;
+  ClockOrbitType COTYPE_GLONASSHR;
+  ClockOrbitType COTYPE_GLONASSURA;
+
+  ClockOrbitType COTYPE_GALILEOORBIT;
+  ClockOrbitType COTYPE_GALILEOCLOCK;
+  ClockOrbitType COTYPE_GALILEOCOMBINED;
+  ClockOrbitType COTYPE_GALILEOHR;
+  ClockOrbitType COTYPE_GALILEOURA;
+
+  ClockOrbitType COTYPE_QZSSORBIT;
+  ClockOrbitType COTYPE_QZSSCLOCK;
+  ClockOrbitType COTYPE_QZSSCOMBINED;
+  ClockOrbitType COTYPE_QZSSHR;
+  ClockOrbitType COTYPE_QZSSURA;
+
+  ClockOrbitType COTYPE_SBASORBIT;
+  ClockOrbitType COTYPE_SBASCLOCK;
+  ClockOrbitType COTYPE_SBASCOMBINED;
+  ClockOrbitType COTYPE_SBASHR;
+  ClockOrbitType COTYPE_SBASURA;
+
+  ClockOrbitType COTYPE_BDSORBIT;
+  ClockOrbitType COTYPE_BDSCLOCK;
+  ClockOrbitType COTYPE_BDSCOMBINED;
+  ClockOrbitType COTYPE_BDSHR;
+  ClockOrbitType COTYPE_BDSURA;
+
+  ClockOrbitType COTYPE_AUTO;
+
+  typedef unsigned int CodeBiasType;
+  CodeBiasType CBTYPE_GPS;
+  CodeBiasType CBTYPE_GLONASS;
+  CodeBiasType CBTYPE_GALILEO;
+  CodeBiasType CBTYPE_QZSS;
+  CodeBiasType CBTYPE_SBAS;
+  CodeBiasType CBTYPE_BDS;
+  CodeBiasType CBTYPE_AUTO;
+
+  typedef unsigned int PhaseBiasType;
+  PhaseBiasType PBTYPE_BASE;
+  PhaseBiasType PBTYPE_GPS;
+  PhaseBiasType PBTYPE_GLONASS;
+  PhaseBiasType PBTYPE_GALILEO;
+  PhaseBiasType PBTYPE_QZSS;
+  PhaseBiasType PBTYPE_SBAS;
+  PhaseBiasType PBTYPE_BDS;
+  PhaseBiasType PBTYPE_AUTO;
+
+  typedef unsigned int VtecType;
+  VtecType VTEC_BASE;
+
+  typedef unsigned int CodeType;
+  CodeType RESERVED = 99;
+  CodeType CODETYPE_GPS_L1_CA;
+  CodeType CODETYPE_GPS_L1_P;
+  CodeType CODETYPE_GPS_L1_Z;
+  CodeType CODETYPE_GPS_L1C_D;
+  CodeType CODETYPE_GPS_L1C_P;
+  CodeType CODETYPE_GPS_L1C_DP;
+  CodeType CODETYPE_GPS_L2_CA;
+  CodeType CODETYPE_GPS_SEMI_CODELESS;
+  CodeType CODETYPE_GPS_L2C_M;
+  CodeType CODETYPE_GPS_L2C_L;
+  CodeType CODETYPE_GPS_L2C_ML;
+  CodeType CODETYPE_GPS_L2_P;
+  CodeType CODETYPE_GPS_L2_Z;
+  CodeType CODETYPE_GPS_L5_I;
+  CodeType CODETYPE_GPS_L5_Q;
+  CodeType CODETYPE_GPS_L5_IQ;
+
+  CodeType CODETYPE_GLONASS_L1_CA;
+  CodeType CODETYPE_GLONASS_L1_P;
+  CodeType CODETYPE_GLONASS_L2_CA;
+  CodeType CODETYPE_GLONASS_L2_P;
+  CodeType CODETYPE_GLONASS_L1a_OCd;
+  CodeType CODETYPE_GLONASS_L1a_OCp;
+  CodeType CODETYPE_GLONASS_L1a_OCdp;
+  CodeType CODETYPE_GLONASS_L2a_CSI;
+  CodeType CODETYPE_GLONASS_L2a_OCp;
+  CodeType CODETYPE_GLONASS_L2a_CSIOCp;
+  CodeType CODETYPE_GLONASS_L3_I;
+  CodeType CODETYPE_GLONASS_L3_Q;
+  CodeType CODETYPE_GLONASS_L3_IQ;
+
+  CodeType CODETYPE_GALILEO_E1_A;
+  CodeType CODETYPE_GALILEO_E1_B;
+  CodeType CODETYPE_GALILEO_E1_C;
+  CodeType CODETYPE_GALILEO_E1_BC;
+  CodeType CODETYPE_GALILEO_E1_ABC;
+  CodeType CODETYPE_GALILEO_E5A_I;
+  CodeType CODETYPE_GALILEO_E5A_Q;
+  CodeType CODETYPE_GALILEO_E5A_IQ;
+  CodeType CODETYPE_GALILEO_E5B_I;
+  CodeType CODETYPE_GALILEO_E5B_Q;
+  CodeType CODETYPE_GALILEO_E5B_IQ;
+  CodeType CODETYPE_GALILEO_E5_I;
+  CodeType CODETYPE_GALILEO_E5_Q;
+  CodeType CODETYPE_GALILEO_E5_IQ;
+  CodeType CODETYPE_GALILEO_E6_A;
+  CodeType CODETYPE_GALILEO_E6_B;
+  CodeType CODETYPE_GALILEO_E6_C;
+  CodeType CODETYPE_GALILEO_E6_BC;
+  CodeType CODETYPE_GALILEO_E6_ABC;
+
+  CodeType CODETYPE_QZSS_L1_CA;
+  CodeType CODETYPE_QZSS_L1C_D;
+  CodeType CODETYPE_QZSS_L1C_P;
+  CodeType CODETYPE_QZSS_L2C_M;
+  CodeType CODETYPE_QZSS_L2C_L;
+  CodeType CODETYPE_QZSS_L2C_ML;
+  CodeType CODETYPE_QZSS_L5_I;
+  CodeType CODETYPE_QZSS_L5_Q;
+  CodeType CODETYPE_QZSS_L5_IQ;
+  CodeType CODETYPE_QZSS_L6_D;
+  CodeType CODETYPE_QZSS_L6_P;
+  CodeType CODETYPE_QZSS_L6_DP;
+  CodeType CODETYPE_QZSS_L1C_DP;
+  CodeType CODETYPE_QZSS_L1_S;
+  CodeType CODETYPE_QZSS_L5_D;
+  CodeType CODETYPE_QZSS_L5_P;
+  CodeType CODETYPE_QZSS_L5_DP;
+  CodeType CODETYPE_QZSS_L6_E;
+  CodeType CODETYPE_QZSS_L6_DE;
+
+  CodeType CODETYPE_SBAS_L1_CA;
+  CodeType CODETYPE_SBAS_L5_I;
+  CodeType CODETYPE_SBAS_L5_Q;
+  CodeType CODETYPE_SBAS_L5_IQ;
+
+  CodeType CODETYPE_BDS_B1_I;
+  CodeType CODETYPE_BDS_B1_Q;
+  CodeType CODETYPE_BDS_B1_IQ;
+  CodeType CODETYPE_BDS_B3_I;
+  CodeType CODETYPE_BDS_B3_Q;
+  CodeType CODETYPE_BDS_B3_IQ;
+  CodeType CODETYPE_BDS_B2_I;
+  CodeType CODETYPE_BDS_B2_Q;
+  CodeType CODETYPE_BDS_B2_IQ;
+  CodeType CODETYPE_BDS_B1a_D;
+  CodeType CODETYPE_BDS_B1a_P;
+  CodeType CODETYPE_BDS_B1a_DP;
+  CodeType CODETYPE_BDS_B2a_D;
+  CodeType CODETYPE_BDS_B2a_P;
+  CodeType CODETYPE_BDS_B2a_DP;
+  CodeType CODETYPE_BDS_B1_A;
+  CodeType CODETYPE_BDS_B3_A;
+
+  QList<CorBase> corbase;
+  QList<unsigned int> satoffset;
+
+
+#define SSR_MAXURA 5.5 /* > 5466.5mm in meter */
+#define COBOFS_MAXNUM 7
+
+  /* satellite system data is stored with offset CLOCKORBIT_OFFSET...
+   in the data structures. So first GLONASS satellite is at
+   xxx->Sat[CLOCKORBIT_OFFSETGLONASS], first GPS satellite is
+   xxx->Sat[CLOCKORBIT_OFFSETGPS]. */
+
+  struct ClockOrbit {
+    ClockOrbitType messageType;
+    unsigned int EpochTime[CLOCKORBIT_SATNUM]; /* 0 .. system specific maximum */
+    unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
+    unsigned int Supplied[COBOFS_MAXNUM]; /* boolean */
+    unsigned int SSRIOD;
+    unsigned int SSRProviderID;
+    unsigned int SSRSolutionID;
+    unsigned int UpdateInterval;
+    SatelliteReferenceDatum SatRefDatum;
+    struct SatData {
+      unsigned int ID; /* all */
+      unsigned int IOD; /* all */
+      unsigned int toe; /* SBAS, BDS */
+      double UserRangeAccuracy; /* accuracy values in [m] */
+      double hrclock;
+      struct OrbitPart {
+        double DeltaRadial; /* m */
+        double DeltaAlongTrack; /* m */
+        double DeltaCrossTrack; /* m */
+        double DotDeltaRadial; /* m/s */
+        double DotDeltaAlongTrack; /* m/s */
+        double DotDeltaCrossTrack; /* m/s */
+      } Orbit;
+      struct ClockPart {
+        double DeltaA0; /* m */
+        double DeltaA1; /* m/s */
+        double DeltaA2; /* m/ss */
+      } Clock;
+    } Sat[CLOCKORBIT_COUNTSAT];
+  };
+
+  struct CodeBias {
+    CodeBiasType messageType;
+    unsigned int EpochTime[CLOCKORBIT_SATNUM]; /* 0 .. system specific maximum */
+    unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
+    unsigned int UpdateInterval;
+    unsigned int SSRIOD;
+    unsigned int SSRProviderID;
+    unsigned int SSRSolutionID;
+    struct BiasSat {
+      unsigned int ID; /* all */
+      unsigned int NumberOfCodeBiases;
+      struct CodeBiasEntry {
+        CodeType Type;
+        float Bias; /* m */
+      } Biases[CLOCKORBIT_NUMBIAS];
+    } Sat[CLOCKORBIT_COUNTSAT];
+  };
+
+  struct PhaseBias {
+    PhaseBiasType messageType;
+    unsigned int EpochTime[CLOCKORBIT_SATNUM]; /* 0 .. system specific maximum */
+    unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
+    unsigned int UpdateInterval;
+    unsigned int SSRIOD;
+    unsigned int SSRProviderID;
+    unsigned int SSRSolutionID;
+    unsigned int DispersiveBiasConsistencyIndicator;
+    unsigned int MWConsistencyIndicator;
+    struct PhaseBiasSat {
+      unsigned int ID; /* all */
+      unsigned int NumberOfPhaseBiases;
+      double YawAngle; /* radiant */
+      double YawRate; /* radiant/s */
+      struct PhaseBiasEntry {
+        CodeType Type;
+        unsigned int SignalIntegerIndicator;
+        unsigned int SignalsWideLaneIntegerIndicator;
+        unsigned int SignalDiscontinuityCounter;
+        float Bias; /* m */
+      } Biases[CLOCKORBIT_NUMBIAS];
+    } Sat[CLOCKORBIT_COUNTSAT];
+  };
+
+  struct VTEC {
+    unsigned int EpochTime; /* GPS */
+    unsigned int UpdateInterval;
+    unsigned int SSRIOD;
+    unsigned int SSRProviderID;
+    unsigned int SSRSolutionID;
+    unsigned int NumLayers; /* 1-4 */
+    double Quality;
+    struct IonoLayers {
+      double Height; /* m */
+      unsigned int Degree; /* 1-16 */
+      unsigned int Order;  /* 1-16 */
+      double Sinus[CLOCKORBIT_MAXIONODEGREE][CLOCKORBIT_MAXIONOORDER];
+      double Cosinus[CLOCKORBIT_MAXIONODEGREE][CLOCKORBIT_MAXIONOORDER];
+    } Layers[CLOCKORBIT_NUMIONOLAYERS];
+  };
+
+  /* return size of resulting data or 0 in case of an error */
+  virtual size_t MakeClockOrbit(const struct ClockOrbit *co, CodeType type,
+      int moremessagesfollow, char *buffer, size_t size) = 0;
+  virtual size_t MakeCodeBias(const struct CodeBias *b, CodeBiasType type,
+      int moremessagesfollow, char *buffer, size_t size) = 0;
+  virtual size_t MakePhaseBias(const struct PhaseBias *b, CodeBiasType type,
+      int moremessagesfollow, char *buffer, size_t size) = 0;
+  virtual size_t MakeVTEC(const struct VTEC *b, int moremessagesfollow,
+      char *buffer, size_t size) = 0;
+
+  /* buffer should point to a RTCM3 block */
+  virtual enum GCOB_RETURN GetSSR(struct ClockOrbit *co, struct CodeBias *b,
+      struct VTEC *v, struct PhaseBias *pb, const char *buffer, size_t size,
+      int *bytesused) = 0;
+
+  virtual std::string codeTypeToRnxType(char system, CodeType type) = 0;
+  virtual CodeType    rnxTypeToCodeType(char system, std::string type) = 0;
+
+  static uint32_t CRC24(long size, const unsigned char *buf) {
+    uint32_t crc = 0;
+    int ii;
+    while (size--) {
+      crc ^= (*buf++) << (16);
+      for (ii = 0; ii < 8; ii++)  {
+        crc <<= 1;
+        if (crc & 0x1000000)
+          crc ^= 0x01864cfb;
+      }
+    }
+    return crc;
+  }
+
+//#ifndef NOENCODE
+#define STOREBITS \
+  while(numbits >= 8) { \
+    if(!size) return 0; \
+    *(buffer++) = bitbuffer>>(numbits-8); \
+    numbits -= 8; \
+    ++ressize; \
+    --size; \
+  }
+
+#define ADDBITS(a, b) { \
+    bitbuffer = (bitbuffer<<(a))|((b)&((1<<a)-1)); \
+    numbits += (a); \
+    STOREBITS \
+  }
+
+#define STARTDATA \
+  size_t ressize=0; \
+  char *blockstart; \
+  int numbits; \
+  uint64_t bitbuffer=0;
+
+#define INITBLOCK \
+  numbits = 0; \
+  blockstart = buffer; \
+  ADDBITS(8, 0xD3) \
+  ADDBITS(6, 0) \
+  ADDBITS(10, 0)
+
+#define ENDBLOCK \
+  if(numbits) { ADDBITS((8-numbits), 0) } { \
+    int len = buffer-blockstart-3; \
+    blockstart[1] |= len>>8; \
+    blockstart[2] = len; \
+    if(len > 1023) \
+      return 0; \
+    len = SsrCorr::CRC24(len+3, (const unsigned char *) blockstart); \
+    ADDBITS(24, len) \
+  }
+
+#define SCALEADDBITS(a, b, c) ADDBITS(a, (int64_t)(c > 0 ? b*c+0.5 : b*c-0.5))
+#define MPI         3.141592653589793
+
+/* GNSS macros - Header part */
+#define T_RTCM_MESSAGE_NUMBER(a)         ADDBITS(12, a)      /* DF002         */
+#define T_IGS_SSR_VERSION(a)             ADDBITS( 3, a)      /*        IDF001 */
+#define T_IGS_MESSAGE_NUMBER(a)          ADDBITS( 8, a)      /*        IDF002 */
+#define T_SSR_EPOCH_TIME(a)              ADDBITS(20, a)      /* DF???  IDF003 */ //T_GPS_EPOCH_TIME(a)
+#define T_GLONASS_EPOCH_TIME(a)          ADDBITS(17, a)      /* DF            */
+
+#define T_SSR_UPDATE_INTERVAL(a)         ADDBITS( 4, a)      /* DF391, IDF004 */
+#define T_MULTIPLE_MESSAGE_INDICATOR(a)  ADDBITS( 1, a)      /* DF388, IDF005 */
+#define T_SSR_IOD(a)                     ADDBITS( 4, a)      /* DF413, IDF007 */
+#define T_SSR_PROVIDER_ID(a)             ADDBITS(16, a)      /* DF414, IDF008 */
+#define T_SSR_SOLUTION_ID(a)             ADDBITS( 4, a)      /* DF415, IDF009 */
+#define T_SATELLITE_REFERENCE_DATUM(a)   ADDBITS( 1, a)      /* DF375, IDF006 */
+#define T_NO_OF_SATELLITES(a)            ADDBITS( 6, a)      /* DF387, IDF010 */
+
+/* GNSS macros - Satellite specific part */
+#define T_GNSS_SATELLITE_ID(a)           ADDBITS( 6, a)      /*        IDF011 */
+#define T_GPS_SATELLITE_ID(a)            ADDBITS( 6, a)      /* DF068         */
+#define T_QZSS_SATELLITE_ID(a)           ADDBITS( 4, a)      /* DF249         */
+#define T_GLONASS_SATELLITE_ID(a)        ADDBITS( 5, a)      /* DF            */
+#define T_GNSS_IOD(a)                    ADDBITS( 8, a)      /*        IDF012 */
+#define T_GPS_IODE(a)                    ADDBITS( 8, a)      /* DF071         */
+#define T_GLONASS_IOD(a)                 ADDBITS( 8, a)      /* DF239         */
+#define T_GALILEO_IOD(a)                 ADDBITS(10, a)      /* DF459         */
+#define T_SBAS_T0MOD(a)                  ADDBITS( 9, (a/16)) /* DF468         */
+#define T_SBAS_IODCRC(a)                 ADDBITS(24, a)      /* DF469         */
+#define T_BDS_TOEMOD(a)                  ADDBITS(10, (a/8))  /* DF470         */
+#define T_BDS_IOD(a)                     ADDBITS( 8, a)      /* DF471         */
+
+/* Orbit Corrections */
+#define T_DELTA_RADIAL(a)                SCALEADDBITS(22,    10000.0, a) /* DF365, IDF013 */
+#define T_DELTA_ALONG_TRACK(a)           SCALEADDBITS(20,     2500.0, a) /* DF366, IDF014 */
+#define T_DELTA_CROSS_TRACK(a)           SCALEADDBITS(20,     2500.0, a) /* DF367, IDF015 */
+#define T_DELTA_DOT_RADIAL(a)            SCALEADDBITS(21,  1000000.0, a) /* DF368, IDF016 */
+#define T_DELTA_DOT_ALONG_TRACK(a)       SCALEADDBITS(19,   250000.0, a) /* DF369, IDF017 */
+#define T_DELTA_DOT_CROSS_TRACK(a)       SCALEADDBITS(19,   250000.0, a) /* DF370, IDF018 */
+
+/* Clock Corrections */
+#define T_DELTA_CLOCK_C0(a)              SCALEADDBITS(22,    10000.0, a) /* DF376, IDF019 */
+#define T_DELTA_CLOCK_C1(a)              SCALEADDBITS(21,  1000000.0, a) /* DF377, IDF020 */
+#define T_DELTA_CLOCK_C2(a)              SCALEADDBITS(27, 50000000.0, a) /* DF378, IDF021 */
+#define T_HR_CLOCK_CORRECTION(a)         SCALEADDBITS(22,    10000.0, a) /* DF390, IDF022 */
+
+/* Biases */
+#define T_NO_OF_BIASES(a)                ADDBITS(5, a)                   /* DF, DF       IDF023 */ //_NO_OF_CODE_BIASES(a)T_NO_OF_PHASE_BIASES(a)
+
+#define T_GNSS_SIGNAL_IDENTIFIER(a)      ADDBITS(5, a)                   /* DF       IDF024 */
+#define T_CODE_BIAS(a)                   SCALEADDBITS(14,      100.0, a) /* DF383, IDF025 */
+#define T_YAW_ANGLE(a)                   SCALEADDBITS( 9,  256.0/MPI, a) /* DF480, IDF026 */
+#define T_YAW_RATE(a)                    SCALEADDBITS( 8, 8192.0/MPI, a) /* DF481, IDF027 */
+#define T_PHASE_BIAS(a)                  SCALEADDBITS(20,    10000.0, a) /* DF482, IDF028 */
+
+/* Phase specific part of GNSS phase bias message */
+#define T_INTEGER_INDICATOR(a)           ADDBITS( 1, a)                  /* DF483, IDF029 */
+#define T_WIDE_LANE_INDICATOR(a)         ADDBITS( 2, a)                  /* DF484, IDF030 */
+#define T_DISCONTINUITY_COUNTER(a)       ADDBITS( 4, a)                  /* DF485, IDF031 */
+#define T_DISPERSIVE_BIAS_INDICATOR(a)   ADDBITS( 1, a)                  /* DF486, IDF032 */
+#define T_MW_CONSISTENCY_INDICATOR(a)    ADDBITS( 1, a)                  /* DF487, IDF033 */
+
+/* URA */
+#define T_SSR_URA(a)                     ADDBITS( 6, a)                  /* DF389, IDF034 */
+
+/* Ionosphere */
+#define T_NO_IONO_LAYERS(a)              ADDBITS( 2, a-1)                /* DF472, IDF035 */
+#define T_IONO_HEIGHT(a)                 SCALEADDBITS( 8,  1/10000.0, a) /* DF473, IDF036 */
+#define T_IONO_DEGREE(a)                 ADDBITS( 4, a-1)                /* DF474, IDF037 */
+#define T_IONO_ORDER(a)                  ADDBITS( 4, a-1)                /* DF475, IDF038 */
+#define T_IONO_COEFF_C(a)                SCALEADDBITS(16,      200.0, a) /* DF476, IDF039 */
+#define T_IONO_COEFF_S(a)                SCALEADDBITS(16,      200.0, a) /* DF477, IDF040 */
+#define T_VTEC_QUALITY_INDICATOR(a)      SCALEADDBITS( 9,       20.0, a) /* DF478, IDF041 */
+
+
+static double URAToValue(int ura) {
+  int urac, urav;
+  urac = ura >> 3;
+  urav = ura & 7;
+  if (!ura)
+    return 0;
+  else if (ura == 63)
+    return SSR_MAXURA;
+  return (pow(3, urac) * (1.0 + urav / 4.0) - 1.0) / 1000.0;
+}
+
+static int ValueToURA(double val) {
+  int ura;
+  if (!val)
+    return 0;
+  else if (val > 5.4665)
+    return 63;
+  for (ura = 1; ura < 63 && val > URAToValue(ura); ++ura)
+    ;
+  return ura;
+}
+//#endif /* NOENCODE */
+
+//#ifndef NODECODE
+#define DECODESTART \
+  int numbits=0; \
+  uint64_t bitbuffer=0;
+
+#define LOADSSRBITS(a) { \
+  while((a) > numbits) { \
+    if(!size--) return GCOBR_SHORTMESSAGE; \
+    bitbuffer = (bitbuffer<<8)|((unsigned char)*(buffer++)); \
+    numbits += 8; \
+  } \
+}
+
+/* extract bits from data stream
+ b = variable to store result, a = number of bits */
+#define GETSSRBITS(b, a) { \
+  LOADSSRBITS(a) \
+  b = (bitbuffer<<(64-numbits))>>(64-(a)); \
+  numbits -= (a); \
+}
+
+/* extract bits from data stream
+ b = variable to store result, a = number of bits */
+#define GETSSRBITSFACTOR(b, a, c) { \
+  LOADSSRBITS(a) \
+  b = ((bitbuffer<<(64-numbits))>>(64-(a)))*(c); \
+  numbits -= (a); \
+}
+
+/* extract signed floating value from data stream
+ b = variable to store result, a = number of bits */
+#define GETSSRFLOATSIGN(b, a, c) { \
+  LOADSSRBITS(a) \
+  b = ((double)(((int64_t)(bitbuffer<<(64-numbits)))>>(64-(a))))*(c); \
+  numbits -= (a); \
+}
+
+/* extract floating value from data stream
+ b = variable to store result, a = number of bits, c = scale factor */
+#define GETSSRFLOAT(b, a, c) { \
+  LOADSSRBITS(a) \
+  b = ((double)((bitbuffer<<(sizeof(bitbuffer)*8-numbits))>>(sizeof(bitbuffer)*8-(a))))*(c); \
+  numbits -= (a); \
+}
+
+#define SKIPSSRBITS(b) { LOADSSRBITS(b) numbits -= (b); }
+
+/* GPS macros also used for other systems when matching! */
+#define G_HEADER(a)                      GETSSRBITS(a,  8)
+#define G_RESERVEDH(a)                   GETSSRBITS(a,  6)
+#define G_SIZE(a)                        GETSSRBITS(a, 10)
+
+/* GNSS macros - Header part */
+#define G_RTCM_MESSAGE_NUMBER(a)         GETSSRBITS(a, 12)      /* DF002         */
+
+#define G_IGS_SSR_VERSION(a)             GETSSRBITS(a,  3)      /*        IDF001 */
+#define G_IGS_MESSAGE_NUMBER(a)          GETSSRBITS(a,  8)      /*        IDF002 */
+#define G_SSR_EPOCH_TIME(a)              GETSSRBITS(a, 20)      /*DF      IDF003 */
+#define G_SSR_EPOCH_TIME_CHECK(a, b)     {unsigned int temp; GETSSRBITS(temp, 20) \
+ if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;}
+#define G_GLONASS_EPOCH_TIME(a, b)       {unsigned int temp; GETSSRBITS(temp, 17) \
+ if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;}
+
+#define G_SSR_UPDATE_INTERVAL(a)         GETSSRBITS(a,  4)      /* DF391, IDF004 */
+#define G_MULTIPLE_MESSAGE_INDICATOR(a)  GETSSRBITS(a,  1)      /* DF388, IDF005 */
+#define G_SSR_IOD(a)                     GETSSRBITS(a,  4)      /* DF413, IDF007 */
+#define G_SSR_PROVIDER_ID(a)             GETSSRBITS(a, 16)      /* DF414, IDF008 */
+#define G_SSR_SOLUTION_ID(a)             GETSSRBITS(a,  4)      /* DF415, IDF009 */
+#define G_SATELLITE_REFERENCE_DATUM(a)   GETSSRBITS(a,  1)      /* DF375, IDF006 */
+#define G_NO_OF_SATELLITES(a)            GETSSRBITS(a,  6)      /* DF387, IDF010 */
+
+/* GNSS macros - Satellite specific part */
+#define G_GNSS_SATELLITE_ID(a)           GETSSRBITS(a,  6)     /* DF068,  IDF011 */
+#define G_GLONASS_SATELLITE_ID(a)        GETSSRBITS(a,  5)     /* DF             */
+#define G_QZSS_SATELLITE_ID(a)           GETSSRBITS(a,  4)     /* DF249          */
+
+#define G_GNSS_IOD(a)                    GETSSRBITS(a,  8)     /*DF071, DF237,DF471        IDF012 */
+#define G_GALILEO_IOD(a)                 GETSSRBITS(a, 10)          /* DF459 */
+#define G_SBAS_T0MOD(a)                  GETSSRBITSFACTOR(a, 9, 16) /* DF468 */
+#define G_SBAS_IODCRC(a)                 GETSSRBITS(a, 24)          /* DF469 */
+#define G_BDS_TOEMOD(a)                  GETSSRBITSFACTOR(a, 10, 8) /* DF470 */
+
+/* Orbit Corrections */
+#define G_DELTA_RADIAL(a)                GETSSRFLOATSIGN(a, 22,   1/10000.0)  /* DF365, IDF013 */
+#define G_DELTA_ALONG_TRACK(a)           GETSSRFLOATSIGN(a, 20,    1/2500.0)  /* DF366, IDF014 */
+#define G_DELTA_CROSS_TRACK(a)           GETSSRFLOATSIGN(a, 20,    1/2500.0)  /* DF367, IDF015 */
+#define G_DELTA_DOT_RADIAL(a)            GETSSRFLOATSIGN(a, 21, 1/1000000.0)  /* DF368, IDF016 */
+#define G_DELTA_DOT_ALONG_TRACK(a)       GETSSRFLOATSIGN(a, 19,  1/250000.0)  /* DF369, IDF017 */
+#define G_DELTA_DOT_CROSS_TRACK(a)       GETSSRFLOATSIGN(a, 19,  1/250000.0)  /* DF370, IDF018 */
+
+/* Clock Corrections */
+#define G_DELTA_CLOCK_C0(a)              GETSSRFLOATSIGN(a, 22,    1/10000.0) /* DF376, IDF019 */
+#define G_DELTA_CLOCK_C1(a)              GETSSRFLOATSIGN(a, 21,  1/1000000.0) /* DF377, IDF020 */
+#define G_DELTA_CLOCK_C2(a)              GETSSRFLOATSIGN(a, 27, 1/50000000.0) /* DF378, IDF021 */
+#define G_HR_CLOCK_CORRECTION(a)         GETSSRFLOATSIGN(a, 22,    1/10000.0) /* DF390, IDF022 */
+
+/* Biases */
+#define G_NO_OF_BIASES(a)                GETSSRBITS(a,  5)                    /* DF, DF       IDF023 */
+#define G_GNSS_SIGNAL_IDENTIFIER(a)      GETSSRBITS(a,  5)                    /* DF     IDF024 */
+#define G_CODE_BIAS(a)                   GETSSRFLOATSIGN(a, 14, 1/100.0)      /* DF383, IDF025 */
+#define G_YAW_ANGLE(a)                   GETSSRFLOAT    (a,  9, MPI/256.0)    /* DF480, IDF026 */
+#define G_YAW_RATE(a)                    GETSSRFLOATSIGN(a,  8, MPI/8192.0)   /* DF481, IDF027 */
+#define G_PHASE_BIAS(a)                  GETSSRFLOATSIGN(a, 20, 1/10000.)     /* DF482, IDF028 */
+
+/* Phase specific part of GNSS phase bias message */
+#define G_INTEGER_INDICATOR(a)           GETSSRBITS(a,  1)                    /* DF483, IDF029 */
+#define G_WIDE_LANE_INDICATOR(a)         GETSSRBITS(a,  2)                    /* DF484, IDF030 */
+#define G_DISCONTINUITY_COUNTER(a)       GETSSRBITS(a,  4)                    /* DF485, IDF031 */
+#define G_DISPERSIVE_BIAS_INDICATOR(a)   GETSSRBITS(a,  1)                    /* DF486, IDF032 */
+#define G_MW_CONSISTENCY_INDICATOR(a)    GETSSRBITS(a,  1)                    /* DF487, IDF033 */
+
+/* URA */
+#define G_SSR_URA(a)                     {int temp; GETSSRBITS(temp, 6) \
+ (a) = URAToValue(temp);}                                                  /* DF389, IDF034 */
+
+/* Ionosphere */
+#define G_NO_IONO_LAYERS(a) {unsigned int temp; GETSSRBITS(temp, 2) a = temp+1;} /* DF472, IDF035 */
+#define G_IONO_HEIGHT(a)                 GETSSRFLOAT(a, 8 ,    10000.0)          /* DF473, IDF036 */
+#define G_IONO_DEGREE(a)    {unsigned int temp; GETSSRBITS(temp, 4) a = temp+1;} /* DF474, IDF037 */
+#define G_IONO_ORDER(a)     {unsigned int temp; GETSSRBITS(temp, 4) a = temp+1;} /* DF475, IDF038 */
+#define G_IONO_COEFF_C(a)                GETSSRFLOATSIGN(a, 16,1/200.0)          /* DF476, IDF039 */
+#define G_IONO_COEFF_S(a)                GETSSRFLOATSIGN(a, 16,1/200.0)          /* DF477, IDF040 */
+#define G_VTEC_QUALITY_INDICATOR(a)      GETSSRFLOAT     (a, 9, 1/20.0)          /* DF478, IDF041 */
+
+//#endif /* NODECODE */
+
+};
+
+#endif /* RTCM3_CLOCK_ORBIT_H */
Index: unk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_igs.c
===================================================================
--- /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_igs.c	(revision 9024)
+++ 	(revision )
@@ -1,989 +1,0 @@
-/* Programheader
-
- Name:           clock_orbit_igs.c
- Project:        RTCM3
- Version:        $Id: clock_orbit_igs.c 8963 2020-06-29 12:46:25Z stuerze $
- Authors:        Dirk Stöcker, Andrea Stürze
- Description:    state space approach: IGS
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef sparc
-#include <stdint.h>
-#else
-#include <sys/types.h>
-#endif
-#include <clock_orbit_igs.h>
-
-static uint32_t CRC24(long size, const unsigned char *buf) {
-  uint32_t crc = 0;
-  int i;
-
-  while (size--) {
-    crc ^= (*buf++) << (16);
-    for (i = 0; i < 8; i++)
-        {
-      crc <<= 1;
-      if (crc & 0x1000000)
-        crc ^= 0x01864cfb;
-    }
-  }
-  return crc;
-}
-
-/* NOTE: These defines are interlinked with below functions and directly modify
- the values. This may not be optimized in terms of final program code size but
- should be optimized in terms of speed.
-
- modified variables are:
- - everything defined in STARTDATA (only use ressize outside of the defines,
- others are private)
- - buffer
- - size
- */
-
-#ifndef NOENCODE
-#define STOREBITS \
-  while(numbits >= 8) { \
-    if(!size) return 0; \
-    *(buffer++) = bitbuffer>>(numbits-8); \
-    numbits -= 8; \
-    ++ressize; \
-    --size; \
-  }
-
-#define ADDBITS(a, b) { \
-    bitbuffer = (bitbuffer<<(a))|((b)&((1<<a)-1)); \
-    numbits += (a); \
-    STOREBITS \
-  }
-
-#define STARTDATA \
-  size_t ressize=0; \
-  char *blockstart; \
-  int numbits; \
-  uint64_t bitbuffer=0;
-
-#define INITBLOCK \
-  numbits = 0; \
-  blockstart = buffer; \
-  ADDBITS(8, 0xD3) \
-  ADDBITS(6, 0) \
-  ADDBITS(10, 0)
-
-#define ENDBLOCK \
-  if(numbits) { ADDBITS((8-numbits), 0) } { \
-    int len = buffer-blockstart-3; \
-    blockstart[1] |= len>>8; \
-    blockstart[2] = len; \
-    if(len > 1023) \
-      return 0; \
-    len = CRC24(len+3, (const unsigned char *) blockstart); \
-    ADDBITS(24, len) \
-  }
-
-#define SCALEADDBITS(a, b, c) ADDBITS(a, (int64_t)(c > 0 ? b*c+0.5 : b*c-0.5))
-
-#define MPI         3.141592653589793
-
-/* GNSS macros - Header part */
-#define T_RTCM_MESSAGE_NUMBER(a)         ADDBITS(12, a)      /* DF002         */
-#define T_IGS_SSR_VERSION(a)             ADDBITS( 3, a)      /*        IDF001 */
-#define T_IGS_MESSAGE_NUMBER(a)          ADDBITS( 8, a)      /*        IDF002 */
-#define T_SSR_EPOCH_TIME(a)              ADDBITS(20, a)      /*        IDF003 */
-#define T_SSR_UPDATE_INTERVAL(a)         ADDBITS( 4, a)      /* DF391, IDF004 */
-#define T_MULTIPLE_MESSAGE_INDICATOR(a)  ADDBITS( 1, a)      /* DF388, IDF005 */
-#define T_SSR_IOD(a)                     ADDBITS( 4, a)      /* DF413, IDF007 */
-#define T_SSR_PROVIDER_ID(a)             ADDBITS(16, a)      /* DF414, IDF008 */
-#define T_SSR_SOLUTION_ID(a)             ADDBITS( 4, a)      /* DF415, IDF009 */
-#define T_SATELLITE_REFERENCE_DATUM(a)   ADDBITS( 1, a)      /* DF375, IDF006 */
-#define T_NO_OF_SATELLITES(a)            ADDBITS( 6, a)      /* DF387, IDF010 */
-
-/* GNSS macros - Satellite specific part */
-#define T_GNSS_SATELLITE_ID(a)           ADDBITS( 6, a)      /*        IDF011 */
-#define T_GNSS_IOD(a)                    ADDBITS( 8, a)      /*        IDF012 */
-#define T_DELTA_RADIAL(a)                SCALEADDBITS(22,    10000.0, a) /* DF365, IDF013 */
-#define T_DELTA_ALONG_TRACK(a)           SCALEADDBITS(20,     2500.0, a) /* DF366, IDF014 */
-#define T_DELTA_CROSS_TRACK(a)           SCALEADDBITS(20,     2500.0, a) /* DF367, IDF015 */
-#define T_DELTA_DOT_RADIAL(a)            SCALEADDBITS(21,  1000000.0, a) /* DF368, IDF016 */
-#define T_DELTA_DOT_ALONG_TRACK(a)       SCALEADDBITS(19,   250000.0, a) /* DF369, IDF017 */
-#define T_DELTA_DOT_CROSS_TRACK(a)       SCALEADDBITS(19,   250000.0, a) /* DF370, IDF018 */
-
-#define T_DELTA_CLOCK_C0(a)              SCALEADDBITS(22,    10000.0, a) /* DF376, IDF019 */
-#define T_DELTA_CLOCK_C1(a)              SCALEADDBITS(21,  1000000.0, a) /* DF377, IDF020 */
-#define T_DELTA_CLOCK_C2(a)              SCALEADDBITS(27, 50000000.0, a) /* DF378, IDF021 */
-#define T_HR_CLOCK_CORRECTION(a)         SCALEADDBITS(22,    10000.0, a) /* DF390, IDF022 */
-
-#define T_NO_OF_BIASES(a)                ADDBITS(5, a)                   /*        IDF023 */
-#define T_GNSS_SIGNAL_IDENTIFIER(a)      ADDBITS(5, a)                   /*        IDF024 */
-#define T_CODE_BIAS(a)                   SCALEADDBITS(14,      100.0, a) /* DF383, IDF025 */
-#define T_YAW_ANGLE(a)                   SCALEADDBITS( 9,  256.0/MPI, a) /* DF480, IDF026 */
-#define T_YAW_RATE(a)                    SCALEADDBITS( 8, 8192.0/MPI, a) /* DF481, IDF027 */
-#define T_PHASE_BIAS(a)                  SCALEADDBITS(20,    10000.0, a) /* DF482, IDF028 */
-
-/* Phase specific part of GNSS phase bias message */
-#define T_INTEGER_INDICATOR(a)           ADDBITS( 1, a)                  /* DF483, IDF029 */
-#define T_WIDE_LANE_INDICATOR(a)         ADDBITS( 2, a)                  /* DF484, IDF030 */
-#define T_DISCONTINUITY_COUNTER(a)       ADDBITS( 4, a)                  /* DF485, IDF031 */
-#define T_DISPERSIVE_BIAS_INDICATOR(a)   ADDBITS( 1, a)                  /* DF486, IDF032 */
-#define T_MW_CONSISTENCY_INDICATOR(a)    ADDBITS( 1, a)                  /* DF487, IDF033 */
-
-/* URA */
-#define T_SSR_URA(a)                     ADDBITS( 6, a)                  /* DF389, IDF034 */
-
-/* Ionosphere */
-#define T_NO_IONO_LAYERS(a)              ADDBITS( 2, a-1)                /* DF472, IDF035 */
-#define T_IONO_HEIGHT(a)                 SCALEADDBITS( 8,  1/10000.0, a) /* DF473, IDF036 */
-#define T_IONO_DEGREE(a)                 ADDBITS( 4, a-1)                /* DF474, IDF037 */
-#define T_IONO_ORDER(a)                  ADDBITS( 4, a-1)                /* DF475, IDF038 */
-#define T_IONO_COEFF_C(a)                SCALEADDBITS(16,      200.0, a) /* DF476, IDF039 */
-#define T_IONO_COEFF_S(a)                SCALEADDBITS(16,      200.0, a) /* DF477, IDF040 */
-#define T_VTEC_QUALITY_INDICATOR(a)      SCALEADDBITS( 9,       20.0, a) /* DF478, IDF041 */
-
-static double URAToValue(int ura) {
-  int urac, urav;
-  urac = ura >> 3;
-  urav = ura & 7;
-  if (!ura)
-    return 0;
-  else if (ura == 63)
-    return SSR_MAXURA;
-  return (pow(3, urac) * (1.0 + urav / 4.0) - 1.0) / 1000.0;
-}
-
-static int ValueToURA(double val) {
-  int ura;
-  if (!val)
-    return 0;
-  else if (val > 5.4665)
-    return 63;
-  for (ura = 1; ura < 63 && val > URAToValue(ura); ++ura)
-    ;
-  return ura;
-}
-
-static const enum ClockOrbitType corbase[CLOCKORBIT_SATNUM] = {
-  (int) COBBASE_GPS,
-  (int) COBBASE_GLONASS,
-  (int) COBBASE_GALILEO,
-  (int) COBBASE_QZSS,
-  (int) COBBASE_SBAS,
-  (int) COBBASE_BDS
-};
-
-static const enum COR_OFFSETS satoffset[CLOCKORBIT_SATNUM + 1] = {
-  CLOCKORBIT_OFFSETGPS,
-  CLOCKORBIT_OFFSETGLONASS,
-  CLOCKORBIT_OFFSETGALILEO,
-  CLOCKORBIT_OFFSETQZSS,
-  CLOCKORBIT_OFFSETSBAS,
-  CLOCKORBIT_OFFSETBDS,
-  CLOCKORBIT_COUNTSAT
-};
-
-size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
-    int moremessagesfollow, char *buffer, size_t size) {
-  unsigned int status[CLOCKORBIT_SATNUM][COBOFS_NUM], i, s;
-
-  memset(status, 0, sizeof(status));
-
-  STARTDATA
-
-  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
-    for (i = 0; i < COBOFS_NUM; ++i) {
-      if (co->NumberOfSat[s] && (type == COTYPE_AUTO || type == corbase[s] + i) &&
-           (co->Supplied[i] || (i <= COBOFS_CLOCK &&  co->Supplied[COBOFS_COMBINED]) ||
-           (i == COBOFS_COMBINED && co->Supplied[COBOFS_ORBIT] && co->Supplied[COBOFS_CLOCK]))) {
-        status[s][i] = 1;
-        if (i == COBOFS_COMBINED) {
-          status[s][COBOFS_ORBIT] = status[s][COBOFS_CLOCK] = 0;
-        } /* disable single blocks for combined type */
-      } /* check for data */
-    } /* iterate over sub-types */
-  } /* iterate over satellite systems */
-
-  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
-    if (status[s][COBOFS_ORBIT]) {
-      INITBLOCK
-	  T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
-      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
-	  T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_ORBIT)
-	  T_SSR_EPOCH_TIME(co->EpochTime[s])
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-	  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-	  T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
-        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
-        T_GNSS_IOD(co->Sat[i].IOD)
-        T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
-        T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
-        T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
-        T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
-        T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
-        T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
-      }
-      ENDBLOCK
-    }
-    if (status[s][COBOFS_CLOCK]) {
-      INITBLOCK
-	  T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
-      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
-	  T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_CLOCK)
-	  T_SSR_EPOCH_TIME(co->EpochTime[s])
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-	  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
-        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
-        T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
-        T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
-        T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
-      }
-      ENDBLOCK
-    }
-    if (status[s][COBOFS_COMBINED]) {
-#ifdef SPLITBLOCK
-      int nums = co->NumberOfSat[s];
-      int left, start = satoffset[s];
-      if(nums > 28) {/* split block when more than 28 sats */
-        left = nums - 28;
-        nums = 28;
-      }
-      else {
-        left = 0;
-      }
-      while(nums) {
-#endif
-      INITBLOCK
-	  T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
-      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
-	  T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_COMBINED)
-	  T_SSR_EPOCH_TIME(co->EpochTime[s])
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-#ifdef SPLITBLOCK
-      T_MULTIPLE_MESSAGE_INDICATOR((moremessagesfollow || left) ? 1 : 0)
-#else
-      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-#endif
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-	  T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
-#ifdef SPLITBLOCK
-      T_NO_OF_SATELLITES(nums)
-      for(i = start; i < start+nums; ++i) {
-#else
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
-#endif
-        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
-        T_GNSS_IOD(co->Sat[i].IOD)
-        T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
-        T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
-        T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
-        T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
-        T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
-        T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
-        T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
-        T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
-        T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
-      }
-      ENDBLOCK
-#ifdef SPLITBLOCK
-      start += nums;
-      nums = left;
-      left = 0;
-    }
-#endif
-    }
-    if (status[s][COBOFS_HR]) {
-      INITBLOCK
-	  T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
-      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
-	  T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_HR)
-	  T_SSR_EPOCH_TIME(co->EpochTime[s])
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-	  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
-        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
-        T_HR_CLOCK_CORRECTION(co->Sat[i].hrclock)
-      }
-      ENDBLOCK
-    }
-    if (status[s][COBOFS_URA]) {
-      INITBLOCK
-	  T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
-      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
-	  T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_URA)
-	  T_SSR_EPOCH_TIME(co->EpochTime[s])
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-	  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
-        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
-        T_SSR_URA(ValueToURA(co->Sat[i].UserRangeAccuracy))
-      }
-      ENDBLOCK
-    }
-  }
-  return ressize;
-}
-
-size_t MakeCodeBias(const struct CodeBias *b, enum CodeBiasType type,
-    int moremessagesfollow, char *buffer, size_t size) {
-  unsigned int s, i, j;
-
-  STARTDATA
-
-  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
-    if (b->NumberOfSat[s] && (type == CBTYPE_AUTO || type == corbase[s] + COBOFS_CBIAS)) {
-      INITBLOCK
-	  T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
-      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
-	  T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_CBIAS)
-	  T_SSR_EPOCH_TIME(b->EpochTime[s])
-      T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
-	  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(b->SSRIOD)
-      T_SSR_PROVIDER_ID(b->SSRProviderID)
-      T_SSR_SOLUTION_ID(b->SSRSolutionID)
-      T_NO_OF_SATELLITES(b->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
-        T_GNSS_SATELLITE_ID(b->Sat[i].ID)
-        T_NO_OF_BIASES(b->Sat[i].NumberOfCodeBiases)
-        for (j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j) {
-          T_GNSS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
-          T_CODE_BIAS(b->Sat[i].Biases[j].Bias)
-        }
-      }
-      ENDBLOCK
-    }
-  }
-  return ressize;
-}
-
-size_t MakePhaseBias(const struct PhaseBias *b, enum PhaseBiasType type,
-    int moremessagesfollow, char *buffer, size_t size) {
-  unsigned int s, i, j;
-
-  STARTDATA
-
-  for (s = 0; s < CLOCKORBIT_SATNUM; ++s)       {
-    if (b->NumberOfSat[s] && (type == PBTYPE_AUTO || type == corbase[s] + COBOFS_PBIAS)) {
-      INITBLOCK
-	  T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
-      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
-	  T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_PBIAS)
-	  T_SSR_EPOCH_TIME(b->EpochTime[s])
-      T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
-	  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(b->SSRIOD)
-      T_SSR_PROVIDER_ID(b->SSRProviderID)
-      T_SSR_SOLUTION_ID(b->SSRSolutionID)
-      T_DISPERSIVE_BIAS_INDICATOR(b->DispersiveBiasConsistencyIndicator ? 1 : 0)
-      T_MW_CONSISTENCY_INDICATOR(b->MWConsistencyIndicator ? 1 : 0)
-      T_NO_OF_SATELLITES(b->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
-        T_GNSS_SATELLITE_ID(b->Sat[i].ID)
-        T_NO_OF_BIASES(b->Sat[i].NumberOfPhaseBiases)
-        T_YAW_ANGLE(b->Sat[i].YawAngle)
-        T_YAW_RATE(b->Sat[i].YawRate)
-        for (j = 0; j < b->Sat[i].NumberOfPhaseBiases; ++j) {
-          T_GNSS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
-          T_INTEGER_INDICATOR(b->Sat[i].Biases[j].SignalIntegerIndicator ? 1 : 0)
-          T_WIDE_LANE_INDICATOR(b->Sat[i].Biases[j].SignalsWideLaneIntegerIndicator)
-          T_DISCONTINUITY_COUNTER(b->Sat[i].Biases[j].SignalDiscontinuityCounter)
-          T_PHASE_BIAS(b->Sat[i].Biases[j].Bias)
-        }
-      }
-      ENDBLOCK
-    }
-  }
-  return ressize;
-}
-
-size_t MakeVTEC(const struct VTEC *v, int moremessagesfollow, char *buffer, size_t size) {
-  unsigned int l, o, d;
-
-  STARTDATA
-    INITBLOCK
-
-  T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
-  T_IGS_SSR_VERSION(IGS_SSR_VERSION)
-  T_IGS_MESSAGE_NUMBER(VTEC_BASE)
-  T_SSR_EPOCH_TIME(v->EpochTime)
-  T_SSR_UPDATE_INTERVAL(v->UpdateInterval)
-  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-  T_SSR_IOD(v->SSRIOD)
-  T_SSR_PROVIDER_ID(v->SSRProviderID)
-  T_SSR_SOLUTION_ID(v->SSRSolutionID)
-  T_VTEC_QUALITY_INDICATOR(v->Quality)
-  T_NO_IONO_LAYERS(v->NumLayers)
-  for (l = 0; l < v->NumLayers; ++l) {
-    T_IONO_HEIGHT(v->Layers[l].Height)
-    T_IONO_DEGREE(v->Layers[l].Degree)
-    T_IONO_ORDER(v->Layers[l].Order)
-    for (o = 0; o <= v->Layers[l].Order; ++o) {
-      for (d = o; d <= v->Layers[l].Degree; ++d) {
-        T_IONO_COEFF_C(v->Layers[l].Cosinus[d][o])
-      }
-    }
-    for (o = 1; o <= v->Layers[l].Order; ++o) {
-      for (d = o; d <= v->Layers[l].Degree; ++d) {
-        T_IONO_COEFF_S(v->Layers[l].Sinus[d][o])
-      }
-    }
-  }
-  ENDBLOCK
-  return ressize;
-}
-#endif /* NOENCODE */
-
-#ifndef NODECODE
-
-#define DECODESTART \
-  int numbits=0; \
-  uint64_t bitbuffer=0;
-
-#define LOADBITS(a) { \
-  while((a) > numbits) { \
-    if(!size--) return GCOBR_SHORTMESSAGE; \
-    bitbuffer = (bitbuffer<<8)|((unsigned char)*(buffer++)); \
-    numbits += 8; \
-  } \
-}
-
-/* extract bits from data stream
- b = variable to store result, a = number of bits */
-#define GETBITS(b, a) { \
-  LOADBITS(a) \
-  b = (bitbuffer<<(64-numbits))>>(64-(a)); \
-  numbits -= (a); \
-}
-
-/* extract bits from data stream
- b = variable to store result, a = number of bits */
-#define GETBITSFACTOR(b, a, c) { \
-  LOADBITS(a) \
-  b = ((bitbuffer<<(64-numbits))>>(64-(a)))*(c); \
-  numbits -= (a); \
-}
-
-/* extract signed floating value from data stream
- b = variable to store result, a = number of bits */
-#define GETFLOATSIGN(b, a, c) { \
-  LOADBITS(a) \
-  b = ((double)(((int64_t)(bitbuffer<<(64-numbits)))>>(64-(a))))*(c); \
-  numbits -= (a); \
-}
-
-/* extract floating value from data stream
- b = variable to store result, a = number of bits, c = scale factor */
-#define GETFLOAT(b, a, c) { \
-  LOADBITS(a) \
-  b = ((double)((bitbuffer<<(sizeof(bitbuffer)*8-numbits))>>(sizeof(bitbuffer)*8-(a))))*(c); \
-  numbits -= (a); \
-}
-
-#define SKIPBITS(b) { LOADBITS(b) numbits -= (b); }
-
-/* GPS macros also used for other systems when matching! */
-#define G_HEADER(a)                      GETBITS(a,  8)
-#define G_RESERVEDH(a)                   GETBITS(a,  6)
-#define G_SIZE(a)                        GETBITS(a, 10)
-
-/* GNSS macros - Header part */
-#define G_RTCM_MESSAGE_NUMBER(a)         GETBITS(a, 12)      /* DF002         */
-#define G_IGS_SSR_VERSION(a)             GETBITS(a,  3)      /*        IDF001 */
-#define G_IGS_MESSAGE_NUMBER(a)          GETBITS(a,  8)      /*        IDF002 */
-#define G_SSR_EPOCH_TIME(a)              GETBITS(a, 20)      /*        IDF003 */
-#define G_SSR_EPOCH_TIME_CHECK(a, b)         {unsigned int temp; GETBITS(temp, 20) \
- if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;}
-#define G_SSR_UPDATE_INTERVAL(a)         GETBITS(a,  4)      /* DF391, IDF004 */
-#define G_MULTIPLE_MESSAGE_INDICATOR(a)  GETBITS(a,  1)      /* DF388, IDF005 */
-#define G_SSR_IOD(a)                     GETBITS(a,  4)      /* DF413, IDF007 */
-#define G_SSR_PROVIDER_ID(a)             GETBITS(a, 16)      /* DF414, IDF008 */
-#define G_SSR_SOLUTION_ID(a)             GETBITS(a,  4)      /* DF415, IDF009 */
-#define G_SATELLITE_REFERENCE_DATUM(a)   GETBITS(a,  1)      /* DF375, IDF006 */
-#define G_NO_OF_SATELLITES(a)            GETBITS(a,  6)      /* DF387, IDF010 */
-
-/* GNSS macros - Satellite specific part */
-#define G_GNSS_SATELLITE_ID(a)           GETBITS(a,  6)                    /*        IDF011 */
-#define G_GNSS_IOD(a)                    GETBITS(a,  8)                    /*        IDF012 */
-
-#define G_DELTA_RADIAL(a)                GETFLOATSIGN(a, 22,   1/10000.0)  /* DF365, IDF013 */
-#define G_DELTA_ALONG_TRACK(a)           GETFLOATSIGN(a, 20,    1/2500.0)  /* DF366, IDF014 */
-#define G_DELTA_CROSS_TRACK(a)           GETFLOATSIGN(a, 20,    1/2500.0)  /* DF367, IDF015 */
-#define G_DELTA_DOT_RADIAL(a)            GETFLOATSIGN(a, 21, 1/1000000.0)  /* DF368, IDF016 */
-#define G_DELTA_DOT_ALONG_TRACK(a)       GETFLOATSIGN(a, 19,  1/250000.0)  /* DF369, IDF017 */
-#define G_DELTA_DOT_CROSS_TRACK(a)       GETFLOATSIGN(a, 19,  1/250000.0)  /* DF370, IDF018 */
-
-#define G_DELTA_CLOCK_C0(a)              GETFLOATSIGN(a, 22,    1/10000.0) /* DF376, IDF019 */
-#define G_DELTA_CLOCK_C1(a)              GETFLOATSIGN(a, 21,  1/1000000.0) /* DF377, IDF020 */
-#define G_DELTA_CLOCK_C2(a)              GETFLOATSIGN(a, 27, 1/50000000.0) /* DF378, IDF021 */
-#define G_HR_CLOCK_CORRECTION(a)         GETFLOATSIGN(a, 22,    1/10000.0) /* DF390, IDF022 */
-
-#define G_NO_OF_BIASES(a)                GETBITS(a,  5)                    /*        IDF023 */
-#define G_GNSS_SIGNAL_IDENTIFIER(a)      GETBITS(a,  5)                    /*        IDF024 */
-#define G_CODE_BIAS(a)                   GETFLOATSIGN(a, 14, 1/100.0)      /* DF383, IDF025 */
-#define G_YAW_ANGLE(a)                   GETFLOAT    (a,  9, MPI/256.0)    /* DF480, IDF026 */
-#define G_YAW_RATE(a)                    GETFLOATSIGN(a,  8, MPI/8192.0)   /* DF481, IDF027 */
-#define G_PHASE_BIAS(a)                  GETFLOATSIGN(a, 20, 1/10000.)     /* DF482, IDF028 */
-
-/* Phase specific part of GNSS phase bias message */
-#define G_INTEGER_INDICATOR(a)           GETBITS(a,  1)                    /* DF483, IDF029 */
-#define G_WIDE_LANE_INDICATOR(a)         GETBITS(a,  2)                    /* DF484, IDF030 */
-#define G_DISCONTINUITY_COUNTER(a)       GETBITS(a,  4)                    /* DF485, IDF031 */
-#define G_DISPERSIVE_BIAS_INDICATOR(a)   GETBITS(a,  1)                    /* DF486, IDF032 */
-#define G_MW_CONSISTENCY_INDICATOR(a)    GETBITS(a,  1)                    /* DF487, IDF033 */
-
-/* URA */
-#define G_SSR_URA(a)                     {int temp; GETBITS(temp, 6) \
- (a) = URAToValue(temp);}                                                  /* DF389, IDF034 */
-
-/* Ionosphere */
-#define G_NO_IONO_LAYERS(a) {unsigned int temp; GETBITS(temp, 2) a = temp+1;} /* DF472, IDF035 */
-#define G_IONO_HEIGHT(a)                 GETFLOAT(a, 8 ,    10000.0)          /* DF473, IDF036 */
-#define G_IONO_DEGREE(a)    {unsigned int temp; GETBITS(temp, 4) a = temp+1;} /* DF474, IDF037 */
-#define G_IONO_ORDER(a)     {unsigned int temp; GETBITS(temp, 4) a = temp+1;} /* DF475, IDF038 */
-#define G_IONO_COEFF_C(a)                GETFLOATSIGN(a, 16,1/200.0)          /* DF476, IDF039 */
-#define G_IONO_COEFF_S(a)                GETFLOATSIGN(a, 16,1/200.0)          /* DF477, IDF040 */
-#define G_VTEC_QUALITY_INDICATOR(a)      GETFLOAT     (a, 9, 1/20.0)          /* DF478, IDF041 */
-
-enum GCOB_RETURN GetSSR(struct ClockOrbit *co, struct CodeBias *b,struct VTEC *v,
-    struct PhaseBias *pb, const char *buffer, size_t size, int *bytesused) {
-  int mmi = 0, h, rs;
-  unsigned int type, pos, i, j, s, nums, id, version;
-  size_t sizeofrtcmblock;
-  const char *blockstart = buffer;
-  DECODESTART
-
-  if (size < 7)
-    return GCOBR_SHORTBUFFER;
-
-#ifdef BNC_DEBUG
-  fprintf(stderr, "GetSSR START: size %d, numbits %d\n",(int)size, numbits);
-#endif
-
-  G_HEADER(h)
-  G_RESERVEDH(rs)
-  G_SIZE(sizeofrtcmblock);
-
-  if ((unsigned char) h != 0xD3 || rs)
-    return GCOBR_UNKNOWNDATA;
-  if (size < sizeofrtcmblock + 3) /* 3 header bytes already removed */
-    return GCOBR_MESSAGEEXCEEDSBUFFER;
-  if (CRC24(sizeofrtcmblock + 3, (const unsigned char *) blockstart) !=
-      (uint32_t) ((((unsigned char) buffer[sizeofrtcmblock]) << 16) |
-          (((unsigned char) buffer[sizeofrtcmblock + 1]) << 8) |
-          (((unsigned char) buffer[sizeofrtcmblock + 2]))))
-    return GCOBR_CRCMISMATCH;
-  size = sizeofrtcmblock; /* reduce size, so overflows are detected */
-
-  G_RTCM_MESSAGE_NUMBER(type)
-  G_IGS_SSR_VERSION(version)
-#ifdef BNC_DEBUG
-  fprintf(stderr, "rtcmType %d igsVersion %d ",type, version);
-#endif
-  G_IGS_MESSAGE_NUMBER(type)
-#ifdef BNC_DEBUG
-  fprintf(stderr, "igsType IM%d size %d\n",type,(int)sizeofrtcmblock);
-#endif
-  if (bytesused)
-    *bytesused = sizeofrtcmblock + 6;
-
-  if (type == VTEC_BASE) {
-    unsigned int l, o, d;
-    if (!v)
-      return GCOBR_NOVTECPARAMETER;
-    memset(v, 0, sizeof(*v));
-    G_SSR_EPOCH_TIME(v->EpochTime)
-    G_SSR_UPDATE_INTERVAL(v->UpdateInterval)
-    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-    G_SSR_IOD(v->SSRIOD)
-    G_SSR_PROVIDER_ID(v->SSRProviderID)
-    G_SSR_SOLUTION_ID(v->SSRSolutionID)
-    G_VTEC_QUALITY_INDICATOR(v->Quality)
-    G_NO_IONO_LAYERS(v->NumLayers)
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d ssrIod %d providerId %d solId %d vtecQ %8.3f numLay %d \n",
-        		  v->EpochTime, v->UpdateInterval, mmi,
-				  v->SSRIOD, v->SSRProviderID, v->SSRSolutionID, v->Quality, v->NumLayers);
-#endif
-    for (l = 0; l < v->NumLayers; ++l) {
-      G_IONO_HEIGHT(v->Layers[l].Height)
-      G_IONO_DEGREE(v->Layers[l].Degree)
-      G_IONO_ORDER(v->Layers[l].Order)
-#ifdef BNC_DEBUG
-          fprintf(stderr, "h  %8.3f deg %d ord %d \n",
-        		  v->Layers[l].Height, v->Layers[l].Degree, v->Layers[l].Order);
-#endif
-      for (o = 0; o <= v->Layers[l].Order; ++o) {
-        for (d = o; d <= v->Layers[l].Degree; ++d) {
-          G_IONO_COEFF_C(v->Layers[l].Cosinus[d][o])
-#ifdef BNC_DEBUG
-          fprintf(stderr, "C[%02d][%02d]  %8.3f \n",
-        		  d, o, v->Layers[l].Cosinus[d][o]);
-#endif
-        }
-      }
-      for (o = 1; o <= v->Layers[l].Order; ++o) {
-        for (d = o; d <= v->Layers[l].Degree; ++d) {
-          G_IONO_COEFF_S(v->Layers[l].Sinus[d][o])
-#ifdef BNC_DEBUG
-          fprintf(stderr, "S[%02d][%02d]  %8.3f \n",
-        		  d, o, v->Layers[l].Sinus[d][o]);
-#endif
-        }
-      }
-    }
-#ifdef BNC_DEBUG
-    for(type = 0; type < (unsigned int)size && (unsigned char)buffer[type] != 0xD3; ++type)
-    numbits += 8;
-    fprintf(stderr, "numbits left %d\n",numbits);
-#endif
-    return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
-  }
-  for (s = CLOCKORBIT_SATNUM; s-- > 0;) {
-    if (type >= corbase[s]) {
-      switch (type - corbase[s]) {
-        case COBOFS_ORBIT:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_ORBIT] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            G_GNSS_SATELLITE_ID(id)
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-            G_GNSS_IOD(co->Sat[pos].IOD)
-            G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
-            G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
-            G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
-            G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
-            G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
-            G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d iod %3d dr %8.4f da %8.4f dc %8.4f dr %8.3f da %8.3f dc %8.3f\n",
-                co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
-                co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
-                co->Sat[pos].Orbit.DotDeltaRadial,
-                co->Sat[pos].Orbit.DotDeltaAlongTrack,
-                co->Sat[pos].Orbit.DotDeltaCrossTrack);
-#endif
-          }
-          break;
-        case COBOFS_CLOCK:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_CLOCK] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            G_GNSS_SATELLITE_ID(id)
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-            G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
-            G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
-            G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d c0 %8.3f c1 %8.3f c2 %8.3f\n",
-                co->Sat[pos].ID, co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1,
-                co->Sat[pos].Clock.DeltaA2);
-#endif
-          }
-          break;
-        case COBOFS_COMBINED:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_ORBIT] |= 1;
-          co->Supplied[COBOFS_CLOCK] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            G_GNSS_SATELLITE_ID(id)
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-            G_GNSS_IOD(co->Sat[pos].IOD)
-            G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
-            G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
-            G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
-            G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
-            G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
-            G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
-            G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
-            G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
-            G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d iod %3d dr %10.6f da %10.6f dc %10.6f dr %10.6f da %10.6f dc %10.6f  c0 %10.6f c1 %10.6f c2 %10.6f\n",
-                co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
-                co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
-                co->Sat[pos].Orbit.DotDeltaRadial, co->Sat[pos].Orbit.DotDeltaAlongTrack,
-                co->Sat[pos].Orbit.DotDeltaCrossTrack,
-				co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1, co->Sat[pos].Clock.DeltaA2);
-#endif
-          }
-          break;
-        case COBOFS_URA:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_URA] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            G_GNSS_SATELLITE_ID(id)
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-            G_SSR_URA(co->Sat[pos].UserRangeAccuracy)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d ura %8.3f \n",
-                co->Sat[pos].ID, co->Sat[pos].UserRangeAccuracy);
-#endif
-          }
-          break;
-        case COBOFS_HR:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_HR] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            G_GNSS_SATELLITE_ID(id)
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-            G_HR_CLOCK_CORRECTION(co->Sat[pos].hrclock)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d hrClock %8.3f \n",
-                    co->Sat[pos].ID, co->Sat[pos].hrclock);
-#endif
-          }
-          break;
-        case COBOFS_CBIAS:
-          if (!b)
-            return GCOBR_NOCODEBIASPARAMETER;
-          b->messageType = type;
-          G_SSR_EPOCH_TIME_CHECK(b->EpochTime[s], b->NumberOfSat[s])
-          G_SSR_UPDATE_INTERVAL(b->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(b->SSRIOD)
-          G_SSR_PROVIDER_ID(b->SSRProviderID)
-          G_SSR_SOLUTION_ID(b->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
-        		  b->EpochTime[s], b->UpdateInterval,mmi,b->NumberOfSat[s],nums,
-				  b->SSRIOD, b->SSRProviderID, b->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            G_GNSS_SATELLITE_ID(id)
-            for (pos = satoffset[s];
-                pos < satoffset[s] + b->NumberOfSat[s] && b->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == b->NumberOfSat[s] + satoffset[s])
-              ++b->NumberOfSat[s];
-            b->Sat[pos].ID = id;
-            G_NO_OF_BIASES(b->Sat[pos].NumberOfCodeBiases)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d #%d ",
-                    b->Sat[pos].ID, b->Sat[pos].NumberOfCodeBiases);
-#endif
-            for (j = 0; j < b->Sat[pos].NumberOfCodeBiases; ++j) {
-              G_GNSS_SIGNAL_IDENTIFIER(b->Sat[pos].Biases[j].Type)
-              G_CODE_BIAS(b->Sat[pos].Biases[j].Bias)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "t%02d b %8.2f ",
-                    b->Sat[pos].Biases[j].Type, b->Sat[pos].Biases[j].Bias);
-#endif
-            }
-#ifdef BNC_DEBUG
-            fprintf(stderr, "\n");
-#endif
-          }
-          break;
-        case COBOFS_PBIAS:
-            if (!pb)
-              return GCOBR_NOPHASEBIASPARAMETER;
-            pb->messageType = type;
-            G_SSR_EPOCH_TIME_CHECK(pb->EpochTime[s], pb->NumberOfSat[s])
-            G_SSR_UPDATE_INTERVAL(pb->UpdateInterval)
-            G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-            G_SSR_IOD(pb->SSRIOD)
-            G_SSR_PROVIDER_ID(pb->SSRProviderID)
-            G_SSR_SOLUTION_ID(pb->SSRSolutionID)
-            G_DISPERSIVE_BIAS_INDICATOR(pb->DispersiveBiasConsistencyIndicator)
-            G_MW_CONSISTENCY_INDICATOR(pb->MWConsistencyIndicator)
-            G_NO_OF_SATELLITES(nums)
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d dispInd %d mwInd %d\n",
-        		  pb->EpochTime[s], pb->UpdateInterval,mmi,pb->NumberOfSat[s],nums,
-				  pb->SSRIOD, pb->SSRProviderID, pb->SSRSolutionID,
-				  pb->DispersiveBiasConsistencyIndicator, pb->MWConsistencyIndicator);
-#endif
-            for (i = 0; i < nums; ++i) {
-              G_GNSS_SATELLITE_ID(id)
-              for (pos = satoffset[s];
-                  pos < satoffset[s] + pb->NumberOfSat[s] && pb->Sat[pos].ID != id;
-                  ++pos)
-                ;
-              if (pos >= satoffset[s + 1])
-                return GCOBR_DATAMISMATCH;
-              else if (pos == pb->NumberOfSat[s] + satoffset[s])
-                ++pb->NumberOfSat[s];
-              pb->Sat[pos].ID = id;
-              G_NO_OF_BIASES(pb->Sat[pos].NumberOfPhaseBiases)
-              G_YAW_ANGLE(pb->Sat[pos].YawAngle)
-              G_YAW_RATE(pb->Sat[pos].YawRate)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d #%d y %10.6f yr %10.6f ",
-                    pb->Sat[pos].ID, pb->Sat[pos].NumberOfPhaseBiases,
-					pb->Sat[pos].YawAngle/MPI, pb->Sat[pos].YawRate/MPI);
-#endif
-              for (j = 0; j < pb->Sat[pos].NumberOfPhaseBiases; ++j) {
-                G_GNSS_SIGNAL_IDENTIFIER(pb->Sat[pos].Biases[j].Type)
-                G_INTEGER_INDICATOR(pb->Sat[pos].Biases[j].SignalIntegerIndicator)
-                G_WIDE_LANE_INDICATOR(pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator)
-                G_DISCONTINUITY_COUNTER(pb->Sat[pos].Biases[j].SignalDiscontinuityCounter)
-                G_PHASE_BIAS(pb->Sat[pos].Biases[j].Bias)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "t%02d int %d wl %d disc %d b %8.4f ",
-                    pb->Sat[pos].Biases[j].Type,
-					pb->Sat[pos].Biases[j].SignalIntegerIndicator,
-					pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator,
-					pb->Sat[pos].Biases[j].SignalDiscontinuityCounter,
-					pb->Sat[pos].Biases[j].Bias);
-#endif
-              }
-#ifdef BNC_DEBUG
-            fprintf(stderr, "\n");
-#endif
-            }
-          break;
-        default:
-          continue;
-      }
-#ifdef BNC_DEBUG
-      for(type = 0; type < (unsigned int)size && (unsigned char)buffer[type] != 0xD3; ++type)
-      numbits += 8;
-      fprintf(stderr, "numbits left %d\n",numbits);
-#endif
-      return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
-    }
-  }
-  return GCOBR_UNKNOWNTYPE;
-}
-#endif /* NODECODE */
-
-
-
Index: /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_igs.cpp
===================================================================
--- /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_igs.cpp	(revision 9025)
+++ /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_igs.cpp	(revision 9025)
@@ -0,0 +1,899 @@
+/* Programheader
+
+ Name:           clock_orbit_igs.c
+ Project:        RTCM3
+ Version:        $Id: clock_orbit_igs.c 8963 2020-06-29 12:46:25Z stuerze $
+ Authors:        Dirk Stöcker, Andrea Stürze
+ Description:    state space approach: IGS
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#ifndef sparc
+#include <stdint.h>
+#else
+#include <sys/types.h>
+#endif
+#include <clock_orbit_igs.h>
+
+
+size_t SsrCorrIgs::MakeClockOrbit(const struct ClockOrbit *co, ClockOrbitType type,
+    int moremessagesfollow, char *buffer, size_t size) {
+
+  unsigned int status[CLOCKORBIT_SATNUM][COBOFS_NUM], i, s;
+
+  memset(status, 0, sizeof(status));
+
+  STARTDATA
+
+  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
+    for (i = 0; i < COBOFS_NUM; ++i) {
+      if (co->NumberOfSat[s] && (type == COTYPE_AUTO || type == corbase[s] + i) &&
+           (co->Supplied[i] || (i <= COBOFS_CLOCK &&  co->Supplied[COBOFS_COMBINED]) ||
+           (i == COBOFS_COMBINED && co->Supplied[COBOFS_ORBIT] && co->Supplied[COBOFS_CLOCK]))) {
+        status[s][i] = 1;
+        if (i == COBOFS_COMBINED) {
+          status[s][COBOFS_ORBIT] = status[s][COBOFS_CLOCK] = 0;
+        } /* disable single blocks for combined type */
+      } /* check for data */
+    } /* iterate over sub-types */
+  } /* iterate over satellite systems */
+
+  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
+    if (status[s][COBOFS_ORBIT]) {
+      INITBLOCK
+	    T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
+      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
+	    T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_ORBIT)
+	    T_SSR_EPOCH_TIME(co->EpochTime[s])
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+	    T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+	    T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
+        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
+        T_GNSS_IOD(co->Sat[i].IOD)
+        T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
+        T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
+        T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
+        T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
+        T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
+        T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
+      }
+      ENDBLOCK
+    }
+    if (status[s][COBOFS_CLOCK]) {
+      INITBLOCK
+	    T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
+      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
+	    T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_CLOCK)
+	    T_SSR_EPOCH_TIME(co->EpochTime[s])
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+	    T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
+        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
+        T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
+        T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
+        T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
+      }
+      ENDBLOCK
+    }
+    if (status[s][COBOFS_COMBINED]) {
+#ifdef SPLITBLOCK
+      int nums = co->NumberOfSat[s];
+      int left, start = satoffset[s];
+      if(nums > 28) {/* split block when more than 28 sats */
+        left = nums - 28;
+        nums = 28;
+      }
+      else {
+        left = 0;
+      }
+      while(nums) {
+#endif
+      INITBLOCK
+	    T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
+      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
+	    T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_COMBINED)
+	    T_SSR_EPOCH_TIME(co->EpochTime[s])
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+#ifdef SPLITBLOCK
+      T_MULTIPLE_MESSAGE_INDICATOR((moremessagesfollow || left) ? 1 : 0)
+#else
+      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+#endif
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+	  T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
+#ifdef SPLITBLOCK
+      T_NO_OF_SATELLITES(nums)
+      for(i = start; i < start+nums; ++i) {
+#else
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
+#endif
+        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
+        T_GNSS_IOD(co->Sat[i].IOD)
+        T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
+        T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
+        T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
+        T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
+        T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
+        T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
+        T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
+        T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
+        T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
+      }
+      ENDBLOCK
+#ifdef SPLITBLOCK
+      start += nums;
+      nums = left;
+      left = 0;
+    }
+#endif
+    }
+    if (status[s][COBOFS_HR]) {
+      INITBLOCK
+	    T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
+      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
+	    T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_HR)
+	    T_SSR_EPOCH_TIME(co->EpochTime[s])
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+	    T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
+        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
+        T_HR_CLOCK_CORRECTION(co->Sat[i].hrclock)
+      }
+      ENDBLOCK
+    }
+    if (status[s][COBOFS_URA]) {
+      INITBLOCK
+	    T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
+      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
+	    T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_URA)
+	    T_SSR_EPOCH_TIME(co->EpochTime[s])
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+	    T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
+        T_GNSS_SATELLITE_ID(co->Sat[i].ID)
+        T_SSR_URA(ValueToURA(co->Sat[i].UserRangeAccuracy))
+      }
+      ENDBLOCK
+    }
+  }
+  return ressize;
+}
+
+size_t SsrCorrIgs::MakeCodeBias(const struct CodeBias *b, CodeBiasType type,
+    int moremessagesfollow, char *buffer, size_t size) {
+  unsigned int s, i, j;
+
+  STARTDATA
+
+  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
+    if (b->NumberOfSat[s] && (type == CBTYPE_AUTO || type == corbase[s] + COBOFS_CBIAS)) {
+      INITBLOCK
+	    T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
+      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
+	    T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_CBIAS)
+	    T_SSR_EPOCH_TIME(b->EpochTime[s])
+      T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
+	    T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(b->SSRIOD)
+      T_SSR_PROVIDER_ID(b->SSRProviderID)
+      T_SSR_SOLUTION_ID(b->SSRSolutionID)
+      T_NO_OF_SATELLITES(b->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
+        T_GNSS_SATELLITE_ID(b->Sat[i].ID)
+        T_NO_OF_BIASES(b->Sat[i].NumberOfCodeBiases)
+        for (j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j) {
+          T_GNSS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
+          T_CODE_BIAS(b->Sat[i].Biases[j].Bias)
+        }
+      }
+      ENDBLOCK
+    }
+  }
+  return ressize;
+}
+
+size_t SsrCorrIgs::MakePhaseBias(const struct PhaseBias *b, PhaseBiasType type,
+    int moremessagesfollow, char *buffer, size_t size) {
+  unsigned int s, i, j;
+
+  STARTDATA
+
+  for (s = 0; s < CLOCKORBIT_SATNUM; ++s)       {
+    if (b->NumberOfSat[s] && (type == PBTYPE_AUTO || type == corbase[s] + COBOFS_PBIAS)) {
+      INITBLOCK
+	    T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
+      T_IGS_SSR_VERSION(IGS_SSR_VERSION)
+	    T_IGS_MESSAGE_NUMBER(corbase[s] + COBOFS_PBIAS)
+	    T_SSR_EPOCH_TIME(b->EpochTime[s])
+      T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
+	    T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(b->SSRIOD)
+      T_SSR_PROVIDER_ID(b->SSRProviderID)
+      T_SSR_SOLUTION_ID(b->SSRSolutionID)
+      T_DISPERSIVE_BIAS_INDICATOR(b->DispersiveBiasConsistencyIndicator ? 1 : 0)
+      T_MW_CONSISTENCY_INDICATOR(b->MWConsistencyIndicator ? 1 : 0)
+      T_NO_OF_SATELLITES(b->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
+        T_GNSS_SATELLITE_ID(b->Sat[i].ID)
+        T_NO_OF_BIASES(b->Sat[i].NumberOfPhaseBiases)
+        T_YAW_ANGLE(b->Sat[i].YawAngle)
+        T_YAW_RATE(b->Sat[i].YawRate)
+        for (j = 0; j < b->Sat[i].NumberOfPhaseBiases; ++j) {
+          T_GNSS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
+          T_INTEGER_INDICATOR(b->Sat[i].Biases[j].SignalIntegerIndicator ? 1 : 0)
+          T_WIDE_LANE_INDICATOR(b->Sat[i].Biases[j].SignalsWideLaneIntegerIndicator)
+          T_DISCONTINUITY_COUNTER(b->Sat[i].Biases[j].SignalDiscontinuityCounter)
+          T_PHASE_BIAS(b->Sat[i].Biases[j].Bias)
+        }
+      }
+      ENDBLOCK
+    }
+  }
+  return ressize;
+}
+
+size_t SsrCorrIgs::MakeVTEC(const struct VTEC *v, int moremessagesfollow, char *buffer, size_t size) {
+  unsigned int l, o, d;
+
+  STARTDATA
+    INITBLOCK
+
+  T_RTCM_MESSAGE_NUMBER(RTCM_MESSAGE_NUMBER_IGS)
+  T_IGS_SSR_VERSION(IGS_SSR_VERSION)
+  T_IGS_MESSAGE_NUMBER(VTEC_BASE)
+  T_SSR_EPOCH_TIME(v->EpochTime)
+  T_SSR_UPDATE_INTERVAL(v->UpdateInterval)
+  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+  T_SSR_IOD(v->SSRIOD)
+  T_SSR_PROVIDER_ID(v->SSRProviderID)
+  T_SSR_SOLUTION_ID(v->SSRSolutionID)
+  T_VTEC_QUALITY_INDICATOR(v->Quality)
+  T_NO_IONO_LAYERS(v->NumLayers)
+  for (l = 0; l < v->NumLayers; ++l) {
+    T_IONO_HEIGHT(v->Layers[l].Height)
+    T_IONO_DEGREE(v->Layers[l].Degree)
+    T_IONO_ORDER(v->Layers[l].Order)
+    for (o = 0; o <= v->Layers[l].Order; ++o) {
+      for (d = o; d <= v->Layers[l].Degree; ++d) {
+        T_IONO_COEFF_C(v->Layers[l].Cosinus[d][o])
+      }
+    }
+    for (o = 1; o <= v->Layers[l].Order; ++o) {
+      for (d = o; d <= v->Layers[l].Degree; ++d) {
+        T_IONO_COEFF_S(v->Layers[l].Sinus[d][o])
+      }
+    }
+  }
+  ENDBLOCK
+  return ressize;
+}
+
+enum GCOB_RETURN SsrCorrIgs::GetSSR(struct ClockOrbit *co, struct CodeBias *b,struct VTEC *v,
+    struct PhaseBias *pb, const char *buffer, size_t size, int *bytesused) {
+  int mmi = 0, h, rs;
+  unsigned int rtcmtype, igstype, pos, i, j, s, nums, id, version;
+  size_t sizeofrtcmblock;
+  const char *blockstart = buffer;
+  DECODESTART
+
+  if (size < 7)
+    return GCOBR_SHORTBUFFER;
+
+#ifdef BNC_DEBUG
+  fprintf(stderr, "GetSSR-IGS START: size %d, numbits %d\n",(int)size, numbits);
+#endif
+
+  G_HEADER(h)
+  G_RESERVEDH(rs)
+  G_SIZE(sizeofrtcmblock);
+
+  if ((unsigned char) h != 0xD3 || rs)
+    return GCOBR_UNKNOWNDATA;
+  if (size < sizeofrtcmblock + 3) /* 3 header bytes already removed */
+    return GCOBR_MESSAGEEXCEEDSBUFFER;
+  if (CRC24(sizeofrtcmblock + 3, (const unsigned char *) blockstart) !=
+      (uint32_t) ((((unsigned char) buffer[sizeofrtcmblock]) << 16) |
+          (((unsigned char) buffer[sizeofrtcmblock + 1]) << 8) |
+          (((unsigned char) buffer[sizeofrtcmblock + 2]))))
+    return GCOBR_CRCMISMATCH;
+  size = sizeofrtcmblock; /* reduce size, so overflows are detected */
+
+  G_RTCM_MESSAGE_NUMBER(rtcmtype)
+  G_IGS_SSR_VERSION(version)
+#ifdef BNC_DEBUG
+  fprintf(stderr, "rtcmType %d igsVersion %d ", rtcmtype, version);
+#endif
+  G_IGS_MESSAGE_NUMBER(igstype)
+  fprintf(stderr, "igsType IM%03d ", igstype);
+#ifdef BNC_DEBUG
+  fprintf(stderr, "igsType IM%d size %d\n", igstype,(int)sizeofrtcmblock);
+#endif
+  if (bytesused)
+    *bytesused = sizeofrtcmblock + 6;
+
+  if (igstype == VTEC_BASE) {
+    unsigned int l, o, d;
+    if (!v)
+      return GCOBR_NOVTECPARAMETER;
+    memset(v, 0, sizeof(*v));
+    G_SSR_EPOCH_TIME(v->EpochTime)
+    G_SSR_UPDATE_INTERVAL(v->UpdateInterval)
+    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+    G_SSR_IOD(v->SSRIOD)
+    G_SSR_PROVIDER_ID(v->SSRProviderID)
+    G_SSR_SOLUTION_ID(v->SSRSolutionID)
+    G_VTEC_QUALITY_INDICATOR(v->Quality)
+    G_NO_IONO_LAYERS(v->NumLayers)
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d ssrIod %d providerId %d solId %d vtecQ %8.3f numLay %d \n",
+        		  v->EpochTime, v->UpdateInterval, mmi,
+				  v->SSRIOD, v->SSRProviderID, v->SSRSolutionID, v->Quality, v->NumLayers);
+#endif
+    for (l = 0; l < v->NumLayers; ++l) {
+      G_IONO_HEIGHT(v->Layers[l].Height)
+      G_IONO_DEGREE(v->Layers[l].Degree)
+      G_IONO_ORDER(v->Layers[l].Order)
+#ifdef BNC_DEBUG
+          fprintf(stderr, "h  %8.3f deg %d ord %d \n",
+        		  v->Layers[l].Height, v->Layers[l].Degree, v->Layers[l].Order);
+#endif
+      for (o = 0; o <= v->Layers[l].Order; ++o) {
+        for (d = o; d <= v->Layers[l].Degree; ++d) {
+          G_IONO_COEFF_C(v->Layers[l].Cosinus[d][o])
+#ifdef BNC_DEBUG
+          fprintf(stderr, "C[%02d][%02d]  %8.3f \n",
+        		  d, o, v->Layers[l].Cosinus[d][o]);
+#endif
+        }
+      }
+      for (o = 1; o <= v->Layers[l].Order; ++o) {
+        for (d = o; d <= v->Layers[l].Degree; ++d) {
+          G_IONO_COEFF_S(v->Layers[l].Sinus[d][o])
+#ifdef BNC_DEBUG
+          fprintf(stderr, "S[%02d][%02d]  %8.3f \n",
+        		  d, o, v->Layers[l].Sinus[d][o]);
+#endif
+        }
+      }
+    }
+#ifdef BNC_DEBUG
+    for(igstype = 0; igstype < (unsigned int)size && (unsigned char)buffer[igstype] != 0xD3; ++igstype)
+    numbits += 8;
+    fprintf(stderr, "numbits left %d\n",numbits);
+#endif
+    return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
+  }
+  for (s = CLOCKORBIT_SATNUM; s-- > 0;) {
+    if (igstype >= corbase[s]) {
+      unsigned int corrOffset = igstype - corbase[s]; fprintf(stderr, "corrOffset:  %d ",corrOffset);
+      if (corrOffset == COBOFS_ORBIT) {
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = igstype;
+          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_ORBIT] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            G_GNSS_SATELLITE_ID(id)
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+            G_GNSS_IOD(co->Sat[pos].IOD)
+            G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
+            G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
+            G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
+            G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
+            G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
+            G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d iod %3d dr %8.4f da %8.4f dc %8.4f dr %8.3f da %8.3f dc %8.3f\n",
+                co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
+                co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
+                co->Sat[pos].Orbit.DotDeltaRadial,
+                co->Sat[pos].Orbit.DotDeltaAlongTrack,
+                co->Sat[pos].Orbit.DotDeltaCrossTrack);
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_CLOCK) {
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = igstype;
+          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_CLOCK] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            G_GNSS_SATELLITE_ID(id)
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+            G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
+            G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
+            G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d c0 %8.3f c1 %8.3f c2 %8.3f\n",
+                co->Sat[pos].ID, co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1,
+                co->Sat[pos].Clock.DeltaA2);
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_COMBINED) {fprintf(stderr, "Combined\n");
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = igstype;
+          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_ORBIT] |= 1;
+          co->Supplied[COBOFS_CLOCK] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            G_GNSS_SATELLITE_ID(id)
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+            G_GNSS_IOD(co->Sat[pos].IOD)
+            G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
+            G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
+            G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
+            G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
+            G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
+            G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
+            G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
+            G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
+            G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d iod %3d dr %10.6f da %10.6f dc %10.6f dr %10.6f da %10.6f dc %10.6f  c0 %10.6f c1 %10.6f c2 %10.6f\n",
+                co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
+                co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
+                co->Sat[pos].Orbit.DotDeltaRadial, co->Sat[pos].Orbit.DotDeltaAlongTrack,
+                co->Sat[pos].Orbit.DotDeltaCrossTrack,
+			        	co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1, co->Sat[pos].Clock.DeltaA2);
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_URA) {
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = igstype;
+          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_URA] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            G_GNSS_SATELLITE_ID(id)
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+            G_SSR_URA(co->Sat[pos].UserRangeAccuracy)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d ura %8.3f \n",
+                co->Sat[pos].ID, co->Sat[pos].UserRangeAccuracy);
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_HR) {
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = igstype;
+          G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_HR] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            G_GNSS_SATELLITE_ID(id)
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+            G_HR_CLOCK_CORRECTION(co->Sat[pos].hrclock)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d hrClock %8.3f \n",
+                    co->Sat[pos].ID, co->Sat[pos].hrclock);
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_CBIAS) {fprintf(stderr, "Cbias\n");
+          if (!b)
+            return GCOBR_NOCODEBIASPARAMETER;
+          b->messageType = igstype;
+          G_SSR_EPOCH_TIME_CHECK(b->EpochTime[s], b->NumberOfSat[s])
+          G_SSR_UPDATE_INTERVAL(b->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(b->SSRIOD)
+          G_SSR_PROVIDER_ID(b->SSRProviderID)
+          G_SSR_SOLUTION_ID(b->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
+        		  b->EpochTime[s], b->UpdateInterval,mmi,b->NumberOfSat[s],nums,
+				  b->SSRIOD, b->SSRProviderID, b->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            G_GNSS_SATELLITE_ID(id)
+            for (pos = satoffset[s];
+                pos < satoffset[s] + b->NumberOfSat[s] && b->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == b->NumberOfSat[s] + satoffset[s])
+              ++b->NumberOfSat[s];
+            b->Sat[pos].ID = id;
+            G_NO_OF_BIASES(b->Sat[pos].NumberOfCodeBiases)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d #%d ",
+                    b->Sat[pos].ID, b->Sat[pos].NumberOfCodeBiases);
+#endif
+            for (j = 0; j < b->Sat[pos].NumberOfCodeBiases; ++j) {
+              G_GNSS_SIGNAL_IDENTIFIER(b->Sat[pos].Biases[j].Type)
+              G_CODE_BIAS(b->Sat[pos].Biases[j].Bias)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "t%02d b %8.2f ",
+                    b->Sat[pos].Biases[j].Type, b->Sat[pos].Biases[j].Bias);
+#endif
+            }
+#ifdef BNC_DEBUG
+            fprintf(stderr, "\n");
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_PBIAS) { fprintf(stderr, "Pbias\n");
+            if (!pb)
+              return GCOBR_NOPHASEBIASPARAMETER;
+            pb->messageType = igstype;
+            G_SSR_EPOCH_TIME_CHECK(pb->EpochTime[s], pb->NumberOfSat[s])
+            G_SSR_UPDATE_INTERVAL(pb->UpdateInterval)
+            G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+            G_SSR_IOD(pb->SSRIOD)
+            G_SSR_PROVIDER_ID(pb->SSRProviderID)
+            G_SSR_SOLUTION_ID(pb->SSRSolutionID)
+            G_DISPERSIVE_BIAS_INDICATOR(pb->DispersiveBiasConsistencyIndicator)
+            G_MW_CONSISTENCY_INDICATOR(pb->MWConsistencyIndicator)
+            G_NO_OF_SATELLITES(nums)
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d dispInd %d mwInd %d\n",
+        		  pb->EpochTime[s], pb->UpdateInterval,mmi,pb->NumberOfSat[s],nums,
+				  pb->SSRIOD, pb->SSRProviderID, pb->SSRSolutionID,
+				  pb->DispersiveBiasConsistencyIndicator, pb->MWConsistencyIndicator);
+#endif
+            for (i = 0; i < nums; ++i) {
+              G_GNSS_SATELLITE_ID(id)
+              for (pos = satoffset[s];
+                  pos < satoffset[s] + pb->NumberOfSat[s] && pb->Sat[pos].ID != id;
+                  ++pos)
+                ;
+              if (pos >= satoffset[s + 1])
+                return GCOBR_DATAMISMATCH;
+              else if (pos == pb->NumberOfSat[s] + satoffset[s])
+                ++pb->NumberOfSat[s];
+              pb->Sat[pos].ID = id;
+              G_NO_OF_BIASES(pb->Sat[pos].NumberOfPhaseBiases)
+              G_YAW_ANGLE(pb->Sat[pos].YawAngle)
+              G_YAW_RATE(pb->Sat[pos].YawRate)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d #%d y %10.6f yr %10.6f ",
+                    pb->Sat[pos].ID, pb->Sat[pos].NumberOfPhaseBiases,
+					pb->Sat[pos].YawAngle/MPI, pb->Sat[pos].YawRate/MPI);
+#endif
+              for (j = 0; j < pb->Sat[pos].NumberOfPhaseBiases; ++j) {
+                G_GNSS_SIGNAL_IDENTIFIER(pb->Sat[pos].Biases[j].Type)
+                G_INTEGER_INDICATOR(pb->Sat[pos].Biases[j].SignalIntegerIndicator)
+                G_WIDE_LANE_INDICATOR(pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator)
+                G_DISCONTINUITY_COUNTER(pb->Sat[pos].Biases[j].SignalDiscontinuityCounter)
+                G_PHASE_BIAS(pb->Sat[pos].Biases[j].Bias)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "t%02d int %d wl %d disc %02d b %8.4f ",
+                    pb->Sat[pos].Biases[j].Type,
+					pb->Sat[pos].Biases[j].SignalIntegerIndicator,
+					pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator,
+					pb->Sat[pos].Biases[j].SignalDiscontinuityCounter,
+					pb->Sat[pos].Biases[j].Bias);
+#endif
+              }
+#ifdef BNC_DEBUG
+            fprintf(stderr, "\n");
+#endif
+            }
+      }
+      else {
+        continue;
+      }
+#ifdef BNC_DEBUG
+      for(igstype = 0; igstype < (unsigned int)size && (unsigned char)buffer[igstype] != 0xD3; ++igstype)
+      numbits += 8;
+      fprintf(stderr, "numbits left %d\n",numbits);
+#endif
+      return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
+    }
+  }
+  return GCOBR_UNKNOWNTYPE;
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+std::string SsrCorrIgs::codeTypeToRnxType(char system, CodeType type) {
+  if      (system == 'G') {
+    if (type == CODETYPE_GPS_L1_CA)         return "1C";
+    if (type == CODETYPE_GPS_L1_P)          return "1P";
+    if (type == CODETYPE_GPS_L1_Z)          return "1W";
+
+    if (type == CODETYPE_GPS_SEMI_CODELESS) return "2D";
+    if (type == CODETYPE_GPS_L2_CA)         return "2C";
+    if (type == CODETYPE_GPS_L2_P)          return "2P";
+    if (type == CODETYPE_GPS_L2_Z)          return "2W";
+    if (type == CODETYPE_GPS_L2C_M)         return "2S";
+    if (type == CODETYPE_GPS_L2C_L)         return "2L";
+
+    if (type == CODETYPE_GPS_L5_I)          return "5I";
+    if (type == CODETYPE_GPS_L5_Q)          return "5Q";
+
+    if (type == CODETYPE_GPS_L1C_D)         return "1S";
+    if (type == CODETYPE_GPS_L1C_P)         return "1L";
+  }
+  else if (system == 'R') {
+    if (type == CODETYPE_GLONASS_L1_CA)     return "1C";
+    if (type == CODETYPE_GLONASS_L1_P)      return "1P";
+
+    if (type == CODETYPE_GLONASS_L2_CA)     return "2C";
+    if (type == CODETYPE_GLONASS_L2_P)      return "2P";
+
+    if (type == CODETYPE_GLONASS_L1a_OCd)   return "4A";
+    if (type == CODETYPE_GLONASS_L1a_OCp)   return "4B";
+
+    if (type == CODETYPE_GLONASS_L2a_CSI)   return "6A";
+    if (type == CODETYPE_GLONASS_L2a_OCp)   return "6B";
+
+    if (type == CODETYPE_GLONASS_L3_I)      return "3I";
+    if (type == CODETYPE_GLONASS_L3_Q)      return "3Q";
+  }
+  else if (system == 'E') {
+    if (type == CODETYPE_GALILEO_E1_A)       return "1A";
+    if (type == CODETYPE_GALILEO_E1_B)       return "1B";
+    if (type == CODETYPE_GALILEO_E1_C)       return "1C";
+
+    if (type == CODETYPE_GALILEO_E5A_I)      return "5I";
+    if (type == CODETYPE_GALILEO_E5A_Q)      return "5Q";
+
+    if (type == CODETYPE_GALILEO_E5B_I)      return "7I";
+    if (type == CODETYPE_GALILEO_E5B_Q)      return "7Q";
+
+    if (type == CODETYPE_GALILEO_E6_A)       return "6A";
+    if (type == CODETYPE_GALILEO_E6_B)       return "6B";
+    if (type == CODETYPE_GALILEO_E6_C)       return "6C";
+  }
+   else if (system == 'J') {
+    if (type == CODETYPE_QZSS_L1_CA)         return "1C";
+    if (type == CODETYPE_QZSS_L1C_D)         return "1S";
+    if (type == CODETYPE_QZSS_L1C_P)         return "1L";
+
+    if (type == CODETYPE_QZSS_L2C_M)         return "2S";
+    if (type == CODETYPE_QZSS_L2C_L)         return "2L";
+
+    if (type == CODETYPE_QZSS_L5_I)          return "5I";
+    if (type == CODETYPE_QZSS_L5_Q)          return "5Q";
+
+    if (type == CODETYPE_QZSS_L6_D)          return "6S";
+    if (type == CODETYPE_QZSS_L6_P)          return "6L";
+    if (type == CODETYPE_QZSS_L6_E)          return "6E";
+  }
+  else if (system == 'C') {
+    if (type == CODETYPE_BDS_B1_I)         return "2I";
+    if (type == CODETYPE_BDS_B1_Q)         return "2Q";
+
+    if (type == CODETYPE_BDS_B3_I)         return "6I";
+    if (type == CODETYPE_BDS_B3_Q)         return "6Q";
+    if (type == CODETYPE_BDS_B3_A)         return "6A";
+
+    if (type == CODETYPE_BDS_B2_I)         return "7I";
+    if (type == CODETYPE_BDS_B2_Q)         return "7Q";
+
+    if (type == CODETYPE_BDS_B1a_D)        return "1D";
+    if (type == CODETYPE_BDS_B1a_P)        return "1P";
+
+    if (type == CODETYPE_BDS_B2a_D)        return "5D";
+    if (type == CODETYPE_BDS_B2a_P)        return "5P";
+
+    if (type == CODETYPE_BDS_B1_A)         return "1A";
+  }
+  else if (system == 'S') {
+    if (type == CODETYPE_SBAS_L1_CA)       return "1C";
+
+    if (type == CODETYPE_SBAS_L5_I)        return "5I";
+    if (type == CODETYPE_SBAS_L5_Q)        return "5Q";
+  }
+  return "";
+}
+
+SsrCorr::CodeType SsrCorrIgs::rnxTypeToCodeType(char system, std::string type) {
+  if      (system == 'G') {
+    if (type.compare("1C") == 0) {return CODETYPE_GPS_L1_CA;}
+    if (type.compare("1P") == 0) {return CODETYPE_GPS_L1_P;}
+    if (type.compare("1W") == 0) {return CODETYPE_GPS_L1_Z;}
+
+    if (type.compare("2D") == 0) {return CODETYPE_GPS_SEMI_CODELESS;}
+    if (type.compare("2C") == 0) {return CODETYPE_GPS_L2_CA;}
+    if (type.compare("2P") == 0) {return CODETYPE_GPS_L2_P;}
+    if (type.compare("2W") == 0) {return CODETYPE_GPS_L2_Z;}
+    if (type.compare("2S") == 0) {return CODETYPE_GPS_L2C_M;}
+    if (type.compare("2L") == 0) {return CODETYPE_GPS_L2C_L;}
+
+    if (type.compare("5I") == 0) {return CODETYPE_GPS_L5_I;}
+    if (type.compare("5Q") == 0) {return CODETYPE_GPS_L5_Q;}
+
+    if (type.compare("1S") == 0) {return CODETYPE_GPS_L1C_D;}
+    if (type.compare("1L") == 0) {return CODETYPE_GPS_L1C_P;}
+  }
+  else if (system == 'R') {
+    if (type.compare("1C") == 0) {return CODETYPE_GLONASS_L1_CA;}
+    if (type.compare("1P") == 0) {return CODETYPE_GLONASS_L1_P;}
+
+    if (type.compare("2C") == 0) {return CODETYPE_GLONASS_L2_CA;}
+    if (type.compare("2P") == 0) {return CODETYPE_GLONASS_L2_P;}
+
+    if (type.compare("4A") == 0) {return CODETYPE_GLONASS_L1a_OCd;}
+    if (type.compare("4B") == 0) {return CODETYPE_GLONASS_L1a_OCp;}
+
+    if (type.compare("6A") == 0) {return CODETYPE_GLONASS_L2a_CSI;}
+    if (type.compare("6B") == 0) {return CODETYPE_GLONASS_L2a_OCp;}
+
+    if (type.compare("3I") == 0) {return CODETYPE_GLONASS_L3_I;}
+    if (type.compare("3Q") == 0) {return CODETYPE_GLONASS_L3_Q;}
+  }
+  else if (system == 'E') {
+    if (type.compare("1A") == 0) {return CODETYPE_GALILEO_E1_A;}
+    if (type.compare("1B") == 0) {return CODETYPE_GALILEO_E1_B;}
+    if (type.compare("1C") == 0) {return CODETYPE_GALILEO_E1_C;}
+
+    if (type.compare("5I") == 0) {return CODETYPE_GALILEO_E5A_I;}
+    if (type.compare("5Q") == 0) {return CODETYPE_GALILEO_E5A_Q;}
+
+    if (type.compare("7I") == 0) {return CODETYPE_GALILEO_E5B_I;}
+    if (type.compare("7Q") == 0) {return CODETYPE_GALILEO_E5B_Q;}
+
+    if (type.compare("6A") == 0) {return CODETYPE_GALILEO_E6_A;}
+    if (type.compare("6B") == 0) {return CODETYPE_GALILEO_E6_B;}
+    if (type.compare("6C") == 0) {return CODETYPE_GALILEO_E6_C;}
+  }
+   else if (system == 'J') {
+     if (type.compare("1C") == 0) {return CODETYPE_QZSS_L1_CA;}
+     if (type.compare("1S") == 0) {return CODETYPE_QZSS_L1C_D;}
+     if (type.compare("1L") == 0) {return CODETYPE_QZSS_L1C_P;}
+
+     if (type.compare("2S") == 0) {return CODETYPE_QZSS_L2C_M;}
+     if (type.compare("2L") == 0) {return CODETYPE_QZSS_L2C_L;}
+
+     if (type.compare("5I") == 0) {return CODETYPE_QZSS_L5_I;}
+     if (type.compare("5Q") == 0) {return CODETYPE_QZSS_L5_Q;}
+
+     if (type.compare("6S") == 0) {return CODETYPE_QZSS_L6_D;}
+     if (type.compare("6L") == 0) {return CODETYPE_QZSS_L6_P;}
+     if (type.compare("6E") == 0) {return CODETYPE_QZSS_L6_E;}
+  }
+  else if (system == 'C') {
+    if (type.compare("2I") == 0) {return CODETYPE_BDS_B1_I;}
+    if (type.compare("2Q") == 0) {return CODETYPE_BDS_B1_Q;}
+
+    if (type.compare("6I") == 0) {return CODETYPE_BDS_B3_I;}
+    if (type.compare("6Q") == 0) {return CODETYPE_BDS_B3_Q;}
+    if (type.compare("6A") == 0) {return CODETYPE_BDS_B3_A;}
+
+    if (type.compare("7I") == 0) {return CODETYPE_BDS_B2_I;}
+    if (type.compare("7Q") == 0) {return CODETYPE_BDS_B2_Q;}
+
+    if (type.compare("1D") == 0) {return CODETYPE_BDS_B1a_D;}
+    if (type.compare("1P") == 0) {return CODETYPE_BDS_B1a_P;}
+
+    if (type.compare("5D") == 0) {return CODETYPE_BDS_B2a_D;}
+    if (type.compare("5P") == 0) {return CODETYPE_BDS_B2a_P;}
+
+    if (type.compare("1A") == 0) {return CODETYPE_BDS_B1_A;}
+  }
+  else if (system == 'S') {
+    if (type.compare("1C") == 0) {return CODETYPE_SBAS_L1_CA;}
+
+    if (type.compare("5I") == 0) {return CODETYPE_SBAS_L5_I;}
+    if (type.compare("5Q") == 0) {return CODETYPE_SBAS_L5_Q;}
+  }
+  return RESERVED;
+}
+
Index: /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_igs.h
===================================================================
--- /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_igs.h	(revision 9024)
+++ /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_igs.h	(revision 9025)
@@ -4,378 +4,247 @@
 /* Programheader
 
-        Name:           clock_orbit_igs.h
-        Project:        RTCM3
-        Version:        $Id: clock_orbit_igs.h 8966 2020-07-01 07:48:35Z stuerze $
-        Authors:        Dirk Stöcker, Andrea Stürze
-        Description:    state space approach: IGS
-*/
-
+ Name:           clock_orbit_igs.h
+ Project:        RTCM3
+ Version:        $Id: clock_orbit_igs.h 8966 2020-07-01 07:48:35Z stuerze $
+ Authors:        Dirk Stöcker, Andrea Stürze
+ Description:    state space approach: IGS
+ */
+#include <QDebug>
 #include <string.h>
-
-enum IGS_NUMBERS {
- RTCM_MESSAGE_NUMBER_IGS = 4076,
- IGS_SSR_VERSION         = 3
-};
-
-enum SatelliteReferenceDatum {
-  DATUM_ITRF  = 0,
-  DATUM_LOCAL = 1
-};
-
-enum COR_BASE {
-  COBBASE_GPS     =  21,
-  COBBASE_GLONASS =  41,
-  COBBASE_GALILEO =  61,
-  COBBASE_QZSS    =  81,
-  COBBASE_BDS     = 101,
-  COBBASE_SBAS    = 121,
-  COBBASE_NUM
-};
-
-enum COR_OFFSET {   // sub-type message, for example:
-  COBOFS_ORBIT = 0, // GPS: IM21
-  COBOFS_CLOCK,     // GPS: IM22
-  COBOFS_COMBINED,  // GPS: IM23
-  COBOFS_HR,        // GPS: IM24
-  COBOFS_CBIAS,     // GPS: IM25
-  COBOFS_PBIAS,     // GPS: IM26
-  COBOFS_URA,       // GPS: IM27
-  COBOFS_NUM
-};
-
-enum ClockOrbitType {
-  COTYPE_GPSORBIT        = COBBASE_GPS     + COBOFS_ORBIT,
-  COTYPE_GPSCLOCK,
-  COTYPE_GPSCOMBINED     = COBBASE_GPS     + COBOFS_COMBINED,
-  COTYPE_GPSHR,
-  COTYPE_GPSURA          = COBBASE_GPS     + COBOFS_URA,
-
-  COTYPE_GLONASSORBIT    = COBBASE_GLONASS + COBOFS_ORBIT,
-  COTYPE_GLONASSCLOCK,
-  COTYPE_GLONASSCOMBINED = COBBASE_GLONASS + COBOFS_COMBINED,
-  COTYPE_GLONASSHR,
-  COTYPE_GLONASSURA      = COBBASE_GLONASS + COBOFS_URA,
-
-  COTYPE_GALILEOORBIT    = COBBASE_GALILEO + COBOFS_ORBIT,
-  COTYPE_GALILEOCLOCK,
-  COTYPE_GALILEOCOMBINED = COBBASE_GALILEO + COBOFS_COMBINED,
-  COTYPE_GALILEOHR,
-  COTYPE_GALILEOURA      = COBBASE_GALILEO + COBOFS_URA,
-
-  COTYPE_QZSSORBIT       = COBBASE_QZSS    + COBOFS_ORBIT,
-  COTYPE_QZSSCLOCK,
-  COTYPE_QZSSCOMBINED    = COBBASE_QZSS    + COBOFS_COMBINED,
-  COTYPE_QZSSHR,
-  COTYPE_QZSSURA         = COBBASE_QZSS    + COBOFS_URA,
-
-  COTYPE_SBASORBIT       = COBBASE_SBAS    + COBOFS_ORBIT,
-  COTYPE_SBASCLOCK,
-  COTYPE_SBASCOMBINED    = COBBASE_SBAS    + COBOFS_COMBINED,
-  COTYPE_SBASHR,
-  COTYPE_SBASURA         = COBBASE_SBAS    + COBOFS_URA,
-
-  COTYPE_BDSORBIT        = COBBASE_BDS     + COBOFS_ORBIT,
-  COTYPE_BDSCLOCK,
-  COTYPE_BDSCOMBINED     = COBBASE_BDS     + COBOFS_COMBINED,
-  COTYPE_BDSHR,
-  COTYPE_BDSURA          = COBBASE_BDS     + COBOFS_URA,
-
-  COTYPE_AUTO = 0,
-};
-
-enum CodeBiasType {
-  CBTYPE_GPS     = COBBASE_GPS     + COBOFS_CBIAS,
-  CBTYPE_GLONASS = COBBASE_GLONASS + COBOFS_CBIAS,
-  CBTYPE_GALILEO = COBBASE_GALILEO + COBOFS_CBIAS,
-  CBTYPE_QZSS    = COBBASE_QZSS    + COBOFS_CBIAS,
-  CBTYPE_SBAS    = COBBASE_SBAS    + COBOFS_CBIAS,
-  CBTYPE_BDS     = COBBASE_BDS     + COBOFS_CBIAS,
-  CBTYPE_AUTO    = 0
-};
-
-enum PhaseBiasType {
-  PBTYPE_GPS     = COBBASE_GPS     + COBOFS_PBIAS,
-  PBTYPE_GLONASS = COBBASE_GLONASS + COBOFS_PBIAS,
-  PBTYPE_GALILEO = COBBASE_GALILEO + COBOFS_PBIAS,
-  PBTYPE_QZSS    = COBBASE_QZSS    + COBOFS_PBIAS,
-  PBTYPE_SBAS    = COBBASE_SBAS    + COBOFS_PBIAS,
-  PBTYPE_BDS     = COBBASE_BDS     + COBOFS_PBIAS,
-  PBTYPE_AUTO    = 0
-};
-
-enum VTECType {
-  VTEC_BASE = 201
-};
-
-/* if some systems aren't supported at all, change the following numbers to zero
-for these systems to save space */
-enum COR_CONSTANTS {
-  CLOCKORBIT_BUFFERSIZE    = 8192,
-  CLOCKORBIT_NUMGPS        =   32,
-  CLOCKORBIT_NUMGLONASS    =   26,
-  CLOCKORBIT_NUMGALILEO    =   36,
-  CLOCKORBIT_NUMQZSS       =   10,
-  CLOCKORBIT_NUMSBAS       =   38,
-  CLOCKORBIT_NUMBDS        =   65,
-  CLOCKORBIT_NUMBIAS       =  100,
-  CLOCKORBIT_NUMIONOLAYERS =    4,
-  CLOCKORBIT_MAXIONOORDER  =   16,
-  CLOCKORBIT_MAXIONODEGREE =   16
-};
-
-enum COR_SATSYSTEM {
-  CLOCKORBIT_SATGPS=0,
-  CLOCKORBIT_SATGLONASS,
-  CLOCKORBIT_SATGALILEO,
-  CLOCKORBIT_SATQZSS,
-  CLOCKORBIT_SATSBAS,
-  CLOCKORBIT_SATBDS,
-  CLOCKORBIT_SATNUM
-};
-
-enum COR_OFFSETS {
-  CLOCKORBIT_OFFSETGPS     = 0,
-  CLOCKORBIT_OFFSETGLONASS = CLOCKORBIT_NUMGPS,
-  CLOCKORBIT_OFFSETGALILEO = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS,
-  CLOCKORBIT_OFFSETQZSS    = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO,
-  CLOCKORBIT_OFFSETSBAS    = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO
-                           + CLOCKORBIT_NUMQZSS,
-  CLOCKORBIT_OFFSETBDS     = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO
-                           + CLOCKORBIT_NUMQZSS + CLOCKORBIT_NUMSBAS,
-  CLOCKORBIT_COUNTSAT      = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO
-                           + CLOCKORBIT_NUMQZSS + CLOCKORBIT_NUMSBAS    + CLOCKORBIT_NUMBDS
-};
-
-enum CodeType {
-  CODETYPEGPS_L1_CA          = 0,
-  CODETYPEGPS_L1_P           = 1,
-  CODETYPEGPS_L1_Z           = 2,
-  CODETYPEGPS_L1C_D          = 3,
-  CODETYPEGPS_L1C_P          = 4,
-  CODETYPEGPS_L2_CA          = 5,
-  CODETYPEGPS_SEMI_CODELESS  = 6,
-  CODETYPEGPS_L2C_M          = 7,
-  CODETYPEGPS_L2C_L          = 8,
-  //RESERVED                 = 9,
-  CODETYPEGPS_L2_P           = 10,
-  CODETYPEGPS_L2_Z           = 11,
-  //RESERVED                 = 12,
-  //RESERVED                 = 13,
-  CODETYPEGPS_L5_I           = 14,
-  CODETYPEGPS_L5_Q           = 15,
-
-  CODETYPEGLONASS_L1_CA      = 0,
-  CODETYPEGLONASS_L1_P       = 1,
-  CODETYPEGLONASS_L2_CA      = 2,
-  CODETYPEGLONASS_L2_P       = 3,
-  CODETYPEGLONASS_L1a_OCd    = 4,
-  CODETYPEGLONASS_L1a_OCp    = 5,
-  CODETYPEGLONASS_L2a_CSI    = 6,
-  CODETYPEGLONASS_L2a_OCp    = 7,
-  CODETYPEGLONASS_L3_I       = 8,
-  CODETYPEGLONASS_L3_Q       = 9,
-
-  CODETYPEGALILEO_E1_A       = 0,
-  CODETYPEGALILEO_E1_B       = 1,
-  CODETYPEGALILEO_E1_C       = 2,
-  //RESERVED_E1_BC           = 3,
-  //RESERVED_E1_ABC          = 4,
-  CODETYPEGALILEO_E5A_I      = 5,
-  CODETYPEGALILEO_E5A_Q      = 6,
-  //RESERVED_E5A_IQ          = 7,
-  CODETYPEGALILEO_E5B_I      = 8,
-  CODETYPEGALILEO_E5B_Q      = 9,
-  //RESERVED_E5B_IQ          = 10,
-  //RESERVED_E5_I            = 11,
-  //RESERVED_E5_Q            = 12,
-  //RESERVED_E5_IQ           = 13,
-  CODETYPEGALILEO_E6_A       = 14,
-  CODETYPEGALILEO_E6_B       = 15,
-  CODETYPEGALILEO_E6_C       = 16,
-  //RESERVED_E6_BC           = 17,
-  //RESERVED_E6_ABC          = 18,
-
-  CODETYPEQZSS_L1_CA         = 0,
-  CODETYPEQZSS_L1C_D         = 1,
-  CODETYPEQZSS_L1C_P         = 2,
-  CODETYPEQZSS_L2C_M         = 3,
-  CODETYPEQZSS_L2C_L         = 4,
-  //RESEVED_L2C_ML           = 5,
-  CODETYPEQZSS_L5_I          = 6,
-  CODETYPEQZSS_L5_Q          = 7,
-  //RESERVED_L5_IQ           = 8,
-  CODETYPEQZSS_L6_D          = 9,
-  CODETYPEQZSS_L6_P          = 10,
-  //RESERVED_L6_DP           = 11,
-  //RESERVED_L1C_DP          = 12,
-  //RESERVED_L1_S            = 13,
-  //RESERVED_L5_D            = 14,
-  //RESERVED_L5_P            = 15,
-  //RESERVED_L5_DP           = 16,
-  CODETYPEQZSS_L6_E          = 17,
-  //RESERVED_L6_DE           = 18,
-
-  CODETYPE_SBAS_L1_CA        = 0,
-  CODETYPE_SBAS_L5_I         = 1,
-  CODETYPE_SBAS_L5_Q         = 2,
-  //RESERVED_SBAS_L5_IQ      = 3,
-
-  CODETYPE_BDS_B1_I          = 0,
-  CODETYPE_BDS_B1_Q          = 1,
-  //RESERVED_BDS_B1_IQ       = 2,
-  CODETYPE_BDS_B3_I          = 3,
-  CODETYPE_BDS_B3_Q          = 4,
-  //RESERVED_BDS_B3_IQ       = 5,
-  CODETYPE_BDS_B2_I          = 6,
-  CODETYPE_BDS_B2_Q          = 7,
-  //RESERVED_BDS_B2_IQ       = 8,
-  CODETYPE_BDS_B1a_D         = 9,
-  CODETYPE_BDS_B1a_P         = 10,
-  //RESERVED_BDS_B1a_DP      = 11,
-  CODETYPE_BDS_B2a_D         = 12,
-  CODETYPE_BDS_B2a_P         = 13,
-  //RESEVED_BDS_B2a_DP       = 14,
-  CODETYPE_BDS_B1_A          = 15, //NEW 1A
-  //RESERVED                 = 16,
-  //RESERVED                 = 17,
-  CODETYPE_BDS_B3_A          = 18  //NEW 6A
-};
-
-#define SSR_MAXURA 5.5 /* > 5466.5mm in meter */
-
-/* satellite system data is stored with offset CLOCKORBIT_OFFSET...
-in the data structures. So first GLONASS satellite is at
-xxx->Sat[CLOCKORBIT_OFFSETGLONASS], first GPS satellite is
-xxx->Sat[CLOCKORBIT_OFFSETGPS]. */
-
-struct ClockOrbit {
-  enum ClockOrbitType messageType;
-  unsigned int EpochTime[CLOCKORBIT_SATNUM];   /* 0 .. system specific maximum */
-  unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
-  unsigned int Supplied[COBOFS_NUM];           /* boolean */
-  unsigned int SSRIOD;
-  unsigned int SSRProviderID;
-  unsigned int SSRSolutionID;
-  unsigned int UpdateInterval;
-  enum SatelliteReferenceDatum SatRefDatum;
-  struct SatData {
-    unsigned int ID; /* all */
-    unsigned int IOD; /* all */
-    unsigned int toe; /* SBAS, BDS */
-    double UserRangeAccuracy; /* accuracy values in [m] */
-    double hrclock;
-    struct OrbitPart {
-      double DeltaRadial;           /* m */
-      double DeltaAlongTrack;       /* m */
-      double DeltaCrossTrack;       /* m */
-      double DotDeltaRadial;        /* m/s */
-      double DotDeltaAlongTrack;    /* m/s */
-      double DotDeltaCrossTrack;    /* m/s */
-    } Orbit;
-    struct ClockPart {
-      double DeltaA0;               /* m */
-      double DeltaA1;               /* m/s */
-      double DeltaA2;               /* m/ss */
-    } Clock;
-  } Sat[CLOCKORBIT_COUNTSAT];
-};
-
-struct CodeBias {
-  enum CodeBiasType messageType;
-  unsigned int EpochTime[CLOCKORBIT_SATNUM];   /* 0 .. system specific maximum */
-  unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
-  unsigned int UpdateInterval;
-  unsigned int SSRIOD;
-  unsigned int SSRProviderID;
-  unsigned int SSRSolutionID;
-  struct BiasSat {
-    unsigned int ID; /* all */
-    unsigned int NumberOfCodeBiases;
-    struct CodeBiasEntry {
-      enum CodeType Type;
-      float         Bias;           /* m */
-    } Biases[CLOCKORBIT_NUMBIAS];
-  } Sat[CLOCKORBIT_COUNTSAT];
-};
-
-struct PhaseBias {
-  enum PhaseBiasType messageType;
-  unsigned int EpochTime[CLOCKORBIT_SATNUM];   /* 0 .. system specific maximum */
-  unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
-  unsigned int UpdateInterval;
-  unsigned int SSRIOD;
-  unsigned int SSRProviderID;
-  unsigned int SSRSolutionID;
-  unsigned int DispersiveBiasConsistencyIndicator;
-  unsigned int MWConsistencyIndicator;
-  struct PhaseBiasSat {
-    unsigned int ID; /* all */
-    unsigned int NumberOfPhaseBiases;
-    double YawAngle; /* radiant */
-    double YawRate;  /* radiant/s */
-    struct PhaseBiasEntry {
-      enum CodeType Type;
-      unsigned int  SignalIntegerIndicator;
-      unsigned int  SignalsWideLaneIntegerIndicator;
-      unsigned int  SignalDiscontinuityCounter;
-      float         Bias;           /* m */
-    } Biases[CLOCKORBIT_NUMBIAS];
-  } Sat[CLOCKORBIT_COUNTSAT];
-};
-
-struct VTEC {
-  unsigned int EpochTime; /* GPS */
-  unsigned int UpdateInterval;
-  unsigned int SSRIOD;
-  unsigned int SSRProviderID;
-  unsigned int SSRSolutionID;
-  unsigned int NumLayers; /* 1-4 */
-  double Quality;
-  struct IonoLayers {
-    double       Height; /* m */
-    unsigned int Degree; /* 1-16 */
-    unsigned int Order; /* 1-16 */
-    double       Sinus[CLOCKORBIT_MAXIONODEGREE][CLOCKORBIT_MAXIONOORDER];
-    double       Cosinus[CLOCKORBIT_MAXIONODEGREE][CLOCKORBIT_MAXIONOORDER];
-  } Layers[CLOCKORBIT_NUMIONOLAYERS];
-};
-
-/* return size of resulting data or 0 in case of an error */
-size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
+#include "clock_orbit.h"
+
+class SsrCorrIgs: public SsrCorr {
+  //Q_OBJECT
+
+public:
+  SsrCorrIgs() {qDebug() << "SsrCorrIgs()";
+    setCorBase();
+    setCorOffset();
+    setCoType();
+    setCbType();
+    setPbType();
+    setVtecType();
+    setCodeType();
+
+    satoffset << CLOCKORBIT_OFFSETGPS
+        << CLOCKORBIT_OFFSETGLONASS
+        << CLOCKORBIT_OFFSETGALILEO
+        << CLOCKORBIT_OFFSETQZSS
+        << CLOCKORBIT_OFFSETSBAS
+        << CLOCKORBIT_OFFSETBDS
+        << CLOCKORBIT_COUNTSAT;
+  };
+
+  ~SsrCorrIgs() {};
+
+  void setCorBase() {
+    COBBASE_GPS     =  21;
+    COBBASE_GLONASS =  41;
+    COBBASE_GALILEO =  61;
+    COBBASE_QZSS    =  81;
+    COBBASE_BDS     = 101;
+    COBBASE_SBAS    = 121;
+    COBBASE_NUM     =   6;
+
+    corbase << COBBASE_GPS
+            << COBBASE_GLONASS
+            << COBBASE_GALILEO
+            << COBBASE_QZSS
+            << COBBASE_SBAS
+            << COBBASE_BDS;
+  }
+
+  void setCorOffset() {
+    COBOFS_ORBIT    = 0; // GPS: IM21
+    COBOFS_CLOCK    = 1; // GPS: IM22
+    COBOFS_COMBINED = 2; // GPS: IM23
+    COBOFS_HR       = 3; // GPS: IM24
+    COBOFS_CBIAS    = 4; // GPS: IM25
+    COBOFS_PBIAS    = 5; // GPS: IM26
+    COBOFS_URA      = 6; // GPS: IM27
+    COBOFS_NUM      = 7;
+  };
+
+  void setCoType() {
+    COTYPE_GPSORBIT        = COBBASE_GPS + COBOFS_ORBIT;
+    COTYPE_GPSCLOCK        = COTYPE_GPSORBIT + 1;
+    COTYPE_GPSCOMBINED     = COBBASE_GPS + COBOFS_COMBINED;
+    COTYPE_GPSHR           = COTYPE_GPSCOMBINED + 1;
+    COTYPE_GPSURA          = COBBASE_GPS + COBOFS_URA;
+
+    COTYPE_GLONASSORBIT    = COBBASE_GLONASS + COBOFS_ORBIT;
+    COTYPE_GLONASSCLOCK    = COTYPE_GLONASSORBIT + 1;
+    COTYPE_GLONASSCOMBINED = COBBASE_GLONASS + COBOFS_COMBINED,
+    COTYPE_GLONASSHR       = COTYPE_GLONASSCOMBINED + 1;
+    COTYPE_GLONASSURA      = COBBASE_GLONASS + COBOFS_URA,
+
+    COTYPE_GALILEOORBIT    = COBBASE_GALILEO + COBOFS_ORBIT;
+    COTYPE_GALILEOCLOCK    = COTYPE_GALILEOORBIT + 1;
+    COTYPE_GALILEOCOMBINED = COBBASE_GALILEO + COBOFS_COMBINED,
+    COTYPE_GALILEOHR       = COTYPE_GALILEOCOMBINED + 1;
+    COTYPE_GALILEOURA      = COBBASE_GALILEO + COBOFS_URA;
+
+    COTYPE_QZSSORBIT       = COBBASE_QZSS + COBOFS_ORBIT;
+    COTYPE_QZSSCLOCK       = COTYPE_QZSSORBIT + 1;
+    COTYPE_QZSSCOMBINED    = COBBASE_QZSS + COBOFS_COMBINED;
+    COTYPE_QZSSHR          = COTYPE_QZSSCOMBINED + 1;
+    COTYPE_QZSSURA         = COBBASE_QZSS + COBOFS_URA;
+
+    COTYPE_SBASORBIT       = COBBASE_SBAS + COBOFS_ORBIT;
+    COTYPE_SBASCLOCK       = COTYPE_SBASORBIT + 1;
+    COTYPE_SBASCOMBINED    = COBBASE_SBAS + COBOFS_COMBINED;
+    COTYPE_SBASHR          = COTYPE_SBASCOMBINED + 1;
+    COTYPE_SBASURA         = COBBASE_SBAS + COBOFS_URA;
+
+    COTYPE_BDSORBIT        = COBBASE_BDS + COBOFS_ORBIT;
+    COTYPE_BDSCLOCK        = COTYPE_BDSORBIT + 1;
+    COTYPE_BDSCOMBINED     = COBBASE_BDS + COBOFS_COMBINED;
+    COTYPE_BDSHR           = COTYPE_BDSCOMBINED + 1;
+    COTYPE_BDSURA          = COBBASE_BDS + COBOFS_URA;
+
+    COTYPE_AUTO = 0;
+  };
+
+  void setCbType() {
+    CBTYPE_GPS     = COBBASE_GPS     + COBOFS_CBIAS;
+    CBTYPE_GLONASS = COBBASE_GLONASS + COBOFS_CBIAS;
+    CBTYPE_GALILEO = COBBASE_GALILEO + COBOFS_CBIAS;
+    CBTYPE_QZSS    = COBBASE_QZSS    + COBOFS_CBIAS;
+    CBTYPE_SBAS    = COBBASE_SBAS    + COBOFS_CBIAS;
+    CBTYPE_BDS     = COBBASE_BDS     + COBOFS_CBIAS;
+    CBTYPE_AUTO = 0;
+  };
+
+  void setPbType() {
+    PBTYPE_GPS     = COBBASE_GPS     + COBOFS_PBIAS;
+    PBTYPE_GLONASS = COBBASE_GLONASS + COBOFS_PBIAS;
+    PBTYPE_GALILEO = COBBASE_GALILEO + COBOFS_PBIAS;
+    PBTYPE_QZSS    = COBBASE_QZSS    + COBOFS_PBIAS;
+    PBTYPE_SBAS    = COBBASE_SBAS    + COBOFS_PBIAS;
+    PBTYPE_BDS     = COBBASE_BDS     + COBOFS_PBIAS;
+    PBTYPE_AUTO = 0;
+  };
+
+  void setVtecType() {
+      VTEC_BASE   = 201;
+  };
+
+  void setCodeType() {
+    CODETYPE_GPS_L1_CA          =  0;
+    CODETYPE_GPS_L1_P           =  1;
+    CODETYPE_GPS_L1_Z           =  2;
+    CODETYPE_GPS_L1C_D          =  3;
+    CODETYPE_GPS_L1C_P          =  4;
+    CODETYPE_GPS_L2_CA          =  5;
+    CODETYPE_GPS_SEMI_CODELESS  =  6;
+    CODETYPE_GPS_L2C_M          =  7;
+    CODETYPE_GPS_L2C_L          =  8;
+    //RESERVED                  =  9;
+    CODETYPE_GPS_L2_P           = 10;
+    CODETYPE_GPS_L2_Z           = 11;
+    //RESERVED                  = 12;
+    //RESERVED                  = 13;
+    CODETYPE_GPS_L5_I           = 14;
+    CODETYPE_GPS_L5_Q           = 15;
+
+
+
+
+
+    CODETYPE_GLONASS_L1_CA      =  0;
+    CODETYPE_GLONASS_L1_P       =  1;
+    CODETYPE_GLONASS_L2_CA      =  2;
+    CODETYPE_GLONASS_L2_P       =  3;
+    CODETYPE_GLONASS_L1a_OCd    =  4;
+    CODETYPE_GLONASS_L1a_OCp    =  5;
+    CODETYPE_GLONASS_L2a_CSI    =  6;
+    CODETYPE_GLONASS_L2a_OCp    =  7;
+    CODETYPE_GLONASS_L3_I       =  8;
+    CODETYPE_GLONASS_L3_Q       =  9;
+
+
+
+
+    CODETYPE_GALILEO_E1_A       =  0;
+    CODETYPE_GALILEO_E1_B       =  1;
+    CODETYPE_GALILEO_E1_C       =  2;
+    //RESERVED_E1_BC            =  3;
+    //RESERVED_E1_ABC           =  4;
+    CODETYPE_GALILEO_E5A_I      =  5;
+    CODETYPE_GALILEO_E5A_Q      =  6;
+    //RESERVED_E5A_IQ           =  7;
+    CODETYPE_GALILEO_E5B_I      =  8;
+    CODETYPE_GALILEO_E5B_Q      =  9;
+    //RESERVED_E5B_IQ           = 10;
+    //RESERVED_E5_I             = 11;
+    //RESERVED_E5_Q             = 12;
+    //RESERVED_E5_IQ            = 13;
+    CODETYPE_GALILEO_E6_A       = 14;
+    CODETYPE_GALILEO_E6_B       = 15;
+    CODETYPE_GALILEO_E6_C       = 16;
+    //RESERVED_E6_BC            = 17;
+    //RESERVED_E6_ABC           = 18;
+
+    CODETYPE_QZSS_L1_CA         = 0;
+    CODETYPE_QZSS_L1C_D         = 1;
+    CODETYPE_QZSS_L1C_P         = 2;
+    CODETYPE_QZSS_L2C_M         = 3;
+    CODETYPE_QZSS_L2C_L         = 4;
+    //RESEVED_L2C_ML            = 5;
+    CODETYPE_QZSS_L5_I          = 6;
+    CODETYPE_QZSS_L5_Q          = 7;
+    //RESERVED_L5_IQ            = 8;
+    CODETYPE_QZSS_L6_D          = 9;
+    CODETYPE_QZSS_L6_P          = 10;
+    //RESERVED_L6_DP            = 11;
+    //RESERVED_L1C_DP           = 12;
+    //RESERVED_L1_S             = 13;
+    //RESERVED_L5_D             = 14;
+    //RESERVED_L5_P             = 15;
+    //RESERVED_L5_DP            = 16;
+    CODETYPE_QZSS_L6_E          = 17;
+    //RESERVED_L6_DE            = 18;
+
+    CODETYPE_SBAS_L1_CA        =  0;
+    CODETYPE_SBAS_L5_I         =  1;
+    CODETYPE_SBAS_L5_Q         =  2;
+    //RESERVED_CODETYPE_SBAS_L5_IQ      = 3;
+
+    CODETYPE_BDS_B1_I          =  0;
+    CODETYPE_BDS_B1_Q          =  1;
+    //RESERVED_CODETYPE_BDS_B1_IQ       = 2;
+    CODETYPE_BDS_B3_I          =  3;
+    CODETYPE_BDS_B3_Q          =  4;
+    //RESERVED_CODETYPE_BDS_B3_IQ       = 5;
+    CODETYPE_BDS_B2_I          =  6;
+    CODETYPE_BDS_B2_Q          =  7;
+    //RESERVED_CODETYPE_BDS_B2_IQ       = 8;
+    CODETYPE_BDS_B1a_D         =  9;
+    CODETYPE_BDS_B1a_P         = 10;
+    //RESERVED_CODETYPE_BDS_B1a_DP      = 11;
+    CODETYPE_BDS_B2a_D         = 12;
+    CODETYPE_BDS_B2a_P         = 13;
+    //RESEVED_CODETYPE_BDS_B2a_DP       = 14;
+    CODETYPE_BDS_B1_A          = 15; //NEW 1A
+    //RESERVED                 = 16;
+    //RESERVED                 = 17;
+    CODETYPE_BDS_B3_A          = 18;  //NEW 6A
+   };
+
+   std::string       codeTypeToRnxType(char system, CodeType type);
+   SsrCorr::CodeType rnxTypeToCodeType(char system, std::string type);
+
+   size_t MakeClockOrbit(const struct ClockOrbit *co, ClockOrbitType type,
        int moremessagesfollow, char *buffer, size_t size);
-size_t MakeCodeBias(const struct CodeBias *b, enum CodeBiasType type,
+   size_t MakeCodeBias(const struct CodeBias *b, CodeBiasType type,
        int moremessagesfollow, char *buffer, size_t size);
-size_t MakePhaseBias(const struct PhaseBias *b, enum PhaseBiasType type,
+   size_t MakePhaseBias(const struct PhaseBias *b, PhaseBiasType type,
        int moremessagesfollow, char *buffer, size_t size);
-size_t MakeVTEC(const struct VTEC *b, int moremessagesfollow, char *buffer,
+   size_t MakeVTEC(const struct VTEC *v, int moremessagesfollow, char *buffer,
        size_t size);
-
-enum GCOB_RETURN {
-  /* all well */
-  GCOBR_MESSAGEFOLLOWS        =  1,
-  GCOBR_OK                    =  0,
-  /* unknown data, a warning */
-  GCOBR_UNKNOWNTYPE           = -1,
-  GCOBR_UNKNOWNDATA           = -2,
-  GCOBR_CRCMISMATCH           = -3,
-  GCOBR_SHORTMESSAGE          = -4,
-  /* failed to do the work */
-  GCOBR_NOCLOCKORBITPARAMETER = -10,
-  GCOBR_NOCODEBIASPARAMETER   = -11,
-  GCOBR_NOPHASEBIASPARAMETER  = -12,
-  GCOBR_NOVTECPARAMETER       = -13,
-  /* data mismatch - data in storage does not match new data */
-  GCOBR_TIMEMISMATCH          = -20,
-  GCOBR_DATAMISMATCH          = -21,
-  /* not enough data - can decode the block completely */
-  GCOBR_SHORTBUFFER           = -30,
-  GCOBR_MESSAGEEXCEEDSBUFFER  = -31};
-
-/* NOTE: When an error message has been emitted, the output structures may have been modified. Make a copy of the previous variant before calling the
-function to have a clean state. */
-
-/* buffer should point to a RTCM3 block */
-enum GCOB_RETURN GetSSR(struct ClockOrbit *co, struct CodeBias *b, struct VTEC *v,
-       struct PhaseBias *pb, const char *buffer, size_t size, int *bytesused);
+   enum GCOB_RETURN GetSSR(struct ClockOrbit *co, struct CodeBias *b,
+       struct VTEC *v, struct PhaseBias *pb, const char *buffer, size_t size,
+       int *bytesused);
+  };
 
 #endif /* RTCM3_CLOCK_ORBIT_IGS_H */
Index: unk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.c
===================================================================
--- /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.c	(revision 9024)
+++ 	(revision )
@@ -1,1392 +1,0 @@
-/* Programheader
-
- Name:           clock_orbit_rtcm.c
- Project:        RTCM3
- Version:        $Id$
- Authors:        Dirk Stöcker
- Description:    state space approach: RTCM
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <string.h>
-#ifndef sparc
-#include <stdint.h>
-#else
-#include <sys/types.h>
-#endif
-#include "clock_orbit_rtcm.h"
-
-static uint32_t CRC24(long size, const unsigned char *buf) {
-  uint32_t crc = 0;
-  int i;
-
-  while (size--) {
-    crc ^= (*buf++) << (16);
-    for (i = 0; i < 8; i++)
-        {
-      crc <<= 1;
-      if (crc & 0x1000000)
-        crc ^= 0x01864cfb;
-    }
-  }
-  return crc;
-}
-
-/* NOTE: These defines are interlinked with below functions and directly modify
- the values. This may not be optimized in terms of final program code size but
- should be optimized in terms of speed.
-
- modified variables are:
- - everything defined in STARTDATA (only use ressize outside of the defines,
- others are private)
- - buffer
- - size
- */
-
-#ifndef NOENCODE
-#define STOREBITS \
-  while(numbits >= 8) { \
-    if(!size) return 0; \
-    *(buffer++) = bitbuffer>>(numbits-8); \
-    numbits -= 8; \
-    ++ressize; \
-    --size; \
-  }
-
-#define ADDBITS(a, b) { \
-    bitbuffer = (bitbuffer<<(a))|((b)&((1<<a)-1)); \
-    numbits += (a); \
-    STOREBITS \
-  }
-
-#define STARTDATA \
-  size_t ressize=0; \
-  char *blockstart; \
-  int numbits; \
-  uint64_t bitbuffer=0;
-
-#define INITBLOCK \
-  numbits = 0; \
-  blockstart = buffer; \
-  ADDBITS(8, 0xD3) \
-  ADDBITS(6, 0) \
-  ADDBITS(10, 0)
-
-#define ENDBLOCK \
-  if(numbits) { ADDBITS((8-numbits), 0) } { \
-    int len = buffer-blockstart-3; \
-    blockstart[1] |= len>>8; \
-    blockstart[2] = len; \
-    if(len > 1023) \
-      return 0; \
-    len = CRC24(len+3, (const unsigned char *) blockstart); \
-    ADDBITS(24, len) \
-  }
-
-#define SCALEADDBITS(a, b, c) ADDBITS(a, (int64_t)(c > 0 ? b*c+0.5 : b*c-0.5))
-
-#define MPI         3.141592653589793
-
-/* GNSS macros - Header part */
-#define T_RTCM_MESSAGE_NUMBER(a)         ADDBITS(12, a)      /* DF002 */
-#define T_GPS_EPOCH_TIME(a)              ADDBITS(20, a)
-#define T_GLONASS_EPOCH_TIME(a)          ADDBITS(17, a)
-#define T_SSR_UPDATE_INTERVAL(a)         ADDBITS( 4, a)
-#define T_MULTIPLE_MESSAGE_INDICATOR(a)  ADDBITS( 1, a)
-#define T_SATELLITE_REFERENCE_DATUM(a)   ADDBITS( 1, a)
-#define T_SSR_IOD(a)                     ADDBITS( 4, a)
-#define T_SSR_PROVIDER_ID(a)             ADDBITS(16, a)
-#define T_SSR_SOLUTION_ID(a)             ADDBITS( 4, a)
-#define T_NO_OF_SATELLITES(a)            ADDBITS( 6, a)
-
-/* GNSS macros - Satellite specific part */
-#define T_GPS_SATELLITE_ID(a)            ADDBITS( 6, a)      /* DF068 */
-#define T_QZSS_SATELLITE_ID(a)           ADDBITS( 4, a)      /* DF249 */
-#define T_GLONASS_SATELLITE_ID(a)        ADDBITS( 5, a)
-#define T_GPS_IODE(a)                    ADDBITS( 8, a)      /* DF071 */
-#define T_GLONASS_IOD(a)                 ADDBITS( 8, a)      /* DF239 */
-#define T_GALILEO_IOD(a)                 ADDBITS(10, a)      /* DF459 */
-#define T_SBAS_T0MOD(a)                  ADDBITS( 9, (a/16)) /* DF468 */
-#define T_SBAS_IODCRC(a)                 ADDBITS(24, a)      /* DF469 */
-#define T_BDS_TOEMOD(a)                  ADDBITS(10, (a/8))  /* DF470 */
-#define T_BDS_IOD(a)                     ADDBITS( 8, a)      /* DF471 */
-#define T_DELTA_RADIAL(a)                SCALEADDBITS(22,    10000.0, a)
-#define T_DELTA_ALONG_TRACK(a)           SCALEADDBITS(20,     2500.0, a)
-#define T_DELTA_CROSS_TRACK(a)           SCALEADDBITS(20,     2500.0, a)
-#define T_DELTA_DOT_RADIAL(a)            SCALEADDBITS(21,  1000000.0, a)
-#define T_DELTA_DOT_ALONG_TRACK(a)       SCALEADDBITS(19,   250000.0, a)
-#define T_DELTA_DOT_CROSS_TRACK(a)       SCALEADDBITS(19,   250000.0, a)
-
-#define T_DELTA_CLOCK_C0(a)              SCALEADDBITS(22,    10000.0, a)
-#define T_DELTA_CLOCK_C1(a)              SCALEADDBITS(21,  1000000.0, a)
-#define T_DELTA_CLOCK_C2(a)              SCALEADDBITS(27, 50000000.0, a)
-#define T_HR_CLOCK_CORRECTION(a)         SCALEADDBITS(22,    10000.0, a)
-
-#define T_NO_OF_CODE_BIASES(a)           ADDBITS( 5, a)
-#define T_NO_OF_PHASE_BIASES(a)          ADDBITS( 5, a)
-#define T_SIGNAL_IDENTIFIER(a)           ADDBITS( 5, a)
-#define T_CODE_BIAS(a)                   SCALEADDBITS(14,      100.0, a)
-#define T_YAW_ANGLE(a)                   SCALEADDBITS( 9,  256.0/MPI, a)
-#define T_YAW_RATE(a)                    SCALEADDBITS( 8, 8192.0/MPI, a)
-#define T_PHASE_BIAS(a)                  SCALEADDBITS(20,    10000.0, a)
-
-/* Phase specific part of GNSS phase bias message */
-#define T_INTEGER_INDICATOR(a)           ADDBITS( 1, a)
-#define T_WIDE_LANE_INDICATOR(a)         ADDBITS( 2, a)
-#define T_DISCONTINUITY_COUNTER(a)       ADDBITS( 4, a)
-#define T_DISPERSIVE_BIAS_INDICATOR(a)   ADDBITS( 1, a)
-#define T_MW_CONSISTENCY_INDICATOR(a)    ADDBITS( 1, a)
-
-/* URA */
-#define T_SSR_URA(a)                     ADDBITS( 6, a)
-
-/* Ionosphere */
-#define T_NO_IONO_LAYERS(a)              ADDBITS( 2, a-1)
-#define T_IONO_HEIGHT(a)                 SCALEADDBITS( 8,   1/10000.0, a)
-#define T_IONO_DEGREE(a)                 ADDBITS( 4, a-1)
-#define T_IONO_ORDER(a)                  ADDBITS( 4, a-1)
-#define T_IONO_COEFF(a)                  SCALEADDBITS(16,      200.0, a)
-#define T_VTEC_QUALITY_INDICATOR(a)      SCALEADDBITS( 9,       20.0, a)
-
-static double URAToValue(int ura) {
-  int urac, urav;
-  urac = ura >> 3;
-  urav = ura & 7;
-  if (!ura)
-    return 0;
-  else if (ura == 63)
-    return SSR_MAXURA;
-  return (pow(3, urac) * (1.0 + urav / 4.0) - 1.0) / 1000.0;
-}
-
-static int ValueToURA(double val) {
-  int ura;
-  if (!val)
-    return 0;
-  else if (val > 5.4665)
-    return 63;
-  for (ura = 1; ura < 63 && val > URAToValue(ura); ++ura)
-    ;
-  return ura;
-}
-
-static const enum ClockOrbitType corbase[CLOCKORBIT_SATNUM] = {
-  (int) COBBASE_GPS,
-  (int) COBBASE_GLONASS,
-  (int) COBBASE_GALILEO,
-  (int) COBBASE_QZSS,
-  (int) COBBASE_SBAS,
-  (int) COBBASE_BDS
-};
-
-static const enum COR_OFFSETS satoffset[CLOCKORBIT_SATNUM + 1] = {
-  CLOCKORBIT_OFFSETGPS,
-  CLOCKORBIT_OFFSETGLONASS,
-  CLOCKORBIT_OFFSETGALILEO,
-  CLOCKORBIT_OFFSETQZSS,
-  CLOCKORBIT_OFFSETSBAS,
-  CLOCKORBIT_OFFSETBDS,
-  CLOCKORBIT_COUNTSAT
-};
-
-size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
-    int moremessagesfollow, char *buffer, size_t size) {
-  unsigned int status[CLOCKORBIT_SATNUM][COBOFS_NUM], i, s;
-
-  memset(status, 0, sizeof(status));
-
-  STARTDATA
-
-  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
-    for (i = 0; i < COBOFS_NUM; ++i) {
-      if (co->NumberOfSat[s] && (type == COTYPE_AUTO || type == corbase[s] + i) &&
-           (co->Supplied[i] || (i <= COBOFS_CLOCK &&  co->Supplied[COBOFS_COMBINED]) ||
-           (i == COBOFS_COMBINED && co->Supplied[COBOFS_ORBIT] && co->Supplied[COBOFS_CLOCK]))) {
-        status[s][i] = 1;
-        if (i == COBOFS_COMBINED) {
-          status[s][COBOFS_ORBIT] = status[s][COBOFS_CLOCK] = 0;
-        } /* disable single blocks for combined type */
-      } /* check for data */
-    } /* iterate over RTCM data types */
-  } /* iterate over satellite systems */
-
-  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
-    if (status[s][COBOFS_ORBIT]) {
-      INITBLOCK
-      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_ORBIT)
-      switch (s) {
-        case CLOCKORBIT_SATGPS:
-        case CLOCKORBIT_SATGALILEO:
-        case CLOCKORBIT_SATQZSS:
-        case CLOCKORBIT_SATSBAS:
-        case CLOCKORBIT_SATBDS:
-          T_GPS_EPOCH_TIME(co->EpochTime[s])
-          break;
-        case CLOCKORBIT_SATGLONASS:
-          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
-          break;
-      }
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
-        switch (s)         {
-          case CLOCKORBIT_SATGPS:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            T_GPS_IODE(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATGLONASS:
-            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
-            T_GLONASS_IOD(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATGALILEO:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            T_GALILEO_IOD(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATQZSS:
-            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
-            T_GPS_IODE(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATSBAS:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            T_SBAS_T0MOD(co->Sat[i].toe)
-            T_SBAS_IODCRC(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATBDS:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            T_BDS_TOEMOD(co->Sat[i].toe)
-            T_BDS_IOD(co->Sat[i].IOD)
-            break;
-        }
-        T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
-        T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
-        T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
-        T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
-        T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
-        T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
-      }
-      ENDBLOCK
-    }
-    if (status[s][COBOFS_CLOCK]) {
-      INITBLOCK
-      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_CLOCK)
-      switch (s) {
-        case CLOCKORBIT_SATGPS:
-        case CLOCKORBIT_SATGALILEO:
-        case CLOCKORBIT_SATQZSS:
-        case CLOCKORBIT_SATSBAS:
-        case CLOCKORBIT_SATBDS:
-          T_GPS_EPOCH_TIME(co->EpochTime[s])
-          break;
-        case CLOCKORBIT_SATGLONASS:
-          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
-          break;
-      }
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
-        switch (s) {
-          case CLOCKORBIT_SATGPS:
-          case CLOCKORBIT_SATGALILEO:
-          case CLOCKORBIT_SATSBAS:
-          case CLOCKORBIT_SATBDS:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATQZSS:
-            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATGLONASS:
-            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
-            break;
-        }
-        T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
-        T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
-        T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
-      }
-      ENDBLOCK
-    }
-    if (status[s][COBOFS_COMBINED]) {
-#ifdef SPLITBLOCK
-      int nums = co->NumberOfSat[s];
-      int left, start = satoffset[s];
-      if(nums > 28) {/* split block when more than 28 sats */
-        left = nums - 28;
-        nums = 28;
-      }
-      else {
-        left = 0;
-      }
-      while(nums) {
-#endif
-      INITBLOCK
-      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_COMBINED)
-      switch (s) {
-        case CLOCKORBIT_SATGPS:
-        case CLOCKORBIT_SATGALILEO:
-        case CLOCKORBIT_SATQZSS:
-        case CLOCKORBIT_SATSBAS:
-        case CLOCKORBIT_SATBDS:
-          T_GPS_EPOCH_TIME(co->EpochTime[s])
-          break;
-        case CLOCKORBIT_SATGLONASS:
-          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
-          break;
-      }
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-#ifdef SPLITBLOCK
-      T_MULTIPLE_MESSAGE_INDICATOR((moremessagesfollow || left) ? 1 : 0)
-#else
-      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-#endif
-      T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-#ifdef SPLITBLOCK
-      T_NO_OF_SATELLITES(nums)
-      for(i = start; i < start+nums; ++i)
-#else
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i)
-#endif
-      {
-        switch (s) {
-          case CLOCKORBIT_SATGPS:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            T_GPS_IODE(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATGLONASS:
-            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
-            T_GLONASS_IOD(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATGALILEO:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            T_GALILEO_IOD(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATQZSS:
-            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
-            T_GPS_IODE(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATSBAS:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            T_SBAS_T0MOD(co->Sat[i].toe)
-            T_SBAS_IODCRC(co->Sat[i].IOD)
-            break;
-          case CLOCKORBIT_SATBDS:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            T_BDS_TOEMOD(co->Sat[i].toe)
-            T_BDS_IOD(co->Sat[i].IOD)
-            break;
-        }
-        T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
-        T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
-        T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
-        T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
-        T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
-        T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
-        T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
-        T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
-        T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
-      }
-      ENDBLOCK
-#ifdef SPLITBLOCK
-      start += nums;
-      nums = left;
-      left = 0;
-    }
-#endif
-    }
-    if (status[s][COBOFS_HR]) {
-      INITBLOCK
-      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_HR)
-      switch (s) {
-        case CLOCKORBIT_SATGPS:
-        case CLOCKORBIT_SATGALILEO:
-        case CLOCKORBIT_SATQZSS:
-        case CLOCKORBIT_SATSBAS:
-        case CLOCKORBIT_SATBDS:
-          T_GPS_EPOCH_TIME(co->EpochTime[s])
-          break;
-        case CLOCKORBIT_SATGLONASS:
-          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
-          break;
-      }
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
-        switch (s) {
-          case CLOCKORBIT_SATGPS:
-            case CLOCKORBIT_SATGALILEO:
-            case CLOCKORBIT_SATSBAS:
-            case CLOCKORBIT_SATBDS:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATQZSS:
-            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATGLONASS:
-            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
-            break;
-        }
-        T_HR_CLOCK_CORRECTION(co->Sat[i].hrclock)
-      }
-      ENDBLOCK
-    }
-    if (status[s][COBOFS_URA]) {
-      INITBLOCK
-      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_URA)
-      switch (s) {
-        case CLOCKORBIT_SATGPS:
-        case CLOCKORBIT_SATGALILEO:
-        case CLOCKORBIT_SATQZSS:
-        case CLOCKORBIT_SATSBAS:
-        case CLOCKORBIT_SATBDS:
-          T_GPS_EPOCH_TIME(co->EpochTime[s])
-          break;
-        case CLOCKORBIT_SATGLONASS:
-          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
-          break;
-      }
-      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(co->SSRIOD)
-      T_SSR_PROVIDER_ID(co->SSRProviderID)
-      T_SSR_SOLUTION_ID(co->SSRSolutionID)
-      T_NO_OF_SATELLITES(co->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
-        switch (s) {
-          case CLOCKORBIT_SATGPS:
-          case CLOCKORBIT_SATGALILEO:
-          case CLOCKORBIT_SATSBAS:
-          case CLOCKORBIT_SATBDS:
-            T_GPS_SATELLITE_ID(co->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATQZSS:
-            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATGLONASS:
-            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
-            break;
-        }
-        T_SSR_URA(ValueToURA(co->Sat[i].UserRangeAccuracy))
-      }
-      ENDBLOCK
-    }
-  }
-  return ressize;
-}
-
-size_t MakeCodeBias(const struct CodeBias *b, enum CodeBiasType type,
-    int moremessagesfollow, char *buffer, size_t size) {
-  unsigned int s, i, j;
-
-  STARTDATA
-
-  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
-    if (b->NumberOfSat[s] && (type == CBTYPE_AUTO || type == corbase[s] + COBOFS_CBIAS)) {
-      INITBLOCK
-      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_CBIAS)
-      switch (s) {
-        case CLOCKORBIT_SATGPS:
-        case CLOCKORBIT_SATGALILEO:
-        case CLOCKORBIT_SATQZSS:
-        case CLOCKORBIT_SATSBAS:
-        case CLOCKORBIT_SATBDS:
-          T_GPS_EPOCH_TIME(b->EpochTime[s])
-          break;
-        case CLOCKORBIT_SATGLONASS:
-          T_GLONASS_EPOCH_TIME(b->EpochTime[s])
-          break;
-      }
-      T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
-      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(b->SSRIOD)
-      T_SSR_PROVIDER_ID(b->SSRProviderID)
-      T_SSR_SOLUTION_ID(b->SSRSolutionID)
-      T_NO_OF_SATELLITES(b->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
-        switch (s) {
-          case CLOCKORBIT_SATGPS:
-          case CLOCKORBIT_SATGALILEO:
-          case CLOCKORBIT_SATSBAS:
-          case CLOCKORBIT_SATBDS:
-            T_GPS_SATELLITE_ID(b->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATQZSS:
-            T_QZSS_SATELLITE_ID(b->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATGLONASS:
-            T_GLONASS_SATELLITE_ID(b->Sat[i].ID)
-            break;
-        }
-        T_NO_OF_CODE_BIASES(b->Sat[i].NumberOfCodeBiases)
-        for (j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j) {
-          T_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
-          T_CODE_BIAS(b->Sat[i].Biases[j].Bias)
-        }
-      }
-      ENDBLOCK
-    }
-  }
-  return ressize;
-}
-
-size_t MakePhaseBias(const struct PhaseBias *b, enum PhaseBiasType type,
-    int moremessagesfollow, char *buffer, size_t size) {
-  unsigned int s, i, j;
-
-  STARTDATA
-
-  for (s = 0; s < CLOCKORBIT_SATNUM; ++s)       {
-    if (b->NumberOfSat[s] && (type == PBTYPE_AUTO || type == s + PBTYPE_BASE)) {
-      INITBLOCK
-      T_RTCM_MESSAGE_NUMBER(s + PBTYPE_BASE)
-      switch (s) {
-        case CLOCKORBIT_SATGPS:
-        case CLOCKORBIT_SATGALILEO:
-        case CLOCKORBIT_SATQZSS:
-        case CLOCKORBIT_SATSBAS:
-        case CLOCKORBIT_SATBDS:
-          T_GPS_EPOCH_TIME(b->EpochTime[s])
-          break;
-        case CLOCKORBIT_SATGLONASS:
-          T_GLONASS_EPOCH_TIME(b->EpochTime[s])
-          break;
-      }
-      T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
-      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-      T_SSR_IOD(b->SSRIOD)
-      T_SSR_PROVIDER_ID(b->SSRProviderID)
-      T_SSR_SOLUTION_ID(b->SSRSolutionID)
-      T_DISPERSIVE_BIAS_INDICATOR(b->DispersiveBiasConsistencyIndicator ? 1 : 0)
-      T_MW_CONSISTENCY_INDICATOR(b->MWConsistencyIndicator ? 1 : 0)
-      T_NO_OF_SATELLITES(b->NumberOfSat[s])
-      for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
-        switch (s) {
-          case CLOCKORBIT_SATGPS:
-            case CLOCKORBIT_SATGALILEO:
-            case CLOCKORBIT_SATSBAS:
-            case CLOCKORBIT_SATBDS:
-            T_GPS_SATELLITE_ID(b->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATQZSS:
-            T_QZSS_SATELLITE_ID(b->Sat[i].ID)
-            break;
-          case CLOCKORBIT_SATGLONASS:
-            T_GLONASS_SATELLITE_ID(b->Sat[i].ID)
-            break;
-        }
-        T_NO_OF_PHASE_BIASES(b->Sat[i].NumberOfPhaseBiases)
-        T_YAW_ANGLE(b->Sat[i].YawAngle)
-        T_YAW_RATE(b->Sat[i].YawRate)
-        for (j = 0; j < b->Sat[i].NumberOfPhaseBiases; ++j) {
-          T_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
-          T_INTEGER_INDICATOR(
-              b->Sat[i].Biases[j].SignalIntegerIndicator ? 1 : 0)
-          T_WIDE_LANE_INDICATOR(
-              b->Sat[i].Biases[j].SignalsWideLaneIntegerIndicator)
-          T_DISCONTINUITY_COUNTER(
-              b->Sat[i].Biases[j].SignalDiscontinuityCounter)
-          T_PHASE_BIAS(b->Sat[i].Biases[j].Bias)
-        }
-      }
-      ENDBLOCK
-    }
-  }
-  return ressize;
-}
-
-size_t MakeVTEC(const struct VTEC *v, int moremessagesfollow, char *buffer, size_t size) {
-  unsigned int l, o, d;
-
-  STARTDATA
-    INITBLOCK
-  T_RTCM_MESSAGE_NUMBER(VTEC_BASE)
-  T_GPS_EPOCH_TIME(v->EpochTime)
-  T_SSR_UPDATE_INTERVAL(v->UpdateInterval)
-  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
-  T_SSR_IOD(v->SSRIOD)
-  T_SSR_PROVIDER_ID(v->SSRProviderID)
-  T_SSR_SOLUTION_ID(v->SSRSolutionID)
-  T_VTEC_QUALITY_INDICATOR(v->Quality)
-  T_NO_IONO_LAYERS(v->NumLayers)
-  for (l = 0; l < v->NumLayers; ++l) {
-    T_IONO_HEIGHT(v->Layers[l].Height)
-    T_IONO_DEGREE(v->Layers[l].Degree)
-    T_IONO_ORDER(v->Layers[l].Order)
-    for (o = 0; o <= v->Layers[l].Order; ++o) {
-      for (d = o; d <= v->Layers[l].Degree; ++d) {
-        T_IONO_COEFF(v->Layers[l].Cosinus[d][o])
-      }
-    }
-    for (o = 1; o <= v->Layers[l].Order; ++o) {
-      for (d = o; d <= v->Layers[l].Degree; ++d) {
-        T_IONO_COEFF(v->Layers[l].Sinus[d][o])
-      }
-    }
-  }
-  ENDBLOCK
-  return ressize;
-}
-#endif /* NOENCODE */
-
-#ifndef NODECODE
-
-#define DECODESTART \
-  int numbits=0; \
-  uint64_t bitbuffer=0;
-
-#define LOADBITS(a) { \
-  while((a) > numbits) { \
-    if(!size--) return GCOBR_SHORTMESSAGE; \
-    bitbuffer = (bitbuffer<<8)|((unsigned char)*(buffer++)); \
-    numbits += 8; \
-  } \
-}
-
-/* extract bits from data stream
- b = variable to store result, a = number of bits */
-#define GETBITS(b, a) { \
-  LOADBITS(a) \
-  b = (bitbuffer<<(64-numbits))>>(64-(a)); \
-  numbits -= (a); \
-}
-
-/* extract bits from data stream
- b = variable to store result, a = number of bits */
-#define GETBITSFACTOR(b, a, c) { \
-  LOADBITS(a) \
-  b = ((bitbuffer<<(64-numbits))>>(64-(a)))*(c); \
-  numbits -= (a); \
-}
-
-/* extract signed floating value from data stream
- b = variable to store result, a = number of bits */
-#define GETFLOATSIGN(b, a, c) { \
-  LOADBITS(a) \
-  b = ((double)(((int64_t)(bitbuffer<<(64-numbits)))>>(64-(a))))*(c); \
-  numbits -= (a); \
-}
-
-/* extract floating value from data stream
- b = variable to store result, a = number of bits, c = scale factor */
-#define GETFLOAT(b, a, c) { \
-  LOADBITS(a) \
-  b = ((double)((bitbuffer<<(sizeof(bitbuffer)*8-numbits))>>(sizeof(bitbuffer)*8-(a))))*(c); \
-  numbits -= (a); \
-}
-
-#define SKIPBITS(b) { LOADBITS(b) numbits -= (b); }
-
-#define G_HEADER(a)                      GETBITS(a,  8)
-#define G_RESERVEDH(a)                   GETBITS(a,  6)
-#define G_SIZE(a)                        GETBITS(a, 10)
-
-/* GNSS macros - Header part */
-#define G_RTCM_MESSAGE_NUMBER(a)         GETBITS(a, 12)         /* DF002 */
-#define G_GPS_EPOCH_TIME(a, b)           {unsigned int temp; GETBITS(temp, 20) \
- if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;}
-#define G_GLONASS_EPOCH_TIME(a, b)       {unsigned int temp; GETBITS(temp, 17) \
- if(b && a != temp) return GCOBR_TIMEMISMATCH; a = temp;}
-#define G_EPOCH_TIME(a)                  GETBITS(a, 20)
-#define G_SSR_UPDATE_INTERVAL(a)         GETBITS(a,  4)
-#define G_MULTIPLE_MESSAGE_INDICATOR(a)  GETBITS(a,  1)
-#define G_SATELLITE_REFERENCE_DATUM(a)   GETBITS(a,  1)
-#define G_SSR_IOD(a)                     GETBITS(a,  4)
-#define G_SSR_PROVIDER_ID(a)             GETBITS(a, 16)
-#define G_SSR_SOLUTION_ID(a)             GETBITS(a,  4)
-#define G_NO_OF_SATELLITES(a)            GETBITS(a,  6)
-
-/* GNSS macros - Satellite specific part */
-#define G_GPS_SATELLITE_ID(a)            GETBITS(a,  6)           /* DF068 */
-#define G_QZSS_SATELLITE_ID(a)           GETBITS(a,  4)           /* DF249 */
-#define G_GLONASS_SATELLITE_ID(a)        GETBITS(a,  5)
-#define G_GPS_IODE(a)                    GETBITS(a,  8)           /* DF071 */
-#define G_GLONASS_IOD(a)                 GETBITS(a,  8)           /* DF237 */
-#define G_GALILEO_IOD(a)                 GETBITS(a, 10)          /* DF459 */
-#define G_SBAS_T0MOD(a)                  GETBITSFACTOR(a, 9, 16) /* DF468 */
-#define G_SBAS_IODCRC(a)                 GETBITS(a, 24)          /* DF469 */
-#define G_BDS_TOEMOD(a)                  GETBITSFACTOR(a, 10, 8) /* DF470 */
-#define G_BDS_IOD(a)                     GETBITS(a,  8)           /* DF471 */
-
-#define G_DELTA_RADIAL(a)                GETFLOATSIGN(a, 22, 1/10000.0)
-#define G_DELTA_ALONG_TRACK(a)           GETFLOATSIGN(a, 20, 1/2500.0)
-#define G_DELTA_CROSS_TRACK(a)           GETFLOATSIGN(a, 20, 1/2500.0)
-#define G_DELTA_DOT_RADIAL(a)            GETFLOATSIGN(a, 21, 1/1000000.0)
-#define G_DELTA_DOT_ALONG_TRACK(a)       GETFLOATSIGN(a, 19, 1/250000.0)
-#define G_DELTA_DOT_CROSS_TRACK(a)       GETFLOATSIGN(a, 19, 1/250000.0)
-
-#define G_DELTA_CLOCK_C0(a)              GETFLOATSIGN(a, 22, 1/10000.0)
-#define G_DELTA_CLOCK_C1(a)              GETFLOATSIGN(a, 21, 1/1000000.0)
-#define G_DELTA_CLOCK_C2(a)              GETFLOATSIGN(a, 27, 1/50000000.0)
-#define G_HR_CLOCK_CORRECTION(a)         GETFLOATSIGN(a, 22, 1/10000.0)
-
-#define G_NO_OF_CODE_BIASES(a)           GETBITS(a, 5)
-#define G_NO_OF_PHASE_BIASES(a)          GETBITS(a, 5)
-#define G_SIGNAL_IDENTIFIER(a)           GETBITS(a, 5)
-#define G_CODE_BIAS(a)                   GETFLOATSIGN(a, 14, 1/100.0)
-#define G_YAW_ANGLE(a)                   GETFLOAT(a, 9, MPI/256.0)
-#define G_YAW_RATE(a)                    GETFLOATSIGN(a,  8, MPI/8192.0)
-#define G_PHASE_BIAS(a)                  GETFLOATSIGN(a, 20, 1/10000.0)
-
-/* Phase specific part of GNSS phase bias message */
-#define G_DISPERSIVE_BIAS_INDICATOR(a)   GETBITS(a, 1)
-#define G_MW_CONSISTENCY_INDICATOR(a)    GETBITS(a, 1)
-#define G_INTEGER_INDICATOR(a)           GETBITS(a, 1)
-#define G_WIDE_LANE_INDICATOR(a)         GETBITS(a, 2)
-#define G_DISCONTINUITY_COUNTER(a)       GETBITS(a, 4)
-
-/* URA */
-#define G_SSR_URA(a)                     {int temp; GETBITS(temp, 6) \
- (a) = URAToValue(temp);}
-
-/* Ionosphere */
-#define G_NO_IONO_LAYERS(a) {unsigned int temp; GETBITS(temp, 2) a = temp+1; }
-#define G_IONO_HEIGHT(a)                 GETFLOAT(a, 8 ,    10000.0)
-#define G_IONO_DEGREE(a)    {unsigned int temp; GETBITS(temp, 4) a = temp+1; }
-#define G_IONO_ORDER(a)     {unsigned int temp; GETBITS(temp, 4) a = temp+1; }
-#define G_IONO_COEFF(a)                  GETFLOATSIGN(a, 16,1/200.0)
-#define G_VTEC_QUALITY_INDICATOR(a)      GETFLOAT    (a,  9,      1/20.0)
-
-enum GCOB_RETURN GetSSR(struct ClockOrbit *co, struct CodeBias *b,struct VTEC *v,
-    struct PhaseBias *pb, const char *buffer, size_t size, int *bytesused) {
-  int mmi = 0, h, rs;
-  unsigned int type, pos, i, j, s, nums, id;
-  size_t sizeofrtcmblock;
-  const char *blockstart = buffer;
-  DECODESTART
-
-  if (size < 7)
-    return GCOBR_SHORTBUFFER;
-
-#ifdef BNC_DEBUG
-  fprintf(stderr, "GetSSR START: size %d, numbits %d\n",(int)size, numbits);
-#endif
-
-  G_HEADER(h)
-  G_RESERVEDH(rs)
-  G_SIZE(sizeofrtcmblock);
-
-  if ((unsigned char) h != 0xD3 || rs)
-    return GCOBR_UNKNOWNDATA;
-  if (size < sizeofrtcmblock + 3) /* 3 header bytes already removed */
-    return GCOBR_MESSAGEEXCEEDSBUFFER;
-  if (CRC24(sizeofrtcmblock + 3, (const unsigned char *) blockstart) !=
-      (uint32_t) ((((unsigned char) buffer[sizeofrtcmblock]) << 16) |
-          (((unsigned char) buffer[sizeofrtcmblock + 1]) << 8) |
-          (((unsigned char) buffer[sizeofrtcmblock + 2]))))
-    return GCOBR_CRCMISMATCH;
-  size = sizeofrtcmblock; /* reduce size, so overflows are detected */
-
-  G_RTCM_MESSAGE_NUMBER(type)
-#ifdef BNC_DEBUG
-  fprintf(stderr, "type %d size %d\n",type,(int)sizeofrtcmblock);
-#endif
-  if (bytesused)
-    *bytesused = sizeofrtcmblock + 6;
-  if (type == VTEC_BASE) {
-    unsigned int l, o, d;
-    if (!v)
-      return GCOBR_NOVTECPARAMETER;
-    memset(v, 0, sizeof(*v));
-    G_EPOCH_TIME(v->EpochTime)
-    G_SSR_UPDATE_INTERVAL(v->UpdateInterval)
-    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-    G_SSR_IOD(v->SSRIOD)
-    G_SSR_PROVIDER_ID(v->SSRProviderID)
-    G_SSR_SOLUTION_ID(v->SSRSolutionID)
-    G_VTEC_QUALITY_INDICATOR(v->Quality)
-    G_NO_IONO_LAYERS(v->NumLayers)
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d ssrIod %d providerId %d solId %d vtecQ %8.3f numLay %d \n",
-        		  v->EpochTime, v->UpdateInterval, mmi,
-				  v->SSRIOD, v->SSRProviderID, v->SSRSolutionID, v->Quality, v->NumLayers);
-#endif
-    for (l = 0; l < v->NumLayers; ++l) {
-      G_IONO_HEIGHT(v->Layers[l].Height)
-      G_IONO_DEGREE(v->Layers[l].Degree)
-      G_IONO_ORDER(v->Layers[l].Order)
-#ifdef BNC_DEBUG
-          fprintf(stderr, "h  %8.3f deg %d ord %d \n",
-        		  v->Layers[l].Height, v->Layers[l].Degree, v->Layers[l].Order);
-#endif
-      for (o = 0; o <= v->Layers[l].Order; ++o) {
-        for (d = o; d <= v->Layers[l].Degree; ++d) {
-          G_IONO_COEFF(v->Layers[l].Cosinus[d][o])
-#ifdef BNC_DEBUG
-          fprintf(stderr, "C[%02d][%02d]  %8.3f \n",
-        		  d, o, v->Layers[l].Cosinus[d][o]);
-#endif
-        }
-      }
-      for (o = 1; o <= v->Layers[l].Order; ++o) {
-        for (d = o; d <= v->Layers[l].Degree; ++d) {
-          G_IONO_COEFF(v->Layers[l].Sinus[d][o])
-#ifdef BNC_DEBUG
-          fprintf(stderr, "S[%02d][%02d]  %8.3f \n",
-        		  d, o, v->Layers[l].Sinus[d][o]);
-#endif
-        }
-      }
-    }
-#ifdef BNC_DEBUG
-    for(type = 0; type < (unsigned int)size && (unsigned char)buffer[type] != 0xD3; ++type)
-    numbits += 8;
-    fprintf(stderr, "numbits left %d\n",numbits);
-#endif
-    return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
-  }
-  for (s = CLOCKORBIT_SATNUM; s-- > 0;) {
-    if (type == PBTYPE_BASE + s) {
-      if (!pb)
-        return GCOBR_NOPHASEBIASPARAMETER;
-      pb->messageType = type;
-      switch (s) {
-        case CLOCKORBIT_SATGPS:
-        case CLOCKORBIT_SATGALILEO:
-        case CLOCKORBIT_SATQZSS:
-        case CLOCKORBIT_SATSBAS:
-        case CLOCKORBIT_SATBDS:
-          G_GPS_EPOCH_TIME(pb->EpochTime[s], pb->NumberOfSat[s])
-          break;
-        case CLOCKORBIT_SATGLONASS:
-          G_GLONASS_EPOCH_TIME(pb->EpochTime[s], pb->NumberOfSat[s])
-          break;
-      }
-      G_SSR_UPDATE_INTERVAL(pb->UpdateInterval)
-      G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-      G_SSR_IOD(pb->SSRIOD)
-      G_SSR_PROVIDER_ID(pb->SSRProviderID)
-      G_SSR_SOLUTION_ID(pb->SSRSolutionID)
-      G_DISPERSIVE_BIAS_INDICATOR(pb->DispersiveBiasConsistencyIndicator)
-      G_MW_CONSISTENCY_INDICATOR(pb->MWConsistencyIndicator)
-      G_NO_OF_SATELLITES(nums)
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d dispInd %d mwInd %d\n",
-        		  pb->EpochTime[s], pb->UpdateInterval,mmi,pb->NumberOfSat[s],nums,
-				  pb->SSRIOD, pb->SSRProviderID, pb->SSRSolutionID,
-				  pb->DispersiveBiasConsistencyIndicator, pb->MWConsistencyIndicator);
-#endif
-      for (i = 0; i < nums; ++i) {
-        switch (s) {
-          case CLOCKORBIT_SATGPS:
-          case CLOCKORBIT_SATGALILEO:
-          case CLOCKORBIT_SATSBAS:
-          case CLOCKORBIT_SATBDS:
-            G_GPS_SATELLITE_ID(id)
-            break;
-          case CLOCKORBIT_SATQZSS:
-            G_QZSS_SATELLITE_ID(id)
-            break;
-          case CLOCKORBIT_SATGLONASS:
-            G_GLONASS_SATELLITE_ID(id)
-            break;
-        }
-        for (pos = satoffset[s];
-            pos < satoffset[s] + pb->NumberOfSat[s] && pb->Sat[pos].ID != id;
-            ++pos)
-          ;
-        if (pos >= satoffset[s + 1])
-          return GCOBR_DATAMISMATCH;
-        else if (pos == pb->NumberOfSat[s] + satoffset[s])
-          ++pb->NumberOfSat[s];
-        pb->Sat[pos].ID = id;
-        G_NO_OF_PHASE_BIASES(pb->Sat[pos].NumberOfPhaseBiases)
-        G_YAW_ANGLE(pb->Sat[pos].YawAngle)
-        G_YAW_RATE(pb->Sat[pos].YawRate)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d #%d y %10.6f yr %10.6f ",
-                    pb->Sat[pos].ID, pb->Sat[pos].NumberOfPhaseBiases,
-					pb->Sat[pos].YawAngle/MPI, pb->Sat[pos].YawRate/MPI);
-#endif
-        for (j = 0; j < pb->Sat[pos].NumberOfPhaseBiases; ++j) {
-          G_SIGNAL_IDENTIFIER(pb->Sat[pos].Biases[j].Type)
-          G_INTEGER_INDICATOR(pb->Sat[pos].Biases[j].SignalIntegerIndicator)
-          G_WIDE_LANE_INDICATOR(
-              pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator)
-          G_DISCONTINUITY_COUNTER(
-              pb->Sat[pos].Biases[j].SignalDiscontinuityCounter)
-          G_PHASE_BIAS(pb->Sat[pos].Biases[j].Bias)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "t%02d int %d wl %d disc %d b %8.4f ",
-                    pb->Sat[pos].Biases[j].Type,
-					pb->Sat[pos].Biases[j].SignalIntegerIndicator,
-					pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator,
-					pb->Sat[pos].Biases[j].SignalDiscontinuityCounter,
-					pb->Sat[pos].Biases[j].Bias);
-#endif
-        }
-#ifdef BNC_DEBUG
-            fprintf(stderr, "\n");
-#endif
-      }
-#ifdef BNC_DEBUG
-      for(type = 0; type < (unsigned int)size && (unsigned char)buffer[type] != 0xD3; ++type)
-      numbits += 8;
-      fprintf(stderr, "numbits left %d\n",numbits);
-#endif
-      return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
-    }
-    else if (type >= corbase[s]) {
-      switch (type - corbase[s]) {
-        case COBOFS_ORBIT:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          switch (s) {
-            case CLOCKORBIT_SATGPS:
-            case CLOCKORBIT_SATGALILEO:
-            case CLOCKORBIT_SATQZSS:
-            case CLOCKORBIT_SATSBAS:
-            case CLOCKORBIT_SATBDS:
-              G_GPS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-            case CLOCKORBIT_SATGLONASS:
-              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-          }
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_ORBIT] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            switch (s) {
-              case CLOCKORBIT_SATGPS:
-              case CLOCKORBIT_SATGALILEO:
-              case CLOCKORBIT_SATSBAS:
-              case CLOCKORBIT_SATBDS:
-                G_GPS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATQZSS:
-                G_QZSS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATGLONASS:
-                G_GLONASS_SATELLITE_ID(id)
-                break;
-            }
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-
-            switch (s) {
-              case CLOCKORBIT_SATGPS:
-                case CLOCKORBIT_SATQZSS:
-                G_GPS_IODE(co->Sat[pos].IOD)
-                break;
-              case CLOCKORBIT_SATGLONASS:
-                G_GLONASS_IOD(co->Sat[pos].IOD)
-                break;
-              case CLOCKORBIT_SATGALILEO:
-                G_GALILEO_IOD(co->Sat[pos].IOD)
-                break;
-              case CLOCKORBIT_SATSBAS:
-                G_SBAS_T0MOD(co->Sat[pos].toe)
-                G_SBAS_IODCRC(co->Sat[pos].IOD)
-                break;
-              case CLOCKORBIT_SATBDS:
-                G_BDS_TOEMOD(co->Sat[pos].toe)
-                G_BDS_IOD(co->Sat[pos].IOD)
-                break;
-            }
-            G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
-            G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
-            G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
-            G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
-            G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
-            G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d iod %3d dr %8.4f da %8.4f dc %8.4f dr %8.3f da %8.3f dc %8.3f\n",
-                co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
-                co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
-                co->Sat[pos].Orbit.DotDeltaRadial,
-                co->Sat[pos].Orbit.DotDeltaAlongTrack,
-                co->Sat[pos].Orbit.DotDeltaCrossTrack);
-#endif
-          }
-          break;
-        case COBOFS_CLOCK:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          switch (s) {
-            case CLOCKORBIT_SATGPS:
-            case CLOCKORBIT_SATGALILEO:
-            case CLOCKORBIT_SATQZSS:
-            case CLOCKORBIT_SATSBAS:
-            case CLOCKORBIT_SATBDS:
-              G_GPS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-            case CLOCKORBIT_SATGLONASS:
-              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-          }
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_CLOCK] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            switch (s) {
-              case CLOCKORBIT_SATGPS:
-                case CLOCKORBIT_SATGALILEO:
-                case CLOCKORBIT_SATSBAS:
-                case CLOCKORBIT_SATBDS:
-                G_GPS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATQZSS:
-                G_QZSS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATGLONASS:
-                G_GLONASS_SATELLITE_ID(id)
-                break;
-            }
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-
-            G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
-            G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
-            G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d c0 %8.3f c1 %8.3f c2 %8.3f\n",
-                co->Sat[pos].ID, co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1,
-                co->Sat[pos].Clock.DeltaA2);
-#endif
-          }
-          break;
-        case COBOFS_COMBINED:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          switch (s) {
-            case CLOCKORBIT_SATGPS:
-            case CLOCKORBIT_SATGALILEO:
-            case CLOCKORBIT_SATQZSS:
-            case CLOCKORBIT_SATSBAS:
-            case CLOCKORBIT_SATBDS:
-              G_GPS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-            case CLOCKORBIT_SATGLONASS:
-              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-          }
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_ORBIT] |= 1;
-          co->Supplied[COBOFS_CLOCK] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            switch (s) {
-              case CLOCKORBIT_SATGPS:
-              case CLOCKORBIT_SATGALILEO:
-              case CLOCKORBIT_SATSBAS:
-              case CLOCKORBIT_SATBDS:
-                G_GPS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATQZSS:
-                G_QZSS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATGLONASS:
-                G_GLONASS_SATELLITE_ID(id)
-                break;
-            }
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-
-            switch (s) {
-              case CLOCKORBIT_SATGPS:
-                case CLOCKORBIT_SATQZSS:
-                G_GPS_IODE(co->Sat[pos].IOD)
-                break;
-              case CLOCKORBIT_SATGLONASS:
-                G_GLONASS_IOD(co->Sat[pos].IOD)
-                break;
-              case CLOCKORBIT_SATGALILEO:
-                G_GALILEO_IOD(co->Sat[pos].IOD)
-                break;
-              case CLOCKORBIT_SATSBAS:
-                G_SBAS_T0MOD(co->Sat[pos].toe)
-                G_SBAS_IODCRC(co->Sat[pos].IOD)
-                break;
-              case CLOCKORBIT_SATBDS:
-                G_BDS_TOEMOD(co->Sat[pos].toe)
-                G_BDS_IOD(co->Sat[pos].IOD)
-                break;
-            }
-            G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
-            G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
-            G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
-            G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
-            G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
-            G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
-            G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
-            G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
-            G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d iod %3d dr %10.6f da %10.6f dc %10.6f dr %10.6f da %10.6f dc %10.6f  c0 %10.6f c1 %10.6f c2 %10.6f\n",
-                co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
-                co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
-                co->Sat[pos].Orbit.DotDeltaRadial, co->Sat[pos].Orbit.DotDeltaAlongTrack,
-                co->Sat[pos].Orbit.DotDeltaCrossTrack,
-				co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1, co->Sat[pos].Clock.DeltaA2);
-#endif
-          }
-          break;
-        case COBOFS_URA:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          switch (s) {
-            case CLOCKORBIT_SATGPS:
-            case CLOCKORBIT_SATGALILEO:
-            case CLOCKORBIT_SATQZSS:
-            case CLOCKORBIT_SATSBAS:
-            case CLOCKORBIT_SATBDS:
-              G_GPS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-            case CLOCKORBIT_SATGLONASS:
-              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-          }
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_URA] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            switch (s) {
-              case CLOCKORBIT_SATGPS:
-              case CLOCKORBIT_SATGALILEO:
-              case CLOCKORBIT_SATSBAS:
-              case CLOCKORBIT_SATBDS:
-                G_GPS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATQZSS:
-                G_QZSS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATGLONASS:
-                G_GLONASS_SATELLITE_ID(id)
-                break;
-            }
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-            G_SSR_URA(co->Sat[pos].UserRangeAccuracy)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d ura %8.3f \n",
-                co->Sat[pos].ID, co->Sat[pos].UserRangeAccuracy);
-#endif
-          }
-          break;
-        case COBOFS_HR:
-          if (!co)
-            return GCOBR_NOCLOCKORBITPARAMETER;
-          co->messageType = type;
-          switch (s) {
-            case CLOCKORBIT_SATGPS:
-            case CLOCKORBIT_SATGALILEO:
-            case CLOCKORBIT_SATQZSS:
-            case CLOCKORBIT_SATSBAS:
-            case CLOCKORBIT_SATBDS:
-              G_GPS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-            case CLOCKORBIT_SATGLONASS:
-              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
-              break;
-          }
-          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(co->SSRIOD)
-          G_SSR_PROVIDER_ID(co->SSRProviderID)
-          G_SSR_SOLUTION_ID(co->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-          co->Supplied[COBOFS_HR] |= 1;
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
-        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
-				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            switch (s) {
-              case CLOCKORBIT_SATGPS:
-              case CLOCKORBIT_SATGALILEO:
-              case CLOCKORBIT_SATSBAS:
-              case CLOCKORBIT_SATBDS:
-                G_GPS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATQZSS:
-                G_QZSS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATGLONASS:
-                G_GLONASS_SATELLITE_ID(id)
-                break;
-            }
-            for (pos = satoffset[s];
-                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == co->NumberOfSat[s] + satoffset[s])
-              ++co->NumberOfSat[s];
-            co->Sat[pos].ID = id;
-            G_HR_CLOCK_CORRECTION(co->Sat[pos].hrclock)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d hrClock %8.3f \n",
-                    co->Sat[pos].ID, co->Sat[pos].hrclock);
-#endif
-          }
-          break;
-        case COBOFS_CBIAS:
-          if (!b)
-            return GCOBR_NOCODEBIASPARAMETER;
-          b->messageType = type;
-          switch (s) {
-            case CLOCKORBIT_SATGPS:
-            case CLOCKORBIT_SATGALILEO:
-            case CLOCKORBIT_SATQZSS:
-            case CLOCKORBIT_SATSBAS:
-            case CLOCKORBIT_SATBDS:
-              G_GPS_EPOCH_TIME(b->EpochTime[s], b->NumberOfSat[s])
-              break;
-            case CLOCKORBIT_SATGLONASS:
-              G_GLONASS_EPOCH_TIME(b->EpochTime[s], b->NumberOfSat[s])
-              break;
-          }
-          G_SSR_UPDATE_INTERVAL(b->UpdateInterval)
-          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
-          G_SSR_IOD(b->SSRIOD)
-          G_SSR_PROVIDER_ID(b->SSRProviderID)
-          G_SSR_SOLUTION_ID(b->SSRSolutionID)
-          G_NO_OF_SATELLITES(nums)
-#ifdef BNC_DEBUG
-          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
-        		  b->EpochTime[s], b->UpdateInterval,mmi,b->NumberOfSat[s],nums,
-				  b->SSRIOD, b->SSRProviderID, b->SSRSolutionID);
-#endif
-          for (i = 0; i < nums; ++i) {
-            switch (s) {
-              case CLOCKORBIT_SATGPS:
-              case CLOCKORBIT_SATGALILEO:
-              case CLOCKORBIT_SATSBAS:
-              case CLOCKORBIT_SATBDS:
-                G_GPS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATQZSS:
-                G_QZSS_SATELLITE_ID(id)
-                break;
-              case CLOCKORBIT_SATGLONASS:
-                G_GLONASS_SATELLITE_ID(id)
-                break;
-            }
-            for (pos = satoffset[s];
-                pos < satoffset[s] + b->NumberOfSat[s] && b->Sat[pos].ID != id;
-                ++pos)
-              ;
-            if (pos >= satoffset[s + 1])
-              return GCOBR_DATAMISMATCH;
-            else if (pos == b->NumberOfSat[s] + satoffset[s])
-              ++b->NumberOfSat[s];
-            b->Sat[pos].ID = id;
-            G_NO_OF_CODE_BIASES(b->Sat[pos].NumberOfCodeBiases)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "id %2d #%d ",
-                    b->Sat[pos].ID, b->Sat[pos].NumberOfCodeBiases);
-#endif
-            for (j = 0; j < b->Sat[pos].NumberOfCodeBiases; ++j) {
-              G_SIGNAL_IDENTIFIER(b->Sat[pos].Biases[j].Type)
-              G_CODE_BIAS(b->Sat[pos].Biases[j].Bias)
-#ifdef BNC_DEBUG
-            fprintf(stderr, "t%02d b %8.2f ",
-                    b->Sat[pos].Biases[j].Type, b->Sat[pos].Biases[j].Bias);
-#endif
-            }
-#ifdef BNC_DEBUG
-            fprintf(stderr, "\n");
-#endif
-          }
-          break;
-        default:
-          continue;
-      }
-#ifdef BNC_DEBUG
-      for(type = 0; type < (unsigned int)size && (unsigned char)buffer[type] != 0xD3; ++type)
-      numbits += 8;
-      fprintf(stderr, "numbits left %d\n",numbits);
-#endif
-      return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
-    }
-  }
-  return GCOBR_UNKNOWNTYPE;
-}
-#endif /* NODECODE */
Index: /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.cpp
===================================================================
--- /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.cpp	(revision 9025)
+++ /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.cpp	(revision 9025)
@@ -0,0 +1,1353 @@
+/* Programheader
+
+ Name:           clock_orbit_rtcm.c
+ Project:        RTCM3
+ Version:        $Id: clock_orbit_rtcm.c 8996 2020-07-22 08:29:10Z stuerze $
+ Authors:        Dirk Stöcker
+ Description:    state space approach: RTCM
+ */
+
+#include <math.h>
+#include <stdio.h>
+#include <string.h>
+#ifndef sparc
+#include <stdint.h>
+#else
+#include <sys/types.h>
+#endif
+#include "clock_orbit_rtcm.h"
+
+
+size_t SsrCorrRtcm::MakeClockOrbit(const struct ClockOrbit *co, ClockOrbitType type,
+    int moremessagesfollow, char *buffer, size_t size) {
+  unsigned int status[CLOCKORBIT_SATNUM][COBOFS_NUM], i, s;
+
+  memset(status, 0, sizeof(status));
+
+  STARTDATA
+
+  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
+    for (i = 0; i < COBOFS_NUM; ++i) {
+      if (co->NumberOfSat[s] && (type == COTYPE_AUTO || type == corbase[s] + i) &&
+           (co->Supplied[i] || (i <= COBOFS_CLOCK &&  co->Supplied[COBOFS_COMBINED]) ||
+           (i == COBOFS_COMBINED && co->Supplied[COBOFS_ORBIT] && co->Supplied[COBOFS_CLOCK]))) {
+        status[s][i] = 1;
+        if (i == COBOFS_COMBINED) {
+          status[s][COBOFS_ORBIT] = status[s][COBOFS_CLOCK] = 0;
+        } /* disable single blocks for combined type */
+      } /* check for data */
+    } /* iterate over RTCM data types */
+  } /* iterate over satellite systems */
+
+  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
+    if (status[s][COBOFS_ORBIT]) {
+      INITBLOCK
+      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_ORBIT)
+      switch (s) {
+        case CLOCKORBIT_SATGPS:
+        case CLOCKORBIT_SATGALILEO:
+        case CLOCKORBIT_SATQZSS:
+        case CLOCKORBIT_SATSBAS:
+        case CLOCKORBIT_SATBDS:
+          T_SSR_EPOCH_TIME(co->EpochTime[s])
+          break;
+        case CLOCKORBIT_SATGLONASS:
+          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
+          break;
+      }
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
+        switch (s)         {
+          case CLOCKORBIT_SATGPS:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            T_GPS_IODE(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATGLONASS:
+            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
+            T_GLONASS_IOD(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATGALILEO:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            T_GALILEO_IOD(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATQZSS:
+            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
+            T_GPS_IODE(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATSBAS:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            T_SBAS_T0MOD(co->Sat[i].toe)
+            T_SBAS_IODCRC(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATBDS:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            T_BDS_TOEMOD(co->Sat[i].toe)
+            T_BDS_IOD(co->Sat[i].IOD)
+            break;
+        }
+        T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
+        T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
+        T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
+        T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
+        T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
+        T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
+      }
+      ENDBLOCK
+    }
+    if (status[s][COBOFS_CLOCK]) {
+      INITBLOCK
+      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_CLOCK)
+      switch (s) {
+        case CLOCKORBIT_SATGPS:
+        case CLOCKORBIT_SATGALILEO:
+        case CLOCKORBIT_SATQZSS:
+        case CLOCKORBIT_SATSBAS:
+        case CLOCKORBIT_SATBDS:
+          T_SSR_EPOCH_TIME(co->EpochTime[s])
+          break;
+        case CLOCKORBIT_SATGLONASS:
+          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
+          break;
+      }
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
+        switch (s) {
+          case CLOCKORBIT_SATGPS:
+          case CLOCKORBIT_SATGALILEO:
+          case CLOCKORBIT_SATSBAS:
+          case CLOCKORBIT_SATBDS:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATQZSS:
+            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATGLONASS:
+            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
+            break;
+        }
+        T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
+        T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
+        T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
+      }
+      ENDBLOCK
+    }
+    if (status[s][COBOFS_COMBINED]) {
+#ifdef SPLITBLOCK
+      int nums = co->NumberOfSat[s];
+      int left, start = satoffset[s];
+      if(nums > 28) {/* split block when more than 28 sats */
+        left = nums - 28;
+        nums = 28;
+      }
+      else {
+        left = 0;
+      }
+      while(nums) {
+#endif
+      INITBLOCK
+      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_COMBINED)
+      switch (s) {
+        case CLOCKORBIT_SATGPS:
+        case CLOCKORBIT_SATGALILEO:
+        case CLOCKORBIT_SATQZSS:
+        case CLOCKORBIT_SATSBAS:
+        case CLOCKORBIT_SATBDS:
+          T_SSR_EPOCH_TIME(co->EpochTime[s])
+          break;
+        case CLOCKORBIT_SATGLONASS:
+          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
+          break;
+      }
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+#ifdef SPLITBLOCK
+      T_MULTIPLE_MESSAGE_INDICATOR((moremessagesfollow || left) ? 1 : 0)
+#else
+      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+#endif
+      T_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+#ifdef SPLITBLOCK
+      T_NO_OF_SATELLITES(nums)
+      for(i = start; i < start+nums; ++i)
+#else
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i)
+#endif
+      {
+        switch (s) {
+          case CLOCKORBIT_SATGPS:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            T_GPS_IODE(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATGLONASS:
+            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
+            T_GLONASS_IOD(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATGALILEO:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            T_GALILEO_IOD(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATQZSS:
+            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
+            T_GPS_IODE(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATSBAS:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            T_SBAS_T0MOD(co->Sat[i].toe)
+            T_SBAS_IODCRC(co->Sat[i].IOD)
+            break;
+          case CLOCKORBIT_SATBDS:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            T_BDS_TOEMOD(co->Sat[i].toe)
+            T_BDS_IOD(co->Sat[i].IOD)
+            break;
+        }
+        T_DELTA_RADIAL(co->Sat[i].Orbit.DeltaRadial)
+        T_DELTA_ALONG_TRACK(co->Sat[i].Orbit.DeltaAlongTrack)
+        T_DELTA_CROSS_TRACK(co->Sat[i].Orbit.DeltaCrossTrack)
+        T_DELTA_DOT_RADIAL(co->Sat[i].Orbit.DotDeltaRadial)
+        T_DELTA_DOT_ALONG_TRACK(co->Sat[i].Orbit.DotDeltaAlongTrack)
+        T_DELTA_DOT_CROSS_TRACK(co->Sat[i].Orbit.DotDeltaCrossTrack)
+        T_DELTA_CLOCK_C0(co->Sat[i].Clock.DeltaA0)
+        T_DELTA_CLOCK_C1(co->Sat[i].Clock.DeltaA1)
+        T_DELTA_CLOCK_C2(co->Sat[i].Clock.DeltaA2)
+      }
+      ENDBLOCK
+#ifdef SPLITBLOCK
+      start += nums;
+      nums = left;
+      left = 0;
+    }
+#endif
+    }
+    if (status[s][COBOFS_HR]) {
+      INITBLOCK
+      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_HR)
+      switch (s) {
+        case CLOCKORBIT_SATGPS:
+        case CLOCKORBIT_SATGALILEO:
+        case CLOCKORBIT_SATQZSS:
+        case CLOCKORBIT_SATSBAS:
+        case CLOCKORBIT_SATBDS:
+          T_SSR_EPOCH_TIME(co->EpochTime[s])
+          break;
+        case CLOCKORBIT_SATGLONASS:
+          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
+          break;
+      }
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
+        switch (s) {
+          case CLOCKORBIT_SATGPS:
+            case CLOCKORBIT_SATGALILEO:
+            case CLOCKORBIT_SATSBAS:
+            case CLOCKORBIT_SATBDS:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATQZSS:
+            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATGLONASS:
+            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
+            break;
+        }
+        T_HR_CLOCK_CORRECTION(co->Sat[i].hrclock)
+      }
+      ENDBLOCK
+    }
+    if (status[s][COBOFS_URA]) {
+      INITBLOCK
+      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_URA)
+      switch (s) {
+        case CLOCKORBIT_SATGPS:
+        case CLOCKORBIT_SATGALILEO:
+        case CLOCKORBIT_SATQZSS:
+        case CLOCKORBIT_SATSBAS:
+        case CLOCKORBIT_SATBDS:
+          T_SSR_EPOCH_TIME(co->EpochTime[s])
+          break;
+        case CLOCKORBIT_SATGLONASS:
+          T_GLONASS_EPOCH_TIME(co->EpochTime[s])
+          break;
+      }
+      T_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(co->SSRIOD)
+      T_SSR_PROVIDER_ID(co->SSRProviderID)
+      T_SSR_SOLUTION_ID(co->SSRSolutionID)
+      T_NO_OF_SATELLITES(co->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + co->NumberOfSat[s]; ++i) {
+        switch (s) {
+          case CLOCKORBIT_SATGPS:
+          case CLOCKORBIT_SATGALILEO:
+          case CLOCKORBIT_SATSBAS:
+          case CLOCKORBIT_SATBDS:
+            T_GPS_SATELLITE_ID(co->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATQZSS:
+            T_QZSS_SATELLITE_ID(co->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATGLONASS:
+            T_GLONASS_SATELLITE_ID(co->Sat[i].ID)
+            break;
+        }
+        T_SSR_URA(ValueToURA(co->Sat[i].UserRangeAccuracy))
+      }
+      ENDBLOCK
+    }
+  }
+  return ressize;
+}
+
+size_t SsrCorrRtcm::MakeCodeBias(const struct CodeBias *b, CodeBiasType type,
+    int moremessagesfollow, char *buffer, size_t size) {
+  unsigned int s, i, j;
+
+  STARTDATA
+
+  for (s = 0; s < CLOCKORBIT_SATNUM; ++s) {
+    if (b->NumberOfSat[s] && (type == CBTYPE_AUTO || type == corbase[s] + COBOFS_CBIAS)) {
+      INITBLOCK
+      T_RTCM_MESSAGE_NUMBER(corbase[s] + COBOFS_CBIAS)
+      switch (s) {
+        case CLOCKORBIT_SATGPS:
+        case CLOCKORBIT_SATGALILEO:
+        case CLOCKORBIT_SATQZSS:
+        case CLOCKORBIT_SATSBAS:
+        case CLOCKORBIT_SATBDS:
+          T_SSR_EPOCH_TIME(b->EpochTime[s])
+          break;
+        case CLOCKORBIT_SATGLONASS:
+          T_GLONASS_EPOCH_TIME(b->EpochTime[s])
+          break;
+      }
+      T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
+      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(b->SSRIOD)
+      T_SSR_PROVIDER_ID(b->SSRProviderID)
+      T_SSR_SOLUTION_ID(b->SSRSolutionID)
+      T_NO_OF_SATELLITES(b->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
+        switch (s) {
+          case CLOCKORBIT_SATGPS:
+          case CLOCKORBIT_SATGALILEO:
+          case CLOCKORBIT_SATSBAS:
+          case CLOCKORBIT_SATBDS:
+            T_GPS_SATELLITE_ID(b->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATQZSS:
+            T_QZSS_SATELLITE_ID(b->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATGLONASS:
+            T_GLONASS_SATELLITE_ID(b->Sat[i].ID)
+            break;
+        }
+        T_NO_OF_BIASES(b->Sat[i].NumberOfCodeBiases)
+        for (j = 0; j < b->Sat[i].NumberOfCodeBiases; ++j) {
+          T_GNSS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
+          T_CODE_BIAS(b->Sat[i].Biases[j].Bias)
+        }
+      }
+      ENDBLOCK
+    }
+  }
+  return ressize;
+}
+
+size_t SsrCorrRtcm::MakePhaseBias(const struct PhaseBias *b, PhaseBiasType type,
+    int moremessagesfollow, char *buffer, size_t size) {
+  unsigned int s, i, j;
+
+  STARTDATA
+
+  for (s = 0; s < CLOCKORBIT_SATNUM; ++s)       {
+    if (b->NumberOfSat[s] && (type == PBTYPE_AUTO || type == s + PBTYPE_BASE)) {
+      INITBLOCK
+      T_RTCM_MESSAGE_NUMBER(s + PBTYPE_BASE)
+      switch (s) {
+        case CLOCKORBIT_SATGPS:
+        case CLOCKORBIT_SATGALILEO:
+        case CLOCKORBIT_SATQZSS:
+        case CLOCKORBIT_SATSBAS:
+        case CLOCKORBIT_SATBDS:
+          T_SSR_EPOCH_TIME(b->EpochTime[s])
+          break;
+        case CLOCKORBIT_SATGLONASS:
+          T_GLONASS_EPOCH_TIME(b->EpochTime[s])
+          break;
+      }
+      T_SSR_UPDATE_INTERVAL(b->UpdateInterval)
+      T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+      T_SSR_IOD(b->SSRIOD)
+      T_SSR_PROVIDER_ID(b->SSRProviderID)
+      T_SSR_SOLUTION_ID(b->SSRSolutionID)
+      T_DISPERSIVE_BIAS_INDICATOR(b->DispersiveBiasConsistencyIndicator ? 1 : 0)
+      T_MW_CONSISTENCY_INDICATOR(b->MWConsistencyIndicator ? 1 : 0)
+      T_NO_OF_SATELLITES(b->NumberOfSat[s])
+      for (i = satoffset[s]; i < satoffset[s] + b->NumberOfSat[s]; ++i) {
+        switch (s) {
+          case CLOCKORBIT_SATGPS:
+            case CLOCKORBIT_SATGALILEO:
+            case CLOCKORBIT_SATSBAS:
+            case CLOCKORBIT_SATBDS:
+            T_GPS_SATELLITE_ID(b->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATQZSS:
+            T_QZSS_SATELLITE_ID(b->Sat[i].ID)
+            break;
+          case CLOCKORBIT_SATGLONASS:
+            T_GLONASS_SATELLITE_ID(b->Sat[i].ID)
+            break;
+        }
+        T_NO_OF_BIASES(b->Sat[i].NumberOfPhaseBiases)
+        T_YAW_ANGLE(b->Sat[i].YawAngle)
+        T_YAW_RATE(b->Sat[i].YawRate)
+        for (j = 0; j < b->Sat[i].NumberOfPhaseBiases; ++j) {
+          T_GNSS_SIGNAL_IDENTIFIER(b->Sat[i].Biases[j].Type)
+          T_INTEGER_INDICATOR(
+              b->Sat[i].Biases[j].SignalIntegerIndicator ? 1 : 0)
+          T_WIDE_LANE_INDICATOR(
+              b->Sat[i].Biases[j].SignalsWideLaneIntegerIndicator)
+          T_DISCONTINUITY_COUNTER(
+              b->Sat[i].Biases[j].SignalDiscontinuityCounter)
+          T_PHASE_BIAS(b->Sat[i].Biases[j].Bias)
+        }
+      }
+      ENDBLOCK
+    }
+  }
+  return ressize;
+}
+
+size_t SsrCorrRtcm::MakeVTEC(const struct VTEC *v, int moremessagesfollow, char *buffer, size_t size) {
+  unsigned int l, o, d;
+
+  STARTDATA
+    INITBLOCK
+  T_RTCM_MESSAGE_NUMBER(VTEC_BASE)
+  T_SSR_EPOCH_TIME(v->EpochTime)
+  T_SSR_UPDATE_INTERVAL(v->UpdateInterval)
+  T_MULTIPLE_MESSAGE_INDICATOR(moremessagesfollow ? 1 : 0)
+  T_SSR_IOD(v->SSRIOD)
+  T_SSR_PROVIDER_ID(v->SSRProviderID)
+  T_SSR_SOLUTION_ID(v->SSRSolutionID)
+  T_VTEC_QUALITY_INDICATOR(v->Quality)
+  T_NO_IONO_LAYERS(v->NumLayers)
+  for (l = 0; l < v->NumLayers; ++l) {
+    T_IONO_HEIGHT(v->Layers[l].Height)
+    T_IONO_DEGREE(v->Layers[l].Degree)
+    T_IONO_ORDER(v->Layers[l].Order)
+    for (o = 0; o <= v->Layers[l].Order; ++o) {
+      for (d = o; d <= v->Layers[l].Degree; ++d) {
+        T_IONO_COEFF_C(v->Layers[l].Cosinus[d][o])
+      }
+    }
+    for (o = 1; o <= v->Layers[l].Order; ++o) {
+      for (d = o; d <= v->Layers[l].Degree; ++d) {
+        T_IONO_COEFF_S(v->Layers[l].Sinus[d][o])
+      }
+    }
+  }
+  ENDBLOCK
+  return ressize;
+}
+
+enum GCOB_RETURN SsrCorrRtcm::GetSSR(struct ClockOrbit *co, struct CodeBias *b,struct VTEC *v,
+    struct PhaseBias *pb, const char *buffer, size_t size, int *bytesused) {
+  int mmi = 0, h, rs;
+  unsigned int type, pos, i, j, s, nums, id;
+  size_t sizeofrtcmblock;
+  const char *blockstart = buffer;
+  DECODESTART
+
+  if (size < 7)
+    return GCOBR_SHORTBUFFER;
+
+#ifdef BNC_DEBUG
+  fprintf(stderr, "GetSSR-RTCM START: size %d, numbits %d\n",(int)size, numbits);
+#endif
+
+  G_HEADER(h)
+  G_RESERVEDH(rs)
+  G_SIZE(sizeofrtcmblock);
+
+  if ((unsigned char) h != 0xD3 || rs)
+    return GCOBR_UNKNOWNDATA;
+  if (size < sizeofrtcmblock + 3) /* 3 header bytes already removed */
+    return GCOBR_MESSAGEEXCEEDSBUFFER;
+  if (CRC24(sizeofrtcmblock + 3, (const unsigned char *) blockstart) !=
+      (uint32_t) ((((unsigned char) buffer[sizeofrtcmblock]) << 16) |
+          (((unsigned char) buffer[sizeofrtcmblock + 1]) << 8) |
+          (((unsigned char) buffer[sizeofrtcmblock + 2]))))
+    return GCOBR_CRCMISMATCH;
+  size = sizeofrtcmblock; /* reduce size, so overflows are detected */
+
+  G_RTCM_MESSAGE_NUMBER(type)
+#ifdef BNC_DEBUG
+  fprintf(stderr, "type %d size %d\n",type,(int)sizeofrtcmblock);
+#endif
+  if (bytesused)
+    *bytesused = sizeofrtcmblock + 6;
+  if (type == VTEC_BASE) {
+    unsigned int l, o, d;
+    if (!v)
+      return GCOBR_NOVTECPARAMETER;
+    memset(v, 0, sizeof(*v));
+    G_SSR_EPOCH_TIME(v->EpochTime)
+    G_SSR_UPDATE_INTERVAL(v->UpdateInterval)
+    G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+    G_SSR_IOD(v->SSRIOD)
+    G_SSR_PROVIDER_ID(v->SSRProviderID)
+    G_SSR_SOLUTION_ID(v->SSRSolutionID)
+    G_VTEC_QUALITY_INDICATOR(v->Quality)
+    G_NO_IONO_LAYERS(v->NumLayers)
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d ssrIod %d providerId %d solId %d vtecQ %8.3f numLay %d \n",
+        		  v->EpochTime, v->UpdateInterval, mmi,
+				  v->SSRIOD, v->SSRProviderID, v->SSRSolutionID, v->Quality, v->NumLayers);
+#endif
+    for (l = 0; l < v->NumLayers; ++l) {
+      G_IONO_HEIGHT(v->Layers[l].Height)
+      G_IONO_DEGREE(v->Layers[l].Degree)
+      G_IONO_ORDER(v->Layers[l].Order)
+#ifdef BNC_DEBUG
+          fprintf(stderr, "h  %8.3f deg %d ord %d \n",
+        		  v->Layers[l].Height, v->Layers[l].Degree, v->Layers[l].Order);
+#endif
+      for (o = 0; o <= v->Layers[l].Order; ++o) {
+        for (d = o; d <= v->Layers[l].Degree; ++d) {
+          G_IONO_COEFF_C(v->Layers[l].Cosinus[d][o])
+#ifdef BNC_DEBUG
+          fprintf(stderr, "C[%02d][%02d]  %8.3f \n",
+        		  d, o, v->Layers[l].Cosinus[d][o]);
+#endif
+        }
+      }
+      for (o = 1; o <= v->Layers[l].Order; ++o) {
+        for (d = o; d <= v->Layers[l].Degree; ++d) {
+          G_IONO_COEFF_S(v->Layers[l].Sinus[d][o])
+#ifdef BNC_DEBUG
+          fprintf(stderr, "S[%02d][%02d]  %8.3f \n",
+        		  d, o, v->Layers[l].Sinus[d][o]);
+#endif
+        }
+      }
+    }
+#ifdef BNC_DEBUG
+    for(type = 0; type < (unsigned int)size && (unsigned char)buffer[type] != 0xD3; ++type)
+    numbits += 8;
+    fprintf(stderr, "numbits left %d\n",numbits);
+#endif
+    return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
+  }
+  for (s = CLOCKORBIT_SATNUM; s-- > 0;) {
+    if (type == PBTYPE_BASE + s) {
+      if (!pb)
+        return GCOBR_NOPHASEBIASPARAMETER;
+      pb->messageType = type;
+      switch (s) {
+        case CLOCKORBIT_SATGPS:
+        case CLOCKORBIT_SATGALILEO:
+        case CLOCKORBIT_SATQZSS:
+        case CLOCKORBIT_SATSBAS:
+        case CLOCKORBIT_SATBDS:
+          G_SSR_EPOCH_TIME_CHECK(pb->EpochTime[s], pb->NumberOfSat[s])
+          break;
+        case CLOCKORBIT_SATGLONASS:
+          G_GLONASS_EPOCH_TIME(pb->EpochTime[s], pb->NumberOfSat[s])
+          break;
+      }
+      G_SSR_UPDATE_INTERVAL(pb->UpdateInterval)
+      G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+      G_SSR_IOD(pb->SSRIOD)
+      G_SSR_PROVIDER_ID(pb->SSRProviderID)
+      G_SSR_SOLUTION_ID(pb->SSRSolutionID)
+      G_DISPERSIVE_BIAS_INDICATOR(pb->DispersiveBiasConsistencyIndicator)
+      G_MW_CONSISTENCY_INDICATOR(pb->MWConsistencyIndicator)
+      G_NO_OF_SATELLITES(nums)
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d dispInd %d mwInd %d\n",
+        		  pb->EpochTime[s], pb->UpdateInterval,mmi,pb->NumberOfSat[s],nums,
+				  pb->SSRIOD, pb->SSRProviderID, pb->SSRSolutionID,
+				  pb->DispersiveBiasConsistencyIndicator, pb->MWConsistencyIndicator);
+#endif
+      for (i = 0; i < nums; ++i) {
+        switch (s) {
+          case CLOCKORBIT_SATGPS:
+          case CLOCKORBIT_SATGALILEO:
+          case CLOCKORBIT_SATSBAS:
+          case CLOCKORBIT_SATBDS:
+            G_GNSS_SATELLITE_ID(id)
+            break;
+          case CLOCKORBIT_SATQZSS:
+            G_QZSS_SATELLITE_ID(id)
+            break;
+          case CLOCKORBIT_SATGLONASS:
+            G_GLONASS_SATELLITE_ID(id)
+            break;
+        }
+        for (pos = satoffset[s];
+            pos < satoffset[s] + pb->NumberOfSat[s] && pb->Sat[pos].ID != id;
+            ++pos)
+          ;
+        if (pos >= satoffset[s + 1])
+          return GCOBR_DATAMISMATCH;
+        else if (pos == pb->NumberOfSat[s] + satoffset[s])
+          ++pb->NumberOfSat[s];
+        pb->Sat[pos].ID = id;
+        G_NO_OF_BIASES(pb->Sat[pos].NumberOfPhaseBiases)
+        G_YAW_ANGLE(pb->Sat[pos].YawAngle)
+        G_YAW_RATE(pb->Sat[pos].YawRate)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d #%d y %10.6f yr %10.6f ",
+                    pb->Sat[pos].ID, pb->Sat[pos].NumberOfPhaseBiases,
+					pb->Sat[pos].YawAngle/MPI, pb->Sat[pos].YawRate/MPI);
+#endif
+        for (j = 0; j < pb->Sat[pos].NumberOfPhaseBiases; ++j) {
+          G_GNSS_SIGNAL_IDENTIFIER(pb->Sat[pos].Biases[j].Type)
+          G_INTEGER_INDICATOR(pb->Sat[pos].Biases[j].SignalIntegerIndicator)
+          G_WIDE_LANE_INDICATOR(
+              pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator)
+          G_DISCONTINUITY_COUNTER(
+              pb->Sat[pos].Biases[j].SignalDiscontinuityCounter)
+          G_PHASE_BIAS(pb->Sat[pos].Biases[j].Bias)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "t%02d int %d wl %d disc %d b %8.4f ",
+                    pb->Sat[pos].Biases[j].Type,
+					pb->Sat[pos].Biases[j].SignalIntegerIndicator,
+					pb->Sat[pos].Biases[j].SignalsWideLaneIntegerIndicator,
+					pb->Sat[pos].Biases[j].SignalDiscontinuityCounter,
+					pb->Sat[pos].Biases[j].Bias);
+#endif
+        }
+#ifdef BNC_DEBUG
+            fprintf(stderr, "\n");
+#endif
+      }
+#ifdef BNC_DEBUG
+      for(type = 0; type < (unsigned int)size && (unsigned char)buffer[type] != 0xD3; ++type)
+      numbits += 8;
+      fprintf(stderr, "numbits left %d\n",numbits);
+#endif
+      return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
+    }
+    else if (type >= corbase[s]) {
+      unsigned int corrOffset = type - corbase[s];
+      if (corrOffset == COBOFS_ORBIT) {
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = type;
+          switch (s) {
+            case CLOCKORBIT_SATGPS:
+            case CLOCKORBIT_SATGALILEO:
+            case CLOCKORBIT_SATQZSS:
+            case CLOCKORBIT_SATSBAS:
+            case CLOCKORBIT_SATBDS:
+              G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+            case CLOCKORBIT_SATGLONASS:
+              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+          }
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_ORBIT] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            switch (s) {
+              case CLOCKORBIT_SATGPS:
+              case CLOCKORBIT_SATGALILEO:
+              case CLOCKORBIT_SATSBAS:
+              case CLOCKORBIT_SATBDS:
+                G_GNSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATQZSS:
+                G_QZSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATGLONASS:
+                G_GLONASS_SATELLITE_ID(id)
+                break;
+            }
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+
+            switch (s) {
+              case CLOCKORBIT_SATGPS:
+                case CLOCKORBIT_SATQZSS:
+                G_GNSS_IOD(co->Sat[pos].IOD)
+                break;
+              case CLOCKORBIT_SATGLONASS:
+                G_GNSS_IOD(co->Sat[pos].IOD)
+                break;
+              case CLOCKORBIT_SATGALILEO:
+                G_GALILEO_IOD(co->Sat[pos].IOD)
+                break;
+              case CLOCKORBIT_SATSBAS:
+                G_SBAS_T0MOD(co->Sat[pos].toe)
+                G_SBAS_IODCRC(co->Sat[pos].IOD)
+                break;
+              case CLOCKORBIT_SATBDS:
+                G_BDS_TOEMOD(co->Sat[pos].toe)
+                G_GNSS_IOD(co->Sat[pos].IOD)
+                break;
+            }
+            G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
+            G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
+            G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
+            G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
+            G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
+            G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d iod %3d dr %8.4f da %8.4f dc %8.4f dr %8.3f da %8.3f dc %8.3f\n",
+                co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
+                co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
+                co->Sat[pos].Orbit.DotDeltaRadial,
+                co->Sat[pos].Orbit.DotDeltaAlongTrack,
+                co->Sat[pos].Orbit.DotDeltaCrossTrack);
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_CLOCK) {
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = type;
+          switch (s) {
+            case CLOCKORBIT_SATGPS:
+            case CLOCKORBIT_SATGALILEO:
+            case CLOCKORBIT_SATQZSS:
+            case CLOCKORBIT_SATSBAS:
+            case CLOCKORBIT_SATBDS:
+              G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+            case CLOCKORBIT_SATGLONASS:
+              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+          }
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_CLOCK] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            switch (s) {
+              case CLOCKORBIT_SATGPS:
+                case CLOCKORBIT_SATGALILEO:
+                case CLOCKORBIT_SATSBAS:
+                case CLOCKORBIT_SATBDS:
+                G_GNSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATQZSS:
+                G_QZSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATGLONASS:
+                G_GLONASS_SATELLITE_ID(id)
+                break;
+            }
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+
+            G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
+            G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
+            G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d c0 %8.3f c1 %8.3f c2 %8.3f\n",
+                co->Sat[pos].ID, co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1,
+                co->Sat[pos].Clock.DeltaA2);
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_COMBINED) {
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = type;
+          switch (s) {
+            case CLOCKORBIT_SATGPS:
+            case CLOCKORBIT_SATGALILEO:
+            case CLOCKORBIT_SATQZSS:
+            case CLOCKORBIT_SATSBAS:
+            case CLOCKORBIT_SATBDS:
+              G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+            case CLOCKORBIT_SATGLONASS:
+              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+          }
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SATELLITE_REFERENCE_DATUM(co->SatRefDatum)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_ORBIT] |= 1;
+          co->Supplied[COBOFS_CLOCK] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d rd %d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SatRefDatum, co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            switch (s) {
+              case CLOCKORBIT_SATGPS:
+              case CLOCKORBIT_SATGALILEO:
+              case CLOCKORBIT_SATSBAS:
+              case CLOCKORBIT_SATBDS:
+                G_GNSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATQZSS:
+                G_QZSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATGLONASS:
+                G_GLONASS_SATELLITE_ID(id)
+                break;
+            }
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+
+            switch (s) {
+              case CLOCKORBIT_SATGPS:
+                case CLOCKORBIT_SATQZSS:
+                G_GNSS_IOD(co->Sat[pos].IOD)
+                break;
+              case CLOCKORBIT_SATGLONASS:
+                G_GNSS_IOD(co->Sat[pos].IOD)
+                break;
+              case CLOCKORBIT_SATGALILEO:
+                G_GALILEO_IOD(co->Sat[pos].IOD)
+                break;
+              case CLOCKORBIT_SATSBAS:
+                G_SBAS_T0MOD(co->Sat[pos].toe)
+                G_SBAS_IODCRC(co->Sat[pos].IOD)
+                break;
+              case CLOCKORBIT_SATBDS:
+                G_BDS_TOEMOD(co->Sat[pos].toe)
+                G_GNSS_IOD(co->Sat[pos].IOD)
+                break;
+            }
+            G_DELTA_RADIAL(co->Sat[pos].Orbit.DeltaRadial)
+            G_DELTA_ALONG_TRACK(co->Sat[pos].Orbit.DeltaAlongTrack)
+            G_DELTA_CROSS_TRACK(co->Sat[pos].Orbit.DeltaCrossTrack)
+            G_DELTA_DOT_RADIAL(co->Sat[pos].Orbit.DotDeltaRadial)
+            G_DELTA_DOT_ALONG_TRACK(co->Sat[pos].Orbit.DotDeltaAlongTrack)
+            G_DELTA_DOT_CROSS_TRACK(co->Sat[pos].Orbit.DotDeltaCrossTrack)
+            G_DELTA_CLOCK_C0(co->Sat[pos].Clock.DeltaA0)
+            G_DELTA_CLOCK_C1(co->Sat[pos].Clock.DeltaA1)
+            G_DELTA_CLOCK_C2(co->Sat[pos].Clock.DeltaA2)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d iod %3d dr %10.6f da %10.6f dc %10.6f dr %10.6f da %10.6f dc %10.6f  c0 %10.6f c1 %10.6f c2 %10.6f\n",
+                co->Sat[pos].ID,co->Sat[pos].IOD,co->Sat[pos].Orbit.DeltaRadial,
+                co->Sat[pos].Orbit.DeltaAlongTrack,co->Sat[pos].Orbit.DeltaCrossTrack,
+                co->Sat[pos].Orbit.DotDeltaRadial, co->Sat[pos].Orbit.DotDeltaAlongTrack,
+                co->Sat[pos].Orbit.DotDeltaCrossTrack,
+				        co->Sat[pos].Clock.DeltaA0, co->Sat[pos].Clock.DeltaA1, co->Sat[pos].Clock.DeltaA2);
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_URA) {
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = type;
+          switch (s) {
+            case CLOCKORBIT_SATGPS:
+            case CLOCKORBIT_SATGALILEO:
+            case CLOCKORBIT_SATQZSS:
+            case CLOCKORBIT_SATSBAS:
+            case CLOCKORBIT_SATBDS:
+              G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+            case CLOCKORBIT_SATGLONASS:
+              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+          }
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_URA] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            switch (s) {
+              case CLOCKORBIT_SATGPS:
+              case CLOCKORBIT_SATGALILEO:
+              case CLOCKORBIT_SATSBAS:
+              case CLOCKORBIT_SATBDS:
+                G_GNSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATQZSS:
+                G_QZSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATGLONASS:
+                G_GLONASS_SATELLITE_ID(id)
+                break;
+            }
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+            G_SSR_URA(co->Sat[pos].UserRangeAccuracy)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d ura %8.3f \n",
+                co->Sat[pos].ID, co->Sat[pos].UserRangeAccuracy);
+#endif
+          }
+      }
+      else if (corrOffset == COBOFS_HR) {
+          if (!co)
+            return GCOBR_NOCLOCKORBITPARAMETER;
+          co->messageType = type;
+          switch (s) {
+            case CLOCKORBIT_SATGPS:/* Phase specific part of GNSS phase bias message */
+            case CLOCKORBIT_SATGALILEO:
+            case CLOCKORBIT_SATQZSS:
+            case CLOCKORBIT_SATSBAS:
+            case CLOCKORBIT_SATBDS:
+              G_SSR_EPOCH_TIME_CHECK(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+            case CLOCKORBIT_SATGLONASS:
+              G_GLONASS_EPOCH_TIME(co->EpochTime[s], co->NumberOfSat[s])
+              break;
+          }
+          G_SSR_UPDATE_INTERVAL(co->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(co->SSRIOD)
+          G_SSR_PROVIDER_ID(co->SSRProviderID)
+          G_SSR_SOLUTION_ID(co->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+          co->Supplied[COBOFS_HR] |= 1;
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
+        		  co->EpochTime[s], co->UpdateInterval,mmi,co->NumberOfSat[s],nums,
+				  co->SSRIOD, co->SSRProviderID, co->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            switch (s) {
+              case CLOCKORBIT_SATGPS:
+              case CLOCKORBIT_SATGALILEO:
+              case CLOCKORBIT_SATSBAS:
+              case CLOCKORBIT_SATBDS:
+                G_GNSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATQZSS:
+                G_QZSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATGLONASS:
+                G_GLONASS_SATELLITE_ID(id)
+                break;
+            }
+            for (pos = satoffset[s];
+                pos < satoffset[s] + co->NumberOfSat[s] && co->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == co->NumberOfSat[s] + satoffset[s])
+              ++co->NumberOfSat[s];
+            co->Sat[pos].ID = id;
+            G_HR_CLOCK_CORRECTION(co->Sat[pos].hrclock)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d hrClock %8.3f \n",
+                    co->Sat[pos].ID, co->Sat[pos].hrclock);
+#endif
+          }
+      }
+      else if (corrOffset ==  COBOFS_CBIAS) {
+          if (!b)
+            return GCOBR_NOCODEBIASPARAMETER;
+          b->messageType = type;
+          switch (s) {
+            case CLOCKORBIT_SATGPS:
+            case CLOCKORBIT_SATGALILEO:
+            case CLOCKORBIT_SATQZSS:
+            case CLOCKORBIT_SATSBAS:
+            case CLOCKORBIT_SATBDS:
+              G_SSR_EPOCH_TIME_CHECK(b->EpochTime[s], b->NumberOfSat[s])
+              break;
+            case CLOCKORBIT_SATGLONASS:
+              G_GLONASS_EPOCH_TIME(b->EpochTime[s], b->NumberOfSat[s])
+              break;
+          }
+          G_SSR_UPDATE_INTERVAL(b->UpdateInterval)
+          G_MULTIPLE_MESSAGE_INDICATOR(mmi)
+          G_SSR_IOD(b->SSRIOD)
+          G_SSR_PROVIDER_ID(b->SSRProviderID)
+          G_SSR_SOLUTION_ID(b->SSRSolutionID)
+          G_NO_OF_SATELLITES(nums)
+#ifdef BNC_DEBUG
+          fprintf(stderr, "epochTime %d ui %d mmi %d sats %d/%d ssrIod %d providerId %d solId %d\n",
+        		  b->EpochTime[s], b->UpdateInterval,mmi,b->NumberOfSat[s],nums,
+				  b->SSRIOD, b->SSRProviderID, b->SSRSolutionID);
+#endif
+          for (i = 0; i < nums; ++i) {
+            switch (s) {
+              case CLOCKORBIT_SATGPS:
+              case CLOCKORBIT_SATGALILEO:
+              case CLOCKORBIT_SATSBAS:
+              case CLOCKORBIT_SATBDS:
+                G_GNSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATQZSS:
+                G_QZSS_SATELLITE_ID(id)
+                break;
+              case CLOCKORBIT_SATGLONASS:
+                G_GLONASS_SATELLITE_ID(id)
+                break;
+            }
+            for (pos = satoffset[s];
+                pos < satoffset[s] + b->NumberOfSat[s] && b->Sat[pos].ID != id;
+                ++pos)
+              ;
+            if (pos >= satoffset[s + 1])
+              return GCOBR_DATAMISMATCH;
+            else if (pos == b->NumberOfSat[s] + satoffset[s])
+              ++b->NumberOfSat[s];
+            b->Sat[pos].ID = id;
+            G_NO_OF_BIASES(b->Sat[pos].NumberOfCodeBiases)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "id %2d #%d ",
+                    b->Sat[pos].ID, b->Sat[pos].NumberOfCodeBiases);
+#endif
+            for (j = 0; j < b->Sat[pos].NumberOfCodeBiases; ++j) {
+              G_GNSS_SIGNAL_IDENTIFIER(b->Sat[pos].Biases[j].Type)
+              G_CODE_BIAS(b->Sat[pos].Biases[j].Bias)
+#ifdef BNC_DEBUG
+            fprintf(stderr, "t%02d b %8.2f ",
+                    b->Sat[pos].Biases[j].Type, b->Sat[pos].Biases[j].Bias);
+#endif
+            }
+#ifdef BNC_DEBUG
+            fprintf(stderr, "\n");
+#endif
+          }
+      }
+      else {
+          continue;
+      }
+#ifdef BNC_DEBUG
+      for(type = 0; type < (unsigned int)size && (unsigned char)buffer[type] != 0xD3; ++type)
+      numbits += 8;
+      fprintf(stderr, "numbits left %d\n",numbits);
+#endif
+      return mmi ? GCOBR_MESSAGEFOLLOWS : GCOBR_OK;
+    }
+  }
+  return GCOBR_UNKNOWNTYPE;
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+std::string SsrCorrRtcm::codeTypeToRnxType(char system, CodeType type) {
+  if      (system == 'G') {
+      if (type == CODETYPE_GPS_L1_CA)         return "1C";
+      if (type == CODETYPE_GPS_L1_P)          return "1P";
+      if (type == CODETYPE_GPS_L1_Z)          return "1W";
+
+      if (type == CODETYPE_GPS_SEMI_CODELESS) return "2D";
+      if (type == CODETYPE_GPS_L2_CA)         return "2C";
+      if (type == CODETYPE_GPS_L2_P)          return "2P";
+      if (type == CODETYPE_GPS_L2_Z)          return "2W";
+
+      if (type == CODETYPE_GPS_L2C_M)         return "2S";
+      if (type == CODETYPE_GPS_L2C_L)         return "2L";
+      if (type == CODETYPE_GPS_L2C_ML)        return "2X";
+
+      if (type == CODETYPE_GPS_L5_I)          return "5I";
+      if (type == CODETYPE_GPS_L5_Q)          return "5Q";
+      if (type == CODETYPE_GPS_L5_IQ)         return "5X";
+
+      if (type == CODETYPE_GPS_L1C_D)         return "1S";
+      if (type == CODETYPE_GPS_L1C_P)         return "1L";
+      if (type == CODETYPE_GPS_L1C_DP)        return "1X";
+  }
+  else if (system == 'R') {
+      if (type == CODETYPE_GLONASS_L1_CA)     return "1C";
+      if (type == CODETYPE_GLONASS_L1_P)      return "1P";
+
+      if (type == CODETYPE_GLONASS_L2_CA)     return "2C";
+      if (type == CODETYPE_GLONASS_L2_P)      return "2P";
+
+      if (type == CODETYPE_GLONASS_L1a_OCd)   return "4A";
+      if (type == CODETYPE_GLONASS_L1a_OCp)   return "4B";
+      if (type == CODETYPE_GLONASS_L1a_OCdp)  return "4X";
+
+      if (type == CODETYPE_GLONASS_L2a_CSI)   return "6A";
+      if (type == CODETYPE_GLONASS_L2a_OCp)   return "6B";
+      if (type == CODETYPE_GLONASS_L2a_CSIOCp)return "6X";
+
+      if (type == CODETYPE_GLONASS_L3_I)      return "3I";
+      if (type == CODETYPE_GLONASS_L3_Q)      return "3Q";
+      if (type == CODETYPE_GLONASS_L3_IQ)     return "3X";
+  }
+  else if (system == 'E') {
+      if (type == CODETYPE_GALILEO_E1_A)       return "1A";
+      if (type == CODETYPE_GALILEO_E1_B)       return "1B";
+      if (type == CODETYPE_GALILEO_E1_C)       return "1C";
+      if (type == CODETYPE_GALILEO_E1_BC)      return "1X";
+      if (type == CODETYPE_GALILEO_E1_ABC)     return "1Z";
+
+      if (type == CODETYPE_GALILEO_E5A_I)      return "5I";
+      if (type == CODETYPE_GALILEO_E5A_Q)      return "5Q";
+      if (type == CODETYPE_GALILEO_E5A_IQ)     return "5X";
+
+      if (type == CODETYPE_GALILEO_E5B_I)      return "7I";
+      if (type == CODETYPE_GALILEO_E5B_Q)      return "7Q";
+      if (type == CODETYPE_GALILEO_E5B_IQ)     return "7X";
+
+      if (type == CODETYPE_GALILEO_E5_I)       return "8I";
+      if (type == CODETYPE_GALILEO_E5_Q)       return "8Q";
+      if (type == CODETYPE_GALILEO_E5_IQ)      return "8X";
+
+      if (type == CODETYPE_GALILEO_E6_A)       return "6A";
+      if (type == CODETYPE_GALILEO_E6_B)       return "6B";
+      if (type == CODETYPE_GALILEO_E6_C)       return "6C";
+      if (type == CODETYPE_GALILEO_E6_BC)      return "6X";
+      if (type == CODETYPE_GALILEO_E6_ABC)     return "6Z";
+  }
+   else if (system == 'J') {
+      if (type == CODETYPE_QZSS_L1_CA)         return "1C";
+      if (type == CODETYPE_QZSS_L1_S)          return "1Z";
+
+      if (type == CODETYPE_QZSS_L1C_D)         return "1S";
+      if (type == CODETYPE_QZSS_L1C_P)         return "1L";
+      if (type == CODETYPE_QZSS_L1C_DP)        return "1X";
+
+      if (type == CODETYPE_QZSS_L2C_M)         return "2S";
+      if (type == CODETYPE_QZSS_L2C_L)         return "2L";
+      if (type == CODETYPE_QZSS_L2C_ML)        return "2X";
+
+      if (type == CODETYPE_QZSS_L5_I)          return "5I";
+      if (type == CODETYPE_QZSS_L5_Q)          return "5Q";
+      if (type == CODETYPE_QZSS_L5_IQ)         return "5X";
+
+      if (type == CODETYPE_QZSS_L6_D)          return "6S";
+      if (type == CODETYPE_QZSS_L6_P)          return "6L";
+      if (type == CODETYPE_QZSS_L6_DP)         return "6X";
+
+      if (type == CODETYPE_QZSS_L5_D)          return "5D";
+      if (type == CODETYPE_QZSS_L5_P)          return "5P";
+      if (type == CODETYPE_QZSS_L5_DP)         return "5Z";
+
+      if (type == CODETYPE_QZSS_L6_E)          return "6E";
+      if (type == CODETYPE_QZSS_L6_DE)         return "6Z";
+  }
+  else if (system == 'C') {
+      if (type == CODETYPE_BDS_B1_I)         return "2I";
+      if (type == CODETYPE_BDS_B1_Q)         return "2Q";
+      if (type == CODETYPE_BDS_B1_IQ)        return "2X";
+
+      if (type == CODETYPE_BDS_B3_I)         return "6I";
+      if (type == CODETYPE_BDS_B3_Q)         return "6Q";
+      if (type == CODETYPE_BDS_B3_IQ)        return "6X";
+
+      if (type == CODETYPE_BDS_B2_I)         return "7I";
+      if (type == CODETYPE_BDS_B2_Q)         return "7Q";
+      if (type == CODETYPE_BDS_B2_IQ)        return "7X";
+
+      if (type == CODETYPE_BDS_B1a_D)        return "1D";
+      if (type == CODETYPE_BDS_B1a_P)        return "1P";
+      if (type == CODETYPE_BDS_B1a_DP)       return "1X";
+
+      if (type == CODETYPE_BDS_B2a_D)        return "5D";
+      if (type == CODETYPE_BDS_B2a_P)        return "5P";
+      if (type == CODETYPE_BDS_B2a_DP)       return "5X";
+  }
+  else if (system == 'S') {
+      if (type == CODETYPE_SBAS_L1_CA)       return "1C";
+
+      if (type == CODETYPE_SBAS_L5_I)        return "5I";
+      if (type == CODETYPE_SBAS_L5_Q)        return "5Q";
+      if (type == CODETYPE_SBAS_L5_IQ)       return "5X";
+  }
+  return "";
+}
+
+//
+////////////////////////////////////////////////////////////////////////////
+SsrCorr::CodeType SsrCorrRtcm::rnxTypeToCodeType(char system, std::string type) {
+  if      (system == 'G') {
+    if (type.compare("1C") == 0) {return CODETYPE_GPS_L1_CA;}
+    if (type.compare("1P") == 0) {return CODETYPE_GPS_L1_P;}
+    if (type.compare("1W") == 0) {return CODETYPE_GPS_L1_Z;}
+
+    if (type.compare("2D") == 0) {return CODETYPE_GPS_SEMI_CODELESS;}
+    if (type.compare("2C") == 0) {return CODETYPE_GPS_L2_CA;}
+    if (type.compare("2P") == 0) {return CODETYPE_GPS_L2_P;}
+    if (type.compare("2W") == 0) {return CODETYPE_GPS_L2_Z;}
+    if (type.compare("2S") == 0) {return CODETYPE_GPS_L2C_M;}
+    if (type.compare("2L") == 0) {return CODETYPE_GPS_L2C_L;}
+    if (type.compare("2X") == 0) {return CODETYPE_GPS_L2C_ML;}
+
+    if (type.compare("5I") == 0) {return CODETYPE_GPS_L5_I;}
+    if (type.compare("5Q") == 0) {return CODETYPE_GPS_L5_Q;}
+    if (type.compare("5X") == 0) {return CODETYPE_GPS_L5_IQ;}
+
+    if (type.compare("1S") == 0) {return CODETYPE_GPS_L1C_D;}
+    if (type.compare("1L") == 0) {return CODETYPE_GPS_L1C_P;}
+    if (type.compare("1X") == 0) {return CODETYPE_GPS_L1C_DP;}
+  }
+  else if (system == 'R') {
+    if (type.compare("1C") == 0) {return CODETYPE_GLONASS_L1_CA;}
+    if (type.compare("1P") == 0) {return CODETYPE_GLONASS_L1_P;}
+    if (type.compare("2C") == 0) {return CODETYPE_GLONASS_L2_CA;}
+    if (type.compare("2P") == 0) {return CODETYPE_GLONASS_L2_P;}
+
+    if (type.compare("4A") == 0) {return CODETYPE_GLONASS_L1a_OCd;}
+    if (type.compare("4B") == 0) {return CODETYPE_GLONASS_L1a_OCp;}
+    if (type.compare("4X") == 0) {return CODETYPE_GLONASS_L1a_OCdp;}
+
+    if (type.compare("6A") == 0) {return CODETYPE_GLONASS_L2a_CSI;}
+    if (type.compare("6B") == 0) {return CODETYPE_GLONASS_L2a_OCp;}
+    if (type.compare("6X") == 0) {return CODETYPE_GLONASS_L2a_CSIOCp;}
+
+    if (type.compare("3I") == 0) {return CODETYPE_GLONASS_L3_I;}
+    if (type.compare("3Q") == 0) {return CODETYPE_GLONASS_L3_Q;}
+    if (type.compare("3X") == 0) {return CODETYPE_GLONASS_L3_IQ;}
+  }
+  else if (system == 'E') {
+    if (type.compare("1A") == 0) {return CODETYPE_GALILEO_E1_A;}
+    if (type.compare("1B") == 0) {return CODETYPE_GALILEO_E1_B;}
+    if (type.compare("1C") == 0) {return CODETYPE_GALILEO_E1_C;}
+    if (type.compare("1X") == 0) {return CODETYPE_GALILEO_E1_BC;}
+    if (type.compare("1Z") == 0) {return CODETYPE_GALILEO_E1_ABC;}
+
+    if (type.compare("5I") == 0) {return CODETYPE_GALILEO_E5A_I;}
+    if (type.compare("5Q") == 0) {return CODETYPE_GALILEO_E5A_Q;}
+    if (type.compare("5X") == 0) {return CODETYPE_GALILEO_E5A_IQ;}
+
+    if (type.compare("7I") == 0) {return CODETYPE_GALILEO_E5B_I;}
+    if (type.compare("7Q") == 0) {return CODETYPE_GALILEO_E5B_Q;}
+    if (type.compare("7X") == 0) {return CODETYPE_GALILEO_E5B_IQ;}
+
+    if (type.compare("8I") == 0) {return CODETYPE_GALILEO_E5_I;}
+    if (type.compare("8Q") == 0) {return CODETYPE_GALILEO_E5_Q;}
+    if (type.compare("8X") == 0) {return CODETYPE_GALILEO_E5_IQ;}
+
+    if (type.compare("6A") == 0) {return CODETYPE_GALILEO_E6_A;}
+    if (type.compare("6B") == 0) {return CODETYPE_GALILEO_E6_B;}
+    if (type.compare("6C") == 0) {return CODETYPE_GALILEO_E6_C;}
+    if (type.compare("6X") == 0) {return CODETYPE_GALILEO_E6_BC;}
+    if (type.compare("6Z") == 0) {return CODETYPE_GALILEO_E6_ABC;}
+  }
+   else if (system == 'J') {
+     if (type.compare("1C") == 0) {return CODETYPE_QZSS_L1_CA;}
+     if (type.compare("1Z") == 0) {return CODETYPE_QZSS_L1_S;}
+
+     if (type.compare("1S") == 0) {return CODETYPE_QZSS_L1C_D;}
+     if (type.compare("1L") == 0) {return CODETYPE_QZSS_L1C_P;}
+     if (type.compare("1X") == 0) {return CODETYPE_QZSS_L1C_DP;}
+
+     if (type.compare("2S") == 0) {return CODETYPE_QZSS_L2C_M;}
+     if (type.compare("2L") == 0) {return CODETYPE_QZSS_L2C_L;}
+     if (type.compare("2X") == 0) {return CODETYPE_QZSS_L2C_ML;}
+
+     if (type.compare("5I") == 0) {return CODETYPE_QZSS_L5_I;}
+     if (type.compare("5Q") == 0) {return CODETYPE_QZSS_L5_Q;}
+     if (type.compare("5X") == 0) {return CODETYPE_QZSS_L5_IQ;}
+
+     if (type.compare("6S") == 0) {return CODETYPE_QZSS_L6_D;}
+     if (type.compare("6L") == 0) {return CODETYPE_QZSS_L6_P;}
+     if (type.compare("6X") == 0) {return CODETYPE_QZSS_L6_DP;}
+
+     if (type.compare("5D") == 0) {return CODETYPE_QZSS_L5_D;}
+     if (type.compare("5P") == 0) {return CODETYPE_QZSS_L5_P;}
+     if (type.compare("5Z") == 0) {return CODETYPE_QZSS_L5_DP;}
+
+     if (type.compare("6E") == 0) {return CODETYPE_QZSS_L6_E;}
+     if (type.compare("6Z") == 0) {return CODETYPE_QZSS_L6_DE;}
+  }
+  else if (system == 'C') {
+    if (type.compare("2I") == 0) {return CODETYPE_BDS_B1_I;}
+    if (type.compare("2Q") == 0) {return CODETYPE_BDS_B1_Q;}
+    if (type.compare("2X") == 0) {return CODETYPE_BDS_B1_IQ;}
+
+    if (type.compare("6I") == 0) {return CODETYPE_BDS_B3_I;}
+    if (type.compare("6Q") == 0) {return CODETYPE_BDS_B3_Q;}
+    if (type.compare("6X") == 0) {return CODETYPE_BDS_B3_IQ;}
+
+    if (type.compare("7I") == 0) {return CODETYPE_BDS_B2_I;}
+    if (type.compare("7Q") == 0) {return CODETYPE_BDS_B2_Q;}
+    if (type.compare("7X") == 0) {return CODETYPE_BDS_B2_IQ;}
+
+    if (type.compare("1D") == 0) {return CODETYPE_BDS_B1a_D;}
+    if (type.compare("1P") == 0) {return CODETYPE_BDS_B1a_P;}
+    if (type.compare("1X") == 0) {return CODETYPE_BDS_B1a_DP;}
+
+    if (type.compare("5D") == 0) {return CODETYPE_BDS_B2a_D;}
+    if (type.compare("5P") == 0) {return CODETYPE_BDS_B2a_P;}
+    if (type.compare("5X") == 0) {return CODETYPE_BDS_B2a_DP;}
+  }
+  else if (system == 'S') {
+    if (type.compare("1C") == 0) {return CODETYPE_SBAS_L1_CA;}
+
+    if (type.compare("5I") == 0) {return CODETYPE_SBAS_L5_I;}
+    if (type.compare("5Q") == 0) {return CODETYPE_SBAS_L5_Q;}
+    if (type.compare("5X") == 0) {return CODETYPE_SBAS_L5_IQ;}
+  }
+  return RESERVED;
+}
+
Index: /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.h
===================================================================
--- /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.h	(revision 9024)
+++ /trunk/BNC/src/RTCM3/clock_and_orbit/clock_orbit_rtcm.h	(revision 9025)
@@ -4,381 +4,246 @@
 /* Programheader
 
-        Name:           clock_orbit_rtcm.h
-        Project:        RTCM3
-        Version:        $Id$
-        Authors:        Dirk Stöcker
-        Description:    state space approach: RTCM
-*/
+ Name:           clock_orbit_rtcm.h
+ Project:        RTCM3
+ Version:        $Id$
+ Authors:        Dirk Stöcker, Andrea Stürze
+ Description:    state space approach: RTCM
+ */
 
 #include <string.h>
-
-
-
-
-
-
-enum SatelliteReferenceDatum {
-  DATUM_ITRF  = 0,
-  DATUM_LOCAL = 1
-};
-
-enum COR_BASE {
-  COBBASE_GPS     = 1057,
-  COBBASE_GLONASS = 1063,
-  COBBASE_GALILEO = 1240,
-  COBBASE_QZSS    = 1246,
-  COBBASE_SBAS    = 1252,
-  COBBASE_BDS     = 1258,
-  COBBASE_NUM
-};
-
-enum COR_OFFSET {
-  COBOFS_ORBIT = 0,
-  COBOFS_CLOCK,
-  COBOFS_CBIAS,
-  COBOFS_COMBINED,
-  COBOFS_URA,
-  COBOFS_HR,
-  COBOFS_NUM
-};
-
-enum ClockOrbitType {
-  COTYPE_GPSORBIT        = COBBASE_GPS     + COBOFS_ORBIT,
-  COTYPE_GPSCLOCK,
-  COTYPE_GPSCOMBINED     = COBBASE_GPS     + COBOFS_COMBINED,
-  COTYPE_GPSURA,
-  COTYPE_GPSHR,
-
-  COTYPE_GLONASSORBIT    = COBBASE_GLONASS + COBOFS_ORBIT,
-  COTYPE_GLONASSCLOCK,
-  COTYPE_GLONASSCOMBINED = COBBASE_GLONASS + COBOFS_COMBINED,
-  COTYPE_GLONASSURA,
-  COTYPE_GLONASSHR,
-
-  COTYPE_GALILEOORBIT    = COBBASE_GALILEO + COBOFS_ORBIT,
-  COTYPE_GALILEOCLOCK,
-  COTYPE_GALILEOCOMBINED = COBBASE_GALILEO + COBOFS_COMBINED,
-  COTYPE_GALILEOURA,
-  COTYPE_GALILEOHR,
-
-  COTYPE_QZSSORBIT       = COBBASE_QZSS    + COBOFS_ORBIT,
-  COTYPE_QZSSCLOCK,
-  COTYPE_QZSSCOMBINED    = COBBASE_QZSS    + COBOFS_COMBINED,
-  COTYPE_QZSSURA,
-  COTYPE_QZSSHR,
-
-  COTYPE_SBASORBIT       = COBBASE_SBAS    + COBOFS_ORBIT,
-  COTYPE_SBASCLOCK,
-  COTYPE_SBASCOMBINED    = COBBASE_SBAS    + COBOFS_COMBINED,
-  COTYPE_SBASURA,
-  COTYPE_SBASHR,
-
-  COTYPE_BDSORBIT        = COBBASE_BDS     + COBOFS_ORBIT,
-  COTYPE_BDSCLOCK,
-  COTYPE_BDSCOMBINED     = COBBASE_BDS + COBOFS_COMBINED,
-  COTYPE_BDSURA,
-  COTYPE_BDSHR,
-
-  COTYPE_AUTO = 0,
-};
-
-enum CodeBiasType {
-  CBTYPE_GPS     = COBBASE_GPS     + COBOFS_CBIAS,
-  CBTYPE_GLONASS = COBBASE_GLONASS + COBOFS_CBIAS,
-  CBTYPE_GALILEO = COBBASE_GALILEO + COBOFS_CBIAS,
-  CBTYPE_QZSS    = COBBASE_QZSS    + COBOFS_CBIAS,
-  CBTYPE_SBAS    = COBBASE_SBAS    + COBOFS_CBIAS,
-  CBTYPE_BDS     = COBBASE_BDS     + COBOFS_CBIAS,
-  CBTYPE_AUTO    = 0
-};
-
-enum PhaseBiasType{
-  PBTYPE_BASE    = 1265,
-  PBTYPE_GPS     = PBTYPE_BASE,
-  PBTYPE_GLONASS,
-  PBTYPE_GALILEO,
-  PBTYPE_QZSS,
-  PBTYPE_SBAS,
-  PBTYPE_BDS,
-  PBTYPE_AUTO    = 0
-};
-
-enum VTECType {
-  VTEC_BASE = 1264
-};
-
-/* if some systems aren't supported at all, change the following numbers to zero
-for these systems to save space */
-enum COR_CONSTANTS {
-  CLOCKORBIT_BUFFERSIZE    = 8192,
-  CLOCKORBIT_NUMGPS        =   32,
-  CLOCKORBIT_NUMGLONASS    =   26,
-  CLOCKORBIT_NUMGALILEO    =   36,
-  CLOCKORBIT_NUMQZSS       =   10,
-  CLOCKORBIT_NUMSBAS       =   38,
-  CLOCKORBIT_NUMBDS        =   65,
-  CLOCKORBIT_NUMBIAS       =  100,
-  CLOCKORBIT_NUMIONOLAYERS =    4,
-  CLOCKORBIT_MAXIONOORDER  =   16,
-  CLOCKORBIT_MAXIONODEGREE =   16
-};
-
-enum COR_SATSYSTEM {
-  CLOCKORBIT_SATGPS=0,
-  CLOCKORBIT_SATGLONASS,
-  CLOCKORBIT_SATGALILEO,
-  CLOCKORBIT_SATQZSS,
-  CLOCKORBIT_SATSBAS,
-  CLOCKORBIT_SATBDS,
-  CLOCKORBIT_SATNUM
-};
-
-enum COR_OFFSETS {
-  CLOCKORBIT_OFFSETGPS     = 0,
-  CLOCKORBIT_OFFSETGLONASS = CLOCKORBIT_NUMGPS,
-  CLOCKORBIT_OFFSETGALILEO = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS,
-  CLOCKORBIT_OFFSETQZSS    = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO,
-  CLOCKORBIT_OFFSETSBAS    = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO
-                           + CLOCKORBIT_NUMQZSS,
-  CLOCKORBIT_OFFSETBDS     = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO
-                           + CLOCKORBIT_NUMQZSS + CLOCKORBIT_NUMSBAS,
-  CLOCKORBIT_COUNTSAT      = CLOCKORBIT_NUMGPS  + CLOCKORBIT_NUMGLONASS + CLOCKORBIT_NUMGALILEO
-                           + CLOCKORBIT_NUMQZSS + CLOCKORBIT_NUMSBAS    + CLOCKORBIT_NUMBDS
-};
-
-enum CodeType {
-  CODETYPEGPS_L1_CA          = 0,
-  CODETYPEGPS_L1_P           = 1,
-  CODETYPEGPS_L1_Z           = 2,
-  //CODETYPEGPS_L1_Y           = 3,
-  //CODETYPEGPS_L1_M           = 4,
-  CODETYPEGPS_L2_CA          = 5,
-  CODETYPEGPS_SEMI_CODELESS  = 6,
-  CODETYPEGPS_L2C_M          = 7,
-  CODETYPEGPS_L2C_L          = 8,
-  CODETYPEGPS_L2C_ML         = 9,
-  CODETYPEGPS_L2_P           = 10,
-  CODETYPEGPS_L2_Z           = 11,
-  //CODETYPEGPS_L2_Y           = 12,
-  //CODETYPEGPS_L2_M           = 13,
-  CODETYPEGPS_L5_I           = 14,
-  CODETYPEGPS_L5_Q           = 15,
-  CODETYPEGPS_L5_IQ          = 16,
-  CODETYPEGPS_L1C_D          = 17,
-  CODETYPEGPS_L1C_P          = 18,
-  CODETYPEGPS_L1C_DP         = 19,
-
-  CODETYPEGLONASS_L1_CA      = 0,
-  CODETYPEGLONASS_L1_P       = 1,
-  CODETYPEGLONASS_L2_CA      = 2,
-  CODETYPEGLONASS_L2_P       = 3,
-  CODETYPEGLONASS_L1a_OCd    = 4,
-  CODETYPEGLONASS_L1a_OCp    = 5,
-  CODETYPEGLONASS_L1a_OCdp   = 6,
-  CODETYPEGLONASS_L2a_CSI    = 7,
-  CODETYPEGLONASS_L2a_OCp    = 8,
-  CODETYPEGLONASS_L2a_CSIOCp = 9,
-  CODETYPEGLONASS_L3_I       = 10,
-  CODETYPEGLONASS_L3_Q       = 11,
-  CODETYPEGLONASS_L3_IQ      = 12,
-
-  CODETYPEGALILEO_E1_A       = 0,
-  CODETYPEGALILEO_E1_B       = 1,
-  CODETYPEGALILEO_E1_C       = 2,
-  CODETYPEGALILEO_E1_BC      = 3,
-  CODETYPEGALILEO_E1_ABC     = 4,
-  CODETYPEGALILEO_E5A_I      = 5,
-  CODETYPEGALILEO_E5A_Q      = 6,
-  CODETYPEGALILEO_E5A_IQ     = 7,
-  CODETYPEGALILEO_E5B_I      = 8,
-  CODETYPEGALILEO_E5B_Q      = 9,
-  CODETYPEGALILEO_E5B_IQ     = 10,
-  CODETYPEGALILEO_E5_I       = 11,
-  CODETYPEGALILEO_E5_Q       = 12,
-  CODETYPEGALILEO_E5_IQ      = 13,
-  CODETYPEGALILEO_E6_A       = 14,
-  CODETYPEGALILEO_E6_B       = 15,
-  CODETYPEGALILEO_E6_C       = 16,
-  CODETYPEGALILEO_E6_BC      = 17,
-  CODETYPEGALILEO_E6_ABC     = 18,
-
-  CODETYPEQZSS_L1_CA         = 0,
-  CODETYPEQZSS_L1C_D         = 1,
-  CODETYPEQZSS_L1C_P         = 2,
-  CODETYPEQZSS_L2C_M         = 3,
-  CODETYPEQZSS_L2C_L         = 4,
-  CODETYPEQZSS_L2C_ML        = 5,
-  CODETYPEQZSS_L5_I          = 6,
-  CODETYPEQZSS_L5_Q          = 7,
-  CODETYPEQZSS_L5_IQ         = 8,
-  CODETYPEQZSS_L6_D          = 9,
-  CODETYPEQZSS_L6_P          = 10,
-  CODETYPEQZSS_L6_DP         = 11,
-  CODETYPEQZSS_L1C_DP        = 12,
-  CODETYPEQZSS_L1_S          = 13,
-  CODETYPEQZSS_L5_D          = 14,
-  CODETYPEQZSS_L5_P          = 15,
-  CODETYPEQZSS_L5_DP         = 16,
-  CODETYPEQZSS_L6_E          = 17,
-  CODETYPEQZSS_L6_DE         = 18,
-
-  CODETYPE_SBAS_L1_CA        = 0,
-  CODETYPE_SBAS_L5_I         = 1,
-  CODETYPE_SBAS_L5_Q         = 2,
-  CODETYPE_SBAS_L5_IQ        = 3,
-
-  CODETYPE_BDS_B1_I          = 0,
-  CODETYPE_BDS_B1_Q          = 1,
-  CODETYPE_BDS_B1_IQ         = 2,
-  CODETYPE_BDS_B3_I          = 3,
-  CODETYPE_BDS_B3_Q          = 4,
-  CODETYPE_BDS_B3_IQ         = 5,
-  CODETYPE_BDS_B2_I          = 6,
-  CODETYPE_BDS_B2_Q          = 7,
-  CODETYPE_BDS_B2_IQ         = 8,
-  CODETYPE_BDS_B1a_D         = 9,
-  CODETYPE_BDS_B1a_P         = 10,
-  CODETYPE_BDS_B1a_DP        = 11,
-  CODETYPE_BDS_B2a_D         = 12,
-  CODETYPE_BDS_B2a_P         = 13,
-  CODETYPE_BDS_B2a_DP        = 14
-};
-
-#define SSR_MAXURA 5.5 /* > 5466.5mm in meter */
-
-/* satellite system data is stored with offset CLOCKORBIT_OFFSET...
-in the data structures. So first GLONASS satellite is at
-xxx->Sat[CLOCKORBIT_OFFSETGLONASS], first GPS satellite is
-xxx->Sat[CLOCKORBIT_OFFSETGPS]. */
-
-struct ClockOrbit {
-  enum ClockOrbitType messageType;
-  unsigned int EpochTime[CLOCKORBIT_SATNUM];   /* 0 .. system specific maximum */
-  unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
-  unsigned int Supplied[COBOFS_NUM];           /* boolean */
-  unsigned int SSRIOD;
-  unsigned int SSRProviderID;
-  unsigned int SSRSolutionID;
-  unsigned int UpdateInterval;
-  enum SatelliteReferenceDatum SatRefDatum;
-  struct SatData {
-    unsigned int ID; /* all */
-    unsigned int IOD; /* all */
-    unsigned int toe; /* SBAS, BDS */
-    double UserRangeAccuracy; /* accuracy values in [m] */
-    double hrclock;
-    struct OrbitPart {
-      double DeltaRadial;           /* m */
-      double DeltaAlongTrack;       /* m */
-      double DeltaCrossTrack;       /* m */
-      double DotDeltaRadial;        /* m/s */
-      double DotDeltaAlongTrack;    /* m/s */
-      double DotDeltaCrossTrack;    /* m/s */
-    } Orbit;
-    struct ClockPart {
-      double DeltaA0;               /* m */
-      double DeltaA1;               /* m/s */
-      double DeltaA2;               /* m/ss */
-    } Clock;
-  } Sat[CLOCKORBIT_COUNTSAT];
-};
-
-struct CodeBias {
-  enum CodeBiasType messageType;
-  unsigned int EpochTime[CLOCKORBIT_SATNUM];   /* 0 .. system specific maximum */
-  unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
-  unsigned int UpdateInterval;
-  unsigned int SSRIOD;
-  unsigned int SSRProviderID;
-  unsigned int SSRSolutionID;
-  struct BiasSat {
-    unsigned int ID; /* all */
-    unsigned int NumberOfCodeBiases;
-    struct CodeBiasEntry {
-      enum CodeType Type;
-      float         Bias;           /* m */
-    } Biases[CLOCKORBIT_NUMBIAS];
-  } Sat[CLOCKORBIT_COUNTSAT];
-};
-
-struct PhaseBias {
-  enum PhaseBiasType messageType;
-  unsigned int EpochTime[CLOCKORBIT_SATNUM];   /* 0 .. system specific maximum */
-  unsigned int NumberOfSat[CLOCKORBIT_SATNUM]; /* 0 .. CLOCKORBIT_NUM... */
-  unsigned int UpdateInterval;
-  unsigned int SSRIOD;
-  unsigned int SSRProviderID;
-  unsigned int SSRSolutionID;
-  unsigned int DispersiveBiasConsistencyIndicator;
-  unsigned int MWConsistencyIndicator;
-  struct PhaseBiasSat {
-    unsigned int ID; /* all */
-    unsigned int NumberOfPhaseBiases;
-    double YawAngle; /* radiant */
-    double YawRate;  /* radiant/s */
-    struct PhaseBiasEntry {
-      enum CodeType Type;
-      unsigned int  SignalIntegerIndicator;
-      unsigned int  SignalsWideLaneIntegerIndicator;
-      unsigned int  SignalDiscontinuityCounter;
-      float         Bias;           /* m */
-    } Biases[CLOCKORBIT_NUMBIAS];
-  } Sat[CLOCKORBIT_COUNTSAT];
-};
-
-struct VTEC {
-  unsigned int EpochTime; /* GPS */
-  unsigned int UpdateInterval;
-  unsigned int SSRIOD;
-  unsigned int SSRProviderID;
-  unsigned int SSRSolutionID;
-  unsigned int NumLayers; /* 1-4 */
-  double Quality;
-  struct IonoLayers {
-    double       Height; /* m */
-    unsigned int Degree; /* 1-16 */
-    unsigned int Order; /* 1-16 */
-    double       Sinus[CLOCKORBIT_MAXIONODEGREE][CLOCKORBIT_MAXIONOORDER];
-    double       Cosinus[CLOCKORBIT_MAXIONODEGREE][CLOCKORBIT_MAXIONOORDER];
-  } Layers[CLOCKORBIT_NUMIONOLAYERS];
-};
-
-/* return size of resulting data or 0 in case of an error */
-size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
-       int moremessagesfollow, char *buffer, size_t size);
-size_t MakeCodeBias(const struct CodeBias *b, enum CodeBiasType type,
-       int moremessagesfollow, char *buffer, size_t size);
-size_t MakePhaseBias(const struct PhaseBias *b, enum PhaseBiasType type,
-       int moremessagesfollow, char *buffer, size_t size);
-size_t MakeVTEC(const struct VTEC *b, int moremessagesfollow, char *buffer,
-       size_t size);
-
-enum GCOB_RETURN {
-  /* all well */
-  GCOBR_MESSAGEFOLLOWS        =  1,
-  GCOBR_OK                    =  0,
-  /* unknown data, a warning */
-  GCOBR_UNKNOWNTYPE           = -1,
-  GCOBR_UNKNOWNDATA           = -2,
-  GCOBR_CRCMISMATCH           = -3,
-  GCOBR_SHORTMESSAGE          = -4,
-  /* failed to do the work */
-  GCOBR_NOCLOCKORBITPARAMETER = -10,
-  GCOBR_NOCODEBIASPARAMETER   = -11,
-  GCOBR_NOPHASEBIASPARAMETER  = -12,
-  GCOBR_NOVTECPARAMETER       = -13,
-  /* data mismatch - data in storage does not match new data */
-  GCOBR_TIMEMISMATCH          = -20,
-  GCOBR_DATAMISMATCH          = -21,
-  /* not enough data - can decode the block completely */
-  GCOBR_SHORTBUFFER           = -30,
-  GCOBR_MESSAGEEXCEEDSBUFFER  = -31};
-
-/* NOTE: When an error message has been emitted, the output structures may have been modified. Make a copy of the previous variant before calling the
-function to have a clean state. */
-
-/* buffer should point to a RTCM3 block */
-enum GCOB_RETURN GetSSR(struct ClockOrbit *co, struct CodeBias *b, struct VTEC *v,
-       struct PhaseBias *pb, const char *buffer, size_t size, int *bytesused);
+#include "clock_orbit.h"
+
+class SsrCorrRtcm: public SsrCorr {
+  //Q_OBJECT
+
+public:
+  SsrCorrRtcm() {
+    setCorBase();
+    setCorOffset();
+    setCoType();
+    setCbType();
+    setPbType();
+    setVtecType();
+    setCodeType();
+
+    satoffset << CLOCKORBIT_OFFSETGPS
+        << CLOCKORBIT_OFFSETGLONASS
+        << CLOCKORBIT_OFFSETGALILEO
+        << CLOCKORBIT_OFFSETQZSS
+        << CLOCKORBIT_OFFSETSBAS
+        << CLOCKORBIT_OFFSETBDS
+        << CLOCKORBIT_COUNTSAT;
+  };
+
+  ~SsrCorrRtcm() {};
+
+  void setCorBase() {
+    COBBASE_GPS     = 1057;
+    COBBASE_GLONASS = 1063;
+    COBBASE_GALILEO = 1240;
+    COBBASE_QZSS    = 1246;
+    COBBASE_SBAS    = 1252;
+    COBBASE_BDS     = 1258;
+    COBBASE_NUM     =    6;
+    corbase << COBBASE_GPS
+        << COBBASE_GLONASS
+        << COBBASE_GALILEO
+        << COBBASE_QZSS
+        << COBBASE_SBAS
+        << COBBASE_BDS;
+  };
+
+  void setCorOffset() {
+    COBOFS_ORBIT     = 0;
+    COBOFS_CLOCK     = 1;
+    COBOFS_CBIAS     = 2;
+    COBOFS_COMBINED  = 3;
+    COBOFS_URA       = 4;
+    COBOFS_HR        = 5;
+    COBOFS_NUM       = 6;
+  };
+
+  void setCoType() {
+    COTYPE_GPSORBIT        = COBBASE_GPS + COBOFS_ORBIT;
+    COTYPE_GPSCLOCK        = COTYPE_GPSORBIT + 1;
+    COTYPE_GPSCOMBINED     = COBBASE_GPS + COBOFS_COMBINED;
+    COTYPE_GPSURA          = COTYPE_GPSCOMBINED + 1;
+    COTYPE_GPSHR           = COTYPE_GPSURA + 1;
+
+    COTYPE_GLONASSORBIT    = COBBASE_GLONASS + COBOFS_ORBIT;
+    COTYPE_GLONASSCLOCK    = COTYPE_GLONASSORBIT + 1;
+    COTYPE_GLONASSCOMBINED = COBBASE_GLONASS + COBOFS_COMBINED;
+    COTYPE_GLONASSURA      = COTYPE_GLONASSCOMBINED + 1;
+    COTYPE_GLONASSHR       = COTYPE_GLONASSURA + 1;
+
+    COTYPE_GALILEOORBIT    = COBBASE_GALILEO + COBOFS_ORBIT,
+    COTYPE_GALILEOCLOCK    = COTYPE_GALILEOORBIT + 1;
+    COTYPE_GALILEOCOMBINED = COBBASE_GALILEO + COBOFS_COMBINED;
+    COTYPE_GALILEOURA      = COTYPE_GALILEOCOMBINED + 1;
+    COTYPE_GALILEOHR       = COTYPE_GALILEOURA + 1;
+
+    COTYPE_QZSSORBIT       = COBBASE_QZSS + COBOFS_ORBIT;
+    COTYPE_QZSSCLOCK       = COTYPE_QZSSORBIT + 1;
+    COTYPE_QZSSCOMBINED    = COBBASE_QZSS + COBOFS_COMBINED,
+    COTYPE_QZSSURA         = COTYPE_QZSSCOMBINED + 1;
+    COTYPE_QZSSHR          = COTYPE_QZSSURA + 1;
+
+    COTYPE_SBASORBIT       = COBBASE_SBAS + COBOFS_ORBIT;
+    COTYPE_SBASCLOCK       = COTYPE_SBASORBIT + 1;
+    COTYPE_SBASCOMBINED    = COBBASE_SBAS + COBOFS_COMBINED;
+    COTYPE_SBASURA         = COTYPE_SBASCOMBINED + 1;
+    COTYPE_SBASHR          = COTYPE_SBASURA + 1;
+
+    COTYPE_BDSORBIT        = COBBASE_BDS + COBOFS_ORBIT;
+    COTYPE_BDSCLOCK        = COTYPE_BDSORBIT + 1;
+    COTYPE_BDSCOMBINED     = COBBASE_BDS + COBOFS_COMBINED,
+    COTYPE_BDSURA          = COTYPE_BDSCOMBINED + 1;
+    COTYPE_BDSHR           = COTYPE_BDSURA + 1;
+
+    COTYPE_AUTO = 0;
+  };
+
+  void setCbType() {
+    CBTYPE_GPS     = COBBASE_GPS     + COBOFS_CBIAS;
+    CBTYPE_GLONASS = COBBASE_GLONASS + COBOFS_CBIAS;
+    CBTYPE_GALILEO = COBBASE_GALILEO + COBOFS_CBIAS;
+    CBTYPE_QZSS    = COBBASE_QZSS    + COBOFS_CBIAS;
+    CBTYPE_SBAS    = COBBASE_SBAS    + COBOFS_CBIAS;
+    CBTYPE_BDS     = COBBASE_BDS     + COBOFS_CBIAS;
+    CBTYPE_AUTO = 0;
+  };
+
+  void setPbType() {
+    PBTYPE_BASE    = 1265;
+    PBTYPE_GPS     = PBTYPE_BASE;
+    PBTYPE_GLONASS = PBTYPE_GPS++;
+    PBTYPE_GALILEO = PBTYPE_GLONASS++;
+    PBTYPE_QZSS    = PBTYPE_GALILEO++;
+    PBTYPE_SBAS    = PBTYPE_QZSS++;
+    PBTYPE_BDS     = PBTYPE_SBAS++;
+    PBTYPE_AUTO = 0;
+  };
+
+  void setVtecType() {
+      VTEC_BASE   = 1264;
+  };
+
+  void setCodeType() {
+    CODETYPE_GPS_L1_CA          =  0;
+    CODETYPE_GPS_L1_P           =  1;
+    CODETYPE_GPS_L1_Z           =  2;
+
+
+    CODETYPE_GPS_L2_CA          =  5;
+    CODETYPE_GPS_SEMI_CODELESS  =  6;
+    CODETYPE_GPS_L2C_M          =  7;
+    CODETYPE_GPS_L2C_L          =  8;
+    CODETYPE_GPS_L2C_ML         =  9;
+    CODETYPE_GPS_L2_P           = 10;
+    CODETYPE_GPS_L2_Z           = 11;
+
+
+    CODETYPE_GPS_L5_I           = 14;
+    CODETYPE_GPS_L5_Q           = 15;
+    CODETYPE_GPS_L5_IQ          = 16;
+    CODETYPE_GPS_L1C_D          = 17;
+    CODETYPE_GPS_L1C_P          = 18;
+    CODETYPE_GPS_L1C_DP         = 19;
+
+    CODETYPE_GLONASS_L1_CA      =  0;
+    CODETYPE_GLONASS_L1_P       =  1;
+    CODETYPE_GLONASS_L2_CA      =  2;
+    CODETYPE_GLONASS_L2_P       =  3;
+    CODETYPE_GLONASS_L1a_OCd    =  4;
+    CODETYPE_GLONASS_L1a_OCp    =  5;
+    CODETYPE_GLONASS_L1a_OCdp   =  6;
+    CODETYPE_GLONASS_L2a_CSI    =  7;
+    CODETYPE_GLONASS_L2a_OCp    =  8;
+    CODETYPE_GLONASS_L2a_CSIOCp =  9;
+    CODETYPE_GLONASS_L3_I       = 10;
+    CODETYPE_GLONASS_L3_Q       = 11;
+    CODETYPE_GLONASS_L3_IQ      = 12;
+
+    CODETYPE_GALILEO_E1_A       =  0;
+    CODETYPE_GALILEO_E1_B       =  1;
+    CODETYPE_GALILEO_E1_C       =  2;
+    CODETYPE_GALILEO_E1_BC      =  3;
+    CODETYPE_GALILEO_E1_ABC     =  4;
+    CODETYPE_GALILEO_E5A_I      =  5;
+    CODETYPE_GALILEO_E5A_Q      =  6;
+    CODETYPE_GALILEO_E5A_IQ     =  7;
+    CODETYPE_GALILEO_E5B_I      =  8;
+    CODETYPE_GALILEO_E5B_Q      =  9;
+    CODETYPE_GALILEO_E5B_IQ     = 10;
+    CODETYPE_GALILEO_E5_I       = 11;
+    CODETYPE_GALILEO_E5_Q       = 12;
+    CODETYPE_GALILEO_E5_IQ      = 13;
+    CODETYPE_GALILEO_E6_A       = 14;
+    CODETYPE_GALILEO_E6_B       = 15;
+    CODETYPE_GALILEO_E6_C       = 16;
+    CODETYPE_GALILEO_E6_BC      = 17;
+    CODETYPE_GALILEO_E6_ABC     = 18;
+
+    CODETYPE_QZSS_L1_CA         =  0;
+    CODETYPE_QZSS_L1C_D         =  1;
+    CODETYPE_QZSS_L1C_P         =  2;
+    CODETYPE_QZSS_L2C_M         =  3;
+    CODETYPE_QZSS_L2C_L         =  4;
+    CODETYPE_QZSS_L2C_ML        =  5;
+    CODETYPE_QZSS_L5_I          =  6;
+    CODETYPE_QZSS_L5_Q          =  7;
+    CODETYPE_QZSS_L5_IQ         =  8;
+    CODETYPE_QZSS_L6_D          =  9;
+    CODETYPE_QZSS_L6_P          = 10;
+    CODETYPE_QZSS_L6_DP         = 11;
+    CODETYPE_QZSS_L1C_DP        = 12;
+    CODETYPE_QZSS_L1_S          = 13;
+    CODETYPE_QZSS_L5_D          = 14;
+    CODETYPE_QZSS_L5_P          = 15;
+    CODETYPE_QZSS_L5_DP         = 16;
+    CODETYPE_QZSS_L6_E          = 17;
+    CODETYPE_QZSS_L6_DE         = 18;
+
+    CODETYPE_SBAS_L1_CA         =  0;
+    CODETYPE_SBAS_L5_I          =  1;
+    CODETYPE_SBAS_L5_Q          =  2;
+    CODETYPE_SBAS_L5_IQ         =  3;
+
+    CODETYPE_BDS_B1_I           =  0;
+    CODETYPE_BDS_B1_Q           =  1;
+    CODETYPE_BDS_B1_IQ          =  2;
+    CODETYPE_BDS_B3_I           =  3;
+    CODETYPE_BDS_B3_Q           =  4;
+    CODETYPE_BDS_B3_IQ          =  5;
+    CODETYPE_BDS_B2_I           =  6;
+    CODETYPE_BDS_B2_Q           =  7;
+    CODETYPE_BDS_B2_IQ          =  8;
+    CODETYPE_BDS_B1a_D          =  9;
+    CODETYPE_BDS_B1a_P          = 10;
+    CODETYPE_BDS_B1a_DP         = 11;
+    CODETYPE_BDS_B2a_D          = 12;
+    CODETYPE_BDS_B2a_P          = 13;
+    CODETYPE_BDS_B2a_DP         = 14;
+
+
+
+
+  }
+
+  std::string       codeTypeToRnxType(char system, CodeType type);
+  SsrCorr::CodeType rnxTypeToCodeType(char system, std::string type);
+
+  size_t MakeClockOrbit(const struct ClockOrbit *co, ClockOrbitType type,
+      int moremessagesfollow, char *buffer, size_t size);
+  size_t MakeCodeBias(const struct CodeBias *b, CodeBiasType type,
+      int moremessagesfollow, char *buffer, size_t size);
+  size_t MakePhaseBias(const struct PhaseBias *b, PhaseBiasType type,
+      int moremessagesfollow, char *buffer, size_t size);
+  size_t MakeVTEC(const struct VTEC *v, int moremessagesfollow, char *buffer,
+      size_t size);
+  enum GCOB_RETURN GetSSR(struct ClockOrbit *co, struct CodeBias *b,
+      struct VTEC *v, struct PhaseBias *pb, const char *buffer, size_t size,
+      int *bytesused);
+ };
 
 #endif /* RTCM3_CLOCK_ORBIT_RTCM_H */
Index: /trunk/BNC/src/bncwindow.cpp
===================================================================
--- /trunk/BNC/src/bncwindow.cpp	(revision 9024)
+++ /trunk/BNC/src/bncwindow.cpp	(revision 9025)
@@ -515,6 +515,6 @@
   // Upload Results
   // -------------
-  _uploadTable = new QTableWidget(0,14);
-  _uploadTable->setHorizontalHeaderLabels(QString("Host, Port, Mount, Ntrip, User, Password, System, CoM, SP3 File, RNX File, PID, SID, IOD, bytes").split(","));
+  _uploadTable = new QTableWidget(0,15);
+  _uploadTable->setHorizontalHeaderLabels(QString("Host, Port, Mount, Ntrip, User, Password, System, Format, CoM, SP3 File, RNX File, PID, SID, IOD, bytes").split(","));
   _uploadTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
   _uploadTable->setSelectionBehavior(QAbstractItemView::SelectRows);
@@ -526,11 +526,12 @@
   _uploadTable->horizontalHeader()->resizeSection( 5, 8*ww);
   _uploadTable->horizontalHeader()->resizeSection( 6,11*ww);
-  _uploadTable->horizontalHeader()->resizeSection( 7, 4*ww);
-  _uploadTable->horizontalHeader()->resizeSection( 8,15*ww);
+  _uploadTable->horizontalHeader()->resizeSection( 7,11*ww);
+  _uploadTable->horizontalHeader()->resizeSection( 8, 4*ww);
   _uploadTable->horizontalHeader()->resizeSection( 9,15*ww);
-  _uploadTable->horizontalHeader()->resizeSection(10, 4*ww);
+  _uploadTable->horizontalHeader()->resizeSection(10,15*ww);
   _uploadTable->horizontalHeader()->resizeSection(11, 4*ww);
   _uploadTable->horizontalHeader()->resizeSection(12, 4*ww);
-  _uploadTable->horizontalHeader()->resizeSection(13,12*ww);
+  _uploadTable->horizontalHeader()->resizeSection(13, 4*ww);
+  _uploadTable->horizontalHeader()->resizeSection(14,12*ww);
 #if QT_VERSION < 0x050000
   _uploadTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
@@ -1878,5 +1879,5 @@
     for (int iCol = 0; iCol < _uploadTable->columnCount(); iCol++) {
       if (_uploadTable->cellWidget(iRow, iCol) &&
-          (iCol == 3 || iCol == 4 || iCol == 5 || iCol == 6 || iCol == 7)) {
+          (iCol == 3 || iCol == 4 || iCol == 5 || iCol == 6 || iCol == 7 || iCol == 8)) {
         if       (iCol == 3) {
           QComboBox* ntripversion = (QComboBox*)(_uploadTable->cellWidget(iRow, iCol));
@@ -1896,4 +1897,8 @@
         }
         else if (iCol == 7) {
+          QComboBox* system = (QComboBox*)(_uploadTable->cellWidget(iRow, iCol));
+          hlp += system->currentText() + ",";
+        }
+        else if (iCol == 8) {
           QCheckBox* com    = (QCheckBox*)(_uploadTable->cellWidget(iRow, iCol));
           QString state; state.setNum(com->checkState());
@@ -2709,8 +2714,15 @@
     }
     else if (iCol == 7) {
+      QComboBox* format = new QComboBox();
+      format->setEditable(false);
+      format->addItems(QString("IGS-SSR,RTCM-SSR").split(","));
+      format->setFrame(false);
+      _uploadTable->setCellWidget(iRow, iCol, format);
+    }
+    else if (iCol == 8) {
       QCheckBox* com = new QCheckBox();
       _uploadTable->setCellWidget(iRow, iCol, com);
     }
-    else if (iCol == 13) {
+    else if (iCol == 14) {
       bncTableItem* bncIt = new bncTableItem();
       bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
@@ -2745,5 +2757,5 @@
   for (int iRow = 0; iRow < _uploadTable->rowCount(); iRow++) {
     BNC_CORE->_uploadTableItems[iRow] =
-                                (bncTableItem*) _uploadTable->item(iRow, 13);
+                                (bncTableItem*) _uploadTable->item(iRow, 14);
   }
   nRows = _uploadTable->rowCount();
@@ -2806,4 +2818,12 @@
       }
       else if (iCol == 7) {
+        QComboBox* format = new QComboBox();
+        format->setEditable(false);
+        format->addItems(QString("IGS-SSR,RTCM-SSR").split(","));
+        format->setFrame(false);
+        format->setCurrentIndex(format->findText(hlp[iCol]));
+        _uploadTable->setCellWidget(iRow, iCol, format);
+      }
+      else if (iCol == 8) {
         QCheckBox* com = new QCheckBox();
         if (hlp[iCol].toInt() == Qt::Checked) {
@@ -2812,5 +2832,5 @@
         _uploadTable->setCellWidget(iRow, iCol, com);
       }
-      else if (iCol == 13) {
+      else if (iCol == 14) {
         bncTableItem* bncIt = new bncTableItem();
         bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
Index: /trunk/BNC/src/combination/bnccomb.cpp
===================================================================
--- /trunk/BNC/src/combination/bnccomb.cpp	(revision 9024)
+++ /trunk/BNC/src/combination/bnccomb.cpp	(revision 9025)
@@ -162,4 +162,21 @@
   }
 
+  QString ssrFormat;
+  QListIterator<QString> it(settings.value("uploadMountpointsOut").toStringList());
+  while (it.hasNext()) {
+    QStringList hlp = it.next().split(",");
+    if (hlp.size() > 7) {
+      ssrFormat = hlp[7];
+    }
+  }
+  _ssrCorr = 0;
+  if      (ssrFormat == "IGS-SSR") {
+    _ssrCorr = new SsrCorrIgs();
+  }
+  else if (ssrFormat == "RTCM-SSR") {
+    _ssrCorr = new SsrCorrRtcm();
+  }
+
+
   _rtnetDecoder = 0;
 
@@ -266,4 +283,7 @@
   }
   delete _rtnetDecoder;
+  if (_ssrCorr) {
+    delete _ssrCorr;
+  }
   delete _antex;
   for (int iPar = 1; iPar <= _params.size(); iPar++) {
@@ -714,5 +734,5 @@
 
   QString     outLines;
-  QStringList corrLines;
+  //QStringList corrLines;
 
   unsigned year, month, day, hour, minute;
@@ -770,5 +790,5 @@
 
     QString line;
-    int messageType   = COTYPE_GPSCOMBINED;
+    int messageType   = _ssrCorr->COTYPE_GPSCOMBINED;
     int updateInt     = 0;
     line.sprintf("%d %d %d %.1f %s"
@@ -789,5 +809,5 @@
                  corr->_orbCorr._dotXr[2],
                  0.0);
-    corrLines << line;
+    //corrLines << line;
 
     delete corr;
Index: /trunk/BNC/src/combination/bnccomb.h
===================================================================
--- /trunk/BNC/src/combination/bnccomb.h	(revision 9024)
+++ /trunk/BNC/src/combination/bnccomb.h	(revision 9025)
@@ -7,4 +7,6 @@
 #include "bncephuser.h"
 #include "satObs.h"
+#include "../RTCM3/clock_and_orbit/clock_orbit_rtcm.h"
+#include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
 
 class bncRtnetDecoder;
@@ -126,4 +128,5 @@
   QMap<QString, QMap<t_prn, t_orbCorr> > _orbCorrections;
   bncEphUser                             _ephUser;
+  SsrCorr*                               _ssrCorr;
 };
 
Index: /trunk/BNC/src/src.pri
===================================================================
--- /trunk/BNC/src/src.pri	(revision 9024)
+++ /trunk/BNC/src/src.pri	(revision 9025)
@@ -63,4 +63,7 @@
           RTCM3/RTCM3Decoder.h RTCM3/bits.h RTCM3/gnss.h              \
           RTCM3/RTCM3coDecoder.h RTCM3/ephEncoder.h                   \
+          RTCM3/clock_and_orbit/clock_orbit.h                         \
+          RTCM3/clock_and_orbit/clock_orbit_igs.h                     \
+          RTCM3/clock_and_orbit/clock_orbit_rtcm.h                    \
           rinex/rnxobsfile.h                                          \
           rinex/rnxnavfile.h       rinex/corrfile.h                   \
@@ -99,4 +102,6 @@
           RTCM3/RTCM3Decoder.cpp                                      \
           RTCM3/RTCM3coDecoder.cpp RTCM3/ephEncoder.cpp               \
+          RTCM3/clock_and_orbit/clock_orbit_igs.cpp                   \
+          RTCM3/clock_and_orbit/clock_orbit_rtcm.cpp                  \
           rinex/rnxobsfile.cpp                                        \
           rinex/rnxnavfile.cpp     rinex/corrfile.cpp                 \
@@ -114,18 +119,4 @@
 
 QT += network
-
-
-# Format of SSR corrections
-# -------------------------
-DEFINES += USE_SSR_RTCM
-#DEFINES += USE_SSR_IGS
-contains(DEFINES, USE_SSR_IGS) {
-  HEADERS += RTCM3/clock_and_orbit/clock_orbit_igs.h
-  SOURCES += RTCM3/clock_and_orbit/clock_orbit_igs.c
-}
-else {
-  HEADERS += RTCM3/clock_and_orbit/clock_orbit_rtcm.h
-  SOURCES += RTCM3/clock_and_orbit/clock_orbit_rtcm.c
-}
 
 exists(PPP) {
Index: /trunk/BNC/src/upload/bncrtnetdecoder.cpp
===================================================================
--- /trunk/BNC/src/upload/bncrtnetdecoder.cpp	(revision 9024)
+++ /trunk/BNC/src/upload/bncrtnetdecoder.cpp	(revision 9025)
@@ -56,25 +56,25 @@
   while (it.hasNext()) {
     QStringList hlp = it.next().split(",");
-    if (hlp.size() > 6) {
+    if (hlp.size() > 8) {
       ++iRow;
       int  outPort = hlp[1].toInt();
-      bool CoM     = (hlp[7].toInt() == Qt::Checked);
+      bool CoM     = (hlp[8].toInt() == Qt::Checked);
       int PID = 0;
-      if (hlp.size() > 10) {
-        PID = hlp[10].toInt();
+      if (hlp.size() > 11) {
+        PID = hlp[11].toInt();
       }
       int SID = 0;
-      if (hlp.size() > 11) {
-        SID = hlp[11].toInt();
+      if (hlp.size() > 12) {
+        SID = hlp[12].toInt();
       }
       int IOD = 0;
-      if (hlp.size() > 12) {
-        IOD = hlp[12].toInt();
+      if (hlp.size() > 13) {
+        IOD = hlp[13].toInt();
       }
       bncRtnetUploadCaster* newCaster = new bncRtnetUploadCaster(
                                                        hlp[2], hlp[0], outPort,
                                                        hlp[3], hlp[4],
-                                                       hlp[5], hlp[6], CoM,
-                                                       hlp[8], hlp[9],
+                                                       hlp[5], hlp[6], hlp[7], CoM,
+                                                       hlp[9], hlp[10],
                                                        PID, SID, IOD, iRow);
       newCaster->start();
Index: /trunk/BNC/src/upload/bncrtnetuploadcaster.cpp
===================================================================
--- /trunk/BNC/src/upload/bncrtnetuploadcaster.cpp	(revision 9024)
+++ /trunk/BNC/src/upload/bncrtnetuploadcaster.cpp	(revision 9025)
@@ -31,8 +31,8 @@
     const QString& ntripVersion,
     const QString& userName, const QString& password,
-    const QString& crdTrafo, bool CoM, const QString& sp3FileName,
+    const QString& crdTrafo, const QString& ssrFormat, bool CoM, const QString& sp3FileName,
     const QString& rnxFileName, int PID, int SID, int IOD, int iRow) :
     bncUploadCaster(mountpoint, outHost, outPort, ntripVersion, userName, password, iRow, 0) {
-
+qDebug() << "bncRtnetUploadCaster";
 
   if (!mountpoint.isEmpty()) {
@@ -56,4 +56,16 @@
 
   _crdTrafo = crdTrafo;
+
+  _ssrFormat = ssrFormat;qDebug() << _ssrFormat;
+  _ssrCorr = 0;
+  if      (_ssrFormat == "IGS-SSR") {qDebug() << "bin hier IGS";
+    _ssrCorr = new SsrCorrIgs();
+  }
+  else if (_ssrFormat == "RTCM-SSR") {qDebug() << "bin hier RTCM";
+    _ssrCorr = new SsrCorrRtcm();
+  }
+if (!_ssrCorr) {
+  qDebug() << "no _ssrCorr";
+}
   _CoM = CoM;
   _PID = PID;
@@ -228,10 +240,11 @@
   delete _ephUser;
   delete _usedEph;
+  delete _ssrCorr;
 }
 
 //
 ////////////////////////////////////////////////////////////////////////////
-void bncRtnetUploadCaster::decodeRtnetStream(char* buffer, int bufLen) {
-
+void bncRtnetUploadCaster::decodeRtnetStream(char* buffer, int bufLen) {qDebug() << "decodeRtnetStream";
+  qDebug() << "decodeRtnetStream";
   QMutexLocker locker(&_mutex);
 
@@ -294,58 +307,60 @@
           + _casterID.toLatin1(), false));
 
-  struct ClockOrbit co;
+  struct SsrCorr::ClockOrbit co;
   memset(&co, 0, sizeof(co));
   co.EpochTime[CLOCKORBIT_SATGPS] = static_cast<int>(epoTime.gpssec());
-#ifdef USE_SSR_RTCM
-  double gt = epoTime.gpssec() + 3 * 3600 - gnumleap(year, month, day);
-  co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(fmod(gt, 86400.0));
-#elif USE_SSR_IGS
-  co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(epoTime.gpssec());
-#endif
+  if      (_ssrFormat == "RTCM-SSR") {
+    double gt = epoTime.gpssec() + 3 * 3600 - gnumleap(year, month, day);
+    co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(fmod(gt, 86400.0));
+  }
+  else if (_ssrFormat == "IGS-SSR") {
+    co.EpochTime[CLOCKORBIT_SATGLONASS] = static_cast<int>(epoTime.gpssec());
+  }
   co.EpochTime[CLOCKORBIT_SATGALILEO] = static_cast<int>(epoTime.gpssec());
-  co.EpochTime[CLOCKORBIT_SATQZSS] = static_cast<int>(epoTime.gpssec());
-  co.EpochTime[CLOCKORBIT_SATSBAS] = static_cast<int>(epoTime.gpssec());
-#ifdef USE_SSR_RTCM
-  co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.bdssec());
-#elif  USE_SSR_IGS
-  co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.gpssec());
-#endif
-  co.Supplied[COBOFS_CLOCK] = 1;
-  co.Supplied[COBOFS_ORBIT] = 1;
-  co.SatRefDatum = DATUM_ITRF;
-  co.SSRIOD = _IOD;
+  co.EpochTime[CLOCKORBIT_SATQZSS]    = static_cast<int>(epoTime.gpssec());
+  co.EpochTime[CLOCKORBIT_SATSBAS]    = static_cast<int>(epoTime.gpssec());
+  if      (_ssrFormat == "RTCM-SSR") {
+    co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.bdssec());
+  }
+  else if (_ssrFormat == "IGS-SSR") {
+    co.EpochTime[CLOCKORBIT_SATBDS] = static_cast<int>(epoTime.gpssec());
+  }
+  co.Supplied[_ssrCorr->COBOFS_CLOCK] = 1;
+  co.Supplied[_ssrCorr->COBOFS_ORBIT] = 1;
+  co.SatRefDatum = _ssrCorr->DATUM_ITRF; // ToDo: to decode from RTNET format
+  co.SSRIOD        = _IOD;
   co.SSRProviderID = _PID; // 256 .. BKG,  257 ... EUREF
   co.SSRSolutionID = _SID;
 
-  struct CodeBias bias;
+  struct SsrCorr::CodeBias bias;
   memset(&bias, 0, sizeof(bias));
-  bias.EpochTime[CLOCKORBIT_SATGPS] = co.EpochTime[CLOCKORBIT_SATGPS];
+  bias.EpochTime[CLOCKORBIT_SATGPS]     = co.EpochTime[CLOCKORBIT_SATGPS];
   bias.EpochTime[CLOCKORBIT_SATGLONASS] = co.EpochTime[CLOCKORBIT_SATGLONASS];
   bias.EpochTime[CLOCKORBIT_SATGALILEO] = co.EpochTime[CLOCKORBIT_SATGALILEO];
-  bias.EpochTime[CLOCKORBIT_SATQZSS] = co.EpochTime[CLOCKORBIT_SATQZSS];
-  bias.EpochTime[CLOCKORBIT_SATSBAS] = co.EpochTime[CLOCKORBIT_SATSBAS];
-  bias.EpochTime[CLOCKORBIT_SATBDS] = co.EpochTime[CLOCKORBIT_SATBDS];
-  bias.SSRIOD = _IOD;
+  bias.EpochTime[CLOCKORBIT_SATQZSS]    = co.EpochTime[CLOCKORBIT_SATQZSS];
+  bias.EpochTime[CLOCKORBIT_SATSBAS]    = co.EpochTime[CLOCKORBIT_SATSBAS];
+  bias.EpochTime[CLOCKORBIT_SATBDS]     = co.EpochTime[CLOCKORBIT_SATBDS];
+  bias.SSRIOD        = _IOD;
   bias.SSRProviderID = _PID;
   bias.SSRSolutionID = _SID;
 
-  struct PhaseBias phasebias;
+  struct SsrCorr::PhaseBias phasebias;
   memset(&phasebias, 0, sizeof(phasebias));
   unsigned int dispersiveBiasConsistenyIndicator = 0;
   unsigned int mwConsistencyIndicator = 0;
-  phasebias.EpochTime[CLOCKORBIT_SATGPS] = co.EpochTime[CLOCKORBIT_SATGPS];
+  phasebias.EpochTime[CLOCKORBIT_SATGPS]     = co.EpochTime[CLOCKORBIT_SATGPS];
   phasebias.EpochTime[CLOCKORBIT_SATGLONASS] = co.EpochTime[CLOCKORBIT_SATGLONASS];
   phasebias.EpochTime[CLOCKORBIT_SATGALILEO] = co.EpochTime[CLOCKORBIT_SATGALILEO];
-  phasebias.EpochTime[CLOCKORBIT_SATQZSS] = co.EpochTime[CLOCKORBIT_SATQZSS];
-  phasebias.EpochTime[CLOCKORBIT_SATSBAS] = co.EpochTime[CLOCKORBIT_SATSBAS];
-  phasebias.EpochTime[CLOCKORBIT_SATBDS] = co.EpochTime[CLOCKORBIT_SATBDS];
-  phasebias.SSRIOD = _IOD;
+  phasebias.EpochTime[CLOCKORBIT_SATQZSS]    = co.EpochTime[CLOCKORBIT_SATQZSS];
+  phasebias.EpochTime[CLOCKORBIT_SATSBAS]    = co.EpochTime[CLOCKORBIT_SATSBAS];
+  phasebias.EpochTime[CLOCKORBIT_SATBDS]     = co.EpochTime[CLOCKORBIT_SATBDS];
+  phasebias.SSRIOD        = _IOD;
   phasebias.SSRProviderID = _PID;
   phasebias.SSRSolutionID = _SID;
 
-  struct VTEC vtec;
+  struct SsrCorr::VTEC vtec;
   memset(&vtec, 0, sizeof(vtec));
   vtec.EpochTime = static_cast<int>(epoTime.gpssec());
-  vtec.SSRIOD = _IOD;
+  vtec.SSRIOD        = _IOD;
   vtec.SSRProviderID = _PID;
   vtec.SSRSolutionID = _SID;
@@ -468,5 +483,5 @@
         QString key;
         int numVal = 0;
-        in >> key;
+        in >> key;qDebug() << key;
         if (in.status() != QTextStream::Ok) {
           break;
@@ -553,5 +568,5 @@
       }
 
-      struct ClockOrbit::SatData* sd = 0;
+      struct SsrCorr::ClockOrbit::SatData* sd = 0;
       if (prn.system() == 'G') {
         sd = co.Sat + co.NumberOfSat[CLOCKORBIT_SATGPS];
@@ -599,5 +614,5 @@
       // Code Biases
       // -----------
-      struct CodeBias::BiasSat* biasSat = 0;
+      struct SsrCorr::CodeBias::BiasSat* biasSat = 0;
       if (!codeBiases.isEmpty()) {
         if (prn.system() == 'G') {
@@ -639,783 +654,15 @@
         biasSat->ID = prn.number();
         biasSat->NumberOfCodeBiases = 0;
-        if (prn.system() == 'G') {
-          QMapIterator<QString, double> it(codeBiases);
-          while (it.hasNext()) {
-            it.next();
-            if (it.key() == "1C") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L1_CA;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1S") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L1C_D;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1L") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L1C_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "1X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L1C_DP;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "1P") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L1_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1W") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L1_Z;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2C") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L2_CA;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2D") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_SEMI_CODELESS;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2S") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L2C_M;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2L") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L2C_L;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "2X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L2C_ML;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "2P") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L2_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2W") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L2_Z;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L5_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L5_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "5X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGPS_L5_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-          }
-        }
-        else if (prn.system() == 'R') {
-          QMapIterator<QString, double> it(codeBiases);
-          while (it.hasNext()) {
-            it.next();
-            if (it.key() == "1C") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L1_CA;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1P") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L1_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2C") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L2_CA;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2P") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L2_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "4A") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L1a_OCd;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "4B") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L1a_OCp;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "4X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L1a_OCdp;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "6A") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L2a_CSI;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "6B") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L2a_OCp;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "6X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L2a_CSIOCp;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "3I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L3_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "3Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L3_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "3X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGLONASS_L3_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-          }
-        }
-        else if (prn.system() == 'E') {
-          QMapIterator<QString, double> it(codeBiases);
-          while (it.hasNext()) {
-            it.next();
-            if (it.key() == "1A") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E1_A;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1B") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E1_B;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1C") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E1_C;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "1X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E1_BC;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1Z") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E1_ABC;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "5I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E5A_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E5A_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "5X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E5A_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "7I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E5B_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "7Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E5B_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "7X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E5B_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "8I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E5_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "8Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E5_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "8X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E5_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "6A") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E6_A;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "6B") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E6_B;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "6C") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E6_C;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "6X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E6_BC;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "6Z") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEGALILEO_E6_ABC;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-          }
-        }
-        else if (prn.system() == 'J') {
-          QMapIterator<QString, double> it(codeBiases);
-          while (it.hasNext()) {
-            it.next();
-            if (it.key() == "1C") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L1_CA;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1S") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L1C_D;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1L") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L1C_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2S") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L2C_M;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2L") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L2C_L;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "2X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L2C_ML;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "5I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L5_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L5_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "5X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L5_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "6S") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L6_D;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "6L") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L6_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "6X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L6_DP;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-                        else if (it.key() == "1X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L1C_DP;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1Z") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L1_S;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5D") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L5_D;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5P") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L5_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5Z") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L5_DP;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "6E") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L6_E;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "6Z") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPEQZSS_L6_DE;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-          }
-        }
-        else if (prn.system() == 'S') {
-          QMapIterator<QString, double> it(codeBiases);
-          while (it.hasNext()) {
-            it.next();
-            if (it.key() == "1C") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_SBAS_L1_CA;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_SBAS_L5_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_SBAS_L5_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "5X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_SBAS_L5_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-          }
-        }
-        else if (prn.system() == 'C') {
-          QMapIterator<QString, double> it(codeBiases);
-          while (it.hasNext()) {
-            it.next();
-            if (it.key() == "2I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B1_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "2Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B1_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "2X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B1_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "6I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B3_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "6Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B3_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "6X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B3_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "7I") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B2_I;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "7Q") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B2_Q;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "7X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B2_IQ;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "1D") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B1a_D;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "1P") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B1a_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "1X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B1a_DP;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
-            else if (it.key() == "5D") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B2a_D;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "5P") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B2a_P;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#ifdef USE_SSR_RTCM
-            else if (it.key() == "5X") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B2a_DP;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#elif USE_SSR_IGS
-            else if (it.key() == "1A") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B1_A;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-            else if (it.key() == "6A") {
-              int ii = biasSat->NumberOfCodeBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              biasSat->NumberOfCodeBiases += 1;
-              biasSat->Biases[ii].Type = CODETYPE_BDS_B3_A;
-              biasSat->Biases[ii].Bias = it.value();
-            }
-#endif
+        QMapIterator<QString, double> it(codeBiases);
+        while (it.hasNext()) {
+          it.next();
+          int ii = biasSat->NumberOfCodeBiases;
+          if (ii >= CLOCKORBIT_NUMBIAS)
+            break;
+          SsrCorr::CodeType type = _ssrCorr->rnxTypeToCodeType(prn.system(), it.key().toStdString());
+          if (type != _ssrCorr->RESERVED) {
+            biasSat->NumberOfCodeBiases += 1;
+            biasSat->Biases[ii].Type = type;
+            biasSat->Biases[ii].Bias = it.value();
           }
         }
@@ -1424,5 +671,5 @@
       // Phase Biases
       // ------------
-      struct PhaseBias::PhaseBiasSat* phasebiasSat = 0;
+      struct SsrCorr::PhaseBias::PhaseBiasSat* phasebiasSat = 0;
       if (prn.system()      == 'G') {
         phasebiasSat = phasebias.Sat
@@ -1467,1035 +714,18 @@
         phasebiasSat->YawAngle = pbSat.yawAngle;
         phasebiasSat->YawRate = pbSat.yawRate;
-        if (prn.system() == 'G') {
-          QListIterator<phaseBiasSignal> it(phaseBiasList);
-          while (it.hasNext()) {
-            const phaseBiasSignal &pbSig = it.next();
-            if (pbSig.type == "1C") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L1_CA;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1P") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L1_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1W") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L1_Z;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2C") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L2_CA;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2D") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_SEMI_CODELESS;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2S") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L2C_M;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2L") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L2C_L;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "2X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L2C_ML;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "2P") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L2_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2W") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L2_Z;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L5_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L5_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "5X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L5_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "1S") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L1C_D;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1L") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L1C_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "1X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGPS_L1C_DP;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-          }
-        }
-        if (prn.system() == 'R') {
-          QListIterator<phaseBiasSignal> it(phaseBiasList);
-          while (it.hasNext()) {
-            const phaseBiasSignal &pbSig = it.next();
-            if (pbSig.type == "1C") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L1_CA;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1P") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L1_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2C") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L2_CA;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2P") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L2_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "4A") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L1a_OCd;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "4B") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L1a_OCp;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "4X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L1a_OCdp;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "6A") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L2a_CSI;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "6B") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L2a_OCp;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "6X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L2a_CSIOCp;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "3I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L3_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "3Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L3_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "3X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGLONASS_L3_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-          }
-        }
-        if (prn.system() == 'E') {
-          QListIterator<phaseBiasSignal> it(phaseBiasList);
-          while (it.hasNext()) {
-            const phaseBiasSignal &pbSig = it.next();
-            if (pbSig.type == "1A") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E1_A;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1B") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E1_B;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1C") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E1_C;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "1X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E1_BC;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1Z") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E1_ABC;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "5I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E5A_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E5A_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "5X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E5A_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "7I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E5B_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "7Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E5B_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "7X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E5B_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "8I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E5_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "8Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E5_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "8X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E5_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "6A") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E6_A;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "6B") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E6_B;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "6C") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E6_C;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "6X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E6_BC;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "6Z") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEGALILEO_E6_ABC;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-          }
-        }
-        if (prn.system() == 'J') {
-          QListIterator<phaseBiasSignal> it(phaseBiasList);
-          while (it.hasNext()) {
-            const phaseBiasSignal &pbSig = it.next();
-            if (pbSig.type == "1C") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L1_CA;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1S") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L1C_D;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1L") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L1C_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2S") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L2C_M;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2L") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L2C_L;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "2X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L2C_ML;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "5I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L5_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L5_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "5X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L5_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "6S") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L6_D;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "6L") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L6_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "6X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L6_DP;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-                        else if (pbSig.type == "1X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L1C_DP;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1Z") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L1_S;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5D") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L5_D;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5P") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L5_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5Z") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L5_DP;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "6E") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L6_E;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "6Z") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPEQZSS_L6_DE;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-          }
-        }
-        if (prn.system() == 'S') {
-          QListIterator<phaseBiasSignal> it(phaseBiasList);
-          while (it.hasNext()) {
-            const phaseBiasSignal &pbSig = it.next();
-            if (pbSig.type == "1C") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_SBAS_L1_CA;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_SBAS_L5_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_SBAS_L5_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "5X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_SBAS_L5_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-          }
-        }
-        if (prn.system() == 'C') {
-          QListIterator<phaseBiasSignal> it(phaseBiasList);
-          while (it.hasNext()) {
-            const phaseBiasSignal &pbSig = it.next();
-            if (pbSig.type == "2I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B1_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "2Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B1_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "2X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B1_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "6I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B3_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "6Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B3_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "6X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B3_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "7I") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B2_I;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "7Q") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B2_Q;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "7X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B2_IQ;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "1D") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B1a_D;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "1P") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B1a_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "1X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B1a_DP;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
-            else if (pbSig.type == "5D") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B2a_D;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "5P") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B2a_P;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#ifdef USE_SSR_RTCM
-            else if (pbSig.type == "5X") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B2a_DP;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#elif USE_SSR_IGS
-            else if (pbSig.type == "1A") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B1_A;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-            else if (pbSig.type == "6A") {
-              int ii = phasebiasSat->NumberOfPhaseBiases;
-              if (ii >= CLOCKORBIT_NUMBIAS)
-                break;
-              phasebiasSat->NumberOfPhaseBiases += 1;
-              phasebiasSat->Biases[ii].Type = CODETYPE_BDS_B3_A;
-              phasebiasSat->Biases[ii].Bias = pbSig.bias;
-              phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
-              phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
-            }
-#endif
+        QListIterator<phaseBiasSignal> it(phaseBiasList);
+        while (it.hasNext()) {
+          const phaseBiasSignal &pbSig = it.next();
+          int ii = phasebiasSat->NumberOfPhaseBiases;
+          if (ii >= CLOCKORBIT_NUMBIAS)
+            break;
+          SsrCorr::CodeType type = _ssrCorr->rnxTypeToCodeType(prn.system(), pbSig.type.toStdString());
+          if (type != _ssrCorr->RESERVED) {
+            phasebiasSat->NumberOfPhaseBiases += 1;
+            phasebiasSat->Biases[ii].Type = type;
+            phasebiasSat->Biases[ii].Bias = pbSig.bias;
+            phasebiasSat->Biases[ii].SignalIntegerIndicator = pbSig.integerIndicator;
+            phasebiasSat->Biases[ii].SignalsWideLaneIntegerIndicator = pbSig.wlIndicator;
+            phasebiasSat->Biases[ii].SignalDiscontinuityCounter = pbSig.discontinuityCounter;
           }
         }
@@ -2517,5 +747,5 @@
         || co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
       char obuffer[CLOCKORBIT_BUFFERSIZE];
-      int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
+      int len = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
       if (len > 0) {
         hlpBufferCo = QByteArray(obuffer, len);
@@ -2531,5 +761,5 @@
       if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
         co.UpdateInterval = ephUpdInd;
-        int len1 = MakeClockOrbit(&co, COTYPE_GPSORBIT, 1, obuffer,
+        int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GPSORBIT, 1, obuffer,
             sizeof(obuffer));
         co.UpdateInterval = clkUpdInd;
@@ -2543,5 +773,5 @@
                   co.NumberOfSat[CLOCKORBIT_SATSBAS]    > 0 ||
                   co.NumberOfSat[CLOCKORBIT_SATBDS]     > 0   ) ? 1 : 0;
-      int len2 = MakeClockOrbit(&co, COTYPE_GPSCLOCK, mmsg, obuffer,
+      int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GPSCLOCK, mmsg, obuffer,
           sizeof(obuffer));
       if (len2 > 0) {
@@ -2553,5 +783,5 @@
       if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
         co.UpdateInterval = ephUpdInd;
-        int len1 = MakeClockOrbit(&co, COTYPE_GLONASSORBIT, 1, obuffer,
+        int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GLONASSORBIT, 1, obuffer,
             sizeof(obuffer));
         co.UpdateInterval = clkUpdInd;
@@ -2564,5 +794,5 @@
                   co.NumberOfSat[CLOCKORBIT_SATSBAS]    > 0 ||
                   co.NumberOfSat[CLOCKORBIT_SATBDS]     > 0   ) ? 1 : 0;
-      int len2 = MakeClockOrbit(&co, COTYPE_GLONASSCLOCK, mmsg, obuffer,
+      int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GLONASSCLOCK, mmsg, obuffer,
           sizeof(obuffer));
       if (len2 > 0) {
@@ -2574,5 +804,5 @@
       if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
         co.UpdateInterval = ephUpdInd;
-        int len1 = MakeClockOrbit(&co, COTYPE_GALILEOORBIT, 1, obuffer,
+        int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GALILEOORBIT, 1, obuffer,
             sizeof(obuffer));
         co.UpdateInterval = clkUpdInd;
@@ -2584,5 +814,5 @@
                   co.NumberOfSat[CLOCKORBIT_SATSBAS]    > 0 ||
                   co.NumberOfSat[CLOCKORBIT_SATBDS]     > 0   ) ? 1 : 0;
-      int len2 = MakeClockOrbit(&co, COTYPE_GALILEOCLOCK, mmsg, obuffer,
+      int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_GALILEOCLOCK, mmsg, obuffer,
           sizeof(obuffer));
       if (len2 > 0) {
@@ -2594,5 +824,5 @@
       if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
         co.UpdateInterval = ephUpdInd;
-        int len1 = MakeClockOrbit(&co, COTYPE_QZSSORBIT, 1, obuffer,
+        int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_QZSSORBIT, 1, obuffer,
             sizeof(obuffer));
         co.UpdateInterval = clkUpdInd;
@@ -2603,5 +833,5 @@
       int mmsg = (co.NumberOfSat[CLOCKORBIT_SATSBAS]    > 0 ||
                   co.NumberOfSat[CLOCKORBIT_SATBDS]     > 0   ) ? 1 : 0;
-      int len2 = MakeClockOrbit(&co, COTYPE_QZSSCLOCK, mmsg, obuffer,
+      int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_QZSSCLOCK, mmsg, obuffer,
           sizeof(obuffer));
       if (len2 > 0) {
@@ -2613,5 +843,5 @@
       if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
         co.UpdateInterval = ephUpdInd;
-        int len1 = MakeClockOrbit(&co, COTYPE_SBASORBIT, 1, obuffer,
+        int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_SBASORBIT, 1, obuffer,
             sizeof(obuffer));
         co.UpdateInterval = clkUpdInd;
@@ -2621,5 +851,5 @@
       }
       int mmsg = (co.NumberOfSat[CLOCKORBIT_SATBDS] > 0) ? 1 : 0;
-      int len2 = MakeClockOrbit(&co, COTYPE_SBASCLOCK, mmsg, obuffer,
+      int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_SBASCLOCK, mmsg, obuffer,
           sizeof(obuffer));
       if (len2 > 0) {
@@ -2631,5 +861,5 @@
       if (fmod(epoTime.gpssec(), _samplRtcmEphCorr) == 0.0) {
         co.UpdateInterval = ephUpdInd;
-        int len1 = MakeClockOrbit(&co, COTYPE_BDSORBIT, 1, obuffer,
+        int len1 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_BDSORBIT, 1, obuffer,
             sizeof(obuffer));
         co.UpdateInterval = clkUpdInd;
@@ -2639,5 +869,5 @@
       }
       int mmsg = 0;
-      int len2 = MakeClockOrbit(&co, COTYPE_BDSCLOCK, mmsg, obuffer,
+      int len2 = _ssrCorr->MakeClockOrbit(&co, _ssrCorr->COTYPE_BDSCLOCK, mmsg, obuffer,
           sizeof(obuffer));
       if (len2 > 0) {
@@ -2657,5 +887,5 @@
       || bias.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
     char obuffer[CLOCKORBIT_BUFFERSIZE];
-    int len = MakeCodeBias(&bias, CBTYPE_AUTO, 0, obuffer, sizeof(obuffer));
+    int len = _ssrCorr->MakeCodeBias(&bias, _ssrCorr->CBTYPE_AUTO, 0, obuffer, sizeof(obuffer));
     if (len > 0) {
       hlpBufferBias = QByteArray(obuffer, len);
@@ -2673,5 +903,5 @@
       || phasebias.NumberOfSat[CLOCKORBIT_SATBDS] > 0) {
     char obuffer[CLOCKORBIT_BUFFERSIZE];
-    int len = MakePhaseBias(&phasebias, PBTYPE_AUTO, 0, obuffer,
+    int len = _ssrCorr->MakePhaseBias(&phasebias, _ssrCorr->PBTYPE_AUTO, 0, obuffer,
         sizeof(obuffer));
     if (len > 0) {
@@ -2685,5 +915,5 @@
   if (vtec.NumLayers > 0) {
     char obuffer[CLOCKORBIT_BUFFERSIZE];
-    int len = MakeVTEC(&vtec, 0, obuffer, sizeof(obuffer));
+    int len = _ssrCorr->MakeVTEC(&vtec, 0, obuffer, sizeof(obuffer));
     if (len > 0) {
       hlpBufferVtec = QByteArray(obuffer, len);
@@ -2701,5 +931,5 @@
     double rtnUra, const ColumnVector& rtnClk, const ColumnVector& rtnVel,
     const ColumnVector& rtnCoM, const ColumnVector& rtnClkSig,
-    struct ClockOrbit::SatData* sd, QString& outLine) {
+    struct SsrCorr::ClockOrbit::SatData* sd, QString& outLine) {
 
   // Broadcast Position and Velocity
@@ -2744,9 +974,9 @@
   double dClkA1 = 0.0;
   if (rtnClk(2)) {
-    dClkA1 = rtnClk(2) - xB(5) * t_CST::c;
+         dClkA1 = rtnClk(2) - xB(5) * t_CST::c;
   }
   double dClkA2 = 0.0;
   if (rtnClk(3)) {
-    dClkA2 = rtnClk(3) - xB(6) * t_CST::c;
+         dClkA2 = rtnClk(3) - xB(6) * t_CST::c;
   }
 
Index: /trunk/BNC/src/upload/bncrtnetuploadcaster.h
===================================================================
--- /trunk/BNC/src/upload/bncrtnetuploadcaster.h	(revision 9024)
+++ /trunk/BNC/src/upload/bncrtnetuploadcaster.h	(revision 9025)
@@ -6,11 +6,6 @@
 #include "bnctime.h"
 #include "ephemeris.h"
-extern "C" {
-#ifdef USE_SSR_RTCM
 #include "../RTCM3/clock_and_orbit/clock_orbit_rtcm.h"
-#elif  USE_SSR_IGS
 #include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
-#endif
-}
 
 class bncEphUser;
@@ -18,4 +13,5 @@
 class bncClockRinex;
 class bncSP3;
+class SsrCorr;
 
 class bncRtnetUploadCaster : public bncUploadCaster {
@@ -26,6 +22,6 @@
                   const QString& ntripVersion,
                   const QString& userName,const QString& password,
-                  const QString& crdTrafo, bool  CoM,
-                  const QString& sp3FileName,
+                  const QString& crdTrafo, const QString& ssrFormat,
+                  bool  CoM, const QString& sp3FileName,
                   const QString& rnxFileName,
                   int PID, int SID, int IOD, int iRow);
@@ -42,5 +38,5 @@
                         const ColumnVector& rtnCoM,
                         const ColumnVector& rtnClkSig,
-                        struct ClockOrbit::SatData* sd,
+                        struct SsrCorr::ClockOrbit::SatData* sd,
                         QString& outLine);
   void crdTrafo(int GPSWeek, ColumnVector& xyz, double& dc);
@@ -52,4 +48,6 @@
   QString        _rtnetStreamBuffer;
   QString        _crdTrafo;
+  SsrCorr*       _ssrCorr;
+  QString        _ssrFormat;
   bool           _CoM;
   int            _PID;
