source: ntrip/branches/BNC_LM/GPSS/hassDecoder.cpp@ 3571

Last change on this file since 3571 was 3571, checked in by mervart, 12 years ago
File size: 3.6 KB
RevLine 
[3504]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
[3571]18#include <iostream>
[3504]19#include "hassDecoder.h"
[3507]20#include "bnctime.h"
[3571]21#include "bncutils.h"
[3504]22
23using namespace std;
24
25// Constructor
26////////////////////////////////////////////////////////////////////////////
[3505]27hassDecoder::hassDecoder(const QString& staID) : RTCM3coDecoder(staID) {
[3506]28 _GPSweeks = -1.0;
[3504]29}
30
31// Destructor
32////////////////////////////////////////////////////////////////////////////
33hassDecoder::~hassDecoder() {
34}
35
36//
37////////////////////////////////////////////////////////////////////////////
38t_irc hassDecoder::Decode(char* data, int dataLen, vector<string>& errmsg) {
39
40 errmsg.clear();
41
42 _buffer += QByteArray(data, dataLen);
43
[3506]44 bool corrFound = false;
45 int indexEOL = -1;
46 while ( (indexEOL = _buffer.indexOf('\n')) != -1) {
47 QByteArray line = _buffer.left(indexEOL-1);
[3571]48 _buffer = _buffer.mid(indexEOL+1);
[3504]49
[3571]50 if (QString(line).split(QRegExp("\\s+"), QString::SkipEmptyParts).count() != 11) {
[3506]51 continue;
52 }
53 else {
54 corrFound = true;
55 }
56
57 QTextStream in(line, QIODevice::ReadOnly | QIODevice::Text);
58 int mjd, IOD;
59 double daySec;
[3571]60 ColumnVector dx(3);
61 ColumnVector dxRate(3);
62 double clkFull;
63
[3506]64 QString prn;
65
[3571]66 in >> mjd >> daySec >> prn >> IOD >> dx[0] >> dx[1] >> dx[2] >> clkFull
67 >> dxRate[0] >> dxRate[1] >> dxRate[2];
[3506]68
[3571]69 // Correction Time
70 // ---------------
[3507]71 bncTime tt;
72 tt.setmjd(daySec, mjd);
73
74 _GPSweeks = tt.gpssec();
75 long coTime = tt.gpsw() * 7*24*3600 + long(floor(_GPSweeks+0.5));
76
[3571]77 // Transform Correction
78 // --------------------
79 dx = -dx;
80 dxRate = -dxRate;
81
82 //// beg test
83 continue;
84 //// end test
85 //// t_eph* eph = 0;
86 //// if (_eph.contains(prn)) {
87 //// if (_eph.value(prn)->last && _eph.value(prn)->last->IOD() == IOD) {
88 //// eph = _eph.value(prn)->last;
89 //// }
90 //// else if (_eph.value(prn)->prev && _eph.value(prn)->prev->IOD() == IOD) {
91 //// eph = _eph.value(prn)->prev;
92 //// }
93 //// }
94 //// if (!eph) {
95 //// continue;
96 //// }
97
98 ColumnVector xc(4);
99 ColumnVector vv(3);
100 //// eph->position(tt.gpsw(), tt.gpssec(), xc.data(), vv.data());
101
102 ColumnVector rao(3);
103 XYZ_to_RSW(xc.Rows(1,3), vv, dx, rao);
104
105 ColumnVector dotRao(3);
106 XYZ_to_RSW(xc.Rows(1,3), vv, dxRate, dotRao);
107
108 double dClk = clkFull - xc[3] * t_CST::c;
109
110 // Print Correction Line
111 // ---------------------
[3507]112 QString corrLine;
113
[3571]114 int updateInterval = 0;
115 int messageType = 0;
[3508]116 if (prn[0] == 'G') {
[3571]117 messageType = COTYPE_GPSCOMBINED;
[3508]118 }
119 else if (prn[0] == 'R') {
[3571]120 messageType = COTYPE_GLONASSCOMBINED;
[3508]121 }
[3507]122
123 corrLine.sprintf("%d %d %d %.1f %s"
124 " %3d"
125 " %8.3f %8.3f %8.3f %8.3f"
126 " %10.5f %10.5f %10.5f %10.5f"
127 " %10.5f",
128 messageType, updateInterval, tt.gpsw(), _GPSweeks,
129 prn.toAscii().data(), IOD,
[3571]130 dClk, rao[0], rao[1], rao[2],
131 0.0, dotRao[0], dotRao[1], dotRao[2], 0.0);
132
133 reopen(_fileNameSkl, _fileName, _out);
[3507]134 printLine(corrLine, coTime);
[3506]135 }
136
137 if (corrFound) {
138 return success;
139 }
140 else {
141 return failure;
142 }
[3504]143}
Note: See TracBrowser for help on using the repository browser.