Index: trunk/BNC/src/ephemeris.cpp
===================================================================
--- trunk/BNC/src/ephemeris.cpp	(revision 9290)
+++ trunk/BNC/src/ephemeris.cpp	(revision 9367)
@@ -150,5 +150,5 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephGPS::t_ephGPS(float rnxVersion, const QStringList& lines) {
+t_ephGPS::t_ephGPS(double rnxVersion, const QStringList& lines) {
 
   const int nLines = 8;
@@ -508,7 +508,16 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephGlo::t_ephGlo(float rnxVersion, const QStringList& lines) {
-
-  const int nLines = 4;
+t_ephGlo::t_ephGlo(double rnxVersion, const QStringList& lines) {
+
+  int nLines = 4;
+  if (rnxVersion >= 3.05) {
+    nLines += 1;
+    _flags_unknown = false;
+  }
+  else {
+    _M_delta_tau = 0.9999e9; // unknown
+    _M_FT = 1.5e1;           // unknown
+    _flags_unknown = true;
+  }
 
   if (lines.size() != nLines) {
@@ -520,4 +529,6 @@
   // ------------
   int fieldLen = 19;
+  double statusflags = 0.0;
+  double healthflags = 0.0;
 
   int pos[4];
@@ -601,4 +612,43 @@
         _checkState = bad;
         return;
+      }
+    }
+
+    else if ( iLine == 4 ) {
+      if ( readDbl(line, pos[0], fieldLen, statusflags    )  ||
+           readDbl(line, pos[1], fieldLen, _M_delta_tau   )  ||
+           readDbl(line, pos[2], fieldLen, _M_FT          )  ||
+           readDbl(line, pos[3], fieldLen, healthflags    ) ) {
+        _checkState = bad;
+        return;
+      }
+      else {
+        // status flags
+        // ============
+        // bit 0-1
+        _M_P  = double(bitExtracted(statusflags, 2, 0));
+        // bit 2-3
+        _P1   = double(bitExtracted(statusflags, 2, 2));
+        // bit 4
+        _P2   = double(bitExtracted(statusflags, 1, 4));
+        // bit 5
+        _P3   = double(bitExtracted(statusflags, 1, 5));
+        // bit 6
+        _M_P4 = double(bitExtracted(statusflags, 1, 6));
+        // bit 7-8
+        _M_M  = double(bitExtracted(statusflags, 2, 7));
+        /// GLO M/K exclusive flags/values only valid if flag M is set to '01'
+        if (!_M_M) {
+          _M_P4 = 0.0;
+          _M_P  = 0.0;
+        }
+        // health flags
+        // ============
+        // bit 0 (is to be ignored, if bit 1 is zero)
+        _almanac_health = double(bitExtracted(healthflags, 1, 0));
+        // bit 1
+        _almanac_health_availablility_indicator = double(bitExtracted(healthflags, 1, 1));
+        //  bit 2
+        _M_l3 = double(bitExtracted(healthflags, 1, 2));
       }
     }
@@ -699,4 +749,76 @@
     .arg(_E,              19, 'e', 12);
 
+  if (version >= 3.05) {
+    // unknown (RINEX version < 3.05)
+    if (_flags_unknown) {
+      out << QString(fmt)
+        .arg("",            19, QChar(' '))  // statusflags blank if unknown
+        .arg(_M_delta_tau,  19, 'e', 12)
+        .arg(_M_FT,         19, 'e', 12)
+        .arg("",            19, QChar(' ')); // healthflags blank if unknown
+    }
+    else {
+      int statusflags = 0;
+      // bit 7-8
+      if (_M_M == 2.0) {
+        statusflags |= (1<<7);
+      }
+      // bit 6
+      if (_M_P4) {
+        statusflags |= (1<<6);
+      }
+      // bit 5
+      if (_P3) {
+        statusflags |= (1<<5);
+      }
+      // bit 4
+      if (_P2) {
+        statusflags |= (1<<4);
+      }
+      // bit 2-3
+      if      (_P1 == 2.0) {
+        statusflags |= (1<<2);
+      }
+      else if (_P1 == 1.0) {
+        statusflags |= (1<<3);
+      }
+      else if (_P1 == 3.0) {
+        statusflags |= (1<<2);
+        statusflags |= (1<<3);
+      }
+      // bit 0-1
+      if       (_M_P == 2.0) {
+        statusflags |= (1<<0);
+      }
+      else if (_M_P == 1.0) {
+        statusflags |= (1<<1);
+      }
+      else if (_M_P == 3.0) {
+        statusflags |= (1<<0);
+        statusflags |= (1<<1);
+      }
+      // health flags
+      // ============
+      int healthflags = 0;
+      // bit 0 (is to be ignored, if bit 1 is zero)
+      if (_almanac_health) {
+        healthflags |= (1<<0);
+      }
+      // bit 1
+      if (_almanac_health_availablility_indicator) {
+        healthflags |= (1<<1);
+      }
+      //  bit 2
+      if (_M_l3) {
+        healthflags |= (1<<2);
+      }
+      out << QString(fmt)
+        .arg(double(statusflags), 19, 'e', 12)
+        .arg(_M_delta_tau,        19, 'e', 12)
+        .arg(_M_FT,               19, 'e', 12)
+        .arg(double(healthflags), 19, 'e', 12);
+    }
+  }
+
   return rnxStr;
 }
@@ -767,5 +889,5 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephGal::t_ephGal(float rnxVersion, const QStringList& lines) {
+t_ephGal::t_ephGal(double rnxVersion, const QStringList& lines) {
   int       year, month, day, hour, min;
   double    sec;
@@ -887,15 +1009,15 @@
       } else {
         // Bit 0
-        _e1DataInValid = (int(SVhealth) & (1<<0));
+        _e1DataInValid  = (int(SVhealth) & (1<<0));
         // Bit 1-2
-        _E1_bHS = double((int(SVhealth) >> 1) & 0x3);
+        _E1_bHS         = double((int(SVhealth) >> 1) & 0x3);
         // Bit 3
         _e5aDataInValid = (int(SVhealth) & (1<<3));
         // Bit 4-5
-        _E5aHS = double((int(SVhealth) >> 4) & 0x3);
+        _E5aHS          = double((int(SVhealth) >> 4) & 0x3);
         // Bit 6
         _e5bDataInValid = (int(SVhealth) & (1<<6));
         // Bit 7-8
-        _E5bHS = double((int(SVhealth) >> 7) & 0x3);
+        _E5bHS          = double((int(SVhealth) >> 7) & 0x3);
 
         if (prnStr.at(0) == 'E') {
@@ -1158,5 +1280,5 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephSBAS::t_ephSBAS(float rnxVersion, const QStringList& lines) {
+t_ephSBAS::t_ephSBAS(double rnxVersion, const QStringList& lines) {
 
   const int nLines = 4;
@@ -1351,5 +1473,5 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephBDS::t_ephBDS(float rnxVersion, const QStringList& lines) {
+t_ephBDS::t_ephBDS(double rnxVersion, const QStringList& lines) {
 
   const int nLines = 8;
