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

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

* empty log message *

File size: 1.9 KB
Line 
1
2#include <iostream>
3#include <iomanip>
4
5#include "RTCM/GPSDecoder.h"
6
7#include <QTcpSocket>
8
9using namespace std;
10
11const char begEpoch = 'A';
12const char begObs = 'B';
13const char endEpoch = 'C';
14
15int main(int /* argc */, char** /* argv */) {
16
17 QTcpSocket socket;
18
19 socket.connectToHost("127.0.0.1", 1968);
20 if (!socket.waitForConnected(10000)) {
21 cout << "not connected" << endl;
22 exit(1);
23 }
24
25 // Receive Data
26 // ------------
27 Observation obs;
28 char flag = ' ';
29 cout.setf(ios::showpoint | ios::fixed);
30
31 while (true) {
32 if ( socket.bytesAvailable() ) {
33 int bytesRecv = socket.read(&flag, 1);
34 if (flag == begObs) {
35 if ( socket.bytesAvailable() >= sizeof(obs) ) {
36 bytesRecv = socket.read((char*) &obs, sizeof(obs));
37 cout << setw(5) << obs.StatID << " "
38 << obs.satSys << setw(2) << obs.satNum << " "
39 << setw(4) << obs.GPSWeek << " "
40 << setw(10) << setprecision(2) << obs.GPSWeeks << " "
41 << setw(14) << setprecision(4) << obs.C1 << " "
42 << setw(14) << setprecision(4) << obs.C2 << " "
43 << setw(14) << setprecision(4) << obs.P1 << " "
44 << setw(14) << setprecision(4) << obs.P2 << " "
45 << setw(14) << setprecision(4) << obs.L1 << " "
46 << setw(14) << setprecision(4) << obs.L2 << " "
47 << setw(14) << setprecision(4) << obs.S1 << " "
48 << setw(14) << setprecision(4) << obs.S2 << " "
49 << setw(4) << obs.SNR1 << " "
50 << setw(4) << obs.SNR2 << endl;
51 }
52 }
53 }
54 else {
55 socket.waitForReadyRead(100);
56 }
57 }
58
59 return 0;
60}
Note: See TracBrowser for help on using the repository browser.