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

Last change on this file since 2253 was 2253, checked in by mervart, 14 years ago

* empty log message *

File size: 4.8 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 <stdlib.h>
42#include <iostream>
43#include <iomanip>
44
45#include "RTCM/GPSDecoder.h"
46#include "bnctime.h"
47extern "C" {
48#include "RTCM3/rtcm3torinex.h"
49}
50
51#include <QTcpSocket>
52
53using namespace std;
54
55void RTCM3Error(const char*, ...) {}
56
57int main(int /* argc */, char** /* argv */) {
58
59 bncTime tt;
60 tt.set(2010, 1, 10, 10, 45, 0.0);
61
62 cout << tt.timestr() << endl;
63
64// if (argc != 2) {
65// cerr << "Usage: test_bnc_qt port\n";
66// exit(1);
67// }
68//
69// int port = atoi(argv[1]);
70//
71// QTcpSocket socketObs;
72//
73// socketObs.connectToHost("127.0.0.1", port);
74// if (!socketObs.waitForConnected(10000)) {
75// cerr << "socketObs: not connected on port " << port << endl;
76// exit(1);
77// }
78//
79// cout.setf(ios::fixed);
80//
81// // Receive Data
82// // ------------
83// const char begObs[] = "BEGOBS";
84// const char begEpoch[] = "BEGEPOCH";
85// const char endEpoch[] = "ENDEPOCH";
86// const unsigned begObsNBytes = sizeof(begObs) - 1;
87// const unsigned begEpochNBytes = sizeof(begEpoch) - 1;
88// const unsigned endEpochNBytes = sizeof(endEpoch) - 1;
89//
90// QByteArray buffer;
91//
92// while (true) {
93// if (socketObs.state() != QAbstractSocket::ConnectedState) {
94// cerr << "socketObs: disconnected" << endl;
95// exit(1);
96// }
97//
98// if ( socketObs.bytesAvailable() ) {
99// buffer += socketObs.readAll();
100//
101// // Skip begEpoch and endEpoch Marks
102// // --------------------------------
103// for (;;) {
104// int i1 = buffer.indexOf(begEpoch);
105// if (i1 == -1) {
106// break;
107// }
108// else {
109// buffer.remove(i1, begEpochNBytes);
110// cout << endl;
111// }
112// }
113// for (;;) {
114// int i2 = buffer.indexOf(endEpoch);
115// if (i2 == -1) {
116// break;
117// }
118// else {
119// buffer.remove(i2, endEpochNBytes);
120// }
121// }
122// for (;;) {
123// int i3 = buffer.indexOf(begObs);
124// if (i3 == -1) {
125// break;
126// }
127// else {
128// buffer.remove(i3, begObsNBytes);
129// }
130// }
131//
132// // Interpret a portion of buffer as observation
133// // --------------------------------------------
134// t_obsInternal* obs;
135// const int obsSize = sizeof(t_obsInternal);
136//
137//
138// while (buffer.size() >= obsSize) {
139//
140// obs = (t_obsInternal*) (buffer.left(obsSize).data());
141//
142// cout << obs->StatID << " "
143// << obs->satSys << obs->satNum << " "
144// << obs->GPSWeek << " "
145// << setprecision(2) << obs->GPSWeeks << " "
146// << setprecision(4) << obs->C1 << " "
147// << setprecision(4) << obs->C2 << " "
148// << setprecision(4) << obs->P1 << " "
149// << setprecision(4) << obs->P2 << " "
150// << setprecision(4) << obs->L1 << " "
151// << setprecision(4) << obs->L2 << " "
152// << obs->slip_cnt_L1 << " "
153// << obs->slip_cnt_L2 << " "
154// << setprecision(4) << obs->S1 << " "
155// << setprecision(4) << obs->S2 << " "
156// << obs->SNR1 << " "
157// << obs->SNR2 << endl;
158//
159// buffer.remove(0,obsSize);
160// }
161// }
162// else {
163// socketObs.waitForReadyRead(1);
164// }
165// }
166
167 return 0;
168}
Note: See TracBrowser for help on using the repository browser.