source: ntrip/trunk/BNS/bns.cpp@ 764

Last change on this file since 764 was 764, checked in by mervart, 16 years ago

* empty log message *

File size: 1.9 KB
Line 
1/* -------------------------------------------------------------------------
2 * BKG NTRIP Server
3 * -------------------------------------------------------------------------
4 *
5 * Class: bns
6 *
7 * Purpose: This class implements the main application behaviour
8 *
9 * Author: L. Mervart
10 *
11 * Created: 29-Mar-2008
12 *
13 * Changes:
14 *
15 * -----------------------------------------------------------------------*/
16
17#include <iostream>
18
19#include "bns.h"
20
21using namespace std;
22
23// Constructor
24////////////////////////////////////////////////////////////////////////////
25t_bns::t_bns(QObject* parent) : QThread(parent) {
26
27 this->setTerminationEnabled(true);
28
29 _bnseph = new t_bnseph(parent);
30
31 connect(_bnseph, SIGNAL(newMessage(QByteArray)),
32 this, SLOT(slotMessage(const QByteArray)));
33
34 connect(_bnseph, SIGNAL(error(QByteArray)),
35 this, SLOT(slotError(const QByteArray)));
36}
37
38// Destructor
39////////////////////////////////////////////////////////////////////////////
40t_bns::~t_bns() {
41 deleteBnsEph();
42}
43
44// Delete bns thread
45////////////////////////////////////////////////////////////////////////////
46void t_bns::deleteBnsEph() {
47 if (_bnseph) {
48 _bnseph->terminate();
49 _bnseph->wait(100);
50 delete _bnseph;
51 _bnseph = 0;
52 }
53}
54
55// Write a Program Message
56////////////////////////////////////////////////////////////////////////////
57void t_bns::slotMessage(const QByteArray msg) {
58 cout << msg.data() << endl;
59 emit(newMessage(msg));
60}
61
62// Write a Program Message
63////////////////////////////////////////////////////////////////////////////
64void t_bns::slotError(const QByteArray msg) {
65 cerr << msg.data() << endl;
66 deleteBnsEph();
67 emit(error(msg));
68}
69
70// Start
71////////////////////////////////////////////////////////////////////////////
72void t_bns::run() {
73 slotMessage("============ Start BNS ============");
74 _bnseph->start();
75}
76
Note: See TracBrowser for help on using the repository browser.