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

Last change on this file since 246 was 246, checked in by mervart, 18 years ago

* empty log message *

File size: 1.5 KB
Line 
1//------------------------------------------------------------------------------
2//
3// RTCM2Decoder.cpp
4//
5//------------------------------------------------------------------------------
6
7#include <QMutexLocker>
8
9#include "../bncutils.h"
10#include "GPSDecoder.h"
11#include "RTCM2Decoder.h"
12
13using namespace std;
14
15//
16// Constructor
17//
18
19RTCM2Decoder::RTCM2Decoder() {
20
21}
22
23//
24// Destructor
25//
26
27RTCM2Decoder::~RTCM2Decoder() {
28
29}
30
31//
32//
33//
34
35void RTCM2Decoder::Decode(char* buffer, int bufLen) {
36
37 QMutexLocker locker(&_mutex);
38
39 _buffer.append(buffer, bufLen);
40 int refWeek;
41 double refSecs;
42 currentGPSWeeks(refWeek, refSecs);
43
44 while(true) {
45 _PP.getPacket(_buffer);
46 if (!_PP.valid()) {
47 return;
48 }
49
50 if ( _PP.ID()==18 || _PP.ID()==19 ) {
51
52 _ObsBlock.extract(_PP);
53
54 if (_ObsBlock.valid()) {
55
56 int epochWeek;
57 double epochSecs;
58 _ObsBlock.resolveEpoch(refWeek, refSecs, epochWeek, epochSecs);
59
60 for (int iSat=0; iSat < _ObsBlock.nSat; iSat++) {
61 Observation* obs = new Observation();
62
63 obs->SVPRN = _ObsBlock.PRN[iSat];
64 obs->GPSWeek = epochWeek;
65 obs->GPSWeeks = epochSecs;
66 obs->C1 = _ObsBlock.rng_C1[iSat];
67 obs->P1 = _ObsBlock.rng_P1[iSat];
68 obs->P2 = _ObsBlock.rng_P2[iSat];
69 obs->L1 = _ObsBlock.resolvedPhase_L1(iSat);
70 obs->L2 = _ObsBlock.resolvedPhase_L2(iSat);
71
72 _obsList.push_back(obs);
73 }
74 _ObsBlock.clear();
75 }
76 }
77 }
78}
79
Note: See TracBrowser for help on using the repository browser.