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 GPSDECODER_H
|
---|
26 | #define GPSDECODER_H
|
---|
27 |
|
---|
28 | #include <iostream>
|
---|
29 | #include <vector>
|
---|
30 | #include <string>
|
---|
31 |
|
---|
32 | #include <QtCore>
|
---|
33 |
|
---|
34 | #include "bncconst.h"
|
---|
35 | #include "bnctime.h"
|
---|
36 |
|
---|
37 | extern "C" {
|
---|
38 | #include "rtcm3torinex.h"
|
---|
39 | }
|
---|
40 |
|
---|
41 | class bncRinex;
|
---|
42 |
|
---|
43 | class t_obs {
|
---|
44 | public:
|
---|
45 | t_obs() {
|
---|
46 | StatID[0] = '\x0';
|
---|
47 | satSys = 'G';
|
---|
48 | satNum = 0;
|
---|
49 | slotNum = 0;
|
---|
50 | GPSWeek = 0;
|
---|
51 | GPSWeeks = 0.0;
|
---|
52 | _dataflags = 0;
|
---|
53 | _dataflags2 = 0;
|
---|
54 | for (int ie = 0; ie < GNSSENTRY_NUMBER; ie++) {
|
---|
55 | _measdata[ie] = 0.0;
|
---|
56 | }
|
---|
57 | slip_cnt_L1 = -1;
|
---|
58 | slip_cnt_L2 = -1;
|
---|
59 | slip_cnt_L5 = -1;
|
---|
60 | snrL1 = 0;
|
---|
61 | snrL2 = 0;
|
---|
62 | snrL5 = 0;
|
---|
63 | slipL1 = false;
|
---|
64 | slipL2 = false;
|
---|
65 | slipL5 = false;
|
---|
66 | }
|
---|
67 |
|
---|
68 | ~t_obs() {}
|
---|
69 |
|
---|
70 | double measdata(QString rnxStr, float rnxVer) const;
|
---|
71 | void setMeasdata(QString rnxStr, float rnxVer, double value);
|
---|
72 |
|
---|
73 | char StatID[20+1]; // Station ID
|
---|
74 | char satSys; // Satellite System ('G' or 'R')
|
---|
75 | int satNum; // Satellite Number (PRN for GPS NAVSTAR)
|
---|
76 | int slotNum; // Slot Number (for Glonass)
|
---|
77 | int GPSWeek; // Week of GPS-Time
|
---|
78 | double GPSWeeks; // Second of Week (GPS-Time)
|
---|
79 |
|
---|
80 | int slip_cnt_L1; // L1 cumulative loss of continuity indicator (negative value = undefined)
|
---|
81 | int slip_cnt_L2; // L2 cumulative loss of continuity indicator (negative value = undefined)
|
---|
82 | int slip_cnt_L5; // L5 cumulative loss of continuity indicator (negative value = undefined)
|
---|
83 |
|
---|
84 | int snrL1; // signal-to-noise ratio mapped to <1,9>
|
---|
85 | int snrL2; // s = int(floor(SNR/6)); if (s > 9) s = 9; if (s < 1) s = 1;
|
---|
86 | int snrL5;
|
---|
87 |
|
---|
88 | bool slipL1;
|
---|
89 | bool slipL2;
|
---|
90 | bool slipL5;
|
---|
91 |
|
---|
92 | double _measdata[GNSSENTRY_NUMBER]; // data fields */
|
---|
93 | unsigned long long _dataflags; // GNSSDF_xxx */
|
---|
94 | unsigned int _dataflags2; // GNSSDF2_xxx */
|
---|
95 | QString _codetype[GNSSENTRY_NUMBER];
|
---|
96 |
|
---|
97 | QString rnxStr(int iEntry) const;
|
---|
98 |
|
---|
99 | private:
|
---|
100 | int iEntry(QString rnxStr, float rnxVers, bool cmode=false) const;
|
---|
101 | };
|
---|
102 |
|
---|
103 | class GPSDecoder {
|
---|
104 | public:
|
---|
105 | GPSDecoder();
|
---|
106 | virtual ~GPSDecoder();
|
---|
107 |
|
---|
108 | virtual t_irc Decode(char* buffer, int bufLen,
|
---|
109 | std::vector<std::string>& errmsg) = 0;
|
---|
110 |
|
---|
111 |
|
---|
112 | virtual int corrGPSEpochTime() const {return -1;}
|
---|
113 |
|
---|
114 | void initRinex(const QByteArray& staID, const QUrl& mountPoint,
|
---|
115 | const QByteArray& latitude, const QByteArray& longitude,
|
---|
116 | const QByteArray& nmea, const QByteArray& ntripVersion);
|
---|
117 |
|
---|
118 | void dumpRinexEpoch(const t_obs& obs, const QByteArray& format);
|
---|
119 |
|
---|
120 | void setRinexReconnectFlag(bool flag);
|
---|
121 |
|
---|
122 | struct t_antInfo {
|
---|
123 | enum t_type { ARP, APC };
|
---|
124 |
|
---|
125 | t_antInfo() {
|
---|
126 | xx = yy = zz = height = 0.0;
|
---|
127 | type = ARP;
|
---|
128 | height_f = false;
|
---|
129 | message = 0;
|
---|
130 | };
|
---|
131 |
|
---|
132 | double xx;
|
---|
133 | double yy;
|
---|
134 | double zz;
|
---|
135 | t_type type;
|
---|
136 | double height;
|
---|
137 | bool height_f;
|
---|
138 | int message;
|
---|
139 | };
|
---|
140 |
|
---|
141 | QList<t_obs> _obsList;
|
---|
142 | QList<int> _typeList; // RTCM message types
|
---|
143 | QStringList _antType; // RTCM antenna descriptor
|
---|
144 | QList<t_antInfo> _antList; // RTCM antenna XYZ
|
---|
145 | bncRinex* _rnx; // RINEX writer
|
---|
146 | };
|
---|
147 |
|
---|
148 | #endif
|
---|