Index: trunk/BNC/src/rinex/reqcanalyze.cpp
===================================================================
--- trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 10577)
+++ trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 10587)
@@ -1019,5 +1019,5 @@
             *_log  << "                     "
                 << navFi.fileName() << ' ' << QString(": WRONG %2:%3\n")
-                           .arg(eph->ephTypeStr(eph->ephType(), eph->prn(), 99.0))
+                           .arg(eph->typeStr(eph->type(), eph->prn(), 99.0))
                            .arg(eph->rinexDateStr(eph->TOC(), eph->prn(), 99.0)).toLatin1();
           }
Index: trunk/BNC/src/rinex/reqcedit.cpp
===================================================================
--- trunk/BNC/src/rinex/reqcedit.cpp	(revision 10577)
+++ trunk/BNC/src/rinex/reqcedit.cpp	(revision 10587)
@@ -586,8 +586,8 @@
   bool haveGPS     = false;
   bool haveGlonass = false;
-  QMap<t_eph::e_type, bool> haveGnss;
+  QMap<t_eph::e_system, bool> haveGnss;
   for (int ii = 0; ii < _ephs.size(); ii++) {
     const t_eph* eph = _ephs[ii];
-    switch (eph->type()) {
+    switch (eph->system()) {
       case t_eph::GPS:
         haveGPS = true;
@@ -680,5 +680,5 @@
     bncTime begTime = _begTime;
     bncTime endTime = _endTime;
-    if (eph->type() == t_eph::BDS) {
+    if (eph->system() == t_eph::BDS) {
       begTime += 14;
       endTime += 14;
@@ -695,26 +695,11 @@
 
     if (outNavFile.version() < 3.0) {
-  	  if (outNavFile.glonass() && eph->type() != t_eph::GLONASS) {
+  	  if (outNavFile.glonass() && eph->system() != t_eph::GLONASS) {
   	    continue;
   	  }
-  	  if (!outNavFile.glonass() && eph->type() != t_eph::GPS) {
+  	  if (!outNavFile.glonass() && eph->system() != t_eph::GPS) {
   	    continue;
       }
     }
-
-    if (outNavFile.version() < 4.0) {
-      if (eph->ephType() == t_eph::CNAV ||
-          eph->ephType() == t_eph::CNV1 ||
-          eph->ephType() == t_eph::CNV2 ||
-          eph->ephType() == t_eph::CNV3) {
-        continue;
-      }
-    }
-
-    if (outNavFile.version() >= 4.0 &&
-        eph->ephType() == t_eph::undefined) { // input files < version 4.0
-      continue;
-    }
-
     outNavFile.writeEph(eph);
   }
@@ -739,23 +724,23 @@
 
     if (isNew) {
-      if      (eph->type() == t_eph::GPS) {
+      if      (eph->system() == t_eph::GPS) {
         ephs.append(new t_ephGPS(*dynamic_cast<t_ephGPS*>(eph)));
       }
-      else if (eph->type() == t_eph::GLONASS) {
+      else if (eph->system() == t_eph::GLONASS) {
         ephs.append(new t_ephGlo(*dynamic_cast<t_ephGlo*>(eph)));
       }
-      else if (eph->type() == t_eph::Galileo) {
+      else if (eph->system() == t_eph::Galileo) {
         ephs.append(new t_ephGal(*dynamic_cast<t_ephGal*>(eph)));
       }
-      else if (eph->type() == t_eph::QZSS) {
+      else if (eph->system() == t_eph::QZSS) {
         ephs.append(new t_ephGPS(*dynamic_cast<t_ephGPS*>(eph)));
       }
-      else if (eph->type() == t_eph::SBAS) {
+      else if (eph->system() == t_eph::SBAS) {
         ephs.append(new t_ephSBAS(*dynamic_cast<t_ephSBAS*>(eph)));
       }
-      else if (eph->type() == t_eph::BDS) {
+      else if (eph->system() == t_eph::BDS) {
         ephs.append(new t_ephBDS(*dynamic_cast<t_ephBDS*>(eph)));
       }
-      else if (eph->type() == t_eph::IRNSS) {
+      else if (eph->system() == t_eph::IRNSS) {
         ephs.append(new t_ephGPS(*dynamic_cast<t_ephGPS*>(eph)));
       }
Index: trunk/BNC/src/rinex/rnxnavfile.cpp
===================================================================
--- trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 10577)
+++ trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 10587)
@@ -149,5 +149,4 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_rnxNavFile::read(QTextStream* stream) {
-  QString ephType;
 
   while (stream->status() == QTextStream::Ok && !stream->atEnd()) {
@@ -157,19 +156,23 @@
       continue;
     }
-
+    QString navType;
     QStringList hlp = line.split(QRegExp("\\s+"), Qt::SkipEmptyParts);
-    QString key, prn, navSubType;
+    QString prn;
     char sys;
-
     QString firstStr = hlp.at(0);
-    if      (version() >= 3.0 &&  firstStr != ">") {
+
+    // RINEX version 3
+    if      (version() >= 3.0 &&
+             version() <  4.0 &&  firstStr != ">") {
       prn = firstStr;
       sys = prn[0].toLatin1();
-    }
+      navType = "";
+    }
+    // RINEX version 4
     else if (version() >= 4.0 && firstStr == ">") {
-      key = hlp.at(1);
+      QString key = hlp.at(1);
       prn = hlp.at(2);
       sys = prn[0].toLatin1();
-      ephType = hlp.at(3);
+      navType = hlp.at(3);
 
       // ALL Non-EPH messages are currently ignored
@@ -194,7 +197,7 @@
                  sys == 'J' || sys == 'I') {
           lines2skip = 3;
-          if ((sys == 'I' && ephType == "L1NV") || // I: KLOB, NEQN
-              (sys == 'J' && ephType == "CNVX")) { // J: WIDE, JAPN
-            navSubType = hlp.at(4);
+          if ((sys == 'I' && navType == "L1NV") || // I: KLOB, NEQN
+              (sys == 'J' && navType == "CNVX")) { // J: WIDE, JAPN
+            QString navSubType = hlp.at(4);
             if      (navSubType == "KLOB") {
               lines2skip += 1;
@@ -213,4 +216,5 @@
       continue;
     }
+    // RINEX version 2
     else {
       if (glonass()) {
@@ -226,5 +230,12 @@
     lines << line;
     if      (sys == 'G') {
-      for (int ii = 1; ii < 8; ii++) {
+      int nLines = 8;
+      if (navType == "CNAV") {
+        nLines += 1;
+      }
+      if (navType == "CNV2") {
+        nLines += 2;
+      }
+      for (int ii = 1; ii < nLines; ii++) {
         lines << stream->readLine();
       }
@@ -232,9 +243,9 @@
     }
     else if (sys == 'R') {
-      int num = 4;
+      int nLines = 4;
       if (version() >= 3.05) {
-        num += 1;
-      }
-      for (int ii = 1; ii < num; ii++) {
+        nLines += 1;
+      }
+      for (int ii = 1; ii < nLines; ii++) {
         lines << stream->readLine();
       }
@@ -248,5 +259,12 @@
     }
     else if (sys == 'J') {
-      for (int ii = 1; ii < 8; ii++) {
+      int nLines = 8;
+      if (navType == "CNAV") {
+        nLines += 1;
+      }
+      if (navType == "CNV2") {
+        nLines += 2;
+      }
+      for (int ii = 1; ii < nLines; ii++) {
         lines << stream->readLine();
       }
@@ -260,5 +278,13 @@
     }
     else if (sys == 'C') {
-      for (int ii = 1; ii < 8; ii++) {
+      int nLines = 8;
+      if (navType == "CNV1" ||
+          navType == "CNV2") {
+        nLines += 2;
+      }
+      if (navType == "CNV3") {
+        nLines += 1;
+      }
+      for (int ii = 1; ii < nLines; ii++) {
         lines << stream->readLine();
       }
@@ -266,5 +292,9 @@
     }
     else if (sys == 'I') {
-      for (int ii = 1; ii < 8; ii++) {
+      int nLines = 8;
+      if (navType == "L1NV") {
+        nLines += 1;
+      }
+      for (int ii = 1; ii < nLines; ii++) {
         lines << stream->readLine();
       }
@@ -272,14 +302,9 @@
     }
 
-    if (version() >= 4.0 && key == "EPH") {
-      if (eph->setEphType(ephType) != success) {
-        delete eph;
-        continue;
-      }
-    }
-
     if (eph) {
+      eph->setType(navType);
       _ephs.push_back(eph);
     }
+
   }
 }
@@ -363,5 +388,5 @@
   else {
     QString fmt;
-    t_eph::e_type sys = satSystem();
+    t_eph::e_system sys = satSystem();
     switch(sys) {
       case t_eph::GPS:
Index: trunk/BNC/src/rinex/rnxnavfile.h
===================================================================
--- trunk/BNC/src/rinex/rnxnavfile.h	(revision 10577)
+++ trunk/BNC/src/rinex/rnxnavfile.h	(revision 10587)
@@ -38,5 +38,5 @@
 #define defaultRnxNavVersion2 2.11
 #define defaultRnxNavVersion3 3.05
-#define defaultRnxNavVersion4 4.01
+#define defaultRnxNavVersion4 4.02
 
 class t_rnxNavFile {
@@ -52,7 +52,7 @@
     double _version;
     bool   _glonass;
-    t_eph::e_type _satSys;
-    QStringList _comments;
-    QStringList _runByDate;
+    t_eph::e_system _satSys;
+    QStringList     _comments;
+    QStringList     _runByDate;
   };
 
@@ -67,7 +67,7 @@
   QStringList comments() const {return _header._comments;}
   QStringList runByDate() const {return _header._runByDate;}
-  t_eph::e_type satSystem() const {return _header._satSys;}
+  t_eph::e_system satSystem() const {return _header._satSys;}
   void   setGlonass(bool glo) {_header._glonass = glo;}
-  void   setGnssTypeV3(t_eph::e_type sys) {_header._satSys = sys;}
+  void   setGnssTypeV3(t_eph::e_system system) {_header._satSys = system;}
   void   writeHeader(const QMap<QString, QString>* txtMap = 0, int numMergedFiles = 0, int leapSecs = 0);
   void   writeEph(const t_eph* eph);
Index: trunk/BNC/src/rinex/rnxobsfile.h
===================================================================
--- trunk/BNC/src/rinex/rnxobsfile.h	(revision 10577)
+++ trunk/BNC/src/rinex/rnxobsfile.h	(revision 10587)
@@ -40,5 +40,5 @@
 #define defaultRnxObsVersion2 2.11
 #define defaultRnxObsVersion3 3.05
-#define defaultRnxObsVersion4 4.01
+#define defaultRnxObsVersion4 4.02
 
 class t_rnxObsHeader {
