Index: trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 10587)
+++ trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 10599)
@@ -71,14 +71,9 @@
   _rawFile = rawFile;
 
-  connect(this, SIGNAL(newGPSEph(t_ephGPS)), BNC_CORE,
-      SLOT(slotNewGPSEph(t_ephGPS)));
-  connect(this, SIGNAL(newGlonassEph(t_ephGlo)), BNC_CORE,
-      SLOT(slotNewGlonassEph(t_ephGlo)));
-  connect(this, SIGNAL(newGalileoEph(t_ephGal)), BNC_CORE,
-      SLOT(slotNewGalileoEph(t_ephGal)));
-  connect(this, SIGNAL(newSBASEph(t_ephSBAS)), BNC_CORE,
-      SLOT(slotNewSBASEph(t_ephSBAS)));
-  connect(this, SIGNAL(newBDSEph(t_ephBDS)), BNC_CORE,
-      SLOT(slotNewBDSEph(t_ephBDS)));
+  connect(this, SIGNAL(newGPSEph(t_ephGPS)),     BNC_CORE, SLOT(slotNewGPSEph(t_ephGPS)));
+  connect(this, SIGNAL(newGlonassEph(t_ephGlo)), BNC_CORE, SLOT(slotNewGlonassEph(t_ephGlo)));
+  connect(this, SIGNAL(newGalileoEph(t_ephGal)), BNC_CORE, SLOT(slotNewGalileoEph(t_ephGal)));
+  connect(this, SIGNAL(newSBASEph(t_ephSBAS)),   BNC_CORE, SLOT(slotNewSBASEph(t_ephSBAS)));
+  connect(this, SIGNAL(newBDSEph(t_ephBDS)),     BNC_CORE, SLOT(slotNewBDSEph(t_ephBDS)));
 
   _MessageSize = _SkipBytes = _BlockSize = _NeedBytes = 0;
@@ -134,8 +129,16 @@
 
     GETBITS(sv, 6)
-    if (sv < 40)
-      CurrentObs._prn.set('G', sv);
-    else
-      CurrentObs._prn.set('S', sv - 20);
+    char sys;
+    int num, flag;
+    if (sv < 40) {
+      sys = 'G';
+      num = sv;
+    }
+    else {
+      sys = 'S';
+      num = sv - 20;
+    }
+    flag = t_corrSSR::getSsrNavTypeFlag(sys, num);
+    CurrentObs._prn.set(sys, num, flag);
 
     t_frqObs *frqObs = new t_frqObs;
@@ -706,6 +709,11 @@
             /* next satellite */
             ;
-          if (CurrentObs._obs.size() > 0)
+          if (CurrentObs._obs.size() > 0) {
+            char sys = CurrentObs._prn.system();
+            int  num = CurrentObs._prn.number();
+            int flag = t_corrSSR::getSsrNavTypeFlag(sys, num);
+            CurrentObs._prn.setFlag(flag);
             _CurrentObsList.push_back(CurrentObs);
+          }
           CurrentObs.clear();
           CurrentObs._time = CurrentObsTime;
@@ -882,4 +890,8 @@
       }
       if (CurrentObs._obs.size() > 0) {
+        char sys = CurrentObs._prn.system();
+        int  num = CurrentObs._prn.number();
+        int flag = t_corrSSR::getSsrNavTypeFlag(sys, num);
+        CurrentObs._prn.setFlag(flag);
         _CurrentObsList.push_back(CurrentObs);
       }
@@ -939,5 +951,7 @@
 
     GETBITS(sv, 6)
-    CurrentObs._prn.set('R', sv);
+    char sys = 'R';
+    int flag = t_corrSSR::getSsrNavTypeFlag(sys, sv);
+    CurrentObs._prn.set(sys, sv, flag);
     GETBITS(code, 1)
     GETBITS(freq, 5)
@@ -1135,4 +1149,5 @@
     eph._TOT = 0.9999e9;
     eph._type = t_eph::LNAV;
+    eph._prn.setFlag(eph._type);
 
     emit newGPSEph(eph);
@@ -1313,5 +1328,11 @@
     _gloFrq = QString("%1 %2").arg(eph._prn.toString().c_str()).arg(eph._frq_num, 2, 'f', 0);
 
-    eph._type = t_eph::FDMA;
+    if (eph.validMdata()) {
+      eph._type = t_eph::FDMA_M;
+    }
+    else {
+      eph._type = t_eph::FDMA;
+    }
+    eph._prn.setFlag(eph._type);
     eph._healthflags_unknown = false;
     eph._statusflags_unknown = false;
@@ -1568,4 +1589,5 @@
     eph._TOT = 0.9999e9;
     eph._type = t_eph::LNAV;
+    eph._prn.setFlag(eph._type);
 
     emit newGPSEph(eph);
@@ -1643,4 +1665,5 @@
     eph._health = 0;
     eph._type = t_eph::SBASL1;
+    eph._prn.setFlag(eph._type);
 
     emit newSBASEph(eph);
@@ -1661,5 +1684,6 @@
   GETBITS(i, 12)
 
-  if ((i == 1046 && size == 61) || (i == 1045 && size == 60)) {
+  if ((i == 1046 && size == 61) ||
+      (i == 1045 && size == 60)) {
     t_ephGal eph;
     eph._receptDateTime = currentDateAndTimeGPS();
@@ -1679,5 +1703,5 @@
       return false;
     }
-    eph._prn.set('E', i, eph._inav ? 1 : 0);
+    eph._prn.set('E', i, eph._inav ? t_eph::INAV : t_eph::FNAV);
 
     GETBITS(week, 12) //FIXME: roll-over after week 4095!!
@@ -1741,4 +1765,5 @@
     GETFLOATSIGN(eph._BGD_1_5A, 10, 1.0 / (double )(1 << 30) / (double )(1 << 2))
     if (eph._inav) {
+      eph._type = t_eph::INAV;
       /* set unused F/NAV values */
       eph._E5a_HS = 0.0;
@@ -1767,7 +1792,7 @@
         return false;
       }
-      eph._type = t_eph::INAV;
     }
     else {
+      eph._type = t_eph::FNAV;
       /* set unused I/NAV values */
       eph._BGD_1_5B = 0.0;
@@ -1779,5 +1804,4 @@
       GETBITS(eph._E5a_HS, 2)
       GETBITS(eph._E5a_DataInvalid, 1)
-      eph._type = t_eph::FNAV;
     }
     eph._TOT = 0.9999e9;
@@ -1908,4 +1932,5 @@
       eph._type = t_eph::D2;
     }
+    eph._prn.setFlag(eph._type);
 
     emit newBDSEph(eph);
Index: trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 10587)
+++ trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 10599)
@@ -243,29 +243,43 @@
       continue;
     }
-    char sysCh = ' ';
-    int flag = 0;
+    char sys = ' ';
+    int  num  = _clkOrb.Sat[ii].ID;
+    int  flag = 0;  // to force NAV type usage according SSR standard
     if      (ii < _clkOrb.NumberOfSat[CLOCKORBIT_SATGPS]) {
-      sysCh = 'G';
+      sys = 'G';
+      flag = t_eph::LNAV;
     }
     else if (ii >= CLOCKORBIT_OFFSETGLONASS &&
         ii < CLOCKORBIT_OFFSETGLONASS + _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]) {
-      sysCh = 'R';
+      sys = 'R';
+      flag = t_eph::FDMA_M;
     }
     else if (ii >= CLOCKORBIT_OFFSETGALILEO &&
         ii < CLOCKORBIT_OFFSETGALILEO + _clkOrb.NumberOfSat[CLOCKORBIT_SATGALILEO]) {
-      sysCh = 'E';
-      flag = 1; // I/NAV clock has been chosen as reference clock for Galileo SSR corrections
+      sys = 'E';
+      flag = t_eph::INAV;
     }
     else if (ii >= CLOCKORBIT_OFFSETQZSS &&
         ii < CLOCKORBIT_OFFSETQZSS + _clkOrb.NumberOfSat[CLOCKORBIT_SATQZSS]) {
-      sysCh = 'J';
+      sys = 'J';
+      flag = t_eph::LNAV;
     }
     else if (ii >= CLOCKORBIT_OFFSETSBAS &&
         ii < CLOCKORBIT_OFFSETSBAS + _clkOrb.NumberOfSat[CLOCKORBIT_SATSBAS]) {
-      sysCh = 'S';
+      sys = 'S';
+      flag = t_eph::SBASL1;
     }
     else if (ii >= CLOCKORBIT_OFFSETBDS &&
         ii < CLOCKORBIT_OFFSETBDS + _clkOrb.NumberOfSat[CLOCKORBIT_SATBDS]) {
-      sysCh = 'C';
+      sys = 'C';
+      if (num < 6) {// GEO
+        flag = t_eph::D2;
+      }
+      else if (num > 58 && num < 63) { // GEO
+        flag = t_eph::D2;
+      }
+      else {
+        flag = t_eph::D1;
+      }
     }
     else {
@@ -289,10 +303,10 @@
 
       t_orbCorr orbCorr;
-      orbCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID, flag);
+      orbCorr._prn.set(sys, num, flag);
       orbCorr._staID     = _staID.toStdString();
       orbCorr._iod       = _clkOrb.Sat[ii].IOD;
       orbCorr._time      = _lastTime;
       orbCorr._updateInt = _clkOrb.UpdateInterval;
-      orbCorr._system    = sysCh;
+      orbCorr._system    = sys;
       orbCorr._xr[0]     = _clkOrb.Sat[ii].Orbit.DeltaRadial;
       orbCorr._xr[1]     = _clkOrb.Sat[ii].Orbit.DeltaAlongTrack;
@@ -323,5 +337,5 @@
 
       t_clkCorr clkCorr;
-      clkCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID, flag);
+      clkCorr._prn.set(sys, _clkOrb.Sat[ii].ID, flag);
       clkCorr._staID      = _staID.toStdString();
       clkCorr._time       = _lastTime;
@@ -347,5 +361,5 @@
          _clkOrb.messageType == _ssrCorr->COTYPE_SBASHR ||
          _clkOrb.messageType == _ssrCorr->COTYPE_BDSHR) {
-      t_prn prn(sysCh, _clkOrb.Sat[ii].ID, flag);
+      t_prn prn(sys, _clkOrb.Sat[ii].ID, flag);
       if (_lastClkCorrections.contains(prn)) {
         t_clkCorr clkCorr;
@@ -371,27 +385,43 @@
                             + _codeBias.NumberOfSat[CLOCKORBIT_SATBDS];
     ii++) {
-    char sysCh = ' ';
+    char sys = ' ';
+    int  num =  _codeBias.Sat[ii].ID;
+    int flag = 0;
     if      (ii < _codeBias.NumberOfSat[CLOCKORBIT_SATGPS]) {
-      sysCh = 'G';
+      sys = 'G';
+      flag = t_eph::LNAV;
     }
     else if (ii >= CLOCKORBIT_OFFSETGLONASS &&
         ii < CLOCKORBIT_OFFSETGLONASS + _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS]) {
-      sysCh = 'R';
+      sys = 'R';
+      flag = t_eph::FDMA_M;
     }
     else if (ii >= CLOCKORBIT_OFFSETGALILEO &&
         ii < CLOCKORBIT_OFFSETGALILEO + _codeBias.NumberOfSat[CLOCKORBIT_SATGALILEO]) {
-      sysCh = 'E';
+      sys = 'E';
+      flag = t_eph::INAV;
     }
     else if (ii >= CLOCKORBIT_OFFSETQZSS &&
         ii < CLOCKORBIT_OFFSETQZSS + _codeBias.NumberOfSat[CLOCKORBIT_SATQZSS]) {
-      sysCh = 'J';
+      sys = 'J';
+      flag = t_eph::LNAV;
     }
     else if (ii >= CLOCKORBIT_OFFSETSBAS &&
         ii < CLOCKORBIT_OFFSETSBAS + _codeBias.NumberOfSat[CLOCKORBIT_SATSBAS]) {
-      sysCh = 'S';
+      sys = 'S';
+      flag = t_eph::SBASL1;
     }
     else if (ii >= CLOCKORBIT_OFFSETBDS &&
         ii < CLOCKORBIT_OFFSETBDS + _codeBias.NumberOfSat[CLOCKORBIT_SATBDS]) {
-      sysCh = 'C';
+      sys = 'C';
+      if (num < 6) {// GEO
+        flag = t_eph::D2;
+      }
+      else if (num > 58 && num < 63) { // GEO
+        flag = t_eph::D2;
+      }
+      else {
+        flag = t_eph::D1;
+      }
     }
     else {
@@ -399,5 +429,5 @@
     }
     t_satCodeBias satCodeBias;
-    satCodeBias._prn.set(sysCh, _codeBias.Sat[ii].ID);
+    satCodeBias._prn.set(sys, num, flag);
     satCodeBias._staID     = _staID.toStdString();
     satCodeBias._time      = _lastTime;
@@ -406,5 +436,5 @@
       const SsrCorr::CodeBias::BiasSat::CodeBiasEntry& biasEntry = _codeBias.Sat[ii].Biases[jj];
       t_frqCodeBias frqCodeBias;
-      frqCodeBias._rnxType2ch.assign(_ssrCorr->codeTypeToRnxType(sysCh, biasEntry.Type));
+      frqCodeBias._rnxType2ch.assign(_ssrCorr->codeTypeToRnxType(sys, biasEntry.Type));
       frqCodeBias._value      = biasEntry.Bias;
       if (!frqCodeBias._rnxType2ch.empty()) {
@@ -424,27 +454,43 @@
                             + _phaseBias.NumberOfSat[CLOCKORBIT_SATBDS];
     ii++) {
-    char sysCh = ' ';
+    char sys = ' ';
+    int num = _phaseBias.Sat[ii].ID;
+    int flag = 0;
     if      (ii < _phaseBias.NumberOfSat[CLOCKORBIT_SATGPS]) {
-      sysCh = 'G';
+      sys = 'G';
+      flag = t_eph::LNAV;
     }
     else if (ii >= CLOCKORBIT_OFFSETGLONASS &&
         ii < CLOCKORBIT_OFFSETGLONASS + _phaseBias.NumberOfSat[CLOCKORBIT_SATGLONASS]) {
-      sysCh = 'R';
+      sys = 'R';
+      flag = t_eph::FDMA_M;
     }
     else if (ii >= CLOCKORBIT_OFFSETGALILEO &&
         ii < CLOCKORBIT_OFFSETGALILEO + _phaseBias.NumberOfSat[CLOCKORBIT_SATGALILEO]) {
-      sysCh = 'E';
+      sys = 'E';
+      flag = t_eph::INAV;
     }
     else if (ii >= CLOCKORBIT_OFFSETQZSS &&
         ii < CLOCKORBIT_OFFSETQZSS + _phaseBias.NumberOfSat[CLOCKORBIT_SATQZSS]) {
-      sysCh = 'J';
+      sys = 'J';
+      flag = t_eph::LNAV;
     }
     else if (ii >= CLOCKORBIT_OFFSETSBAS &&
         ii < CLOCKORBIT_OFFSETSBAS + _phaseBias.NumberOfSat[CLOCKORBIT_SATSBAS]) {
-      sysCh = 'S';
+      sys = 'S';
+      flag = t_eph::SBASL1;
     }
     else if (ii >= CLOCKORBIT_OFFSETBDS &&
         ii < CLOCKORBIT_OFFSETBDS + _phaseBias.NumberOfSat[CLOCKORBIT_SATBDS]) {
-      sysCh = 'C';
+      sys = 'C';
+      if (num < 6) {// GEO
+        flag = t_eph::D2;
+      }
+      else if (num > 58 && num < 63) { // GEO
+        flag = t_eph::D2;
+      }
+      else {
+        flag = t_eph::D1;
+      }
     }
     else {
@@ -452,5 +498,5 @@
     }
     t_satPhaseBias satPhaseBias;
-    satPhaseBias._prn.set(sysCh, _phaseBias.Sat[ii].ID);
+    satPhaseBias._prn.set(sys, num, flag);
     satPhaseBias._staID      = _staID.toStdString();
     satPhaseBias._time       = _lastTime;
@@ -463,5 +509,5 @@
       const SsrCorr::PhaseBias::PhaseBiasSat::PhaseBiasEntry& biasEntry = _phaseBias.Sat[ii].Biases[jj];
       t_frqPhaseBias frqPhaseBias;
-      frqPhaseBias._rnxType2ch.assign(_ssrCorr->codeTypeToRnxType(sysCh, biasEntry.Type));
+      frqPhaseBias._rnxType2ch.assign(_ssrCorr->codeTypeToRnxType(sys, biasEntry.Type));
       frqPhaseBias._value                = biasEntry.Bias;
       frqPhaseBias._fixIndicator         = biasEntry.SignalIntegerIndicator;
Index: trunk/BNC/src/RTCM3/RTCM3coDecoder.h
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3coDecoder.h	(revision 10587)
+++ trunk/BNC/src/RTCM3/RTCM3coDecoder.h	(revision 10599)
@@ -33,4 +33,5 @@
 #include "../RTCM3/clock_and_orbit/clock_orbit_igs.h"
 #include "../RTCM3/clock_and_orbit/clock_orbit_rtcm.h"
+#include "ephemeris.h"
 
   class RTCM3coDecoder : public QObject, public GPSDecoder {
