[297] | 1 | // Part of BNC, a utility for retrieving decoding and
|
---|
| 2 | // converting GNSS data streams from NTRIP broadcasters,
|
---|
| 3 | // written by Leos Mervart.
|
---|
[242] | 4 | //
|
---|
[297] | 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.
|
---|
[242] | 25 |
|
---|
| 26 | #include "../bncutils.h"
|
---|
| 27 | #include "GPSDecoder.h"
|
---|
[243] | 28 | #include "RTCM2Decoder.h"
|
---|
[242] | 29 |
|
---|
| 30 | using namespace std;
|
---|
| 31 |
|
---|
| 32 | //
|
---|
| 33 | // Constructor
|
---|
| 34 | //
|
---|
| 35 |
|
---|
| 36 | RTCM2Decoder::RTCM2Decoder() {
|
---|
| 37 |
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | //
|
---|
| 41 | // Destructor
|
---|
| 42 | //
|
---|
| 43 |
|
---|
| 44 | RTCM2Decoder::~RTCM2Decoder() {
|
---|
| 45 |
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | //
|
---|
| 49 | //
|
---|
| 50 | //
|
---|
| 51 |
|
---|
| 52 | void 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();
|
---|
[341] | 77 | if (_ObsBlock.PRN[iSat] > 100) {
|
---|
| 78 | obs->satNum = _ObsBlock.PRN[iSat] % 100;
|
---|
| 79 | obs->satSys = 'R';
|
---|
| 80 | }
|
---|
| 81 | else {
|
---|
| 82 | obs->satNum = _ObsBlock.PRN[iSat];
|
---|
| 83 | obs->satSys = 'G';
|
---|
| 84 | }
|
---|
[242] | 85 | obs->GPSWeek = epochWeek;
|
---|
| 86 | obs->GPSWeeks = epochSecs;
|
---|
| 87 | obs->C1 = _ObsBlock.rng_C1[iSat];
|
---|
| 88 | obs->P1 = _ObsBlock.rng_P1[iSat];
|
---|
| 89 | obs->P2 = _ObsBlock.rng_P2[iSat];
|
---|
| 90 | obs->L1 = _ObsBlock.resolvedPhase_L1(iSat);
|
---|
| 91 | obs->L2 = _ObsBlock.resolvedPhase_L2(iSat);
|
---|
| 92 |
|
---|
| 93 | _obsList.push_back(obs);
|
---|
| 94 | }
|
---|
| 95 | _ObsBlock.clear();
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 | }
|
---|
| 99 | }
|
---|
| 100 |
|
---|