Index: trunk/BNC/RTCM3/ephemeris.cpp
===================================================================
--- trunk/BNC/RTCM3/ephemeris.cpp	(revision 3658)
+++ trunk/BNC/RTCM3/ephemeris.cpp	(revision 3659)
@@ -99,4 +99,6 @@
 
   _TGD      = ee->TGD;
+
+  _ok       = true;
 }
 
@@ -492,4 +494,6 @@
   _xv(5) = _y_velocity * 1.e3; 
   _xv(6) = _z_velocity * 1.e3; 
+
+  _ok = true;
 }
 
@@ -613,4 +617,6 @@
   _OMEGADOT = ee->OMEGADOT;
   _IDOT     = ee->IDOT;
+
+  _ok = true;
 }
 
@@ -783,2 +789,23 @@
   return size;
 }
+
+// Constructor
+//////////////////////////////////////////////////////////////////////////////
+t_ephGPS::t_ephGPS(float rnxVersion, const QStringList& lines) {
+
+  _ok = false;
+}
+
+// Constructor
+//////////////////////////////////////////////////////////////////////////////
+t_ephGlo::t_ephGlo(float rnxVersion, const QStringList& lines) {
+
+  _ok = false;
+}
+
+// Constructor
+//////////////////////////////////////////////////////////////////////////////
+t_ephGal::t_ephGal(float rnxVersion, const QStringList& lines) {
+
+  _ok = false;
+}
Index: trunk/BNC/RTCM3/ephemeris.h
===================================================================
--- trunk/BNC/RTCM3/ephemeris.h	(revision 3658)
+++ trunk/BNC/RTCM3/ephemeris.h	(revision 3659)
@@ -12,6 +12,8 @@
 class t_eph {
  public:
+  t_eph() {_ok = false;}
   virtual ~t_eph() {};
 
+  bool     ok() const {return _ok;}
   bool     isNewerThan(const t_eph* eph) const;
   QString  prn() const {return _prn;}
@@ -49,4 +51,5 @@
   double    _GPSweeks;
   QDateTime _receptDateTime;
+  bool      _ok;
 };
 
@@ -55,4 +58,5 @@
  public:
   t_ephGPS() { }
+  t_ephGPS(float rnxVersion, const QStringList& lines);
   virtual ~t_ephGPS() {}
   double TOC() const {return _TOC;}
@@ -105,4 +109,5 @@
  public:
   t_ephGlo() { _xv.ReSize(6); }
+  t_ephGlo(float rnxVersion, const QStringList& lines);
 
   virtual ~t_ephGlo() {}
@@ -146,4 +151,5 @@
  public:
   t_ephGal() { }
+  t_ephGal(float rnxVersion, const QStringList& lines);
   virtual ~t_ephGal() {}
   double TOC() const {return _TOC;}
Index: trunk/BNC/rnxnavfile.cpp
===================================================================
--- trunk/BNC/rnxnavfile.cpp	(revision 3658)
+++ trunk/BNC/rnxnavfile.cpp	(revision 3659)
@@ -42,4 +42,5 @@
 #include "rnxnavfile.h"
 #include "bncutils.h"
+#include "RTCM3/ephemeris.h"
 
 using namespace std;
@@ -49,4 +50,5 @@
 t_rnxNavFile::t_rnxNavHeader::t_rnxNavHeader() {
   _version = 0.0;
+  _glonass = false;
 }
 
@@ -72,4 +74,7 @@
       QTextStream in(value.toAscii(), QIODevice::ReadOnly);
       in >> _version;
+      if (value.indexOf("GLONASS") != -1) {
+        _glonass = true;
+      }
     }
   }
@@ -96,2 +101,55 @@
 }
 
+// Read Next Ephemeris
+////////////////////////////////////////////////////////////////////////////
+t_irc t_rnxNavFile::getNextEph(t_eph* eph) {
+
+  while (_stream->status() == QTextStream::Ok && !_stream->atEnd()) {
+    QString line = _stream->readLine();
+    if (line.isEmpty()) {
+      continue;
+    }
+    QStringList hlp = line.split(QRegExp("\\s+"), QString::SkipEmptyParts);
+    QString prn;
+    if (version() >= 3.0) {
+      prn = hlp.at(0);
+    }
+    else {
+      if (glonass()) {
+        prn = 'R' + QString("%1").arg(hlp.at(0).toInt(), 2, QChar('0'));
+      }
+      else {
+        prn = 'G' + QString("%1").arg(hlp.at(0).toInt(), 2, QChar('0'));
+      }
+    }
+    QStringList lines; lines << line;
+    if      (prn[0] == 'G') {
+      for (int ii = 1; ii < 8; ii++) {
+        lines << _stream->readLine();
+      }
+      eph = new t_ephGPS(version(), lines);
+    }
+    else if (prn[0] == 'R') {
+      for (int ii = 1; ii < 4; ii++) {
+        lines << _stream->readLine();
+      }
+      eph = new t_ephGlo(version(), lines);
+    }
+    else if (prn[0] == 'E') {
+      for (int ii = 1; ii < 8; ii++) {
+        lines << _stream->readLine();
+      }
+      eph = new t_ephGal(version(), lines);
+    }
+    else {
+      return failure;
+    }
+    if (!eph->ok()) {
+      delete eph;
+      eph = 0;
+      return failure;
+    }
+  }
+
+  return success;
+}
Index: trunk/BNC/rnxnavfile.h
===================================================================
--- trunk/BNC/rnxnavfile.h	(revision 3658)
+++ trunk/BNC/rnxnavfile.h	(revision 3659)
@@ -31,4 +31,5 @@
 class t_pppOpt;
 class bncPPPclient;
+class t_eph;
 
 class t_rnxNavFile {
@@ -39,6 +40,9 @@
     ~t_rnxNavHeader();
     t_irc read(QTextStream* stream);
+    float version() const {return _version;}
+    bool  glonass() const {return _glonass;}
    private:
     float   _version;
+    bool    _glonass;
   };
  
@@ -46,4 +50,7 @@
   t_rnxNavFile(QString fileName);
   ~t_rnxNavFile();
+  t_irc getNextEph(t_eph* eph);
+  float version() const {return _header.version();}
+  bool  glonass() const {return _header.glonass();}
 
  private:
