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