source: ntrip/trunk/BNC/test_bnc_qt.cpp@ 516

Last change on this file since 516 was 464, checked in by weber, 17 years ago

* empty log message *

File size: 3.3 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
7// Czech Technical University Prague, Department of Geodesy
8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25/* -------------------------------------------------------------------------
26 * BKG NTRIP Client
27 * -------------------------------------------------------------------------
28 *
29 * Class: test_bnc_qt
30 *
31 * Purpose: Example program to read BNC output from IP port.
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Jan-2007
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iostream>
42#include <iomanip>
43
44#include "RTCM/GPSDecoder.h"
45
46#include <QTcpSocket>
47
48using namespace std;
49
50const char begEpoch = 'A';
51const char begObs = 'B';
52const char endEpoch = 'C';
53
54int main(int /* argc */, char** /* argv */) {
55
56 QTcpSocket socket;
57
58 socket.connectToHost("127.0.0.1", 1968);
59 if (!socket.waitForConnected(10000)) {
60 cout << "not connected" << endl;
61 exit(1);
62 }
63
64 // Receive Data
65 // ------------
66 Observation obs;
67 char flag = ' ';
68 cout.setf(ios::showpoint | ios::fixed);
69
70 while (true) {
71 if ( socket.bytesAvailable() ) {
72 int bytesRecv = socket.read(&flag, 1);
73 if (flag == begObs) {
74 if ( socket.bytesAvailable() >= sizeof(obs) ) {
75 bytesRecv = socket.read((char*) &obs, sizeof(obs));
76 cout << setw(5) << obs.StatID << " "
77 << obs.satSys << setw(2) << obs.satNum << " "
78 << setw(4) << obs.GPSWeek << " "
79 << setw(10) << setprecision(2) << obs.GPSWeeks << " "
80 << setw(14) << setprecision(4) << obs.C1 << " "
81 << setw(14) << setprecision(4) << obs.C2 << " "
82 << setw(14) << setprecision(4) << obs.P1 << " "
83 << setw(14) << setprecision(4) << obs.P2 << " "
84 << setw(14) << setprecision(4) << obs.L1 << " "
85 << setw(14) << setprecision(4) << obs.L2 << " "
86 << setw(14) << setprecision(4) << obs.S1 << " "
87 << setw(14) << setprecision(4) << obs.S2 << " "
88 << setw(4) << obs.SNR1 << " "
89 << setw(4) << obs.SNR2 << endl;
90 }
91 }
92 }
93 else {
94 socket.waitForReadyRead(100);
95 }
96 }
97
98 return 0;
99}
Note: See TracBrowser for help on using the repository browser.