source: ntrip/trunk/BNS/bnseph.cpp@ 761

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

* empty log message *

File size: 1.5 KB
Line 
1/* -------------------------------------------------------------------------
2 * BKG NTRIP Server
3 * -------------------------------------------------------------------------
4 *
5 * Class: bnseph
6 *
7 * Purpose: Retrieve broadcast ephemeris from BNC
8 *
9 * Author: L. Mervart
10 *
11 * Created: 29-Mar-2008
12 *
13 * Changes:
14 *
15 * -----------------------------------------------------------------------*/
16
17#include <iostream>
18
19#include "bnseph.h"
20
21using namespace std;
22
23// Constructor
24////////////////////////////////////////////////////////////////////////////
25t_bnseph::t_bnseph(QObject* parent) : QThread(parent) {
26 _socket = 0;
27}
28
29// Destructor
30////////////////////////////////////////////////////////////////////////////
31t_bnseph::~t_bnseph() {
32 delete _socket;
33}
34
35// Start
36////////////////////////////////////////////////////////////////////////////
37void t_bnseph::run() {
38
39 emit(newMessage("bnseph::run Start"));
40
41 // Connect the Socket
42 // ------------------
43 QSettings settings;
44 QString host = settings.value("ephHost").toString();
45 int port = settings.value("ephPort").toInt();
46
47 _socket = new QTcpSocket();
48 _socket->connectToHost(host, port);
49
50 const int timeOut = 3*1000; // 3 seconds
51 if (!_socket->waitForConnected(timeOut)) {
52 emit(error("bnseph::run Connect Timeout"));
53 }
54 else {
55 while (true) {
56 if (_socket->canReadLine()) {
57 QByteArray line = _socket->readLine();
58 cout << line.data();
59 }
60 else {
61 _socket->waitForReadyRead(10);
62 }
63 }
64 }
65}
66
Note: See TracBrowser for help on using the repository browser.