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: RTCM2Decoder
|
---|
30 | *
|
---|
31 | * Purpose: RTCM2 Decoder
|
---|
32 | *
|
---|
33 | * Author: L. Mervart
|
---|
34 | *
|
---|
35 | * Created: 24-Aug-2006
|
---|
36 | *
|
---|
37 | * Changes:
|
---|
38 | *
|
---|
39 | * -----------------------------------------------------------------------*/
|
---|
40 |
|
---|
41 | #include "../bncutils.h"
|
---|
42 | #include "GPSDecoder.h"
|
---|
43 | #include "RTCM2Decoder.h"
|
---|
44 |
|
---|
45 | using namespace std;
|
---|
46 |
|
---|
47 | //
|
---|
48 | // Constructor
|
---|
49 | //
|
---|
50 |
|
---|
51 | RTCM2Decoder::RTCM2Decoder() {
|
---|
52 |
|
---|
53 | }
|
---|
54 |
|
---|
55 | //
|
---|
56 | // Destructor
|
---|
57 | //
|
---|
58 |
|
---|
59 | RTCM2Decoder::~RTCM2Decoder() {
|
---|
60 | }
|
---|
61 |
|
---|
62 | //
|
---|
63 |
|
---|
64 | t_irc RTCM2Decoder::Decode(char* buffer, int bufLen) {
|
---|
65 |
|
---|
66 | _buffer.append(buffer, bufLen);
|
---|
67 | int refWeek;
|
---|
68 | double refSecs;
|
---|
69 | currentGPSWeeks(refWeek, refSecs);
|
---|
70 |
|
---|
71 | while(true) {
|
---|
72 | _PP.getPacket(_buffer);
|
---|
73 | if (!_PP.valid()) {
|
---|
74 | return failure;
|
---|
75 | }
|
---|
76 |
|
---|
77 | if ( _PP.ID()==18 || _PP.ID()==19 ) {
|
---|
78 |
|
---|
79 | _ObsBlock.extract(_PP);
|
---|
80 |
|
---|
81 | if (_ObsBlock.valid()) {
|
---|
82 |
|
---|
83 | int epochWeek;
|
---|
84 | double epochSecs;
|
---|
85 | _ObsBlock.resolveEpoch(refWeek, refSecs, epochWeek, epochSecs);
|
---|
86 |
|
---|
87 | for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) {
|
---|
88 | p_obs obs = new t_obs();
|
---|
89 | _obsList.push_back(obs);
|
---|
90 | if (_ObsBlock.PRN[iSat] > 100) {
|
---|
91 | obs->_o.satNum = _ObsBlock.PRN[iSat] % 100;
|
---|
92 | obs->_o.satSys = 'R';
|
---|
93 | }
|
---|
94 | else {
|
---|
95 | obs->_o.satNum = _ObsBlock.PRN[iSat];
|
---|
96 | obs->_o.satSys = 'G';
|
---|
97 | }
|
---|
98 | obs->_o.GPSWeek = epochWeek;
|
---|
99 | obs->_o.GPSWeeks = epochSecs;
|
---|
100 | obs->_o.C1 = _ObsBlock.rng_C1[iSat];
|
---|
101 | obs->_o.P1 = _ObsBlock.rng_P1[iSat];
|
---|
102 | obs->_o.P2 = _ObsBlock.rng_P2[iSat];
|
---|
103 | obs->_o.L1 = _ObsBlock.resolvedPhase_L1(iSat);
|
---|
104 | obs->_o.L2 = _ObsBlock.resolvedPhase_L2(iSat);
|
---|
105 | }
|
---|
106 | _ObsBlock.clear();
|
---|
107 | return success;
|
---|
108 | }
|
---|
109 | }
|
---|
110 | }
|
---|
111 | return success;
|
---|
112 | }
|
---|
113 |
|
---|