Index: trunk/BNC/src/GPSS/gpssDecoder.cpp
===================================================================
--- trunk/BNC/src/GPSS/gpssDecoder.cpp	(revision 5069)
+++ trunk/BNC/src/GPSS/gpssDecoder.cpp	(revision 5070)
@@ -17,5 +17,5 @@
 
 #include "gpssDecoder.h"
-#include "bncapp.h"
+#include "bnccore.h"
 
 using namespace std;
Index: trunk/BNC/src/GPSS/hassDecoder.cpp
===================================================================
--- trunk/BNC/src/GPSS/hassDecoder.cpp	(revision 5069)
+++ trunk/BNC/src/GPSS/hassDecoder.cpp	(revision 5070)
@@ -19,5 +19,5 @@
 
 #include "hassDecoder.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bnctime.h"
 #include "bncutils.h"
Index: trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 5069)
+++ trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 5070)
@@ -48,5 +48,5 @@
 #include "../RTCM/rtcm_utils.h"
 #include "bncconst.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncutils.h"
 #include "bncsettings.h" 
Index: trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
===================================================================
--- trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 5069)
+++ trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp	(revision 5070)
@@ -45,5 +45,5 @@
 #include "bncutils.h"
 #include "bncrinex.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncsettings.h"
 #include "rtcm3torinex.h"
Index: trunk/BNC/src/RTCM3/ephemeris.cpp
===================================================================
--- trunk/BNC/src/RTCM3/ephemeris.cpp	(revision 5069)
+++ trunk/BNC/src/RTCM3/ephemeris.cpp	(revision 5070)
@@ -11,5 +11,5 @@
 #include "timeutils.h"
 #include "bnctime.h"
-#include "bncapp.h"
+#include "bnccore.h"
 
 using namespace std;
Index: trunk/BNC/src/app.cpp
===================================================================
--- trunk/BNC/src/app.cpp	(revision 5069)
+++ trunk/BNC/src/app.cpp	(revision 5070)
@@ -16,5 +16,5 @@
 
 #include "app.h" 
-#include "bncapp.h"
+#include "bnccore.h"
 
 using namespace std;
Index: trunk/BNC/src/bncapp.cpp
===================================================================
--- trunk/BNC/src/bncapp.cpp	(revision 5069)
+++ 	(revision )
@@ -1,818 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-/* -------------------------------------------------------------------------
- * BKG NTRIP Client
- * -------------------------------------------------------------------------
- *
- * Class:      t_pgmCore
- *
- * Purpose:    This class implements the main application
- *
- * Author:     L. Mervart
- *
- * Created:    29-Aug-2006
- *
- * Changes:    
- *
- * -----------------------------------------------------------------------*/
-
-#include <iostream>
-#include <QMessageBox>
-#include <cmath>
-
-#include "bncapp.h" 
-#include "bncutils.h" 
-#include "bncrinex.h" 
-#include "bncsettings.h" 
-#include "bncversion.h" 
-#include "RTCM3/ephemeris.h" 
-
-#ifdef USE_COMBINATION
-#include "combination/bnccomb.h" 
-#endif
-
-using namespace std;
-
-// Constructor
-////////////////////////////////////////////////////////////////////////////
-t_pgmCore::t_pgmCore(int& argc, char* argv[], bool GUIenabled) {
-  _GUIenabled  = GUIenabled;
-  _logFileFlag = 0;
-  _logFile     = 0;
-  _logStream   = 0;
-  _caster      = 0;
-  _rawFile     = 0;
-#ifdef USE_COMBINATION
-  _bncComb     = 0;
-#endif
-
-  // Lists of Ephemeris
-  // ------------------
-  for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
-    _gpsEph[ii-PRN_GPS_START] = 0;
-  }
-  for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
-    _glonassEph[ii-PRN_GLONASS_START] = 0;
-  }
-  for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
-    _galileoEph[ii-PRN_GALILEO_START] = 0;
-  }
-
-  // Eph file(s)
-  // -----------
-  _rinexVers        = 0;
-  _ephFileGPS       = 0;
-  _ephStreamGPS     = 0;
-  _ephFileGlonass   = 0;
-  _ephStreamGlonass = 0;
-  _ephFileGalileo   = 0;
-  _ephStreamGalileo = 0;
-
-  _port    = 0;
-  _server  = 0;
-  _sockets = 0;
-
-  _portCorr    = 0;
-  _serverCorr  = 0;
-  _socketsCorr = 0;
-
-  _pgmName  = QString(BNCPGMNAME).leftJustified(20, ' ', true);
-#ifdef WIN32
-  _userName = QString("${USERNAME}");
-#else
-  _userName = QString("${USER}");
-#endif
-  expandEnvVar(_userName);
-  _userName = _userName.leftJustified(20, ' ', true);
-
-  _lastDumpCoSec = 0;
-
-  _corrs = new QMultiMap<long, QString>;
-
-  _currentDateAndTimeGPS = 0;
-
-  for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
-    _GLOFreq[ii] = 0;
-  }
-
-  _bncPPPclient = 0;
-
-  _mainWindow = 0;
-}
-
-// Destructor
-////////////////////////////////////////////////////////////////////////////
-t_pgmCore::~t_pgmCore() {
-  delete _logStream;
-  delete _logFile;
-  delete _ephStreamGPS;
-  delete _ephFileGPS;
-  delete _server;
-  delete _sockets;
-  delete _serverCorr;
-  delete _socketsCorr;
-  if (_rinexVers == 2) {
-    delete _ephStreamGlonass;
-    delete _ephFileGlonass;
-  }
-  for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
-    delete _gpsEph[ii-PRN_GPS_START];
-  }
-  for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
-    delete _glonassEph[ii-PRN_GLONASS_START];
-  }
-  for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
-    delete _galileoEph[ii-PRN_GALILEO_START];
-  }
-
-  delete _corrs;
-
-  delete _currentDateAndTimeGPS;
-
-  delete _rawFile;
-
-#ifdef USE_COMBINATION
-  delete _bncComb;
-#endif
-}
-
-// Write a Program Message
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::slotMessage(QByteArray msg, bool showOnScreen) {
-
-  QMutexLocker locker(&_mutexMessage);
-
-  messagePrivate(msg);
-  emit newMessage(msg, showOnScreen);
-}
-
-// Write a Program Message (private, no lock)
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::messagePrivate(const QByteArray& msg) {
-
-  // First time resolve the log file name
-  // ------------------------------------
-  QDate currDate = currentDateAndTimeGPS().date();
-  if (_logFileFlag == 0 || _fileDate != currDate) {
-    delete _logStream; _logStream = 0;
-    delete _logFile;   _logFile   = 0;
-    _logFileFlag = 1;
-    bncSettings settings;
-    QString logFileName = settings.value("logFile").toString();
-    if ( !logFileName.isEmpty() ) {
-      expandEnvVar(logFileName);
-      _logFile = new QFile(logFileName + "_" + 
-                          currDate.toString("yyMMdd").toAscii().data());
-      _fileDate = currDate;
-      if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
-        _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
-      }
-      else {
-        _logFile->open(QIODevice::WriteOnly);
-      }
-      _logStream = new QTextStream();
-      _logStream->setDevice(_logFile);
-    }
-  }
-
-  if (_logStream) {
-    QByteArray msgLocal = msg;
-    if (msg.indexOf('\n') == 0) {
-      *_logStream << endl;
-      msgLocal = msg.mid(1);
-    }
-    *_logStream << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
-    *_logStream << msgLocal.data() << endl;
-    _logStream->flush();
-    _logFile->flush();
-  }
-}
-
-// New GPS Ephemeris 
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::slotNewGPSEph(gpsephemeris* gpseph) {
-
-  QMutexLocker locker(&_mutex);
-
-  gpsephemeris copy_gpseph = *gpseph;
-  emit newEphGPS(copy_gpseph);
-
-  printEphHeader();
-
-  gpsephemeris** ee = &_gpsEph[gpseph->satellite-1];
-
-  if ( *ee != 0 && 
-       gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC == (*ee)->TOC ) {
-    checkEphemeris(*ee, gpseph);
-  }
-
-  if ( *ee == 0                         || 
-       gpseph->GPSweek > (*ee)->GPSweek ||
-       (gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC > (*ee)->TOC) ) {
-    delete *ee;
-    *ee = gpseph;
-    printGPSEph(gpseph, true);
-  }
-  else {
-    printGPSEph(gpseph, false);
-    delete gpseph;
-  }
-}
-    
-// New Glonass Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::slotNewGlonassEph(glonassephemeris* glonasseph) {
-
-  QMutexLocker locker(&_mutex);
-
-  // Check wrong Ephemerides
-  // -----------------------
-  if (glonasseph->x_pos == 0.0 && 
-      glonasseph->y_pos == 0.0 && 
-      glonasseph->z_pos == 0.0) {
-    delete glonasseph;
-    return;
-  } 
-
-  glonassephemeris copy_glonasseph = *glonasseph;
-  emit newEphGlonass(copy_glonasseph);
-
-  printEphHeader();
-
-  glonassephemeris** ee = &_glonassEph[glonasseph->almanac_number-1];
-
-  int wwOld, towOld, wwNew, towNew;
-  if (*ee != 0) {
-    wwOld  = (*ee)->GPSWeek;
-    towOld = (*ee)->GPSTOW; 
-    updatetime(&wwOld, &towOld, (*ee)->tb*1000, 0);  // Moscow -> GPS
-
-    wwNew  = glonasseph->GPSWeek;
-    towNew = glonasseph->GPSTOW; 
-    updatetime(&wwNew, &towNew, glonasseph->tb*1000, 0); // Moscow -> GPS
-  }
-
-  if ( *ee == 0      || 
-       wwNew > wwOld ||
-       (wwNew == wwOld && towNew > towOld) ) {
-    delete *ee;
-    *ee = glonasseph;
-    printGlonassEph(glonasseph, true);
-  }
-  else {
-    printGlonassEph(glonasseph, false);
-    delete glonasseph;
-  }
-}
-
-// New Galileo Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::slotNewGalileoEph(galileoephemeris* galileoeph) {
-
-  QMutexLocker locker(&_mutex);
-
-  galileoephemeris copy_galileoeph = *galileoeph;
-  emit newEphGalileo(copy_galileoeph);
-
-  printEphHeader();
-
-  int galIndex = galileoeph->satellite;
-  /* GIOVE */
-  if(galIndex == 51) galIndex = 1;
-  else if(galIndex == 52) galIndex = 16;
-  if (galIndex < 0 || galIndex > PRN_GALILEO_END - PRN_GALILEO_START) {
-    emit( newMessage("Wrong Galileo Satellite Number", true) );
-    exit(1);
-  }
-
-  galileoephemeris** ee = &_galileoEph[galIndex];
-
-  if ( *ee == 0                       || 
-       galileoeph->Week > (*ee)->Week ||
-       (galileoeph->Week == (*ee)->Week && galileoeph->TOC > (*ee)->TOC) ) {
-    delete *ee;
-    *ee = galileoeph;
-    printGalileoEph(galileoeph, true);
-  }
-  else {
-    printGalileoEph(galileoeph, false);
-    delete galileoeph;
-  }
-}
-
-// Print Header of the output File(s)
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::printEphHeader() {
-
-  bncSettings settings;
-
-  // Initialization
-  // --------------
-  if (_rinexVers == 0) {
-
-    if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
-      _rinexVers = 3;    
-    }
-    else {
-      _rinexVers = 2;
-    }
-
-    _ephPath = settings.value("ephPath").toString();
-
-    if ( !_ephPath.isEmpty() ) {
-      if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
-        _ephPath += QDir::separator();
-      }
-      expandEnvVar(_ephPath);
-    }
-  }
-
-  // (Re-)Open output File(s)
-  // ------------------------
-  if (!_ephPath.isEmpty()) {
-
-    QDateTime datTim = currentDateAndTimeGPS();
-
-    QString ephFileNameGPS = _ephPath + "BRDC" + 
-               QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'));
-
-    QString hlpStr = bncRinex::nextEpochStr(datTim, 
-                         settings.value("ephIntr").toString());
-
-    if (_rinexVers == 3) {
-      ephFileNameGPS += hlpStr + datTim.toString(".yyP");
-    }
-    else {
-      ephFileNameGPS += hlpStr + datTim.toString(".yyN");
-    }
-
-    if (_ephFileNameGPS == ephFileNameGPS) {
-      return;
-    }
-    else {
-      _ephFileNameGPS = ephFileNameGPS;
-    }
-
-    for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
-      delete _gpsEph[ii-PRN_GPS_START];
-      _gpsEph[ii-PRN_GPS_START] = 0;
-    }
-    for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
-      delete _glonassEph[ii-PRN_GLONASS_START];
-      _glonassEph[ii-PRN_GLONASS_START] = 0;
-    }
-    for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
-      delete _galileoEph[ii-PRN_GALILEO_START];
-      _galileoEph[ii-PRN_GALILEO_START] = 0;
-    }
-
-    delete _ephStreamGPS;
-    delete _ephFileGPS;
-
-    QFlags<QIODevice::OpenModeFlag> appendFlagGPS;
-    QFlags<QIODevice::OpenModeFlag> appendFlagGlonass;
-    QFlags<QIODevice::OpenModeFlag> appendFlagGalileo;
-
-    if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
-         QFile::exists(ephFileNameGPS) ) {
-      appendFlagGPS = QIODevice::Append;
-    }
-
-    _ephFileGPS = new QFile(ephFileNameGPS);
-    _ephFileGPS->open(QIODevice::WriteOnly | appendFlagGPS);
-    _ephStreamGPS = new QTextStream();
-    _ephStreamGPS->setDevice(_ephFileGPS);
-
-    if      (_rinexVers == 3) {
-      _ephFileGlonass   = _ephFileGPS;
-      _ephStreamGlonass = _ephStreamGPS;
-      _ephFileGalileo   = _ephFileGPS;
-      _ephStreamGalileo = _ephStreamGPS;
-    }
-    else if (_rinexVers == 2) {
-      QString ephFileNameGlonass = _ephPath + "BRDC" +
-          QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
-          hlpStr + datTim.toString(".yyG");
-
-      delete _ephStreamGlonass;
-      delete _ephFileGlonass;
-
-      if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
-           QFile::exists(ephFileNameGlonass) ) {
-        appendFlagGlonass = QIODevice::Append;
-      }
-
-      _ephFileGlonass = new QFile(ephFileNameGlonass);
-      _ephFileGlonass->open(QIODevice::WriteOnly | appendFlagGlonass);
-      _ephStreamGlonass = new QTextStream();
-      _ephStreamGlonass->setDevice(_ephFileGlonass);
-    }
-
-    // Header - RINEX Version 3
-    // ------------------------
-    if (_rinexVers == 3) {
-      if ( ! (appendFlagGPS & QIODevice::Append)) {
-        QString line;
-        line.sprintf(
-          "%9.2f%11sN: GNSS NAV DATA    M: Mixed%12sRINEX VERSION / TYPE\n", 
-          3.0, "", "");
-        *_ephStreamGPS << line;
-        
-        QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
-        *_ephStreamGPS << _pgmName.toAscii().data() 
-                       << _userName.toAscii().data() 
-                       << hlp.toAscii().data() 
-                       << "PGM / RUN BY / DATE" << endl;
-
-        line.sprintf("%60sEND OF HEADER\n", "");
-        *_ephStreamGPS << line;
-        
-        _ephStreamGPS->flush();
-      }
-    }
-
-    // Headers - RINEX Version 2
-    // -------------------------
-    else if (_rinexVers == 2) {
-      if (! (appendFlagGPS & QIODevice::Append)) {
-        QString line;
-        line.sprintf(
-          "%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n", 2.10, "", "");
-        *_ephStreamGPS << line;
-         
-        QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
-        *_ephStreamGPS << _pgmName.toAscii().data() 
-                       << _userName.toAscii().data() 
-                       << hlp.toAscii().data() 
-                       << "PGM / RUN BY / DATE" << endl;
-
-        line.sprintf("%60sEND OF HEADER\n", "");
-        *_ephStreamGPS << line;
-
-        _ephStreamGPS->flush();
-      }
-      if (! (appendFlagGlonass & QIODevice::Append)) {
-        QString line;
-        line.sprintf(
-          "%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n",2.10,"","");
-        *_ephStreamGlonass << line;
-        
-        QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
-        *_ephStreamGlonass << _pgmName.toAscii().data() 
-                           << _userName.toAscii().data() 
-                           << hlp.toAscii().data() 
-                           << "PGM / RUN BY / DATE" << endl;
-
-        line.sprintf("%60sEND OF HEADER\n", "");
-        *_ephStreamGlonass << line;
-
-        _ephStreamGlonass->flush();
-      }
-    }
-  }
-}
-
-// Print One GPS Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::printGPSEph(gpsephemeris* ep, bool printFile) {
-
-  t_ephGPS eph;
-  eph.set(ep);
-
-  QString strV2 = eph.toString(2.11);
-  QString strV3 = eph.toString(3.01);
-
-  printOutput(printFile, _ephStreamGPS, strV2, strV3);
-}
-
-// Print One Glonass Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::printGlonassEph(glonassephemeris* ep, bool printFile) {
-
-  t_ephGlo eph;
-  bool timeChanged;
-  eph.set(ep, timeChanged);
-
-  QString strV2 = eph.toString(2.11);
-  QString strV3 = eph.toString(3.01);
-
-  printOutput(printFile, _ephStreamGlonass, strV2, strV3);
-}
-
-// Print One Galileo Ephemeris
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::printGalileoEph(galileoephemeris* ep, bool printFile) {
-
-  t_ephGal eph;
-  eph.set(ep);
-
-  QString strV2 = eph.toString(2.11);
-  QString strV3 = eph.toString(3.01);
-
-  printOutput(printFile, _ephStreamGalileo, strV2, strV3);
-}
-
-// Output
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::printOutput(bool printFile, QTextStream* stream,
-                         const QString& strV2, const QString& strV3) {
-
-  // Output into file
-  // ----------------
-  if (printFile && stream) {
-    if (_rinexVers == 2) {
-      *stream << strV2.toAscii();
-    }
-    else {
-      *stream << strV3.toAscii();
-    }
-    stream->flush();
-  }
-
-  // Output into the socket
-  // ----------------------
-  if (_sockets) {
-    QMutableListIterator<QTcpSocket*> is(*_sockets);
-    while (is.hasNext()) {
-      QTcpSocket* sock = is.next();
-      if (sock->state() == QAbstractSocket::ConnectedState) {
-        if (sock->write(strV3.toAscii()) == -1) {
-          delete sock;
-          is.remove();
-        }
-      }
-      else if (sock->state() != QAbstractSocket::ConnectingState) {
-        delete sock;
-        is.remove();
-      }
-    }
-  }
-}
-
-// Set Port Number
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::setPort(int port) {
-  _port = port;
-  if (_port != 0) {
-    delete _server;
-    _server = new QTcpServer;
-    if ( !_server->listen(QHostAddress::Any, _port) ) {
-      slotMessage("t_pgmCore: Cannot listen on ephemeris port", true);
-    }
-    connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
-    delete _sockets;
-    _sockets = new QList<QTcpSocket*>;
-  }
-}
-
-// Set Port Number
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::setPortCorr(int port) {
-  _portCorr = port;
-  if (_portCorr != 0) {
-    delete _serverCorr;
-    _serverCorr = new QTcpServer;
-    if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
-      slotMessage("t_pgmCore: Cannot listen on correction port", true);
-    }
-    connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
-    delete _socketsCorr;
-    _socketsCorr = new QList<QTcpSocket*>;
-  }
-}
-
-// New Connection
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::slotNewConnection() {
-  _sockets->push_back( _server->nextPendingConnection() );
-}
-
-// New Connection
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::slotNewConnectionCorr() {
-  _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::slotQuit() {
-  cout << "t_pgmCore::slotQuit" << endl;
-  delete _caster;
-  qApp->quit();
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::slotNewCorrLine(QString line, QString staID, long coTime) {
-
-  QMutexLocker locker(&_mutex);
-
-  // Combination of Corrections
-  // --------------------------
-#ifdef USE_COMBINATION
-  if (_bncComb) {
-    _bncComb->processCorrLine(staID, line);
-  }
-#endif
-
-  bncSettings settings;
-  _waitCoTime = settings.value("corrTime").toInt();
-  if (_waitCoTime < 0) {
-    _waitCoTime = 0;
-  }
-
-  // First time, set the _lastDumpSec immediately
-  // --------------------------------------------
-  if (_lastDumpCoSec == 0) {
-    _lastDumpCoSec = coTime - 1;
-  }
-
-  // An old correction - throw it away
-  // ---------------------------------
-  if (_waitCoTime > 0 && coTime <= _lastDumpCoSec) {
-    if (!_bncComb) {
-      QString line = staID + ": Correction for one sat neglected because overaged by " +
-                      QString().sprintf(" %ld sec",
-                      _lastDumpCoSec - coTime + _waitCoTime);
-      messagePrivate(line.toAscii());
-      emit( newMessage(line.toAscii(), true) );
-    }
-    return;
-  }
-
-  _corrs->insert(coTime, QString(line + " " + staID));
-
-  // Dump Corrections
-  // ----------------
-  if      (_waitCoTime == 0) {
-    dumpCorrs();
-  }
-  else if (coTime - _waitCoTime > _lastDumpCoSec) {
-    dumpCorrs(_lastDumpCoSec + 1, coTime - _waitCoTime);
-    _lastDumpCoSec = coTime - _waitCoTime;
-  }
-}
-
-// Dump Complete Correction Epochs
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::dumpCorrs(long minTime, long maxTime) {
-  for (long sec = minTime; sec <= maxTime; sec++) {
-    QList<QString> allCorrs = _corrs->values(sec);
-    dumpCorrs(allCorrs);
-    _corrs->remove(sec);
-  }
-}
-
-// Dump all corrections
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::dumpCorrs() {
-  QList<QString> allCorrs;
-  QMutableMapIterator<long, QString> it(*_corrs);
-  while (it.hasNext()) {
-    allCorrs << it.next().value();
-    it.remove();
-  }
-  dumpCorrs(allCorrs);
-}
-
-// Dump List of Corrections 
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::dumpCorrs(const QList<QString>& allCorrs) {
-  emit newCorrections(allCorrs);
-  if (_socketsCorr) {
-    QListIterator<QString> it(allCorrs);
-    while (it.hasNext()) {
-      QString corrLine = it.next() + "\n";
-    
-      QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
-      while (is.hasNext()) {
-        QTcpSocket* sock = is.next();
-        if (sock->state() == QAbstractSocket::ConnectedState) {
-          if (sock->write(corrLine.toAscii()) == -1) {
-            delete sock;
-            is.remove();
-          }
-        }
-        else if (sock->state() != QAbstractSocket::ConnectingState) {
-          delete sock;
-          is.remove();
-        }
-      }
-    }
-  }
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::setConfFileName(const QString& confFileName) {
-  if (confFileName.isEmpty()) {
-    _confFileName = QDir::homePath() + QDir::separator() 
-                  + ".config" + QDir::separator()
-                  + qApp->organizationName() + QDir::separator()
-                  + qApp->applicationName() + ".bnc";
-  }
-  else {
-    _confFileName = confFileName;
-  }
-}
-
-// Raw Output
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::writeRawData(const QByteArray& data, const QByteArray& staID,
-                          const QByteArray& format) {
-
-  QMutexLocker locker(&_mutex);
-
-  if (!_rawFile) {
-    bncSettings settings;
-    QByteArray fileName = settings.value("rawOutFile").toByteArray();
-    if (!fileName.isEmpty()) {
-      _rawFile = new bncRawFile(fileName, staID, bncRawFile::output);
-    }
-  }
-
-  if (_rawFile) {
-    _rawFile->writeRawData(data, staID, format);
-  }
-}
-
-// Get Glonass Slot Numbers from Global Array
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::getGlonassSlotNums(int GLOFreq[]) {
-
-  QMutexLocker locker(&_mutex);
-
-  for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
-    if (_GLOFreq[ii] != 0) {
-      GLOFreq[ii] = _GLOFreq[ii];
-    }
-  }
-}
-
-// Store Glonass Slot Numbers to Global Array
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::storeGlonassSlotNums(const int GLOFreq[]) {
-
-  QMutexLocker locker(&_mutex);
-
-  for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
-    if (GLOFreq[ii] != 0) {
-      _GLOFreq[ii] = GLOFreq[ii];
-    }
-  }
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::initCombination() {
-#ifdef USE_COMBINATION
-  _bncComb = new bncComb();
-  if (_bncComb->nStreams() < 1) {
-    delete _bncComb;
-    _bncComb = 0;
-  }
-#endif
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::stopCombination() {
-#ifdef USE_COMBINATION
-  delete _bncComb;
-  _bncComb = 0;
-#endif
-}
-
-// Check Ephemeris Consistency
-////////////////////////////////////////////////////////////////////////////
-void t_pgmCore::checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph) {
-  if (oldEph->clock_bias      != newEph->clock_bias      ||
-      oldEph->clock_drift     != newEph->clock_drift     ||
-      oldEph->clock_driftrate != newEph->clock_driftrate) {
-    QString msg = currentDateAndTimeGPS().toString(Qt::ISODate) +
-                  QString(" %1 EPH DIFFERS\n").arg(oldEph->satellite);
-    messagePrivate(msg.toAscii());
-  }
-}
Index: trunk/BNC/src/bncapp.h
===================================================================
--- trunk/BNC/src/bncapp.h	(revision 5069)
+++ 	(revision )
@@ -1,146 +1,0 @@
-// Part of BNC, a utility for retrieving decoding and
-// converting GNSS data streams from NTRIP broadcasters.
-//
-// Copyright (C) 2007
-// German Federal Agency for Cartography and Geodesy (BKG)
-// http://www.bkg.bund.de
-// Czech Technical University Prague, Department of Geodesy
-// http://www.fsv.cvut.cz
-//
-// Email: euref-ip@bkg.bund.de
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation, version 2.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-#ifndef BNCAPP_H
-#define BNCAPP_H
-
-#include <QtGui>
-
-#include "bnccaster.h"
-#include "bncrawfile.h"
-#include "RTCM3/RTCM3Decoder.h"
-
-class bncComb;
-class bncPPPclient;
-class bncTableItem;
-
-class t_pgmCore : public QObject {
-  Q_OBJECT
-
-    friend class bncSettings;
-    QSettings::SettingsMap   _settings;
-
-  public:
-    enum e_mode {interactive, nonInteractive, batchPostProcessing};
-    t_pgmCore(int& argc, char* argv[], bool GUIenabled);
-    virtual ~t_pgmCore();  
-    e_mode mode() const {return _mode;}
-    void   setMode(e_mode mode) {_mode = mode;}
-    void setPort(int port);
-    void setPortCorr(int port);
-    void setCaster(bncCaster* caster) {_caster = caster;}
-    QDateTime* _currentDateAndTimeGPS;
-    void setConfFileName(const QString& confFileName);
-    QString confFileName() const {return _confFileName;}
-    void writeRawData(const QByteArray& data, const QByteArray& staID,
-                      const QByteArray& format);
-    void storeGlonassSlotNums(const int GLOFreq[]);
-    void getGlonassSlotNums(int GLOFreq[]);
-    void initCombination();
-    void stopCombination();
-    const QString& pgmName() {return _pgmName;}
-    const QString& userName() {return _userName;}
-    QWidget* mainWindow() const {return _mainWindow;};
-    void setMainWindow(QWidget* mainWindow){_mainWindow = mainWindow;}
-    bool GUIenabled() const {return _GUIenabled;}
-
-  public slots:
-    void slotMessage(QByteArray msg, bool showOnScreen);
-    void slotNewGPSEph(gpsephemeris* gpseph);
-    void slotNewGlonassEph(glonassephemeris* glonasseph);
-    void slotNewGalileoEph(galileoephemeris* galileoeph);
-    void slotNewCorrLine(QString line, QString staID, long coTime);
-    void slotQuit();
-
-  signals:
-    void newMessage(QByteArray msg, bool showOnScreen);
-    void newEphGPS(gpsephemeris gpseph);
-    void newEphGlonass(glonassephemeris glonasseph);
-    void newEphGalileo(galileoephemeris galileoeph);
-    void newCorrections(QList<QString>);
-    
- private slots:
-   void slotNewConnection();
-   void slotNewConnectionCorr();
-  private:
-    void printEphHeader();
-    void printGPSEph(gpsephemeris* ep, bool printFile);
-    void printGlonassEph(glonassephemeris* ep, bool printFile);
-    void printGalileoEph(galileoephemeris* ep, bool printFile);
-    void printOutput(bool printFile, QTextStream* stream, 
-                     const QString& strV2, const QString& strV3);
-    void dumpCorrs(long minTime, long maxTime);
-    void dumpCorrs();
-    void dumpCorrs(const QList<QString>& allCorrs);
-    void messagePrivate(const QByteArray& msg);
-    void checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph);
-
-    QFile*            _logFile;
-    QTextStream*      _logStream;
-    int               _logFileFlag;
-    QMutex            _mutex;
-    QMutex            _mutexMessage;
-    QString           _ephPath;
-    QString           _ephFileNameGPS;
-    int               _rinexVers;
-    QFile*            _ephFileGPS;
-    QTextStream*      _ephStreamGPS;
-    QFile*            _ephFileGlonass;
-    QTextStream*      _ephStreamGlonass;
-    QFile*            _ephFileGalileo;
-    QTextStream*      _ephStreamGalileo;
-    gpsephemeris*     _gpsEph[PRN_GPS_END - PRN_GPS_START + 1];
-    glonassephemeris* _glonassEph[PRN_GLONASS_END - PRN_GLONASS_START + 1];
-    galileoephemeris* _galileoEph[PRN_GALILEO_END - PRN_GALILEO_START + 1];
-    QString           _userName;
-    QString           _pgmName;
-    int                 _port;
-    QTcpServer*         _server;
-    QList<QTcpSocket*>* _sockets;
-    int                 _portCorr;
-    QTcpServer*         _serverCorr;
-    QList<QTcpSocket*>* _socketsCorr;
-    int                 _portNMEA;
-    QTcpServer*         _serverNMEA;
-    QList<QTcpSocket*>* _socketsNMEA;
-    bncCaster*          _caster;
-    long                _lastDumpCoSec;
-    long                _waitCoTime;
-    QMultiMap<long, QString>* _corrs;
-    QString             _confFileName;
-    QDate               _fileDate;
-    bncRawFile*         _rawFile;
-    int                 _GLOFreq[PRN_GLONASS_NUM];
-    bncComb*            _bncComb;
-    e_mode              _mode;
-    QWidget*            _mainWindow;
-    bool                _GUIenabled;
- public:
-    bncPPPclient*       _bncPPPclient;
-    QMap<int, bncTableItem*> _uploadTableItems;
-};
-
-extern t_pgmCore* BNC_CORE;
-
-#endif
Index: trunk/BNC/src/bnccaster.cpp
===================================================================
--- trunk/BNC/src/bnccaster.cpp	(revision 5069)
+++ trunk/BNC/src/bnccaster.cpp	(revision 5070)
@@ -47,5 +47,5 @@
 #include "bnccaster.h"
 #include "bncrinex.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncgetthread.h"
 #include "bncutils.h"
Index: trunk/BNC/src/bnccore.cpp
===================================================================
--- trunk/BNC/src/bnccore.cpp	(revision 5070)
+++ trunk/BNC/src/bnccore.cpp	(revision 5070)
@@ -0,0 +1,818 @@
+// Part of BNC, a utility for retrieving decoding and
+// converting GNSS data streams from NTRIP broadcasters.
+//
+// Copyright (C) 2007
+// German Federal Agency for Cartography and Geodesy (BKG)
+// http://www.bkg.bund.de
+// Czech Technical University Prague, Department of Geodesy
+// http://www.fsv.cvut.cz
+//
+// Email: euref-ip@bkg.bund.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+/* -------------------------------------------------------------------------
+ * BKG NTRIP Client
+ * -------------------------------------------------------------------------
+ *
+ * Class:      t_pgmCore
+ *
+ * Purpose:    This class implements the main application
+ *
+ * Author:     L. Mervart
+ *
+ * Created:    29-Aug-2006
+ *
+ * Changes:    
+ *
+ * -----------------------------------------------------------------------*/
+
+#include <iostream>
+#include <QMessageBox>
+#include <cmath>
+
+#include "bnccore.h" 
+#include "bncutils.h" 
+#include "bncrinex.h" 
+#include "bncsettings.h" 
+#include "bncversion.h" 
+#include "RTCM3/ephemeris.h" 
+
+#ifdef USE_COMBINATION
+#include "combination/bnccomb.h" 
+#endif
+
+using namespace std;
+
+// Constructor
+////////////////////////////////////////////////////////////////////////////
+t_pgmCore::t_pgmCore(int& argc, char* argv[], bool GUIenabled) {
+  _GUIenabled  = GUIenabled;
+  _logFileFlag = 0;
+  _logFile     = 0;
+  _logStream   = 0;
+  _caster      = 0;
+  _rawFile     = 0;
+#ifdef USE_COMBINATION
+  _bncComb     = 0;
+#endif
+
+  // Lists of Ephemeris
+  // ------------------
+  for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
+    _gpsEph[ii-PRN_GPS_START] = 0;
+  }
+  for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
+    _glonassEph[ii-PRN_GLONASS_START] = 0;
+  }
+  for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
+    _galileoEph[ii-PRN_GALILEO_START] = 0;
+  }
+
+  // Eph file(s)
+  // -----------
+  _rinexVers        = 0;
+  _ephFileGPS       = 0;
+  _ephStreamGPS     = 0;
+  _ephFileGlonass   = 0;
+  _ephStreamGlonass = 0;
+  _ephFileGalileo   = 0;
+  _ephStreamGalileo = 0;
+
+  _port    = 0;
+  _server  = 0;
+  _sockets = 0;
+
+  _portCorr    = 0;
+  _serverCorr  = 0;
+  _socketsCorr = 0;
+
+  _pgmName  = QString(BNCPGMNAME).leftJustified(20, ' ', true);
+#ifdef WIN32
+  _userName = QString("${USERNAME}");
+#else
+  _userName = QString("${USER}");
+#endif
+  expandEnvVar(_userName);
+  _userName = _userName.leftJustified(20, ' ', true);
+
+  _lastDumpCoSec = 0;
+
+  _corrs = new QMultiMap<long, QString>;
+
+  _currentDateAndTimeGPS = 0;
+
+  for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
+    _GLOFreq[ii] = 0;
+  }
+
+  _bncPPPclient = 0;
+
+  _mainWindow = 0;
+}
+
+// Destructor
+////////////////////////////////////////////////////////////////////////////
+t_pgmCore::~t_pgmCore() {
+  delete _logStream;
+  delete _logFile;
+  delete _ephStreamGPS;
+  delete _ephFileGPS;
+  delete _server;
+  delete _sockets;
+  delete _serverCorr;
+  delete _socketsCorr;
+  if (_rinexVers == 2) {
+    delete _ephStreamGlonass;
+    delete _ephFileGlonass;
+  }
+  for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
+    delete _gpsEph[ii-PRN_GPS_START];
+  }
+  for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
+    delete _glonassEph[ii-PRN_GLONASS_START];
+  }
+  for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
+    delete _galileoEph[ii-PRN_GALILEO_START];
+  }
+
+  delete _corrs;
+
+  delete _currentDateAndTimeGPS;
+
+  delete _rawFile;
+
+#ifdef USE_COMBINATION
+  delete _bncComb;
+#endif
+}
+
+// Write a Program Message
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::slotMessage(QByteArray msg, bool showOnScreen) {
+
+  QMutexLocker locker(&_mutexMessage);
+
+  messagePrivate(msg);
+  emit newMessage(msg, showOnScreen);
+}
+
+// Write a Program Message (private, no lock)
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::messagePrivate(const QByteArray& msg) {
+
+  // First time resolve the log file name
+  // ------------------------------------
+  QDate currDate = currentDateAndTimeGPS().date();
+  if (_logFileFlag == 0 || _fileDate != currDate) {
+    delete _logStream; _logStream = 0;
+    delete _logFile;   _logFile   = 0;
+    _logFileFlag = 1;
+    bncSettings settings;
+    QString logFileName = settings.value("logFile").toString();
+    if ( !logFileName.isEmpty() ) {
+      expandEnvVar(logFileName);
+      _logFile = new QFile(logFileName + "_" + 
+                          currDate.toString("yyMMdd").toAscii().data());
+      _fileDate = currDate;
+      if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
+        _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
+      }
+      else {
+        _logFile->open(QIODevice::WriteOnly);
+      }
+      _logStream = new QTextStream();
+      _logStream->setDevice(_logFile);
+    }
+  }
+
+  if (_logStream) {
+    QByteArray msgLocal = msg;
+    if (msg.indexOf('\n') == 0) {
+      *_logStream << endl;
+      msgLocal = msg.mid(1);
+    }
+    *_logStream << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
+    *_logStream << msgLocal.data() << endl;
+    _logStream->flush();
+    _logFile->flush();
+  }
+}
+
+// New GPS Ephemeris 
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::slotNewGPSEph(gpsephemeris* gpseph) {
+
+  QMutexLocker locker(&_mutex);
+
+  gpsephemeris copy_gpseph = *gpseph;
+  emit newEphGPS(copy_gpseph);
+
+  printEphHeader();
+
+  gpsephemeris** ee = &_gpsEph[gpseph->satellite-1];
+
+  if ( *ee != 0 && 
+       gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC == (*ee)->TOC ) {
+    checkEphemeris(*ee, gpseph);
+  }
+
+  if ( *ee == 0                         || 
+       gpseph->GPSweek > (*ee)->GPSweek ||
+       (gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC > (*ee)->TOC) ) {
+    delete *ee;
+    *ee = gpseph;
+    printGPSEph(gpseph, true);
+  }
+  else {
+    printGPSEph(gpseph, false);
+    delete gpseph;
+  }
+}
+    
+// New Glonass Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::slotNewGlonassEph(glonassephemeris* glonasseph) {
+
+  QMutexLocker locker(&_mutex);
+
+  // Check wrong Ephemerides
+  // -----------------------
+  if (glonasseph->x_pos == 0.0 && 
+      glonasseph->y_pos == 0.0 && 
+      glonasseph->z_pos == 0.0) {
+    delete glonasseph;
+    return;
+  } 
+
+  glonassephemeris copy_glonasseph = *glonasseph;
+  emit newEphGlonass(copy_glonasseph);
+
+  printEphHeader();
+
+  glonassephemeris** ee = &_glonassEph[glonasseph->almanac_number-1];
+
+  int wwOld, towOld, wwNew, towNew;
+  if (*ee != 0) {
+    wwOld  = (*ee)->GPSWeek;
+    towOld = (*ee)->GPSTOW; 
+    updatetime(&wwOld, &towOld, (*ee)->tb*1000, 0);  // Moscow -> GPS
+
+    wwNew  = glonasseph->GPSWeek;
+    towNew = glonasseph->GPSTOW; 
+    updatetime(&wwNew, &towNew, glonasseph->tb*1000, 0); // Moscow -> GPS
+  }
+
+  if ( *ee == 0      || 
+       wwNew > wwOld ||
+       (wwNew == wwOld && towNew > towOld) ) {
+    delete *ee;
+    *ee = glonasseph;
+    printGlonassEph(glonasseph, true);
+  }
+  else {
+    printGlonassEph(glonasseph, false);
+    delete glonasseph;
+  }
+}
+
+// New Galileo Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::slotNewGalileoEph(galileoephemeris* galileoeph) {
+
+  QMutexLocker locker(&_mutex);
+
+  galileoephemeris copy_galileoeph = *galileoeph;
+  emit newEphGalileo(copy_galileoeph);
+
+  printEphHeader();
+
+  int galIndex = galileoeph->satellite;
+  /* GIOVE */
+  if(galIndex == 51) galIndex = 1;
+  else if(galIndex == 52) galIndex = 16;
+  if (galIndex < 0 || galIndex > PRN_GALILEO_END - PRN_GALILEO_START) {
+    emit( newMessage("Wrong Galileo Satellite Number", true) );
+    exit(1);
+  }
+
+  galileoephemeris** ee = &_galileoEph[galIndex];
+
+  if ( *ee == 0                       || 
+       galileoeph->Week > (*ee)->Week ||
+       (galileoeph->Week == (*ee)->Week && galileoeph->TOC > (*ee)->TOC) ) {
+    delete *ee;
+    *ee = galileoeph;
+    printGalileoEph(galileoeph, true);
+  }
+  else {
+    printGalileoEph(galileoeph, false);
+    delete galileoeph;
+  }
+}
+
+// Print Header of the output File(s)
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::printEphHeader() {
+
+  bncSettings settings;
+
+  // Initialization
+  // --------------
+  if (_rinexVers == 0) {
+
+    if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
+      _rinexVers = 3;    
+    }
+    else {
+      _rinexVers = 2;
+    }
+
+    _ephPath = settings.value("ephPath").toString();
+
+    if ( !_ephPath.isEmpty() ) {
+      if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
+        _ephPath += QDir::separator();
+      }
+      expandEnvVar(_ephPath);
+    }
+  }
+
+  // (Re-)Open output File(s)
+  // ------------------------
+  if (!_ephPath.isEmpty()) {
+
+    QDateTime datTim = currentDateAndTimeGPS();
+
+    QString ephFileNameGPS = _ephPath + "BRDC" + 
+               QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'));
+
+    QString hlpStr = bncRinex::nextEpochStr(datTim, 
+                         settings.value("ephIntr").toString());
+
+    if (_rinexVers == 3) {
+      ephFileNameGPS += hlpStr + datTim.toString(".yyP");
+    }
+    else {
+      ephFileNameGPS += hlpStr + datTim.toString(".yyN");
+    }
+
+    if (_ephFileNameGPS == ephFileNameGPS) {
+      return;
+    }
+    else {
+      _ephFileNameGPS = ephFileNameGPS;
+    }
+
+    for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
+      delete _gpsEph[ii-PRN_GPS_START];
+      _gpsEph[ii-PRN_GPS_START] = 0;
+    }
+    for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
+      delete _glonassEph[ii-PRN_GLONASS_START];
+      _glonassEph[ii-PRN_GLONASS_START] = 0;
+    }
+    for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
+      delete _galileoEph[ii-PRN_GALILEO_START];
+      _galileoEph[ii-PRN_GALILEO_START] = 0;
+    }
+
+    delete _ephStreamGPS;
+    delete _ephFileGPS;
+
+    QFlags<QIODevice::OpenModeFlag> appendFlagGPS;
+    QFlags<QIODevice::OpenModeFlag> appendFlagGlonass;
+    QFlags<QIODevice::OpenModeFlag> appendFlagGalileo;
+
+    if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
+         QFile::exists(ephFileNameGPS) ) {
+      appendFlagGPS = QIODevice::Append;
+    }
+
+    _ephFileGPS = new QFile(ephFileNameGPS);
+    _ephFileGPS->open(QIODevice::WriteOnly | appendFlagGPS);
+    _ephStreamGPS = new QTextStream();
+    _ephStreamGPS->setDevice(_ephFileGPS);
+
+    if      (_rinexVers == 3) {
+      _ephFileGlonass   = _ephFileGPS;
+      _ephStreamGlonass = _ephStreamGPS;
+      _ephFileGalileo   = _ephFileGPS;
+      _ephStreamGalileo = _ephStreamGPS;
+    }
+    else if (_rinexVers == 2) {
+      QString ephFileNameGlonass = _ephPath + "BRDC" +
+          QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
+          hlpStr + datTim.toString(".yyG");
+
+      delete _ephStreamGlonass;
+      delete _ephFileGlonass;
+
+      if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
+           QFile::exists(ephFileNameGlonass) ) {
+        appendFlagGlonass = QIODevice::Append;
+      }
+
+      _ephFileGlonass = new QFile(ephFileNameGlonass);
+      _ephFileGlonass->open(QIODevice::WriteOnly | appendFlagGlonass);
+      _ephStreamGlonass = new QTextStream();
+      _ephStreamGlonass->setDevice(_ephFileGlonass);
+    }
+
+    // Header - RINEX Version 3
+    // ------------------------
+    if (_rinexVers == 3) {
+      if ( ! (appendFlagGPS & QIODevice::Append)) {
+        QString line;
+        line.sprintf(
+          "%9.2f%11sN: GNSS NAV DATA    M: Mixed%12sRINEX VERSION / TYPE\n", 
+          3.0, "", "");
+        *_ephStreamGPS << line;
+        
+        QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
+        *_ephStreamGPS << _pgmName.toAscii().data() 
+                       << _userName.toAscii().data() 
+                       << hlp.toAscii().data() 
+                       << "PGM / RUN BY / DATE" << endl;
+
+        line.sprintf("%60sEND OF HEADER\n", "");
+        *_ephStreamGPS << line;
+        
+        _ephStreamGPS->flush();
+      }
+    }
+
+    // Headers - RINEX Version 2
+    // -------------------------
+    else if (_rinexVers == 2) {
+      if (! (appendFlagGPS & QIODevice::Append)) {
+        QString line;
+        line.sprintf(
+          "%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n", 2.10, "", "");
+        *_ephStreamGPS << line;
+         
+        QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
+        *_ephStreamGPS << _pgmName.toAscii().data() 
+                       << _userName.toAscii().data() 
+                       << hlp.toAscii().data() 
+                       << "PGM / RUN BY / DATE" << endl;
+
+        line.sprintf("%60sEND OF HEADER\n", "");
+        *_ephStreamGPS << line;
+
+        _ephStreamGPS->flush();
+      }
+      if (! (appendFlagGlonass & QIODevice::Append)) {
+        QString line;
+        line.sprintf(
+          "%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n",2.10,"","");
+        *_ephStreamGlonass << line;
+        
+        QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
+        *_ephStreamGlonass << _pgmName.toAscii().data() 
+                           << _userName.toAscii().data() 
+                           << hlp.toAscii().data() 
+                           << "PGM / RUN BY / DATE" << endl;
+
+        line.sprintf("%60sEND OF HEADER\n", "");
+        *_ephStreamGlonass << line;
+
+        _ephStreamGlonass->flush();
+      }
+    }
+  }
+}
+
+// Print One GPS Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::printGPSEph(gpsephemeris* ep, bool printFile) {
+
+  t_ephGPS eph;
+  eph.set(ep);
+
+  QString strV2 = eph.toString(2.11);
+  QString strV3 = eph.toString(3.01);
+
+  printOutput(printFile, _ephStreamGPS, strV2, strV3);
+}
+
+// Print One Glonass Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::printGlonassEph(glonassephemeris* ep, bool printFile) {
+
+  t_ephGlo eph;
+  bool timeChanged;
+  eph.set(ep, timeChanged);
+
+  QString strV2 = eph.toString(2.11);
+  QString strV3 = eph.toString(3.01);
+
+  printOutput(printFile, _ephStreamGlonass, strV2, strV3);
+}
+
+// Print One Galileo Ephemeris
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::printGalileoEph(galileoephemeris* ep, bool printFile) {
+
+  t_ephGal eph;
+  eph.set(ep);
+
+  QString strV2 = eph.toString(2.11);
+  QString strV3 = eph.toString(3.01);
+
+  printOutput(printFile, _ephStreamGalileo, strV2, strV3);
+}
+
+// Output
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::printOutput(bool printFile, QTextStream* stream,
+                         const QString& strV2, const QString& strV3) {
+
+  // Output into file
+  // ----------------
+  if (printFile && stream) {
+    if (_rinexVers == 2) {
+      *stream << strV2.toAscii();
+    }
+    else {
+      *stream << strV3.toAscii();
+    }
+    stream->flush();
+  }
+
+  // Output into the socket
+  // ----------------------
+  if (_sockets) {
+    QMutableListIterator<QTcpSocket*> is(*_sockets);
+    while (is.hasNext()) {
+      QTcpSocket* sock = is.next();
+      if (sock->state() == QAbstractSocket::ConnectedState) {
+        if (sock->write(strV3.toAscii()) == -1) {
+          delete sock;
+          is.remove();
+        }
+      }
+      else if (sock->state() != QAbstractSocket::ConnectingState) {
+        delete sock;
+        is.remove();
+      }
+    }
+  }
+}
+
+// Set Port Number
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::setPort(int port) {
+  _port = port;
+  if (_port != 0) {
+    delete _server;
+    _server = new QTcpServer;
+    if ( !_server->listen(QHostAddress::Any, _port) ) {
+      slotMessage("t_pgmCore: Cannot listen on ephemeris port", true);
+    }
+    connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
+    delete _sockets;
+    _sockets = new QList<QTcpSocket*>;
+  }
+}
+
+// Set Port Number
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::setPortCorr(int port) {
+  _portCorr = port;
+  if (_portCorr != 0) {
+    delete _serverCorr;
+    _serverCorr = new QTcpServer;
+    if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
+      slotMessage("t_pgmCore: Cannot listen on correction port", true);
+    }
+    connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
+    delete _socketsCorr;
+    _socketsCorr = new QList<QTcpSocket*>;
+  }
+}
+
+// New Connection
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::slotNewConnection() {
+  _sockets->push_back( _server->nextPendingConnection() );
+}
+
+// New Connection
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::slotNewConnectionCorr() {
+  _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::slotQuit() {
+  cout << "t_pgmCore::slotQuit" << endl;
+  delete _caster;
+  qApp->quit();
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::slotNewCorrLine(QString line, QString staID, long coTime) {
+
+  QMutexLocker locker(&_mutex);
+
+  // Combination of Corrections
+  // --------------------------
+#ifdef USE_COMBINATION
+  if (_bncComb) {
+    _bncComb->processCorrLine(staID, line);
+  }
+#endif
+
+  bncSettings settings;
+  _waitCoTime = settings.value("corrTime").toInt();
+  if (_waitCoTime < 0) {
+    _waitCoTime = 0;
+  }
+
+  // First time, set the _lastDumpSec immediately
+  // --------------------------------------------
+  if (_lastDumpCoSec == 0) {
+    _lastDumpCoSec = coTime - 1;
+  }
+
+  // An old correction - throw it away
+  // ---------------------------------
+  if (_waitCoTime > 0 && coTime <= _lastDumpCoSec) {
+    if (!_bncComb) {
+      QString line = staID + ": Correction for one sat neglected because overaged by " +
+                      QString().sprintf(" %ld sec",
+                      _lastDumpCoSec - coTime + _waitCoTime);
+      messagePrivate(line.toAscii());
+      emit( newMessage(line.toAscii(), true) );
+    }
+    return;
+  }
+
+  _corrs->insert(coTime, QString(line + " " + staID));
+
+  // Dump Corrections
+  // ----------------
+  if      (_waitCoTime == 0) {
+    dumpCorrs();
+  }
+  else if (coTime - _waitCoTime > _lastDumpCoSec) {
+    dumpCorrs(_lastDumpCoSec + 1, coTime - _waitCoTime);
+    _lastDumpCoSec = coTime - _waitCoTime;
+  }
+}
+
+// Dump Complete Correction Epochs
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::dumpCorrs(long minTime, long maxTime) {
+  for (long sec = minTime; sec <= maxTime; sec++) {
+    QList<QString> allCorrs = _corrs->values(sec);
+    dumpCorrs(allCorrs);
+    _corrs->remove(sec);
+  }
+}
+
+// Dump all corrections
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::dumpCorrs() {
+  QList<QString> allCorrs;
+  QMutableMapIterator<long, QString> it(*_corrs);
+  while (it.hasNext()) {
+    allCorrs << it.next().value();
+    it.remove();
+  }
+  dumpCorrs(allCorrs);
+}
+
+// Dump List of Corrections 
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::dumpCorrs(const QList<QString>& allCorrs) {
+  emit newCorrections(allCorrs);
+  if (_socketsCorr) {
+    QListIterator<QString> it(allCorrs);
+    while (it.hasNext()) {
+      QString corrLine = it.next() + "\n";
+    
+      QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
+      while (is.hasNext()) {
+        QTcpSocket* sock = is.next();
+        if (sock->state() == QAbstractSocket::ConnectedState) {
+          if (sock->write(corrLine.toAscii()) == -1) {
+            delete sock;
+            is.remove();
+          }
+        }
+        else if (sock->state() != QAbstractSocket::ConnectingState) {
+          delete sock;
+          is.remove();
+        }
+      }
+    }
+  }
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::setConfFileName(const QString& confFileName) {
+  if (confFileName.isEmpty()) {
+    _confFileName = QDir::homePath() + QDir::separator() 
+                  + ".config" + QDir::separator()
+                  + qApp->organizationName() + QDir::separator()
+                  + qApp->applicationName() + ".bnc";
+  }
+  else {
+    _confFileName = confFileName;
+  }
+}
+
+// Raw Output
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::writeRawData(const QByteArray& data, const QByteArray& staID,
+                          const QByteArray& format) {
+
+  QMutexLocker locker(&_mutex);
+
+  if (!_rawFile) {
+    bncSettings settings;
+    QByteArray fileName = settings.value("rawOutFile").toByteArray();
+    if (!fileName.isEmpty()) {
+      _rawFile = new bncRawFile(fileName, staID, bncRawFile::output);
+    }
+  }
+
+  if (_rawFile) {
+    _rawFile->writeRawData(data, staID, format);
+  }
+}
+
+// Get Glonass Slot Numbers from Global Array
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::getGlonassSlotNums(int GLOFreq[]) {
+
+  QMutexLocker locker(&_mutex);
+
+  for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
+    if (_GLOFreq[ii] != 0) {
+      GLOFreq[ii] = _GLOFreq[ii];
+    }
+  }
+}
+
+// Store Glonass Slot Numbers to Global Array
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::storeGlonassSlotNums(const int GLOFreq[]) {
+
+  QMutexLocker locker(&_mutex);
+
+  for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
+    if (GLOFreq[ii] != 0) {
+      _GLOFreq[ii] = GLOFreq[ii];
+    }
+  }
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::initCombination() {
+#ifdef USE_COMBINATION
+  _bncComb = new bncComb();
+  if (_bncComb->nStreams() < 1) {
+    delete _bncComb;
+    _bncComb = 0;
+  }
+#endif
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::stopCombination() {
+#ifdef USE_COMBINATION
+  delete _bncComb;
+  _bncComb = 0;
+#endif
+}
+
+// Check Ephemeris Consistency
+////////////////////////////////////////////////////////////////////////////
+void t_pgmCore::checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph) {
+  if (oldEph->clock_bias      != newEph->clock_bias      ||
+      oldEph->clock_drift     != newEph->clock_drift     ||
+      oldEph->clock_driftrate != newEph->clock_driftrate) {
+    QString msg = currentDateAndTimeGPS().toString(Qt::ISODate) +
+                  QString(" %1 EPH DIFFERS\n").arg(oldEph->satellite);
+    messagePrivate(msg.toAscii());
+  }
+}
Index: trunk/BNC/src/bnccore.h
===================================================================
--- trunk/BNC/src/bnccore.h	(revision 5070)
+++ trunk/BNC/src/bnccore.h	(revision 5070)
@@ -0,0 +1,146 @@
+// Part of BNC, a utility for retrieving decoding and
+// converting GNSS data streams from NTRIP broadcasters.
+//
+// Copyright (C) 2007
+// German Federal Agency for Cartography and Geodesy (BKG)
+// http://www.bkg.bund.de
+// Czech Technical University Prague, Department of Geodesy
+// http://www.fsv.cvut.cz
+//
+// Email: euref-ip@bkg.bund.de
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation, version 2.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef BNCAPP_H
+#define BNCAPP_H
+
+#include <QtGui>
+
+#include "bnccaster.h"
+#include "bncrawfile.h"
+#include "RTCM3/RTCM3Decoder.h"
+
+class bncComb;
+class bncPPPclient;
+class bncTableItem;
+
+class t_pgmCore : public QObject {
+  Q_OBJECT
+
+    friend class bncSettings;
+    QSettings::SettingsMap   _settings;
+
+  public:
+    enum e_mode {interactive, nonInteractive, batchPostProcessing};
+    t_pgmCore(int& argc, char* argv[], bool GUIenabled);
+    virtual ~t_pgmCore();  
+    e_mode mode() const {return _mode;}
+    void   setMode(e_mode mode) {_mode = mode;}
+    void setPort(int port);
+    void setPortCorr(int port);
+    void setCaster(bncCaster* caster) {_caster = caster;}
+    QDateTime* _currentDateAndTimeGPS;
+    void setConfFileName(const QString& confFileName);
+    QString confFileName() const {return _confFileName;}
+    void writeRawData(const QByteArray& data, const QByteArray& staID,
+                      const QByteArray& format);
+    void storeGlonassSlotNums(const int GLOFreq[]);
+    void getGlonassSlotNums(int GLOFreq[]);
+    void initCombination();
+    void stopCombination();
+    const QString& pgmName() {return _pgmName;}
+    const QString& userName() {return _userName;}
+    QWidget* mainWindow() const {return _mainWindow;};
+    void setMainWindow(QWidget* mainWindow){_mainWindow = mainWindow;}
+    bool GUIenabled() const {return _GUIenabled;}
+
+  public slots:
+    void slotMessage(QByteArray msg, bool showOnScreen);
+    void slotNewGPSEph(gpsephemeris* gpseph);
+    void slotNewGlonassEph(glonassephemeris* glonasseph);
+    void slotNewGalileoEph(galileoephemeris* galileoeph);
+    void slotNewCorrLine(QString line, QString staID, long coTime);
+    void slotQuit();
+
+  signals:
+    void newMessage(QByteArray msg, bool showOnScreen);
+    void newEphGPS(gpsephemeris gpseph);
+    void newEphGlonass(glonassephemeris glonasseph);
+    void newEphGalileo(galileoephemeris galileoeph);
+    void newCorrections(QList<QString>);
+    
+ private slots:
+   void slotNewConnection();
+   void slotNewConnectionCorr();
+  private:
+    void printEphHeader();
+    void printGPSEph(gpsephemeris* ep, bool printFile);
+    void printGlonassEph(glonassephemeris* ep, bool printFile);
+    void printGalileoEph(galileoephemeris* ep, bool printFile);
+    void printOutput(bool printFile, QTextStream* stream, 
+                     const QString& strV2, const QString& strV3);
+    void dumpCorrs(long minTime, long maxTime);
+    void dumpCorrs();
+    void dumpCorrs(const QList<QString>& allCorrs);
+    void messagePrivate(const QByteArray& msg);
+    void checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph);
+
+    QFile*            _logFile;
+    QTextStream*      _logStream;
+    int               _logFileFlag;
+    QMutex            _mutex;
+    QMutex            _mutexMessage;
+    QString           _ephPath;
+    QString           _ephFileNameGPS;
+    int               _rinexVers;
+    QFile*            _ephFileGPS;
+    QTextStream*      _ephStreamGPS;
+    QFile*            _ephFileGlonass;
+    QTextStream*      _ephStreamGlonass;
+    QFile*            _ephFileGalileo;
+    QTextStream*      _ephStreamGalileo;
+    gpsephemeris*     _gpsEph[PRN_GPS_END - PRN_GPS_START + 1];
+    glonassephemeris* _glonassEph[PRN_GLONASS_END - PRN_GLONASS_START + 1];
+    galileoephemeris* _galileoEph[PRN_GALILEO_END - PRN_GALILEO_START + 1];
+    QString           _userName;
+    QString           _pgmName;
+    int                 _port;
+    QTcpServer*         _server;
+    QList<QTcpSocket*>* _sockets;
+    int                 _portCorr;
+    QTcpServer*         _serverCorr;
+    QList<QTcpSocket*>* _socketsCorr;
+    int                 _portNMEA;
+    QTcpServer*         _serverNMEA;
+    QList<QTcpSocket*>* _socketsNMEA;
+    bncCaster*          _caster;
+    long                _lastDumpCoSec;
+    long                _waitCoTime;
+    QMultiMap<long, QString>* _corrs;
+    QString             _confFileName;
+    QDate               _fileDate;
+    bncRawFile*         _rawFile;
+    int                 _GLOFreq[PRN_GLONASS_NUM];
+    bncComb*            _bncComb;
+    e_mode              _mode;
+    QWidget*            _mainWindow;
+    bool                _GUIenabled;
+ public:
+    bncPPPclient*       _bncPPPclient;
+    QMap<int, bncTableItem*> _uploadTableItems;
+};
+
+extern t_pgmCore* BNC_CORE;
+
+#endif
Index: trunk/BNC/src/bncephuser.cpp
===================================================================
--- trunk/BNC/src/bncephuser.cpp	(revision 5069)
+++ trunk/BNC/src/bncephuser.cpp	(revision 5070)
@@ -42,5 +42,5 @@
 
 #include "bncephuser.h"
-#include "bncapp.h"
+#include "bnccore.h"
 
 using namespace std;
Index: trunk/BNC/src/bncgetthread.cpp
===================================================================
--- trunk/BNC/src/bncgetthread.cpp	(revision 5069)
+++ trunk/BNC/src/bncgetthread.cpp	(revision 5070)
@@ -50,5 +50,5 @@
 #include "bncgetthread.h"
 #include "bnctabledlg.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncutils.h"
 #include "bnczerodecoder.h"
Index: trunk/BNC/src/bncmain.cpp
===================================================================
--- trunk/BNC/src/bncmain.cpp	(revision 5069)
+++ trunk/BNC/src/bncmain.cpp	(revision 5070)
@@ -46,5 +46,5 @@
 
 #include "app.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncwindow.h"
 #include "bncsettings.h"
Index: trunk/BNC/src/bncmodel.cpp
===================================================================
--- trunk/BNC/src/bncmodel.cpp	(revision 5069)
+++ trunk/BNC/src/bncmodel.cpp	(revision 5070)
@@ -46,5 +46,5 @@
 #include "bncmodel.h"
 #include "bncpppclient.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncpppclient.h"
 #include "bancroft.h"
Index: trunk/BNC/src/bncnetquery.h
===================================================================
--- trunk/BNC/src/bncnetquery.h	(revision 5069)
+++ trunk/BNC/src/bncnetquery.h	(revision 5070)
@@ -4,5 +4,5 @@
 #include <QtNetwork>
 #include "bncconst.h"
-#include "bncapp.h"
+#include "bnccore.h"
 
 class bncNetQuery : public QObject {
Index: trunk/BNC/src/bncpppclient.cpp
===================================================================
--- trunk/BNC/src/bncpppclient.cpp	(revision 5069)
+++ trunk/BNC/src/bncpppclient.cpp	(revision 5070)
@@ -44,5 +44,5 @@
 
 #include "bncpppclient.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncutils.h"
 #include "bncconst.h"
Index: trunk/BNC/src/bncrawfile.cpp
===================================================================
--- trunk/BNC/src/bncrawfile.cpp	(revision 5069)
+++ trunk/BNC/src/bncrawfile.cpp	(revision 5070)
@@ -40,5 +40,5 @@
 
 #include "bncrawfile.h" 
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncutils.h"
 #include "bncsettings.h"
Index: trunk/BNC/src/bncrinex.cpp
===================================================================
--- trunk/BNC/src/bncrinex.cpp	(revision 5069)
+++ trunk/BNC/src/bncrinex.cpp	(revision 5070)
@@ -50,5 +50,5 @@
 
 #include "bncrinex.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncutils.h"
 #include "bncconst.h"
Index: trunk/BNC/src/bncsettings.cpp
===================================================================
--- trunk/BNC/src/bncsettings.cpp	(revision 5069)
+++ trunk/BNC/src/bncsettings.cpp	(revision 5070)
@@ -18,5 +18,5 @@
 
 #include "bncsettings.h"
-#include "bncapp.h"
+#include "bnccore.h"
 
 QMutex bncSettings::_mutex;  // static mutex 
Index: trunk/BNC/src/bncutils.cpp
===================================================================
--- trunk/BNC/src/bncutils.cpp	(revision 5069)
+++ trunk/BNC/src/bncutils.cpp	(revision 5070)
@@ -48,5 +48,5 @@
 
 #include "bncutils.h"
-#include "bncapp.h"
+#include "bnccore.h"
 
 using namespace std;
Index: trunk/BNC/src/bncwindow.cpp
===================================================================
--- trunk/BNC/src/bncwindow.cpp	(revision 5069)
+++ trunk/BNC/src/bncwindow.cpp	(revision 5070)
@@ -43,5 +43,5 @@
 #include <unistd.h>
 #include "bncwindow.h" 
-#include "bncapp.h" 
+#include "bnccore.h" 
 #include "bncgetthread.h" 
 #include "bnctabledlg.h" 
Index: trunk/BNC/src/combination/bnccomb.cpp
===================================================================
--- trunk/BNC/src/combination/bnccomb.cpp	(revision 5069)
+++ trunk/BNC/src/combination/bnccomb.cpp	(revision 5070)
@@ -20,5 +20,5 @@
 
 #include "bnccomb.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "upload/bncrtnetdecoder.h"
 #include "bncsettings.h"
Index: trunk/BNC/src/latencychecker.cpp
===================================================================
--- trunk/BNC/src/latencychecker.cpp	(revision 5069)
+++ trunk/BNC/src/latencychecker.cpp	(revision 5070)
@@ -48,5 +48,5 @@
 
 #include "latencychecker.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncutils.h"
 #include "bncsettings.h"
Index: trunk/BNC/src/rinex/bncpostprocess.cpp
===================================================================
--- trunk/BNC/src/rinex/bncpostprocess.cpp	(revision 5069)
+++ trunk/BNC/src/rinex/bncpostprocess.cpp	(revision 5070)
@@ -41,5 +41,5 @@
 #include <iostream>
 #include "bncpostprocess.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncsettings.h"
 #include "pppopt.h"
Index: trunk/BNC/src/rinex/reqcanalyze.cpp
===================================================================
--- trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 5069)
+++ trunk/BNC/src/rinex/reqcanalyze.cpp	(revision 5070)
@@ -44,5 +44,5 @@
 
 #include "reqcanalyze.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncsettings.h"
 #include "reqcedit.h"
Index: trunk/BNC/src/rinex/reqcedit.cpp
===================================================================
--- trunk/BNC/src/rinex/reqcedit.cpp	(revision 5069)
+++ trunk/BNC/src/rinex/reqcedit.cpp	(revision 5070)
@@ -41,5 +41,5 @@
 #include <iostream>
 #include "reqcedit.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncsettings.h"
 #include "bncutils.h"
Index: trunk/BNC/src/rinex/rnxnavfile.cpp
===================================================================
--- trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 5069)
+++ trunk/BNC/src/rinex/rnxnavfile.cpp	(revision 5070)
@@ -42,5 +42,5 @@
 #include <newmatio.h>
 #include "rnxnavfile.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bncutils.h"
 #include "RTCM3/ephemeris.h"
Index: trunk/BNC/src/rinex/rnxobsfile.cpp
===================================================================
--- trunk/BNC/src/rinex/rnxobsfile.cpp	(revision 5069)
+++ trunk/BNC/src/rinex/rnxobsfile.cpp	(revision 5070)
@@ -44,5 +44,5 @@
 #include "rnxobsfile.h"
 #include "bncutils.h"
-#include "bncapp.h"
+#include "bnccore.h"
 
 using namespace std;
Index: trunk/BNC/src/upload/bncuploadcaster.cpp
===================================================================
--- trunk/BNC/src/upload/bncuploadcaster.cpp	(revision 5069)
+++ trunk/BNC/src/upload/bncuploadcaster.cpp	(revision 5070)
@@ -18,5 +18,5 @@
 #include "bncuploadcaster.h" 
 #include "bncversion.h"
-#include "bncapp.h"
+#include "bnccore.h"
 #include "bnctableitem.h"
 
