Index: trunk/BNC/RTCM3/RTCM3Decoder.cpp
===================================================================
--- trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 509)
+++ trunk/BNC/RTCM3/RTCM3Decoder.cpp	(revision 511)
@@ -44,4 +44,5 @@
 #include "RTCM3Decoder.h"
 #include "bncconst.h"
+#include "bncapp.h"
 
 using namespace std;
@@ -50,4 +51,13 @@
 #  define isinf(x) 0
 #endif
+
+// 
+////////////////////////////////////////////////////////////////////////////
+ephSender::ephSender() {
+  connect(this, SIGNAL(newGPSEph(gpsephemeris*)), 
+          (bncApp*) qApp, SLOT(slotNewGPSEph(gpsephemeris*)));
+  connect(this, SIGNAL(newGlonassEph(glonassephemeris*)), 
+          (bncApp*) qApp, SLOT(slotNewGlonassEph(glonassephemeris*)));
+}
 
 // Error Handling
@@ -63,5 +73,5 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
-RTCM3Decoder::RTCM3Decoder(const QByteArray& staID) : GPSDecoder() {
+RTCM3Decoder::RTCM3Decoder() : GPSDecoder() {
 
   const int LEAPSECONDS = 14; /* only needed for approx. time */
@@ -73,15 +83,4 @@
   _Parser.GPSWeek = tim/(7*24*60*60);
   _Parser.GPSTOW  = tim%(7*24*60*60);
-
-  // _Parser2 is used for direct file output
-  // ---------------------------------------
-  memset(&_Parser2, 0, sizeof(_Parser2));
-  _Parser2.GPSWeek = tim/(7*24*60*60);
-  _Parser2.GPSTOW  = tim%(7*24*60*60);
-
-  _Parser2.headerfile       = 0;
-  _Parser2.glonassephemeris = 0;
-  _Parser2.gpsephemeris     = strdup((staID + ".EPH").data());
-  _Parser2.rinex3           = 1;
 }
 
@@ -89,10 +88,4 @@
 ////////////////////////////////////////////////////////////////////////////
 RTCM3Decoder::~RTCM3Decoder() {
-  if (_Parser2.glonassfile) {
-    fclose(_Parser2.glonassfile);
-  }
-  if (_Parser2.gpsfile) {
-    fclose(_Parser2.gpsfile);
-  }
 }
 
@@ -101,18 +94,4 @@
 void RTCM3Decoder::Decode(char* buffer, int bufLen) {
 
-  // Direct file output
-  // ------------------
-  for (int ii = 0; ii < bufLen; ii++) {
-    HandleByte(&_Parser2, (unsigned int) buffer[ii]);
-    if (_Parser2.glonassfile) {
-      fflush(_Parser2.glonassfile);
-    }
-    if (_Parser2.gpsfile) {
-      fflush(_Parser2.gpsfile);
-    }
-  }
-
-  // Fill the obs structure
-  // ----------------------
   for (int ii = 0; ii < bufLen; ii++) {
 
@@ -122,77 +101,96 @@
       while(int rr = RTCM3Parser(&_Parser)) {
 
-        if (!_Parser.init) {
-          HandleHeader(&_Parser);
-          _Parser.init = 1;
-        }
+        // GNSS Observations
+        // -----------------
+        if (rr == 1 || rr == 2) {
 
-        if (rr == 2) {
-          std::cerr << "No valid RINEX! All values are modulo 299792.458!\n";
-        }
-
-        for (int ii = 0; ii < _Parser.Data.numsats; ii++) {
-          Observation* obs = new Observation();
-          if (_Parser.Data.satellites[ii] <= PRN_GPS_END) {
-            obs->satSys = 'G';
-            obs->satNum = _Parser.Data.satellites[ii];
-	  }
-	  else {
-            obs->satSys = 'R';
-            obs->satNum = _Parser.Data.satellites[ii] - PRN_GLONASS_START + 1;
-	  }
-          obs->GPSWeek  = _Parser.Data.week;
-          obs->GPSWeeks = _Parser.Data.timeofweek / 1000.0;
-
-          for (int jj = 0; jj < _Parser.numdatatypesGPS; jj++) {
-            int v = 0;
-            int df = _Parser.dataflag[jj];
-            int pos = _Parser.datapos[jj];
-            if ( (_Parser.Data.dataflags[ii] & df)
-                 && !isnan(_Parser.Data.measdata[ii][pos])
-                 && !isinf(_Parser.Data.measdata[ii][pos])) {
-              v = 1;
-            }
-            else {
-              df = _Parser.dataflagGPS[jj];
-              pos = _Parser.dataposGPS[jj];
+          if (!_Parser.init) {
+            HandleHeader(&_Parser);
+            _Parser.init = 1;
+          }
+          
+          if (rr == 2) {
+            std::cerr << "No valid RINEX! All values are modulo 299792.458!\n";
+          }
+          
+          for (int ii = 0; ii < _Parser.Data.numsats; ii++) {
+            Observation* obs = new Observation();
+            if (_Parser.Data.satellites[ii] <= PRN_GPS_END) {
+              obs->satSys = 'G';
+              obs->satNum = _Parser.Data.satellites[ii];
+	    }
+	    else {
+              obs->satSys = 'R';
+              obs->satNum = _Parser.Data.satellites[ii] - PRN_GLONASS_START + 1;
+	    }
+            obs->GPSWeek  = _Parser.Data.week;
+            obs->GPSWeeks = _Parser.Data.timeofweek / 1000.0;
+          
+            for (int jj = 0; jj < _Parser.numdatatypesGPS; jj++) {
+              int v = 0;
+              int df = _Parser.dataflag[jj];
+              int pos = _Parser.datapos[jj];
               if ( (_Parser.Data.dataflags[ii] & df)
                    && !isnan(_Parser.Data.measdata[ii][pos])
                    && !isinf(_Parser.Data.measdata[ii][pos])) {
-              v = 1;
+                v = 1;
+              }
+              else {
+                df = _Parser.dataflagGPS[jj];
+                pos = _Parser.dataposGPS[jj];
+                if ( (_Parser.Data.dataflags[ii] & df)
+                     && !isnan(_Parser.Data.measdata[ii][pos])
+                     && !isinf(_Parser.Data.measdata[ii][pos])) {
+                v = 1;
+                }
+              }
+            if(!v)
+            { continue; }
+            else
+            {
+              if      (_Parser.dataflag[jj] & GNSSDF_C1DATA) {
+                obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
+              }
+              else if (_Parser.dataflag[jj] & GNSSDF_C2DATA) {
+                obs->C2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
+              }
+              else if (_Parser.dataflag[jj] & GNSSDF_P1DATA) {
+                obs->P1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
+              }
+              else if (_Parser.dataflag[jj] & GNSSDF_P2DATA) {
+                obs->P2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
+              }
+              else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) {
+                obs->L1   = _Parser.Data.measdata[ii][pos];
+                obs->SNR1 = _Parser.Data.snrL1[ii];
+              }
+              else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) {
+                obs->L2   = _Parser.Data.measdata[ii][pos];
+                obs->SNR2 = _Parser.Data.snrL2[ii];
+              }
+              else if (df & (GNSSDF_S1CDATA|GNSSDF_S1PDATA)) {
+                obs->S1   = _Parser.Data.measdata[ii][pos];
+              }
+              else if (df & (GNSSDF_S2CDATA|GNSSDF_S2PDATA)) {
+                obs->S2   = _Parser.Data.measdata[ii][pos];
               }
             }
-          if(!v)
-          { continue; }
-          else
-          {
-            if      (_Parser.dataflag[jj] & GNSSDF_C1DATA) {
-              obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
             }
-            else if (_Parser.dataflag[jj] & GNSSDF_C2DATA) {
-              obs->C2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
-            }
-            else if (_Parser.dataflag[jj] & GNSSDF_P1DATA) {
-              obs->P1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
-            }
-            else if (_Parser.dataflag[jj] & GNSSDF_P2DATA) {
-              obs->P2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
-            }
-            else if (df & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) {
-              obs->L1   = _Parser.Data.measdata[ii][pos];
-              obs->SNR1 = _Parser.Data.snrL1[ii];
-            }
-            else if (df & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) {
-              obs->L2   = _Parser.Data.measdata[ii][pos];
-              obs->SNR2 = _Parser.Data.snrL2[ii];
-            }
-            else if (df & (GNSSDF_S1CDATA|GNSSDF_S1PDATA)) {
-              obs->S1   = _Parser.Data.measdata[ii][pos];
-            }
-            else if (df & (GNSSDF_S2CDATA|GNSSDF_S2PDATA)) {
-              obs->S2   = _Parser.Data.measdata[ii][pos];
-            }
+            _obsList.push_back(obs);
           }
-          }
-          _obsList.push_back(obs);
+        }
+
+        // GPS Ephemeris
+        // -------------
+        else if (rr == 1019) {
+          gpsephemeris* ep = new gpsephemeris(_Parser.ephemerisGPS);
+          emit _ephSender.newGPSEph(ep);
+        }
+
+        // GLONASS Ephemeris
+        // -----------------
+        else if (rr == 1020) {
+          glonassephemeris* ep = new glonassephemeris(_Parser.ephemerisGLONASS);
+          emit _ephSender.newGlonassEph(ep);
         }
       }
Index: trunk/BNC/RTCM3/RTCM3Decoder.h
===================================================================
--- trunk/BNC/RTCM3/RTCM3Decoder.h	(revision 509)
+++ trunk/BNC/RTCM3/RTCM3Decoder.h	(revision 511)
@@ -33,12 +33,22 @@
 }
 
+class ephSender : public QObject {
+Q_OBJECT
+public:
+  ephSender();
+  friend class RTCM3Decoder;
+signals:
+  void newGPSEph(gpsephemeris* gpseph);
+  void newGlonassEph(glonassephemeris* glonasseph);
+} ;
+
 class RTCM3Decoder : public GPSDecoder {
 public:
-  RTCM3Decoder(const QByteArray& staID);
+  RTCM3Decoder();
   ~RTCM3Decoder();
   void Decode(char* buffer = 0, int bufLen = 0);
 private:
   struct RTCM3ParserData _Parser;
-  struct RTCM3ParserData _Parser2;
+  ephSender _ephSender;
 } ;
 
Index: trunk/BNC/RTIGS/rtstruct.h
===================================================================
--- trunk/BNC/RTIGS/rtstruct.h	(revision 509)
+++ trunk/BNC/RTIGS/rtstruct.h	(revision 511)
@@ -20,5 +20,5 @@
 /* Purpose : structure definitions for the wide area prototype		   */
 
-/* RCS: $Header: /usr/local/cvsroot/BNC/RTIGS/rtstruct.h,v 1.1 2006/08/20 13:36:49 mervart Exp $ */
+/* RCS: $Header: /usr/local/cvsroot/BNC/RTIGS/rtstruct.h,v 1.3 2006/11/13 11:42:14 mervart Exp $ */
 
 /* Externals :                                                             */
@@ -80,5 +80,7 @@
 
 #define  MAX_STA     	     (24)		/* maximum stations  	   */
+#ifndef PI
 #define  PI   (3.141592653589793)		/* value of PI		   */
+#endif
 #define  DTR  (0.017453292519943)		/* deg to rad conversion con. */
 #define  C	   (299792458.00)		/* speed of light in vaccuum  */
Index: trunk/BNC/bncapp.cpp
===================================================================
--- trunk/BNC/bncapp.cpp	(revision 509)
+++ trunk/BNC/bncapp.cpp	(revision 511)
@@ -100,2 +100,13 @@
   }
 }
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
+}
+    
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
+}
+
Index: trunk/BNC/bncapp.h
===================================================================
--- trunk/BNC/bncapp.h	(revision 509)
+++ trunk/BNC/bncapp.h	(revision 511)
@@ -31,4 +31,5 @@
 
 #include "bnccaster.h"
+#include "RTCM3/RTCM3Decoder.h"
 
 class bncApp : public QApplication {
@@ -40,4 +41,6 @@
   public slots:
     void slotMessage(const QByteArray msg);
+    void slotNewGPSEph(gpsephemeris* gpseph);
+    void slotNewGlonassEph(glonassephemeris* glonasseph);
   private:
     QFile*       _logFile;
Index: trunk/BNC/bncgetthread.cpp
===================================================================
--- trunk/BNC/bncgetthread.cpp	(revision 509)
+++ trunk/BNC/bncgetthread.cpp	(revision 511)
@@ -333,5 +333,5 @@
     else if (_format.indexOf("RTCM_3") != -1) {
       emit(newMessage("Get Data: " + _staID + " in RTCM 3.0 format"));
-      _decoder = new RTCM3Decoder(_staID);
+      _decoder = new RTCM3Decoder();
     }
     else if (_format.indexOf("RTIGS") != -1) {
