Index: trunk/BNS/bns.cpp
===================================================================
--- trunk/BNS/bns.cpp	(revision 1065)
+++ trunk/BNS/bns.cpp	(revision 1066)
@@ -73,8 +73,8 @@
   // Socket and file for outputting the results
   // -------------------------------------------
-  _caster = new t_bnscaster(settings.value("mountpoint").toString());
-  connect(_caster, SIGNAL(error(const QByteArray)),
+  _caster.push_back(new t_bnscaster(settings.value("mountpoint").toString()));
+  connect(_caster.back(), SIGNAL(error(const QByteArray)),
           this, SLOT(slotError(const QByteArray)));
-  connect(_caster, SIGNAL(newMessage(const QByteArray)),
+  connect(_caster.back(), SIGNAL(newMessage(const QByteArray)),
           this, SLOT(slotMessage(const QByteArray)));
 
@@ -131,11 +131,4 @@
     _sp3 = new bnsSP3(prep, ext, path, intr, sampl);
   }
-
-  // Reference frame
-  // ---------------
-  _crdTrafo = false;
-  if (settings.value("refSys").toString() == "ETRS89") {
-    _crdTrafo = true;
-  }
 }
 
@@ -146,5 +139,7 @@
   delete _clkServer;
   delete _clkSocket;
-  delete _caster;
+  for (int ic = 0; ic < _caster.size(); ic++) {
+    delete _caster.at(ic);
+  }
   delete _logStream;
   delete _logFile;
@@ -250,5 +245,4 @@
     if (_clkSocket && _clkSocket->state() == QAbstractSocket::ConnectedState) {
       if ( _clkSocket->canReadLine()) {
-        _caster->open();
         readEpoch();
       }
@@ -287,77 +281,80 @@
     QStringList prns;
 
-    ///    for (int oldEph = 0; oldEph <= 1; oldEph++) {
-    for (int oldEph = 0; oldEph <= 0; oldEph++) {
-    
-      struct ClockOrbit co;
-      memset(&co, 0, sizeof(co));
-      co.GPSEpochTime      = (int)GPSweeks;
-      co.GLONASSEpochTime  = (int)fmod(GPSweeks, 86400.0);
-      co.ClockDataSupplied = 1;
-      co.OrbitDataSupplied = 1;
-      co.SatRefPoint       = POINT_CENTER;
-      co.SatRefDatum       = DATUM_ITRF;
-    
-      for (int ii = 1; ii <= numSat; ii++) {
-    
-        QString      prn;
-        ColumnVector xx(5);
-        t_eph*       ep = 0;
-    
-        if (oldEph == 0) {
-          line = _clkSocket->readLine();
-          QTextStream in(line);
-          in >> prn;
-          prns << prn;
-          if ( _ephList.contains(prn) ) {
-            in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5); xx(4) *= 1e-6;
-
-            //// beg test (zero clock correction for Gerhard Wuebbena)
-            ////            xx(4) -= xx(5) / 299792458.0;
-            //// end test
-
-            t_ephPair* pair = _ephList[prn];
-            pair->xx = xx;
-            ep = pair->eph;
+    for (int ic = 0; ic < _caster.size(); ic++) {
+      _caster.at(ic)->open();
+
+      for (int oldEph = 0; oldEph <= 0; oldEph++) { // TODO: handle old ephemeris
+      
+        struct ClockOrbit co;
+        memset(&co, 0, sizeof(co));
+        co.GPSEpochTime      = (int)GPSweeks;
+        co.GLONASSEpochTime  = (int)fmod(GPSweeks, 86400.0);
+        co.ClockDataSupplied = 1;
+        co.OrbitDataSupplied = 1;
+        co.SatRefPoint       = POINT_CENTER;
+        co.SatRefDatum       = DATUM_ITRF;
+      
+        for (int ii = 1; ii <= numSat; ii++) {
+      
+          QString      prn;
+          ColumnVector xx(5);
+          t_eph*       ep = 0;
+      
+          if (oldEph == 0) {
+            line = _clkSocket->readLine();
+            QTextStream in(line);
+            in >> prn;
+            prns << prn;
+            if ( _ephList.contains(prn) ) {
+              in >> xx(1) >> xx(2) >> xx(3) >> xx(4) >> xx(5); xx(4) *= 1e-6;
+      
+              //// beg test (zero clock correction for Gerhard Wuebbena)
+              ////            xx(4) -= xx(5) / 299792458.0;
+              //// end test
+      
+              t_ephPair* pair = _ephList[prn];
+              pair->xx = xx;
+              ep = pair->eph;
+            }
+          }
+          else {
+            prn = prns[ii-1];
+            if ( _ephList.contains(prn) ) {
+              t_ephPair* pair = _ephList[prn];
+              prn = pair->eph->prn();
+              xx  = pair->xx;
+              ep  = pair->oldEph;
+            }
+          }
+      
+          if (ep != 0) {
+            struct ClockOrbit::SatData* sd = 0;
+            if      (prn[0] == 'G') {
+              sd = co.Sat + co.NumberOfGPSSat;
+              ++co.NumberOfGPSSat;
+            }
+            else if (prn[0] == 'R') {
+              sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
+              ++co.NumberOfGLONASSSat;
+            }
+            if (sd) {
+              QString outLine;
+              processSatellite(oldEph, _caster.at(ic)->crdTrafo(), ep, GPSweek,
+                               GPSweeks, prn, xx, sd, outLine);
+              _caster.at(ic)->printAscii(line);
+            }
           }
         }
-        else {
-          prn = prns[ii-1];
-          if ( _ephList.contains(prn) ) {
-            t_ephPair* pair = _ephList[prn];
-            prn = pair->eph->prn();
-            xx  = pair->xx;
-            ep  = pair->oldEph;
-          }
-        }
-    
-        if (ep != 0) {
-          struct ClockOrbit::SatData* sd = 0;
-          if      (prn[0] == 'G') {
-            sd = co.Sat + co.NumberOfGPSSat;
-            ++co.NumberOfGPSSat;
-          }
-          else if (prn[0] == 'R') {
-            sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
-            ++co.NumberOfGLONASSSat;
-          }
-          if (sd) {
-            QString outLine;
-            processSatellite(oldEph, ep, GPSweek, GPSweeks, prn, xx, 
-                             sd, outLine);
-            _caster->printAscii(line);
+      
+        if ( _caster.at(ic)->used() && 
+             (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
+          char obuffer[CLOCKORBIT_BUFFERSIZE];
+          int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
+          if (len > 0) {
+            emit(newOutBytes(len));
+            _caster.at(ic)->write(obuffer, len);
           }
         }
       }
-    
-      if ( _caster->used() && 
-           (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
-        char obuffer[CLOCKORBIT_BUFFERSIZE];
-        int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
-        if (len > 0) {
-          emit(newOutBytes(len));
-          _caster->write(obuffer, len);
-        }
-      }
     }
   }
@@ -366,6 +363,7 @@
 // 
 ////////////////////////////////////////////////////////////////////////////
-void t_bns::processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks, 
-                             const QString& prn, const ColumnVector& xx, 
+void t_bns::processSatellite(int oldEph, bool trafo, t_eph* ep, int GPSweek, 
+                             double GPSweeks, const QString& prn, 
+                             const ColumnVector& xx, 
                              struct ClockOrbit::SatData* sd,
                              QString& outLine) {
@@ -377,5 +375,5 @@
 
   ColumnVector xyz = xx.Rows(1,3);
-  if (_crdTrafo) {
+  if (trafo) {
     crdTrafo(GPSweek, xyz);
   }
Index: trunk/BNS/bns.h
===================================================================
--- trunk/BNS/bns.h	(revision 1065)
+++ trunk/BNS/bns.h	(revision 1066)
@@ -59,12 +59,13 @@
   void openCaster();
   void readEpoch();
-  void processSatellite(int oldEph, t_eph* ep, int GPSweek, double GPSweeks, 
-                        const QString& prn, const ColumnVector& xx, 
-                        struct ClockOrbit::SatData* sd, QString& outLine);
+  void processSatellite(int oldEph, bool trafo, t_eph* ep, int GPSweek, 
+                        double GPSweeks, const QString& prn, 
+                        const ColumnVector& xx, struct ClockOrbit::SatData* sd,
+                        QString& outLine);
   void crdTrafo(int GPSWeek, ColumnVector& xyz);
 
   QTcpServer*               _clkServer;
   QTcpSocket*               _clkSocket;
-  t_bnscaster*              _caster;
+  QList<t_bnscaster*>       _caster;
   QFile*                    _logFile;
   QTextStream*              _logStream;
@@ -74,5 +75,4 @@
   bnsRinex*                 _rnx;
   bnsSP3*                   _sp3;
-  bool                      _crdTrafo;
 };
 #endif
Index: trunk/BNS/bnscaster.cpp
===================================================================
--- trunk/BNS/bnscaster.cpp	(revision 1065)
+++ trunk/BNS/bnscaster.cpp	(revision 1066)
@@ -47,4 +47,11 @@
       _outStream = new QTextStream(_outFile);
     }
+  }
+
+  // Reference frame
+  // ---------------
+  _crdTrafo = false;
+  if (settings.value("refSys").toString() == "ETRS89") {
+    _crdTrafo = true;
   }
 }
Index: trunk/BNS/bnscaster.h
===================================================================
--- trunk/BNS/bnscaster.h	(revision 1065)
+++ trunk/BNS/bnscaster.h	(revision 1066)
@@ -12,5 +12,6 @@
   void write(char* buffer, unsigned len);
   void printAscii(const QString& line);
-  bool used() {return _outSocket || _outFile;}
+  bool used() const {return _outSocket || _outFile;}
+  bool crdTrafo() const {return _crdTrafo;}
 
  signals:
@@ -25,4 +26,5 @@
   QFile*       _outFile;
   QTextStream* _outStream;
+  bool         _crdTrafo;
 };
 
