source: ntrip/trunk/BNC/GPSS/hassDecoder.cpp@ 3507

Last change on this file since 3507 was 3507, checked in by mervart, 11 years ago
File size: 2.4 KB
Line 
1
2/* -------------------------------------------------------------------------
3 * BKG NTRIP Client
4 * -------------------------------------------------------------------------
5 *
6 * Class: hassDecoder
7 *
8 * Purpose: Decode Data (PPP Corrections) in HASS Format
9 *
10 * Author: L. Mervart
11 *
12 * Created: 19-Nov-2011
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
18#include "hassDecoder.h"
19#include "bnctime.h"
20
21using namespace std;
22
23// Constructor
24////////////////////////////////////////////////////////////////////////////
25hassDecoder::hassDecoder(const QString& staID) : RTCM3coDecoder(staID) {
26 _GPSweeks = -1.0;
27}
28
29// Destructor
30////////////////////////////////////////////////////////////////////////////
31hassDecoder::~hassDecoder() {
32}
33
34//
35////////////////////////////////////////////////////////////////////////////
36t_irc hassDecoder::Decode(char* data, int dataLen, vector<string>& errmsg) {
37
38 errmsg.clear();
39
40 _buffer += QByteArray(data, dataLen);
41
42 bool corrFound = false;
43 int indexEOL = -1;
44 while ( (indexEOL = _buffer.indexOf('\n')) != -1) {
45 QByteArray line = _buffer.left(indexEOL-1);
46 _buffer = _buffer.mid(indexEOL);
47
48 if (QString(line).split(QRegExp("\\s+")).count() != 11) {
49 continue;
50 }
51 else {
52 corrFound = true;
53 }
54
55 QTextStream in(line, QIODevice::ReadOnly | QIODevice::Text);
56 int mjd, IOD;
57 double daySec;
58 double deltaX, deltaY, deltaZ, deltaClk;
59 double rateDeltaX, rateDeltaY, rateDeltaZ;
60 QString prn;
61
62 in >> mjd >> daySec >> prn >> IOD >> deltaX >> deltaY >> deltaZ
63 >> deltaClk >> rateDeltaX >> rateDeltaY >> rateDeltaZ;
64
65 bncTime tt;
66 tt.setmjd(daySec, mjd);
67
68 _GPSweeks = tt.gpssec();
69 long coTime = tt.gpsw() * 7*24*3600 + long(floor(_GPSweeks+0.5));
70
71 QString corrLine;
72
73 int messageType = -1;
74 int updateInterval = 0;
75
76 corrLine.sprintf("%d %d %d %.1f %s"
77 " %3d"
78 " %8.3f %8.3f %8.3f %8.3f"
79 " %10.5f %10.5f %10.5f %10.5f"
80 " %10.5f",
81 messageType, updateInterval, tt.gpsw(), _GPSweeks,
82 prn.toAscii().data(), IOD,
83 deltaClk, deltaX, deltaY, deltaZ,
84 0.0, rateDeltaX, rateDeltaY, rateDeltaZ, 0.0);
85
86 printLine(corrLine, coTime);
87 }
88
89 if (corrFound) {
90 return success;
91 }
92 else {
93 return failure;
94 }
95}
Note: See TracBrowser for help on using the repository browser.