Index: /trunk/BNC/src/ephemeris.cpp
===================================================================
--- /trunk/BNC/src/ephemeris.cpp	(revision 9785)
+++ /trunk/BNC/src/ephemeris.cpp	(revision 9786)
@@ -244,5 +244,12 @@
 t_ephGPS::t_ephGPS(double rnxVersion, const QStringList& lines) {
 
-  const int nLines = 8;
+  int nLines = 8;
+
+  if (navType() == t_eph::CNAV) {
+    nLines += 1;
+  }
+  else if (navType() == t_eph::CNV2) {
+    nLines += 2;
+  }
 
   if (lines.size() != nLines) {
@@ -305,5 +312,5 @@
       _TOC.set(year, month, day, hour, min, sec);
 
-      if ( readDbl(line, pos[1], fieldLen, _clock_bias     ) ||
+    if   ( readDbl(line, pos[1], fieldLen, _clock_bias     ) ||
            readDbl(line, pos[2], fieldLen, _clock_drift    ) ||
            readDbl(line, pos[3], fieldLen, _clock_driftrate) ) {
@@ -312,15 +319,32 @@
       }
     }
-
-    else if      ( iLine == 1 ) {
-      if ( readDbl(line, pos[0], fieldLen, _IODE   ) ||
-           readDbl(line, pos[1], fieldLen, _Crs    ) ||
-           readDbl(line, pos[2], fieldLen, _Delta_n) ||
-           readDbl(line, pos[3], fieldLen, _M0     ) ) {
-        _checkState = bad;
-        return;
-      }
-    }
-
+    // =====================
+    // BROADCAST ORBIT - 1
+    // =====================
+    else if      ( iLine == 1) {
+
+      if (navType() == t_eph::CNAV ||
+          navType() == t_eph::CNV2) {
+        if ( readDbl(line, pos[0], fieldLen, _ADOT   ) ||
+             readDbl(line, pos[1], fieldLen, _Crs    ) ||
+             readDbl(line, pos[2], fieldLen, _Delta_n) ||
+             readDbl(line, pos[3], fieldLen, _M0     ) ) {
+              _checkState = bad;
+                return;
+                }
+      }
+      else { // LNAV, undefined
+        if ( readDbl(line, pos[0], fieldLen, _IODE   ) ||
+             readDbl(line, pos[1], fieldLen, _Crs    ) ||
+             readDbl(line, pos[2], fieldLen, _Delta_n) ||
+             readDbl(line, pos[3], fieldLen, _M0     ) ) {
+          _checkState = bad;
+          return;
+        }
+      }
+    }
+    // =====================
+    // BROADCAST ORBIT - 2
+    // =====================
     else if ( iLine == 2 ) {
       if ( readDbl(line, pos[0], fieldLen, _Cuc   ) ||
@@ -332,15 +356,32 @@
       }
     }
-
+    // =====================
+    // BROADCAST ORBIT - 3
+    // =====================
     else if ( iLine == 3 ) {
-      if ( readDbl(line, pos[0], fieldLen, _TOEsec)  ||
-           readDbl(line, pos[1], fieldLen, _Cic   )  ||
-           readDbl(line, pos[2], fieldLen, _OMEGA0)  ||
-           readDbl(line, pos[3], fieldLen, _Cis   ) ) {
-        _checkState = bad;
-        return;
-      }
-    }
-
+
+      if (navType() == t_eph::CNAV ||
+          navType() == t_eph::CNV2) {
+        if ( readDbl(line, pos[0], fieldLen, _top)  ||
+             readDbl(line, pos[1], fieldLen, _Cic   )  ||
+             readDbl(line, pos[2], fieldLen, _OMEGA0)  ||
+             readDbl(line, pos[3], fieldLen, _Cis   ) ) {
+          _checkState = bad;
+          return;
+        }
+      }
+      else { // LNAV, undefined
+        if ( readDbl(line, pos[0], fieldLen, _TOEsec)  ||
+             readDbl(line, pos[1], fieldLen, _Cic   )  ||
+             readDbl(line, pos[2], fieldLen, _OMEGA0)  ||
+             readDbl(line, pos[3], fieldLen, _Cis   ) ) {
+          _checkState = bad;
+          return;
+        }
+      }
+    }
+    // =====================
+    // BROADCAST ORBIT - 4
+    // =====================
     else if ( iLine == 4 ) {
       if ( readDbl(line, pos[0], fieldLen, _i0      ) ||
@@ -352,12 +393,27 @@
       }
     }
-
+    // =====================
+    // BROADCAST ORBIT - 5
+    // =====================
     else if ( iLine == 5 && type() != t_eph::IRNSS) {
-      if ( readDbl(line, pos[0], fieldLen, _IDOT   ) ||
-           readDbl(line, pos[1], fieldLen, _L2Codes) ||
-           readDbl(line, pos[2], fieldLen, _TOEweek  ) ||
-           readDbl(line, pos[3], fieldLen, _L2PFlag) ) {
-        _checkState = bad;
-        return;
+
+      if (navType() == t_eph::CNAV ||
+          navType() == t_eph::CNV2) {
+        if ( readDbl(line, pos[0], fieldLen, _IDOT   ) ||
+             readDbl(line, pos[1], fieldLen, _DN0DOT ) ||
+             readDbl(line, pos[2], fieldLen, _URAI_NED0 ) ||
+             readDbl(line, pos[3], fieldLen, _URAI_NED1) ) {
+          _checkState = bad;
+          return;
+        }
+      }
+      else { // LNAV, undefined
+        if ( readDbl(line, pos[0], fieldLen, _IDOT   ) ||
+             readDbl(line, pos[1], fieldLen, _L2Codes) ||
+             readDbl(line, pos[2], fieldLen, _TOEweek  ) ||
+             readDbl(line, pos[3], fieldLen, _L2PFlag) ) {
+          _checkState = bad;
+          return;
+        }
       }
     }
@@ -369,12 +425,27 @@
       }
     }
-
+    // =====================
+    // BROADCAST ORBIT - 6
+    // =====================
     else if ( iLine == 6 && type() != t_eph::IRNSS) {
-      if ( readDbl(line, pos[0], fieldLen, _ura   ) ||
-           readDbl(line, pos[1], fieldLen, _health) ||
-           readDbl(line, pos[2], fieldLen, _TGD   ) ||
-           readDbl(line, pos[3], fieldLen, _IODC  ) ) {
-        _checkState = bad;
-        return;
+
+      if (navType() == t_eph::CNAV ||
+          navType() == t_eph::CNV2  ) {
+        if ( readDbl(line, pos[0], fieldLen, _URAI_ED) ||
+             readDbl(line, pos[1], fieldLen, _health ) ||
+             readDbl(line, pos[2], fieldLen, _TGD    ) ||
+             readDbl(line, pos[3], fieldLen, _URAI_NED2) ) {
+          _checkState = bad;
+          return;
+        }
+      }
+      else { // LNAV, undefined
+        if ( readDbl(line, pos[0], fieldLen, _ura   ) ||
+             readDbl(line, pos[1], fieldLen, _health) ||
+             readDbl(line, pos[2], fieldLen, _TGD   ) ||
+             readDbl(line, pos[3], fieldLen, _IODC  ) ) {
+          _checkState = bad;
+          return;
+        }
       }
     }
@@ -387,22 +458,76 @@
       }
     }
+    // =====================
+    // BROADCAST ORBIT - 7
+    // =====================
     else if ( iLine == 7 ) {
-      if ( readDbl(line, pos[0], fieldLen, _TOT) ) {
-        _checkState = bad;
-        return;
-      }
-      // fitInterval is not valid for IRNSS
-      if (type() != t_eph::IRNSS) {
-        double fitIntervalRnx;
-        readDbl(line, pos[1], fieldLen, fitIntervalRnx);
-        if        (type() == t_eph::GPS) {  // in RINEX specified allways as time period for GPS
-            _fitInterval = fitIntervalRnx;
-        } else if (type() == t_eph::QZSS) { // specified as flag for QZSS
-          if (rnxVersion == 3.02) {
-            _fitInterval = fitIntervalRnx; // specified as time period
+      if (navType() == t_eph::LNAV ||
+          navType() == t_eph::undefined) {
+
+        if ( readDbl(line, pos[0], fieldLen, _TOT) ) {
+          _checkState = bad;
+          return;
+        }
+
+        if (type() != t_eph::IRNSS) {
+          double fitIntervalRnx;
+          if ( readDbl(line, pos[1], fieldLen, fitIntervalRnx) ) {
+            _checkState = bad;
+            return;
           }
-          else {
-            _fitInterval = fitIntervalFromFlag(fitIntervalRnx, _IODC, t_eph::QZSS);
+          if        (type() == t_eph::GPS) {  // in RINEX specified always as time period for GPS
+              _fitInterval = fitIntervalRnx;
+          } else if (type() == t_eph::QZSS) { // specified as flag for QZSS
+            if (rnxVersion == 3.02) {
+              _fitInterval = fitIntervalRnx; // specified as time period
+            }
+            else {
+              _fitInterval = fitIntervalFromFlag(fitIntervalRnx, _IODC, t_eph::QZSS);
+            }
           }
+        }
+      }
+
+      else if (navType() == t_eph::CNAV ||
+               navType() == t_eph::CNV2) {
+        if ( readDbl(line, pos[0], fieldLen, _ISC_L1CA) ||
+             readDbl(line, pos[1], fieldLen, _ISC_L2C ) ||
+             readDbl(line, pos[2], fieldLen, _ISC_L5I5) ||
+             readDbl(line, pos[3], fieldLen, _ISC_L5Q5) ) {
+          _checkState = bad;
+          return;
+        }
+
+      }
+
+    }
+    // =====================
+    // BROADCAST ORBIT - 8
+    // =====================
+    else if ( iLine == 8 ) {
+      if (navType() == t_eph::CNAV) {
+        if ( readDbl(line, pos[0], fieldLen, _TOT) ||
+             readDbl(line, pos[1], fieldLen, _wnop) ) {
+          _checkState = bad;
+          return;
+        }
+      }
+      else if (navType() == t_eph::CNV2) {
+        if ( readDbl(line, pos[0], fieldLen, _ISC_L1Cd) ||
+             readDbl(line, pos[1], fieldLen, _ISC_L1Cp)) {
+          _checkState = bad;
+          return;
+        }
+      }
+    }
+    // =====================
+    // BROADCAST ORBIT - 9
+    // =====================
+    else if ( iLine == 9 ) {
+      if (navType() == t_eph::CNV2) {
+        if ( readDbl(line, pos[0], fieldLen, _TOT) ||
+             readDbl(line, pos[1], fieldLen, _wnop) ) {
+          _checkState = bad;
+          return;
         }
       }
@@ -517,10 +642,26 @@
   QString fmt = version < 3.0 ? "   %1%2%3%4\n" : "    %1%2%3%4\n";
 
-  out << QString(fmt)
-    .arg(_IODE,    19, 'e', 12)
-    .arg(_Crs,     19, 'e', 12)
-    .arg(_Delta_n, 19, 'e', 12)
-    .arg(_M0,      19, 'e', 12);
-
+
+  // =====================
+  // BROADCAST ORBIT - 1
+  // =====================
+  if (navType() == t_eph::CNAV ||
+      navType() == t_eph::CNV2) {
+    out << QString(fmt)
+      .arg(_ADOT,    19, 'e', 12)
+      .arg(_Crs,     19, 'e', 12)
+      .arg(_Delta_n, 19, 'e', 12)
+      .arg(_M0,      19, 'e', 12);
+  }
+  else { // LNAV, undefinded
+    out << QString(fmt)
+      .arg(_IODE,    19, 'e', 12)
+      .arg(_Crs,     19, 'e', 12)
+      .arg(_Delta_n, 19, 'e', 12)
+      .arg(_M0,      19, 'e', 12);
+  }
+  // =====================
+  // BROADCAST ORBIT - 2
+  // =====================
   out << QString(fmt)
     .arg(_Cuc,    19, 'e', 12)
@@ -528,11 +669,25 @@
     .arg(_Cus,    19, 'e', 12)
     .arg(_sqrt_A, 19, 'e', 12);
-
-  out << QString(fmt)
-    .arg(_TOEsec, 19, 'e', 12)
-    .arg(_Cic,    19, 'e', 12)
-    .arg(_OMEGA0, 19, 'e', 12)
-    .arg(_Cis,    19, 'e', 12);
-
+  // =====================
+  // BROADCAST ORBIT - 3
+  // =====================
+  if (navType() == t_eph::CNAV ||
+      navType() == t_eph::CNV2) {
+    out << QString(fmt)
+        .arg(_top,    19, 'e', 12)
+        .arg(_Cic,    19, 'e', 12)
+        .arg(_OMEGA0, 19, 'e', 12)
+        .arg(_Cis,    19, 'e', 12);
+  }
+  else {
+    out << QString(fmt)
+        .arg(_TOEsec, 19, 'e', 12)
+        .arg(_Cic,    19, 'e', 12)
+        .arg(_OMEGA0, 19, 'e', 12)
+        .arg(_Cis,    19, 'e', 12);
+  }
+  // =====================
+  // BROADCAST ORBIT - 4
+  // =====================
   out << QString(fmt)
     .arg(_i0,       19, 'e', 12)
@@ -540,5 +695,7 @@
     .arg(_omega,    19, 'e', 12)
     .arg(_OMEGADOT, 19, 'e', 12);
-
+  // =====================
+  // BROADCAST ORBIT - 5
+  // =====================
   if (type() == t_eph::IRNSS) {
     out << QString(fmt)
@@ -549,11 +706,25 @@
   }
   else {
-    out << QString(fmt)
-      .arg(_IDOT,    19, 'e', 12)
-      .arg(_L2Codes, 19, 'e', 12)
-      .arg(_TOEweek, 19, 'e', 12)
-      .arg(_L2PFlag, 19, 'e', 12);
-  }
-
+    if (navType() == t_eph::CNAV ||
+        navType() == t_eph::CNV2) {
+      out << QString(fmt)
+        .arg(_IDOT,      19, 'e', 12)
+        .arg(_DN0DOT,    19, 'e', 12)
+        .arg(_URAI_NED0, 19, 'e', 12)
+        .arg(_URAI_NED1, 19, 'e', 12);
+
+    }
+    else { // LNAV, undefined
+      out << QString(fmt)
+        .arg(_IDOT,    19, 'e', 12)
+        .arg(_L2Codes, 19, 'e', 12)
+        .arg(_TOEweek, 19, 'e', 12)
+        .arg(_L2PFlag, 19, 'e', 12);
+
+    }
+  }
+  // =====================
+  // BROADCAST ORBIT - 6
+  // =====================
   if (type() == t_eph::IRNSS) {
     out << QString(fmt)
@@ -564,36 +735,90 @@
   }
   else {
+    if (navType() == t_eph::CNAV ||
+        navType() == t_eph::CNV2) {
+      out << QString(fmt)
+        .arg(_URAI_ED,  19, 'e', 12)
+        .arg(_health,   19, 'e', 12)
+        .arg(_TGD,      19, 'e', 12)
+        .arg(_URAI_NED2,19, 'e', 12);
+
+    }
+    else { // LNAV, undefined
+      out << QString(fmt)
+        .arg(_ura,    19, 'e', 12)
+        .arg(_health, 19, 'e', 12)
+        .arg(_TGD,    19, 'e', 12)
+        .arg(_IODC,   19, 'e', 12);
+    }
+  }
+  // =====================
+  // BROADCAST ORBIT - 7
+  // =====================
+  if (navType() == t_eph::LNAV ||
+      navType() == t_eph::undefined) {
+
+    double tot = _TOT;
+    if (tot == 0.9999e9 && version < 3.0) {
+      tot = 0.0;
+    }
+    // fitInterval
+    if (type() == t_eph::IRNSS) {// not valid for IRNSS
+      out << QString(fmt)
+        .arg(tot,          19, 'e', 12)
+        .arg(0.0,          19, 'e', 12)
+        .arg("",           19, QChar(' '))
+        .arg("",           19, QChar(' '));
+    }
+    else {
+      // for GPS and QZSS in version 3.02 specified in hours
+      double fitIntervalRnx = _fitInterval;
+      // otherwise specified as flag
+      if (type() == t_eph::QZSS && version != 3.02) {
+        (_fitInterval == 2.0) ? fitIntervalRnx = 0.0 : fitIntervalRnx = 1.0;
+      }
+      out << QString(fmt)
+        .arg(tot,            19, 'e', 12)
+        .arg(fitIntervalRnx, 19, 'e', 12)
+        .arg("",             19, QChar(' '))
+        .arg("",             19, QChar(' '));
+    }
+  }
+  else if (navType() == t_eph::CNAV ||
+           navType() == t_eph::CNV2) {
     out << QString(fmt)
-      .arg(_ura,    19, 'e', 12)
-      .arg(_health, 19, 'e', 12)
-      .arg(_TGD,    19, 'e', 12)
-      .arg(_IODC,   19, 'e', 12);
-  }
-
-  double tot = _TOT;
-  if (tot == 0.9999e9 && version < 3.0) {
-    tot = 0.0;
-  }
-  // fitInterval
-  if (type() == t_eph::IRNSS) {// not valid for IRNSS
+      .arg(_ISC_L1CA, 19, 'e', 12)
+      .arg(_ISC_L2C,  19, 'e', 12)
+      .arg(_ISC_L5I5, 19, 'e', 12)
+      .arg(_ISC_L5Q5, 19, 'e', 12);
+  }
+  // =====================
+  // BROADCAST ORBIT - 8
+  // =====================
+  if (navType() == t_eph::CNAV) {
     out << QString(fmt)
-      .arg(tot,          19, 'e', 12)
-      .arg(0.0,          19, 'e', 12)
-      .arg("",           19, QChar(' '))
-      .arg("",           19, QChar(' '));
-  }
-  else {
-    // for GPS and QZSS in version 3.02 specified in hours
-    double fitIntervalRnx = _fitInterval;
-    // otherwise specified as flag
-    if (type() == t_eph::QZSS && version != 3.02) {
-      (_fitInterval == 2.0) ? fitIntervalRnx = 0.0 : fitIntervalRnx = 1.0;
-    }
+      .arg(_TOT,  19, 'e', 12)
+      .arg(_wnop, 19, 'e', 12)
+      .arg("",    19, QChar(' '))
+      .arg("",    19, QChar(' '));
+  }
+  else if (navType() == t_eph::CNV2) {
     out << QString(fmt)
-      .arg(tot,            19, 'e', 12)
-      .arg(fitIntervalRnx, 19, 'e', 12)
-      .arg("",             19, QChar(' '))
-      .arg("",             19, QChar(' '));
-  }
+      .arg(_ISC_L1Cd, 19, 'e', 12)
+      .arg(_ISC_L1Cp, 19, 'e', 12)
+      .arg("",        19, QChar(' '))
+      .arg("",        19, QChar(' '));
+  }
+
+  // =====================
+  // BROADCAST ORBIT - 9
+  // =====================
+  if (navType() == t_eph::CNV2) {
+    out << QString(fmt)
+      .arg(_TOT,  19, 'e', 12)
+      .arg(_wnop, 19, 'e', 12)
+      .arg("",    19, QChar(' '))
+      .arg("",    19, QChar(' '));
+  }
+
   return rnxStr;
 }
Index: /trunk/BNC/src/ephemeris.h
===================================================================
--- /trunk/BNC/src/ephemeris.h	(revision 9785)
+++ /trunk/BNC/src/ephemeris.h	(revision 9786)
@@ -104,4 +104,17 @@
     _TOT              = 0.0;
     _fitInterval      = 0.0;
+    _ADOT             = 0.0;
+    _top              = 0.0;
+    _DN0DOT           = 0.0;
+    _URAI_NED0        = 0.0;
+    _URAI_NED1        = 0.0;
+    _URAI_NED2        = 0.0;
+    _URAI_ED          = 0.0;
+    _ISC_L1CA         = 0.0;
+    _ISC_L2C          = 0.0;
+    _ISC_L5I5         = 0.0;
+    _ISC_L5Q5         = 0.0;
+    _ISC_L1Cd         = 0.0;
+    _ISC_L1Cp         = 0.0;
     _receptStaID      = "";
   }
@@ -136,9 +149,9 @@
 
   double  _Cuc;             // [rad]
-  double  _e;               //
+  double  _e;               // []
   double  _Cus;             // [rad]
   double  _sqrt_A;          // [m^0.5]
 
-  double  _TOEsec;          // [s]
+  double  _TOEsec;          // [s of GPS week]
   double  _Cic;             // [rad]
   double  _OMEGA0;          // [rad]
@@ -152,5 +165,5 @@
   double  _IDOT;            // [rad/s]
   double  _L2Codes;         // Codes on L2 channel  (not valid for IRNSS)
-  double  _TOEweek;
+  double  _TOEweek;         // GPS week # to go with TOE, cont. number, not mode 1024
   double  _L2PFlag;         // L2 P data flag (not valid for IRNSS and QZSS)
 
@@ -162,4 +175,22 @@
   double  _TOT;             // Transmission time
   double  _fitInterval;     // Fit interval in hours (not valid for IRNSS)
+
+  double  _ADOT;            // [m/s]
+  double  _top;             // [s]
+  double  _DN0DOT;          // [rad/s^2]
+
+  double _URAI_NED0;        // []
+  double _URAI_NED1;        // []
+  double _URAI_NED2;        // []
+  double _URAI_ED;          // []
+
+  double _ISC_L1CA;         // [s]
+  double _ISC_L2C;          // [s]
+  double _ISC_L5I5;         // [s]
+  double _ISC_L5Q5;         // [s]
+  double _ISC_L1Cd;         // [s]
+  double _ISC_L1Cp;         // [s]
+
+  double _wnop;             // GPS continuous week number with the ambiguity resolved
 };
 
