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

Last change on this file since 297 was 297, checked in by mervart, 17 years ago

* empty log message *

File size: 2.3 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters,
3// written by Leos Mervart.
4//
5// Copyright (C) 2006
6// German Federal Agency for Cartography and Geodesy (BKG)
7// http://www.bkg.bund.de
8// Czech Technical University Prague, Department of Advanced Geodesy
9// http://www.fsv.cvut.cz
10//
11// Email: euref-ip@bkg.bund.de
12//
13// This program is free software; you can redistribute it and/or
14// modify it under the terms of the GNU General Public License
15// as published by the Free Software Foundation, version 2.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26#include "../bncutils.h"
27#include "GPSDecoder.h"
28#include "RTCM2Decoder.h"
29
30using namespace std;
31
32//
33// Constructor
34//
35
36RTCM2Decoder::RTCM2Decoder() {
37
38}
39
40//
41// Destructor
42//
43
44RTCM2Decoder::~RTCM2Decoder() {
45
46}
47
48//
49//
50//
51
52void RTCM2Decoder::Decode(char* buffer, int bufLen) {
53
54 _buffer.append(buffer, bufLen);
55 int refWeek;
56 double refSecs;
57 currentGPSWeeks(refWeek, refSecs);
58
59 while(true) {
60 _PP.getPacket(_buffer);
61 if (!_PP.valid()) {
62 return;
63 }
64
65 if ( _PP.ID()==18 || _PP.ID()==19 ) {
66
67 _ObsBlock.extract(_PP);
68
69 if (_ObsBlock.valid()) {
70
71 int epochWeek;
72 double epochSecs;
73 _ObsBlock.resolveEpoch(refWeek, refSecs, epochWeek, epochSecs);
74
75 for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) {
76 Observation* obs = new Observation();
77
78 obs->SVPRN = _ObsBlock.PRN[iSat];
79 obs->GPSWeek = epochWeek;
80 obs->GPSWeeks = epochSecs;
81 obs->C1 = _ObsBlock.rng_C1[iSat];
82 obs->P1 = _ObsBlock.rng_P1[iSat];
83 obs->P2 = _ObsBlock.rng_P2[iSat];
84 obs->L1 = _ObsBlock.resolvedPhase_L1(iSat);
85 obs->L2 = _ObsBlock.resolvedPhase_L2(iSat);
86
87 _obsList.push_back(obs);
88 }
89 _ObsBlock.clear();
90 }
91 }
92 }
93}
94
Note: See TracBrowser for help on using the repository browser.