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 | #include <QPointer>
|
---|
32 | #include <QList>
|
---|
33 | #include <QStringList>
|
---|
34 |
|
---|
35 | #include "bncconst.h"
|
---|
36 |
|
---|
37 | class t_obsInternal {
|
---|
38 | public:
|
---|
39 |
|
---|
40 | t_obsInternal() :
|
---|
41 | flags(0),
|
---|
42 | satSys(' '),
|
---|
43 | satNum(0),
|
---|
44 | slot(0),
|
---|
45 | GPSWeek(0),
|
---|
46 | GPSWeeks(0.0),
|
---|
47 | C1(0.0),
|
---|
48 | C2(0.0),
|
---|
49 | P1(0.0),
|
---|
50 | P2(0.0),
|
---|
51 | L1(0.0),
|
---|
52 | L2(0.0),
|
---|
53 | slip_cnt_L1(-1),
|
---|
54 | slip_cnt_L2(-1),
|
---|
55 | lock_timei_L1(-1),
|
---|
56 | lock_timei_L2(-1),
|
---|
57 | S1(0.0),
|
---|
58 | S2(0.0),
|
---|
59 | SNR1(0),
|
---|
60 | SNR2(0) {
|
---|
61 | StatID[0] = '\x0';
|
---|
62 | }
|
---|
63 | int flags;
|
---|
64 | char StatID[20+1]; // Station ID
|
---|
65 | char satSys; // Satellite System ('G' or 'R')
|
---|
66 | int satNum; // Satellite Number (PRN for GPS NAVSTAR)
|
---|
67 | int slot; // Slot Number (for Glonass)
|
---|
68 | int GPSWeek; // Week of GPS-Time
|
---|
69 | double GPSWeeks; // Second of Week (GPS-Time)
|
---|
70 | double C1; // CA-code pseudorange (meters)
|
---|
71 | double C2; // CA-code pseudorange (meters)
|
---|
72 | double P1; // P1-code pseudorange (meters)
|
---|
73 | double P2; // P2-code pseudorange (meters)
|
---|
74 | double L1; // L1 carrier phase (cycles)
|
---|
75 | double L2; // L2 carrier phase (cycles)
|
---|
76 | int slip_cnt_L1; // L1 cumulative loss of continuity indicator (negative value = undefined)
|
---|
77 | int slip_cnt_L2; // L2 cumulative loss of continuity indicator (negative value = undefined)
|
---|
78 | int lock_timei_L1; // L1 last lock time indicator (negative value = undefined)
|
---|
79 | int lock_timei_L2; // L2 last lock time indicator (negative value = undefined)
|
---|
80 | double S1; // L1 signal-to noise ratio
|
---|
81 | double S2; // L2 signal-to noise ratio
|
---|
82 | int SNR1; // L1 signal-to noise ratio (mapped to integer)
|
---|
83 | int SNR2; // L2 signal-to noise ratio (mapped to integer)
|
---|
84 | };
|
---|
85 |
|
---|
86 | class t_obs : public QObject{
|
---|
87 | public:
|
---|
88 | enum t_obs_status {initial, posted, received};
|
---|
89 |
|
---|
90 | t_obs() {
|
---|
91 | _status = initial;
|
---|
92 |
|
---|
93 | _o.flags = 0;
|
---|
94 | _o.StatID[0] = '\0';
|
---|
95 | _o.satSys = 'G';
|
---|
96 | _o.satNum = 0;
|
---|
97 | _o.slot = 0;
|
---|
98 | _o.GPSWeek = 0;
|
---|
99 | _o.GPSWeeks = 0.0;
|
---|
100 | _o.C1 = 0.0;
|
---|
101 | _o.C2 = 0.0;
|
---|
102 | _o.P1 = 0.0;
|
---|
103 | _o.P2 = 0.0;
|
---|
104 | _o.L1 = 0.0;
|
---|
105 | _o.L2 = 0.0;
|
---|
106 | _o.S1 = 0.0;
|
---|
107 | _o.S2 = 0.0;
|
---|
108 | _o.slip_cnt_L1 = -1;
|
---|
109 | _o.slip_cnt_L2 = -1;
|
---|
110 | _o.lock_timei_L1 = -1;
|
---|
111 | _o.lock_timei_L2 = -1;
|
---|
112 | _o.SNR1 = 0;
|
---|
113 | _o.SNR2 = 0;
|
---|
114 | }
|
---|
115 |
|
---|
116 | ~t_obs() {}
|
---|
117 |
|
---|
118 | t_obsInternal _o;
|
---|
119 | t_obs_status _status;
|
---|
120 | };
|
---|
121 |
|
---|
122 | typedef QPointer<t_obs> p_obs;
|
---|
123 |
|
---|
124 | class GPSDecoder {
|
---|
125 | public:
|
---|
126 | virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg) = 0;
|
---|
127 |
|
---|
128 | virtual ~GPSDecoder() {
|
---|
129 | QListIterator<p_obs> it(_obsList);
|
---|
130 | while (it.hasNext()) {
|
---|
131 | p_obs obs = it.next();
|
---|
132 | if (!obs.isNull() && obs->_status == t_obs::initial) {
|
---|
133 | delete obs;
|
---|
134 | }
|
---|
135 | }
|
---|
136 | }
|
---|
137 |
|
---|
138 | struct t_antInfo {
|
---|
139 | enum t_type { ARP, APC };
|
---|
140 |
|
---|
141 | t_antInfo() {
|
---|
142 | xx = yy = zz = height = 0.0;
|
---|
143 | type = ARP;
|
---|
144 | height_f = false;
|
---|
145 | message = 0;
|
---|
146 | };
|
---|
147 |
|
---|
148 | double xx;
|
---|
149 | double yy;
|
---|
150 | double zz;
|
---|
151 | t_type type;
|
---|
152 | double height;
|
---|
153 | bool height_f;
|
---|
154 | int message;
|
---|
155 | };
|
---|
156 |
|
---|
157 | QList<p_obs> _obsList;
|
---|
158 | QList<int> _typeList; // RTCM message types
|
---|
159 | QList<int> _epochList; // Broadcast corrections
|
---|
160 | QStringList _antType; // RTCM antenna descriptor
|
---|
161 | QList<t_antInfo> _antList; // RTCM antenna XYZ
|
---|
162 | };
|
---|
163 |
|
---|
164 | #endif
|
---|