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

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