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