source: ntrip/trunk/BNC/RTCM/RTCM2Decoder.h@ 1843

Last change on this file since 1843 was 1304, checked in by zdenek, 16 years ago

* empty log message *

File size: 4.0 KB
RevLine 
[297]1// Part of BNC, a utility for retrieving decoding and
[464]2// converting GNSS data streams from NTRIP broadcasters.
[242]3//
[464]4// Copyright (C) 2007
[297]5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
[464]7// Czech Technical University Prague, Department of Geodesy
[297]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.
[242]24
25#ifndef INC_RTCM2DECODER_H
26#define INC_RTCM2DECODER_H
27
[1044]28#include <map>
[1218]29#include <vector>
30#include <list>
[1044]31
[242]32#include "GPSDecoder.h"
33#include "RTCM2.h"
[1044]34#include "RTCM2_2021.h"
35#include "../RTCM3/rtcm3torinex.h"
36#include "../RTCM3/ephemeris.h"
[242]37
38class RTCM2Decoder: public GPSDecoder {
39
40 public:
[1044]41 RTCM2Decoder(const std::string& ID);
[645]42 virtual ~RTCM2Decoder();
[1218]43 virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg);
[242]44
[1218]45 bool storeEph(const gpsephemeris& gpseph, std::string& storedPRN, std::vector<int>& IODs);
46 bool storeEph(const t_ephGPS& gpseph, std::string& storedPRN, std::vector<int>& IODs);
[1044]47
48 t_irc getStaCrd(double& xx, double& yy, double& zz);
49
[1218]50 t_irc getStaCrd(double& xx, double& yy, double& zz,
[1167]51 double& dx1, double& dy1, double& dz1,
52 double& dx2, double& dy2, double& dz2);
53
[1044]54 const rtcm2::RTCM2_2021& msg2021() const { return _msg2021; }
55
56 std::string ID() const { return _ID; }
57
[242]58 private:
59
[1218]60 class t_ephList {
[1044]61 public:
[1218]62 t_ephList() {}
63
64 ~t_ephList() {
65 for (std::list<t_eph*>::iterator ii = _eph.begin(); ii != _eph.end(); ii++) {
66 delete (*ii);
67 }
[1044]68 }
[1218]69
70 bool store(t_eph* eph) {
71 if ( _eph.size() == 0 ) {
72 _eph.push_back(eph);
73 return true;
74 }
75
76 std::list<t_eph*>::iterator ii = _eph.begin();
77 while (ii != _eph.end()) {
78 if ( eph->IOD() == (*ii)->IOD() ) {
79 return false;
80 }
81 if ( ! eph->isNewerThan(*ii) ) {
82 break;
83 }
84 ++ii;
85 }
86
87 if ( ii == _eph.begin() && _eph.size() == MAXSIZE) {
88 return false;
89 }
90
91 _eph.insert(ii, eph);
92
93 while ( _eph.size() > MAXSIZE ) {
94 delete _eph.front();
95 _eph.pop_front();
96 }
97
98 return true;
99 }
[1044]100
[1218]101 const t_eph* getEph(int IOD) const {
102 for (std::list<t_eph*>::const_iterator ii = _eph.begin(); ii != _eph.end(); ii++) {
103 if ( (*ii)->IOD() == IOD ) {
104 return (*ii);
105 }
106 }
107 return 0;
[1044]108 }
[1218]109
110 void getIODs(std::vector<int>& IODs) const {
111 IODs.clear();
112 for (std::list<t_eph*>::const_iterator ii = _eph.begin(); ii != _eph.end(); ii++) {
113 IODs.push_back((*ii)->IOD());
114 }
115 }
116
[1304]117 static const unsigned MAXSIZE = 5;
[1218]118
119 std::list<t_eph*> _eph;
[1044]120 };
[242]121
[1218]122 void translateCorr2Obs(std::vector<std::string>& errmsg);
[1044]123
124 std::string _ID;
125
126 std::string _buffer;
127 rtcm2::RTCM2packet _PP;
128
129 // for messages 18, 19 decoding
130 rtcm2::RTCM2_Obs _ObsBlock;
131
132 // for messages 20, 21 decoding
133 rtcm2::RTCM2_03 _msg03;
134 rtcm2::RTCM2_22 _msg22;
[1269]135 rtcm2::RTCM2_23 _msg23;
136 rtcm2::RTCM2_24 _msg24;
[1044]137 rtcm2::RTCM2_2021 _msg2021;
[1218]138 std::map<std::string, t_ephList*> _ephList;
[1044]139
[1218]140 typedef std::map<std::string, t_ephList*> t_listMap;
[242]141};
142
143#endif // include blocker
Note: See TracBrowser for help on using the repository browser.