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

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

* empty log message *

File size: 1.5 KB
RevLine 
[758]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
[761]17#include <iostream>
18
[758]19#include "bnseph.h"
20
21using namespace std;
22
23// Constructor
24////////////////////////////////////////////////////////////////////////////
25t_bnseph::t_bnseph(QObject* parent) : QThread(parent) {
[759]26 _socket = 0;
[758]27}
28
29// Destructor
30////////////////////////////////////////////////////////////////////////////
31t_bnseph::~t_bnseph() {
[759]32 delete _socket;
[758]33}
34
35// Start
36////////////////////////////////////////////////////////////////////////////
37void t_bnseph::run() {
[759]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
[760]50 const int timeOut = 3*1000; // 3 seconds
[759]51 if (!_socket->waitForConnected(timeOut)) {
[760]52 emit(error("bnseph::run Connect Timeout"));
[759]53 }
[760]54 else {
55 while (true) {
56 if (_socket->canReadLine()) {
57 QByteArray line = _socket->readLine();
[761]58 cout << line.data();
[760]59 }
60 else {
61 _socket->waitForReadyRead(10);
62 }
[759]63 }
64 }
[758]65}
66
Note: See TracBrowser for help on using the repository browser.