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

Last change on this file since 3517 was 3514, checked in by mervart, 13 years ago
File size: 2.7 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 <iostream>
19#include "hassDecoder.h"
20#include "bnctime.h"
21
22using namespace std;
23
24// Constructor
25////////////////////////////////////////////////////////////////////////////
26hassDecoder::hassDecoder(const QString& staID) : RTCM3coDecoder(staID) {
27 _GPSweeks = -1.0;
28}
29
30// Destructor
31////////////////////////////////////////////////////////////////////////////
32hassDecoder::~hassDecoder() {
33}
34
35//
36////////////////////////////////////////////////////////////////////////////
37t_irc hassDecoder::Decode(char* data, int dataLen, vector<string>& errmsg) {
38
39 errmsg.clear();
40
41 _buffer += QByteArray(data, dataLen);
42
43 bool corrFound = false;
44 int indexEOL = -1;
45 while ( (indexEOL = _buffer.indexOf('\n')) != -1) {
46 QByteArray line = _buffer.left(indexEOL-1);
47 _buffer = _buffer.mid(indexEOL+1);
48
49 if (QString(line).split(QRegExp("\\s+"), QString::SkipEmptyParts).count() != 11) {
50 continue;
51 }
52 else {
53 corrFound = true;
54 }
55
56 QTextStream in(line, QIODevice::ReadOnly | QIODevice::Text);
57 int mjd, IOD;
58 double daySec;
59 double deltaX, deltaY, deltaZ, deltaClk;
60 double rateDeltaX, rateDeltaY, rateDeltaZ;
61 QString prn;
62
63 in >> mjd >> daySec >> prn >> IOD >> deltaX >> deltaY >> deltaZ
64 >> deltaClk >> rateDeltaX >> rateDeltaY >> rateDeltaZ;
65
66 bncTime tt;
67 tt.setmjd(daySec, mjd);
68
69 _GPSweeks = tt.gpssec();
70 long coTime = tt.gpsw() * 7*24*3600 + long(floor(_GPSweeks+0.5));
71
72 QString corrLine;
73
74 int updateInterval = 0;
75 int messageType = 0;
76 if (prn[0] == 'G') {
77 messageType = -COTYPE_GPSCOMBINED;
78 }
79 else if (prn[0] == 'R') {
80 messageType = -COTYPE_GLONASSCOMBINED;
81 }
82
83 corrLine.sprintf("%d %d %d %.1f %s"
84 " %3d"
85 " %8.3f %8.3f %8.3f %8.3f"
86 " %10.5f %10.5f %10.5f %10.5f"
87 " %10.5f",
88 messageType, updateInterval, tt.gpsw(), _GPSweeks,
89 prn.toAscii().data(), IOD,
90 deltaClk, deltaX, deltaY, deltaZ,
91 0.0, rateDeltaX, rateDeltaY, rateDeltaZ, 0.0);
92
93 reopen(_fileNameSkl, _fileName, _out);
94 printLine(corrLine, coTime);
95 }
96
97 if (corrFound) {
98 return success;
99 }
100 else {
101 return failure;
102 }
103}
Note: See TracBrowser for help on using the repository browser.