Index: /trunk/BNC/bnccaster.cpp
===================================================================
--- /trunk/BNC/bnccaster.cpp	(revision 2830)
+++ /trunk/BNC/bnccaster.cpp	(revision 2831)
@@ -41,4 +41,7 @@
 #include <math.h>
 #include <unistd.h>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
 
 #include "bnccaster.h"
@@ -49,4 +52,6 @@
 #include "bncsettings.h"
 #include "RTCM/GPSDecoder.h"
+
+using namespace std;
 
 // Constructor
@@ -158,28 +163,23 @@
   long newTime = obs.GPSWeek * 7*24*3600 + iSec;
 
-  // Rename the Station
-  // ------------------
-  strncpy(obs.StatID, staID.constData(),sizeof(obs.StatID));
-  obs.StatID[sizeof(obs.StatID)-1] = '\0';
-
-  const char begObs[] = "BEGOBS";
-  const int begObsNBytes = sizeof(begObs) - 1;
-
   // Output into the socket
   // ----------------------
   if (_uSockets) {
+
+    ostringstream oStr;
+    oStr.setf(ios::showpoint | ios::fixed);
+    oStr << obs.StatID                                        << " " 
+         << obs.GPSWeek                                       << " "
+         << setprecision(7) << obs.GPSWeeks                   << " "
+         << bncRinex::rinexSatLine(obs, false, ' ', ' ', ' ') << endl;
+
+    string hlpStr = oStr.str();
+
     QMutableListIterator<QTcpSocket*> is(*_uSockets);
     while (is.hasNext()) {
       QTcpSocket* sock = is.next();
       if (sock->state() == QAbstractSocket::ConnectedState) {
-        bool ok = true;
-        if (myWrite(sock, begObs, begObsNBytes) != begObsNBytes) {
-          ok = false;
-        }
-        int numBytes = sizeof(obs); 
-        if (myWrite(sock, (const char*)(&obs), numBytes) != numBytes) {
-          ok = false;
-        }
-        if (!ok) {
+        int numBytes = hlpStr.length();
+        if (myWrite(sock, hlpStr.c_str(), numBytes) != numBytes) {
           delete sock;
           is.remove();
@@ -307,10 +307,4 @@
 void bncCaster::dumpEpochs(long minTime, long maxTime) {
 
-  const char begEpoch[] = "BEGEPOCH";
-  const char endEpoch[] = "ENDEPOCH";
-
-  const int begEpochNBytes = sizeof(begEpoch) - 1;
-  const int endEpochNBytes = sizeof(endEpoch) - 1;
-
   for (long sec = minTime; sec <= maxTime; sec++) {
 
@@ -324,58 +318,40 @@
       if (_samplingRate == 0 || sec % _samplingRate == 0) {
 
-	if (first) {
-	  QTime enomtime = QTime(0,0,0).addSecs(static_cast<int>(floor(obs.GPSWeeks+0.5)));
-//        emit( newMessage( QString("Epoch %1 dumped").arg(enomtime.toString("HH:mm:ss")).toAscii(), true) ); // weber
-	}
-        // Output into the file
-        // --------------------
-        if (_out) {
-          if (first) {
-            _out->setFieldWidth(1); *_out << begEpoch << endl;
+        if (_out || _sockets) {
+          ostringstream oStr;
+          oStr.setf(ios::showpoint | ios::fixed);
+          oStr << obs.StatID                                        << " " 
+               << obs.GPSWeek                                       << " "
+               << setprecision(7) << obs.GPSWeeks                   << " "
+               << bncRinex::rinexSatLine(obs, false, ' ', ' ', ' ') << endl;
+          if (!it.hasNext()) { 
+            oStr << endl;
           }
-
-          *_out << obs.StatID << " " << obs.GPSWeek << " ";  
-          _out->setRealNumberPrecision(7); 
-           *_out << obs.GPSWeeks << " "; 
-
-           *_out << bncRinex::rinexSatLine(obs, ' ', ' ', ' ').c_str() 
-                 << endl;
-
-          if (!it.hasNext()) {
-            _out->setFieldWidth(1); *_out << endEpoch << endl;
+          string hlpStr = oStr.str();
+
+          // Output into the File
+          // --------------------
+          if (_out) {
+            *_out << hlpStr.c_str();
+            _out->flush();
           }
-          _out->flush();
-        }
-        
-        // Output into the socket
-        // ----------------------
-        if (_sockets) {
-          QMutableListIterator<QTcpSocket*> is(*_sockets);
-          while (is.hasNext()) {
-            QTcpSocket* sock = is.next();
-            if (sock->state() == QAbstractSocket::ConnectedState) {
-              bool ok = true;
-              if (first) {
-                if (myWrite(sock, begEpoch, begEpochNBytes) != begEpochNBytes) {
-                  ok = false;
+
+          // Output into the socket
+          // ----------------------
+          if (_sockets) {
+            QMutableListIterator<QTcpSocket*> is(*_sockets);
+            while (is.hasNext()) {
+              QTcpSocket* sock = is.next();
+              if (sock->state() == QAbstractSocket::ConnectedState) {
+                int numBytes = hlpStr.length(); 
+                if (myWrite(sock, hlpStr.c_str(), numBytes) != numBytes) {
+                  delete sock;
+                  is.remove();
                 }
               }
-              int numBytes = sizeof(obs); 
-              if (myWrite(sock, (const char*)(&obs), numBytes) != numBytes) {
-                ok = false;
-              }
-              if (!it.hasNext()) {
-                if (myWrite(sock, endEpoch, endEpochNBytes) != endEpochNBytes) {
-                  ok = false;
-                }
-              }
-              if (!ok) {
+              else if (sock->state() != QAbstractSocket::ConnectingState) {
                 delete sock;
                 is.remove();
               }
-            }
-            else if (sock->state() != QAbstractSocket::ConnectingState) {
-              delete sock;
-              is.remove();
             }
           }
Index: /trunk/BNC/bncrinex.cpp
===================================================================
--- /trunk/BNC/bncrinex.cpp	(revision 2830)
+++ /trunk/BNC/bncrinex.cpp	(revision 2831)
@@ -629,5 +629,5 @@
     // ---------------
     if (_rinexVers == 3) {
-      _out << rinexSatLine(obs, lli1, lli2, lli5); 
+      _out << rinexSatLine(obs, true, lli1, lli2, lli5); 
       _out << endl;
     }
@@ -671,5 +671,5 @@
 // One Line in RINEX v3 (static)
 ////////////////////////////////////////////////////////////////////////////
-string bncRinex::rinexSatLine(const t_obs& obs, 
+string bncRinex::rinexSatLine(const t_obs& obs, bool usells,
                               char lli1, char lli2, char lli5) {
   ostringstream str;
@@ -680,22 +680,52 @@
         << setw(2) << setfill('0') << obs.satNum << setfill(' ')
         << setw(14) << setprecision(3) << obs.C1  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L1C << lli1 << ' '
-        << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '
+        << setw(14) << setprecision(3) << obs.L1C; 
+    if (usells) {
+      str << lli1 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L1 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '
         << setw(14) << setprecision(3) << obs.S1C << ' '  << ' ' 
         << setw(14) << setprecision(3) << obs.P1  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L1P << lli1 << ' '
-        << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '
+        << setw(14) << setprecision(3) << obs.L1P; 
+    if (usells) {
+      str << lli1 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L1 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '
         << setw(14) << setprecision(3) << obs.S1P << ' '  << ' ' 
         << setw(14) << setprecision(3) << obs.P2  << ' '  << ' ' 
-        << setw(14) << setprecision(3) << obs.L2P << lli2 << ' '
-        << setw(14) << setprecision(3) << obs.D2P << ' '  << ' '
+        << setw(14) << setprecision(3) << obs.L2P;
+    if (usells) {
+      str << lli2 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L2 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D2P << ' '  << ' '
         << setw(14) << setprecision(3) << obs.S2P << ' '  << ' ' 
         << setw(14) << setprecision(3) << obs.C2  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L2C << lli2 << ' ' 
-        << setw(14) << setprecision(3) << obs.D2C << ' '  << ' ' 
+        << setw(14) << setprecision(3) << obs.L2C;
+    if (usells) {
+      str << lli2 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L2 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D2C << ' '  << ' ' 
         << setw(14) << setprecision(3) << obs.S2C << ' '  << ' '
         << setw(14) << setprecision(3) << obs.C5  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L5  << lli5 << ' ' 
-        << setw(14) << setprecision(3) << obs.D5  << ' '  << ' '  
+        << setw(14) << setprecision(3) << obs.L5;
+    if (usells) {
+      str << lli5 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L5 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D5  << ' '  << ' '  
         << setw(14) << setprecision(3) << obs.S5;
   }
@@ -704,18 +734,42 @@
         << setw(2) << setfill('0') << obs.satNum << setfill(' ')
         << setw(14) << setprecision(3) << obs.C1  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L1C << lli1 << ' '
-        << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '  
+        << setw(14) << setprecision(3) << obs.L1C;
+    if (usells) {
+      str << lli1 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L1 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '  
         << setw(14) << setprecision(3) << obs.S1C << ' '  << ' ' 
         << setw(14) << setprecision(3) << obs.P1  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L1P << lli1 << ' '
-        << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '  
+        << setw(14) << setprecision(3) << obs.L1P; 
+    if (usells) {
+      str << lli1 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L1 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '  
         << setw(14) << setprecision(3) << obs.S1P << ' '  << ' ' 
         << setw(14) << setprecision(3) << obs.P2  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L2P << lli2 << ' ' 
-        << setw(14) << setprecision(3) << obs.D2P << ' '  << ' '  
+        << setw(14) << setprecision(3) << obs.L2P;
+    if (usells) {
+      str << lli2 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L2 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D2P << ' '  << ' '  
         << setw(14) << setprecision(3) << obs.S2P << ' '  << ' '
         << setw(14) << setprecision(3) << obs.C2  << ' '  << ' ' 
-        << setw(14) << setprecision(3) << obs.L2C << lli2 << ' ' 
-        << setw(14) << setprecision(3) << obs.D2C << ' '  << ' '  
+        << setw(14) << setprecision(3) << obs.L2C;
+    if (usells) {
+      str << lli2 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L2 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D2C << ' '  << ' '  
         << setw(14) << setprecision(3) << obs.S2C;
   }
@@ -724,10 +778,22 @@
         << setw(2) << setfill('0') << obs.satNum << setfill(' ')
         << setw(14) << setprecision(3) << obs.C1  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L1C << lli1 << ' '
-        << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '  
+        << setw(14) << setprecision(3) << obs.L1C;
+    if (usells) {
+      str << lli1 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L1 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '  
         << setw(14) << setprecision(3) << obs.S1C << ' '  << ' '
         << setw(14) << setprecision(3) << obs.P1  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L1P << lli1 << ' '
-        << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '  
+        << setw(14) << setprecision(3) << obs.L1P; 
+    if (usells) {
+      str << lli1 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L1 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '  
         << setw(14) << setprecision(3) << obs.S1P;
   }
@@ -736,10 +802,22 @@
         << setw(2) << setfill('0') << obs.satNum << setfill(' ')
         << setw(14) << setprecision(3) << obs.C1  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L1C << lli1 << ' '
-        << setw(14) << setprecision(3) << obs.D1C << ' '  << ' ' 
+        << setw(14) << setprecision(3) << obs.L1C;
+    if (usells) {
+      str << lli1 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L1 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D1C << ' '  << ' ' 
         << setw(14) << setprecision(3) << obs.S1C << ' '  << ' ' 
         << setw(14) << setprecision(3) << obs.C5  << ' '  << ' '  
-        << setw(14) << setprecision(3) << obs.L5  << lli5 << ' '
-        << setw(14) << setprecision(3) << obs.D5  << ' '  << ' '  
+        << setw(14) << setprecision(3) << obs.L5;
+    if (usells) {
+      str << lli5 << ' ';
+    }
+    else {
+      str << ' ' << obs.slip_cnt_L5 << ' ';
+    }
+    str << setw(14) << setprecision(3) << obs.D5  << ' '  << ' '  
         << setw(14) << setprecision(3) << obs.S5;
   }
Index: /trunk/BNC/bncrinex.h
===================================================================
--- /trunk/BNC/bncrinex.h	(revision 2830)
+++ /trunk/BNC/bncrinex.h	(revision 2831)
@@ -55,5 +55,5 @@
    }
 
-   static std::string rinexSatLine(const t_obs& obs, 
+   static std::string rinexSatLine(const t_obs& obs, bool usells,
                                    char lli1, char lli2, char lli5);
 
