source: ntrip/trunk/BNC/RTCM/RTCM2Decoder.cpp@ 622

Last change on this file since 622 was 622, checked in by mervart, 16 years ago

* empty log message *

File size: 2.8 KB
Line 
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
45using namespace std;
46
47//
48// Constructor
49//
50
51RTCM2Decoder::RTCM2Decoder() {
52
53}
54
55//
56// Destructor
57//
58
59RTCM2Decoder::~RTCM2Decoder() {
60}
61
62//
63
64void 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;
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 if (_ObsBlock.PRN[iSat] > 100) {
90 obs->_o.satNum = _ObsBlock.PRN[iSat] % 100;
91 obs->_o.satSys = 'R';
92 }
93 else {
94 obs->_o.satNum = _ObsBlock.PRN[iSat];
95 obs->_o.satSys = 'G';
96 }
97 obs->_o.GPSWeek = epochWeek;
98 obs->_o.GPSWeeks = epochSecs;
99 obs->_o.C1 = _ObsBlock.rng_C1[iSat];
100 obs->_o.P1 = _ObsBlock.rng_P1[iSat];
101 obs->_o.P2 = _ObsBlock.rng_P2[iSat];
102 obs->_o.L1 = _ObsBlock.resolvedPhase_L1(iSat);
103 obs->_o.L2 = _ObsBlock.resolvedPhase_L2(iSat);
104
105 _obsList.push_back(obs);
106 }
107 _ObsBlock.clear();
108 }
109 }
110 }
111}
112
Note: See TracBrowser for help on using the repository browser.