1 | // Part of BNC, a utility for retrieving decoding and
|
---|
2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
3 | //
|
---|
4 | // Copyright (C) 2007
|
---|
5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
6 | // http://www.bkg.bund.de
|
---|
7 | // Czech Technical University Prague, Department of Geodesy
|
---|
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.
|
---|
24 |
|
---|
25 | #ifndef RNXOBSFILE_H
|
---|
26 | #define RNXOBSFILE_H
|
---|
27 |
|
---|
28 | #include <fstream>
|
---|
29 | #include <string>
|
---|
30 | #include <vector>
|
---|
31 | #include <map>
|
---|
32 |
|
---|
33 | #include "newmat.h"
|
---|
34 | #include "bncconst.h"
|
---|
35 | #include "bnctime.h"
|
---|
36 |
|
---|
37 | #define MAXPRN_GPS 32
|
---|
38 |
|
---|
39 | class t_rnxObsFile {
|
---|
40 | public:
|
---|
41 |
|
---|
42 | class t_rnxSat {
|
---|
43 | public:
|
---|
44 | char satSys;
|
---|
45 | int satNum;
|
---|
46 | std::vector<double> obs;
|
---|
47 | std::vector<int> lli;
|
---|
48 | std::vector<int> snr;
|
---|
49 | };
|
---|
50 |
|
---|
51 | class t_rnxEpo {
|
---|
52 | public:
|
---|
53 | void clear() {
|
---|
54 | rnxSat.clear();
|
---|
55 | }
|
---|
56 | bncTime tt;
|
---|
57 | std::vector<t_rnxSat> rnxSat;
|
---|
58 | };
|
---|
59 |
|
---|
60 | t_rnxObsFile(const std::string& fileName);
|
---|
61 | ~t_rnxObsFile();
|
---|
62 |
|
---|
63 | float version() const {return _header._version;}
|
---|
64 | double interval() const {return _header._interval;}
|
---|
65 | int nTypes(char sys) const {return _header.nTypes(sys);}
|
---|
66 | const std::string& fileName() const {return _fileName;}
|
---|
67 | const std::string& obsType(char sys, int index) const {return _header.obsType(sys, index);}
|
---|
68 | const std::string& antennaName() const {return _header._antennaName;}
|
---|
69 | const std::string& markerName() const {return _header._markerName;}
|
---|
70 | const ColumnVector& xyz() const {return _header._xyz;}
|
---|
71 | const ColumnVector& antNEU() const {return _header._antNEU;}
|
---|
72 | const ColumnVector& antXYZ() const {return _header._antXYZ;}
|
---|
73 | const ColumnVector& antBSG() const {return _header._antBSG;}
|
---|
74 | const t_rnxEpo* nextEpoch();
|
---|
75 | int wlFactorL1(unsigned iPrn) {
|
---|
76 | return iPrn <= MAXPRN_GPS ? _header._wlFactorsL1[iPrn] : 1;
|
---|
77 | }
|
---|
78 | int wlFactorL2(unsigned iPrn) {
|
---|
79 | return iPrn <= MAXPRN_GPS ? _header._wlFactorsL2[iPrn] : 1;
|
---|
80 | }
|
---|
81 |
|
---|
82 | protected:
|
---|
83 | t_rnxObsFile() {};
|
---|
84 | void open(const std::string& fileName);
|
---|
85 | void close();
|
---|
86 |
|
---|
87 | private:
|
---|
88 | class t_rnxObsHeader {
|
---|
89 | public:
|
---|
90 | t_rnxObsHeader();
|
---|
91 | ~t_rnxObsHeader();
|
---|
92 |
|
---|
93 | t_irc read(std::ifstream* stream, int maxLines = 0);
|
---|
94 | int nTypes(char sys) const;
|
---|
95 | const std::string& obsType(char sys, int index) const;
|
---|
96 |
|
---|
97 | static const std::string _emptyStr;
|
---|
98 | float _version;
|
---|
99 | double _interval;
|
---|
100 | std::string _antennaName;
|
---|
101 | std::string _markerName;
|
---|
102 | ColumnVector _antNEU;
|
---|
103 | ColumnVector _antXYZ;
|
---|
104 | ColumnVector _antBSG;
|
---|
105 | ColumnVector _xyz;
|
---|
106 | std::vector<std::string> _obsTypesV2;
|
---|
107 | std::map<char, std::vector<std::string> > _obsTypesV3;
|
---|
108 | int _wlFactorsL1[MAXPRN_GPS+1];
|
---|
109 | int _wlFactorsL2[MAXPRN_GPS+1];
|
---|
110 | };
|
---|
111 |
|
---|
112 | const t_rnxEpo* nextEpochV2();
|
---|
113 | const t_rnxEpo* nextEpochV3();
|
---|
114 | void handleEpochFlag(int flag, const std::string& line);
|
---|
115 |
|
---|
116 | std::string _fileName;
|
---|
117 | t_rnxObsHeader _header;
|
---|
118 | std::ifstream* _stream;
|
---|
119 | t_rnxEpo _currEpo;
|
---|
120 | bool _flgPowerFail;
|
---|
121 | };
|
---|
122 |
|
---|
123 | #endif
|
---|