source: ntrip/trunk/BNC/RTCM3/rtcm3.cpp@ 107

Last change on this file since 107 was 94, checked in by mervart, 19 years ago

* empty log message *

File size: 3.3 KB
RevLine 
[65]1
2/* -------------------------------------------------------------------------
[93]3 * BKG NTRIP Client
[65]4 * -------------------------------------------------------------------------
5 *
6 * Class: rtcm3
7 *
8 * Purpose: RTCM3 Decoder
9 *
10 * Author: L. Mervart
11 *
12 * Created: 24-Aug-2006
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
[94]18#include <math.h>
19
[65]20#include "rtcm3.h"
21
22using namespace std;
23
[94]24#ifndef isinf
25# define isinf(x) 0
26#endif
27
[65]28// Constructor
29////////////////////////////////////////////////////////////////////////////
30rtcm3::rtcm3() : GPSDecoder() {
31 memset(&_Parser, 0, sizeof(_Parser));
32 time_t tim;
33 tim = time(0) - ((10*365+2+5)*24*60*60 + LEAPSECONDS);
34 _Parser.GPSWeek = tim/(7*24*60*60);
[71]35 _Parser.GPSTOW = tim%(7*24*60*60);
[65]36}
37
38// Destructor
39////////////////////////////////////////////////////////////////////////////
40rtcm3::~rtcm3() {
41}
42
43//
44////////////////////////////////////////////////////////////////////////////
45void rtcm3::Decode(char* buffer, int bufLen) {
46 for (int ii = 0; ii < bufLen; ii++) {
[71]47
[72]48#if 0
49 HandleByte(&_Parser, buffer[ii]);
50 continue;
51#endif
[71]52
53 _Parser.Message[_Parser.MessageSize++] = buffer[ii];
[72]54 if (_Parser.MessageSize >= _Parser.NeedBytes) {
55
56 while(int rr = RTCM3Parser(&_Parser)) {
57
58 if (!_Parser.init) {
[71]59 HandleHeader(&_Parser);
60 _Parser.init = 1;
61 }
[72]62
63 if (rr == 2) {
64 cerr << "No valid RINEX! All values are modulo 299792.458!\n";
65 exit(1);
[71]66 }
[72]67
68 for (int ii = 0; ii < _Parser.Data.numsats; ii++) {
69 Observation* obs = new Observation();
70
71//// obs->statID =
72 obs->SVPRN = _Parser.Data.satellites[ii];
73 obs->GPSWeek = _Parser.Data.week;
74 obs->GPSWeeks = (int) (_Parser.Data.timeofweek / 1000.0);
75 obs->sec = fmod(_Parser.Data.timeofweek / 1000.0, 3600.0);
76
77 for (int jj = 0; jj < _Parser.numdatatypes; jj++) {
78
79 if ( !(_Parser.Data.dataflags[ii] & _Parser.dataflag[jj])
80 || isnan(_Parser.Data.measdata[ii][_Parser.datapos[jj]])
81 || isinf(_Parser.Data.measdata[ii][_Parser.datapos[jj]]) ) {
82 continue;
[71]83 }
[72]84
85 if (_Parser.dataflag[jj] & GNSSDF_C1DATA) {
86 obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
87 obs->pCodeIndicator = 0;
[71]88 }
[72]89 else if (_Parser.dataflag[jj] & GNSSDF_P1DATA) {
90 obs->C1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
91 obs->pCodeIndicator = 1;
92 }
93 else if (_Parser.dataflag[jj] & GNSSDF_P2DATA) {
94 obs->P2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
95 }
96 else if (_Parser.dataflag[jj] & (GNSSDF_L1CDATA|GNSSDF_L1PDATA)) {
97 obs->L1 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
98 obs->SNR1 = _Parser.Data.snrL1[ii];
99 }
100 else if (_Parser.dataflag[jj] & (GNSSDF_L2CDATA|GNSSDF_L2PDATA)) {
101 obs->L2 = _Parser.Data.measdata[ii][_Parser.datapos[jj]];
102 obs->SNR2 = _Parser.Data.snrL2[ii];
103 }
[71]104 }
[72]105
106//// obs->cumuLossOfCont =
107
108 m_lObsList.push_back(obs);
[71]109 }
110 }
111 }
[65]112 }
113}
Note: See TracBrowser for help on using the repository browser.