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

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

* empty log message *

File size: 2.9 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 QListIterator<p_obs> it(_obsList);
61 while (it.hasNext()) {
62 delete it.next();
63 }
64 _obsList.clear();
65}
66
67//
68
69void RTCM2Decoder::Decode(char* buffer, int bufLen) {
70
71 _buffer.append(buffer, bufLen);
72 int refWeek;
73 double refSecs;
74 currentGPSWeeks(refWeek, refSecs);
75
76 while(true) {
77 _PP.getPacket(_buffer);
78 if (!_PP.valid()) {
79 return;
80 }
81
82 if ( _PP.ID()==18 || _PP.ID()==19 ) {
83
84 _ObsBlock.extract(_PP);
85
86 if (_ObsBlock.valid()) {
87
88 int epochWeek;
89 double epochSecs;
90 _ObsBlock.resolveEpoch(refWeek, refSecs, epochWeek, epochSecs);
91
92 for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) {
93 Observation* obs = new Observation();
94 if (_ObsBlock.PRN[iSat] > 100) {
95 obs->satNum = _ObsBlock.PRN[iSat] % 100;
96 obs->satSys = 'R';
97 }
98 else {
99 obs->satNum = _ObsBlock.PRN[iSat];
100 obs->satSys = 'G';
101 }
102 obs->GPSWeek = epochWeek;
103 obs->GPSWeeks = epochSecs;
104 obs->C1 = _ObsBlock.rng_C1[iSat];
105 obs->P1 = _ObsBlock.rng_P1[iSat];
106 obs->P2 = _ObsBlock.rng_P2[iSat];
107 obs->L1 = _ObsBlock.resolvedPhase_L1(iSat);
108 obs->L2 = _ObsBlock.resolvedPhase_L2(iSat);
109
110 _obsList.push_back(obs);
111 }
112 _ObsBlock.clear();
113 }
114 }
115 }
116}
117
Note: See TracBrowser for help on using the repository browser.