Index: /trunk/BNC/src/ephemeris.cpp
===================================================================
--- /trunk/BNC/src/ephemeris.cpp	(revision 6389)
+++ /trunk/BNC/src/ephemeris.cpp	(revision 6390)
@@ -1102,6 +1102,99 @@
 // Constructor
 //////////////////////////////////////////////////////////////////////////////
-t_ephSBAS::t_ephSBAS(float /* rnxVersion */, const QStringList& /* lines */) {
-  qDebug() << "not yet implemented";
+t_ephSBAS::t_ephSBAS(float rnxVersion, const QStringList& lines) {
+
+  const int nLines = 4;
+
+  _ok = false;
+
+  if (lines.size() != nLines) {
+    return;
+  }
+
+  // RINEX Format
+  // ------------
+  int fieldLen = 19;
+
+  int pos[4];
+  pos[0] = (rnxVersion <= 2.12) ?  3 :  4;
+  pos[1] = pos[0] + fieldLen;
+  pos[2] = pos[1] + fieldLen;
+  pos[3] = pos[2] + fieldLen;
+
+  // Read four lines
+  // ---------------
+  for (int iLine = 0; iLine < nLines; iLine++) {
+    QString line = lines[iLine];
+
+    if      ( iLine == 0 ) {
+      QTextStream in(line.left(pos[1]).toAscii());
+
+      int    year, month, day, hour, min;
+      double sec;
+      
+      QString prnStr;
+      in >> prnStr >> year >> month >> day >> hour >> min >> sec;
+      if (prnStr.at(0) == 'S') {
+        _prn.set('S', prnStr.mid(1).toInt());
+      }
+      else {
+        _prn.set('S', prnStr.toInt());
+      }
+
+      if      (year <  80) {
+        year += 2000;
+      }
+      else if (year < 100) {
+        year += 1900;
+      }
+
+      _TOC.set(year, month, day, hour, min, sec);
+
+      if ( readDbl(line, pos[1], fieldLen, _agf0 ) ||
+           readDbl(line, pos[2], fieldLen, _agf1 ) ||
+           readDbl(line, pos[3], fieldLen, _TOW  ) ) {
+        return;
+      }
+    }
+
+    else if      ( iLine == 1 ) {
+      if ( readDbl(line, pos[0], fieldLen, _x_pos         ) ||
+           readDbl(line, pos[1], fieldLen, _x_velocity    ) ||
+           readDbl(line, pos[2], fieldLen, _x_acceleration) ||
+           readDbl(line, pos[3], fieldLen, _health        ) ) {
+        return;
+      }
+    }
+
+    else if ( iLine == 2 ) {
+      if ( readDbl(line, pos[0], fieldLen, _y_pos           ) ||
+           readDbl(line, pos[1], fieldLen, _y_velocity      ) ||
+           readDbl(line, pos[2], fieldLen, _y_acceleration  ) ||
+           readDbl(line, pos[3], fieldLen, _ura             ) ) {
+        return;
+      }
+    }
+
+    else if ( iLine == 3 ) {
+      if ( readDbl(line, pos[0], fieldLen, _z_pos         )  ||
+           readDbl(line, pos[1], fieldLen, _z_velocity    )  ||
+           readDbl(line, pos[2], fieldLen, _z_acceleration)  ||
+           readDbl(line, pos[3], fieldLen, _IODN          ) ) {
+        return;
+      }
+    }
+  }
+
+  _x_pos          *= 1.e3; 
+  _y_pos          *= 1.e3; 
+  _z_pos          *= 1.e3; 
+  _x_velocity     *= 1.e3; 
+  _y_velocity     *= 1.e3; 
+  _z_velocity     *= 1.e3; 
+  _x_acceleration *= 1.e3; 
+  _y_acceleration *= 1.e3; 
+  _z_acceleration *= 1.e3; 
+
+  _ok = true;
 }
 
@@ -1132,4 +1225,7 @@
 
   _ura            = ee->URA;
+
+  _ok     = true;
+  _health = 0;
 }
 
@@ -1163,7 +1259,7 @@
 
   out << QString("%1%2%3\n")
-    .arg(_agf0,        19, 'e', 12)
-    .arg(_agf1,        19, 'e', 12)
-    .arg(double(_TOW), 19, 'e', 12);
+    .arg(_agf0, 19, 'e', 12)
+    .arg(_agf1, 19, 'e', 12)
+    .arg(_TOW,  19, 'e', 12);
 
   QString fmt = version < 3.0 ? "   %1%2%3%4\n" : "    %1%2%3%4\n";
@@ -1173,5 +1269,5 @@
     .arg(1.e-3*_x_velocity,     19, 'e', 12)
     .arg(1.e-3*_x_acceleration, 19, 'e', 12)
-    .arg(0.0,                   19, 'e', 12);
+    .arg(_health,               19, 'e', 12);
 
   out << QString(fmt)
@@ -1179,5 +1275,5 @@
     .arg(1.e-3*_y_velocity,     19, 'e', 12)
     .arg(1.e-3*_y_acceleration, 19, 'e', 12)
-    .arg(double(_ura),          19, 'e', 12);
+    .arg(_ura,                  19, 'e', 12);
 
   out << QString(fmt)
@@ -1185,5 +1281,5 @@
     .arg(1.e-3*_z_velocity,     19, 'e', 12)
     .arg(1.e-3*_z_acceleration, 19, 'e', 12)
-    .arg(double(_IODN),         19, 'e', 12);
+    .arg(_IODN,                 19, 'e', 12);
 
   return rnxStr;
Index: /trunk/BNC/src/ephemeris.h
===================================================================
--- /trunk/BNC/src/ephemeris.h	(revision 6389)
+++ /trunk/BNC/src/ephemeris.h	(revision 6390)
@@ -216,6 +216,6 @@
   virtual t_irc position(int GPSweek, double GPSweeks, double* xc, double* vv) const;
 
-  int    _IODN;
-  int    _TOW;            // not used (set to  0.9999e9)
+  double _IODN;
+  double _TOW;            // not used (set to  0.9999e9)
   double _agf0;           // [s]    clock correction
   double _agf1;           // [s/s]  clock correction drift
@@ -233,5 +233,6 @@
   double _z_acceleration; // [m/s^2] 
 
-  int    _ura;
+  double _ura;
+  double _health;
 };
 
