Index: /trunk/BNC/bnccaster.cpp
===================================================================
--- /trunk/BNC/bnccaster.cpp	(revision 349)
+++ /trunk/BNC/bnccaster.cpp	(revision 350)
@@ -114,6 +114,7 @@
 // New Observations
 ////////////////////////////////////////////////////////////////////////////
-int bncCaster::newObs(const QByteArray& staID,
-                       bool firstObs, Observation* obs) {
+void bncCaster::newObs(const QByteArray& staID, const QUrl& mountPoint,
+                       bool firstObs, Observation* obs,
+                       const QByteArray& format) {
 
   QMutexLocker locker(&_mutex);
@@ -127,4 +128,16 @@
   obs->StatID[sizeof(obs->StatID)-1] = '\0';
         
+  // Prepare RINEX Output
+  // --------------------
+  if (_rinexWriters.find(obs->StatID) == _rinexWriters.end()) {
+    _rinexWriters.insert(obs->StatID, new bncRinex(obs->StatID, 
+                                                   mountPoint, format));
+  }
+  bncRinex* rnx = _rinexWriters.find(obs->StatID).value();
+  if (_samplingRate == 0 || iSec % _samplingRate == 0) {
+    rnx->deepCopy(obs);
+  }
+  rnx->dumpEpoch(newTime);
+
   // First time, set the _lastDumpSec immediately
   // --------------------------------------------
@@ -145,5 +158,5 @@
     }
     delete obs;
-    return 1;
+    return;
   }
 
@@ -159,6 +172,4 @@
     _lastDumpSec = newTime - _waitTime;
   }
-
-  return 0;
 }
 
Index: /trunk/BNC/bnccaster.h
===================================================================
--- /trunk/BNC/bnccaster.h	(revision 349)
+++ /trunk/BNC/bnccaster.h	(revision 350)
@@ -32,4 +32,5 @@
 
 #include "RTCM/GPSDecoder.h"
+#include "bncrinex.h"
 
 class bncGetThread;
@@ -43,5 +44,6 @@
    void addGetThread(bncGetThread* getThread);
    int  numStations() const {return _staIDs.size();}
-   int  newObs(const QByteArray& staID, bool firstObs, Observation* obs);
+   void newObs(const QByteArray& staID, const QUrl& mountPoint,
+               bool firstObs, Observation* obs, const QByteArray& format);
 
  signals:
@@ -64,4 +66,5 @@
    QList<QTcpSocket*>*            _sockets;
    QList<QByteArray>              _staIDs;
+   QMap<QString, bncRinex*>       _rinexWriters;
    QList<bncGetThread*>           _threads;
    int                            _samplingRate;
Index: /trunk/BNC/bncgetthread.cpp
===================================================================
--- /trunk/BNC/bncgetthread.cpp	(revision 349)
+++ /trunk/BNC/bncgetthread.cpp	(revision 350)
@@ -49,5 +49,4 @@
 #include "bnctabledlg.h"
 #include "bncapp.h"
-#include "bncutils.h"
 
 #include "RTCM/RTCM2Decoder.h"
@@ -61,14 +60,13 @@
 bncGetThread::bncGetThread(const QUrl& mountPoint, 
                            const QByteArray& format, int iMount) {
-  _decoder     = 0;
-  _mountPoint  = mountPoint;
-  _staID       = mountPoint.path().mid(1).toAscii();
-  _staID_orig  = _staID;
-  _format      = format;
-  _socket      = 0;
-  _timeOut     = 20*1000;  // 20 seconds
-  _nextSleep   =  1;       //  1 second
-  _iMount      = iMount;   // index in mountpoints array
-  _rinexWriter = 0;
+  _decoder    = 0;
+  _mountPoint = mountPoint;
+  _staID      = mountPoint.path().mid(1).toAscii();
+  _staID_orig = _staID;
+  _format     = format;
+  _socket     = 0;
+  _timeOut    = 20*1000;  // 20 seconds
+  _nextSleep  =  1;       //  1 second
+  _iMount     = iMount;   // index in mountpoints array
 
   // Check name conflict
@@ -89,6 +87,4 @@
     }
   }
-
-  _samplingRate = settings.value("rnxSampl").toInt();
 
   if (num > 0) {
@@ -292,47 +288,7 @@
         for (list<Observation*>::iterator it = _decoder->_obsList.begin(); 
              it != _decoder->_obsList.end(); it++) {
-
-          // Check observation epoch
-          // -----------------------
-          int    week;
-          double sec;
-          currentGPSWeeks(week, sec);
-          
-          const double secPerWeek = 7.0 * 24.0 * 3600.0;
-          const double maxDt      = 600.0;            
-
-          if (week < (*it)->GPSWeek) {
-            week += 1;
-            sec  -= secPerWeek;
-          }
-          if (week > (*it)->GPSWeek) {
-            week -= 1;
-            sec  += secPerWeek;
-          }
-          double dt = fabs(sec - (*it)->GPSWeeks);
-          if (week != (*it)->GPSWeek || dt > maxDt) {
-            emit( newMessage("Wrong observation epoch") );
-            delete (*it);
-            continue;
-          }
-
           emit newObs(_staID, *it);
           bool firstObs = (it == _decoder->_obsList.begin());
-          if ( _global_caster->newObs(_staID, firstObs, *it) == 0 ) {
-
-            if (_rinexWriter == 0) {
-              _rinexWriter = new bncRinex((*it)->StatID, _mountPoint, _format);
-            }
-
-            long iSec    = long(floor((*it)->GPSWeeks+0.5));
-            long newTime = (*it)->GPSWeek * 7*24*3600 + iSec;
-
-            if (_samplingRate == 0 || iSec % _samplingRate == 0) {
-              _rinexWriter->deepCopy(*it);
-            }
-            _rinexWriter->dumpEpoch(newTime);
-          }
-
-
+          _global_caster->newObs(_staID, _mountPoint, firstObs, *it, _format);
         }
         _decoder->_obsList.clear();
Index: /trunk/BNC/bncgetthread.h
===================================================================
--- /trunk/BNC/bncgetthread.h	(revision 349)
+++ /trunk/BNC/bncgetthread.h	(revision 350)
@@ -32,5 +32,4 @@
 #include "RTCM/GPSDecoder.h"
 #include "bncconst.h"
-#include "bncrinex.h"
 
 class bncGetThread : public QThread {
@@ -69,6 +68,4 @@
    int         _nextSleep;
    int         _iMount;
-   int         _samplingRate;
-   bncRinex*   _rinexWriter;
 };
 
