Index: /trunk/BNS/bns.cpp
===================================================================
--- /trunk/BNS/bns.cpp	(revision 757)
+++ /trunk/BNS/bns.cpp	(revision 758)
@@ -24,4 +24,7 @@
 ////////////////////////////////////////////////////////////////////////////
 t_bns::t_bns(QObject* parent) : QThread(parent) {
+  _bnseph = new t_bnseph(parent);
+  connect(_bnseph, SIGNAL(newMessage(QByteArray)),
+          this, SLOT(slotMessage(const QByteArray)));
 }
 
@@ -29,9 +32,10 @@
 ////////////////////////////////////////////////////////////////////////////
 t_bns::~t_bns() {
+  delete _bnseph;
 }
 
 // Write a Program Message
 ////////////////////////////////////////////////////////////////////////////
-void t_bns::message(const QByteArray msg) {
+void t_bns::slotMessage(const QByteArray msg) {
   cout << msg.data() << endl;
   emit(newMessage(msg));
@@ -41,5 +45,6 @@
 ////////////////////////////////////////////////////////////////////////////
 void t_bns::run() {
-  message("============ Start BNS ============");
+  slotMessage("============ Start BNS ============");
+  _bnseph->start();
 }
 
Index: /trunk/BNS/bns.h
===================================================================
--- /trunk/BNS/bns.h	(revision 757)
+++ /trunk/BNS/bns.h	(revision 758)
@@ -2,7 +2,8 @@
 #define BNS_H
 
-#include <QApplication>
 #include <QThread>
 #include <QMutex>
+
+#include "bnseph.h"
 
 class t_bns : public QThread {
@@ -16,7 +17,10 @@
   void newMessage(const QByteArray msg);
  
+ private slots:
+  void slotMessage(const QByteArray msg);
+
  private:
-  void message(const QByteArray msg);
-  QMutex _mutex;
+  t_bnseph* _bnseph;
+  QMutex    _mutex;
 };
 #endif
Index: /trunk/BNS/bns.pro
===================================================================
--- /trunk/BNS/bns.pro	(revision 757)
+++ /trunk/BNS/bns.pro	(revision 758)
@@ -21,7 +21,9 @@
 release:MOC_DIR=.moc/release
 
-HEADERS =             bns.h   bnswindow.h   bnshlpdlg.h   bnshtml.h
+HEADERS =             bns.h   bnswindow.h   bnshlpdlg.h   bnshtml.h   \
+          bnseph.h
 
-SOURCES = bnsmain.cpp bns.cpp bnswindow.cpp bnshlpdlg.cpp bnshtml.cpp
+SOURCES = bnsmain.cpp bns.cpp bnswindow.cpp bnshlpdlg.cpp bnshtml.cpp \
+          bnseph.cpp
 
 RC_FILE = bns.rc
Index: /trunk/BNS/bnseph.cpp
===================================================================
--- /trunk/BNS/bnseph.cpp	(revision 758)
+++ /trunk/BNS/bnseph.cpp	(revision 758)
@@ -0,0 +1,36 @@
+/* -------------------------------------------------------------------------
+ * BKG NTRIP Server
+ * -------------------------------------------------------------------------
+ *
+ * Class:      bnseph
+ *
+ * Purpose:    Retrieve broadcast ephemeris from BNC
+ *
+ * Author:     L. Mervart
+ *
+ * Created:    29-Mar-2008
+ *
+ * Changes:    
+ *
+ * -----------------------------------------------------------------------*/
+
+#include "bnseph.h" 
+
+using namespace std;
+
+// Constructor
+////////////////////////////////////////////////////////////////////////////
+t_bnseph::t_bnseph(QObject* parent) : QThread(parent) {
+}
+
+// Destructor
+////////////////////////////////////////////////////////////////////////////
+t_bnseph::~t_bnseph() {
+}
+
+// Start 
+////////////////////////////////////////////////////////////////////////////
+void t_bnseph::run() {
+  emit(newMessage("============ Start bnseph ============"));
+}
+
Index: /trunk/BNS/bnseph.h
===================================================================
--- /trunk/BNS/bnseph.h	(revision 758)
+++ /trunk/BNS/bnseph.h	(revision 758)
@@ -0,0 +1,20 @@
+#ifndef BNSEPH_H
+#define BNSEPH_H
+
+#include <QThread>
+#include <QMutex>
+
+class t_bnseph : public QThread {
+ Q_OBJECT
+ public:
+  t_bnseph(QObject* parent = 0);
+  virtual ~t_bnseph();  
+  virtual void run();  
+
+ signals:
+  void newMessage(const QByteArray msg);
+ 
+ private:
+  QMutex _mutex;
+};
+#endif
Index: /trunk/BNS/bnsmain.cpp
===================================================================
--- /trunk/BNS/bnsmain.cpp	(revision 757)
+++ /trunk/BNS/bnsmain.cpp	(revision 758)
@@ -44,12 +44,8 @@
   app.setApplicationName("BKG_NTRIP_Server");
 
-  // Main processing class
-  // ---------------------
-  t_bns* bns = new t_bns();
-
   // Interactive Mode - open the main window
   // ---------------------------------------
   if (GUIenabled) {
-    bnsWindow* bnsWin = new bnsWindow(bns);
+    bnsWindow* bnsWin = new bnsWindow();
     bnsWin->show();
   }
@@ -58,4 +54,5 @@
   // ----------------------------
   else {
+    t_bns* bns = new t_bns();
     bns->start();
   }
Index: /trunk/BNS/bnswindow.cpp
===================================================================
--- /trunk/BNS/bnswindow.cpp	(revision 757)
+++ /trunk/BNS/bnswindow.cpp	(revision 758)
@@ -58,10 +58,7 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
-bnsWindow::bnsWindow(t_bns* bns) {
-
-  _bns = bns;
-
-  connect(bns, SIGNAL(newMessage(QByteArray)),
-          this, SLOT(slotMessage(const QByteArray)));
+bnsWindow::bnsWindow() {
+
+  _bns = 0;
 
   QSettings settings;
@@ -292,4 +289,6 @@
     _actStart->setEnabled(true);
     _actStop->setEnabled(false);
+    delete _bns; 
+    _bns = 0;
   }
 }
@@ -303,4 +302,7 @@
   _actStop->setEnabled(true);
 
+  _bns = new t_bns(0);
+  connect(_bns, SIGNAL(newMessage(QByteArray)),
+          this, SLOT(slotMessage(const QByteArray)));
   _bns->start();
 }
Index: /trunk/BNS/bnswindow.h
===================================================================
--- /trunk/BNS/bnswindow.h	(revision 757)
+++ /trunk/BNS/bnswindow.h	(revision 758)
@@ -18,5 +18,5 @@
 
  public:
-  bnsWindow(t_bns* bns);
+  bnsWindow();
   ~bnsWindow();
 
