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 BNCPPPCLIENT_H
|
---|
26 | #define BNCPPPCLIENT_H
|
---|
27 |
|
---|
28 | #include <queue>
|
---|
29 | #include <QtNetwork>
|
---|
30 |
|
---|
31 | #include <newmat.h>
|
---|
32 |
|
---|
33 | #include "bncconst.h"
|
---|
34 | #include "bnctime.h"
|
---|
35 | #include "RTCM/GPSDecoder.h"
|
---|
36 | #include "RTCM3/ephemeris.h"
|
---|
37 |
|
---|
38 | class bncModel;
|
---|
39 |
|
---|
40 | class t_satData {
|
---|
41 | public:
|
---|
42 | t_satData() {
|
---|
43 | indexCode = 0;
|
---|
44 | indexPhase = 0;
|
---|
45 | }
|
---|
46 | ~t_satData() {}
|
---|
47 | bncTime tt;
|
---|
48 | QString prn;
|
---|
49 | double P1;
|
---|
50 | double P2;
|
---|
51 | double P5;
|
---|
52 | double P3;
|
---|
53 | double L1;
|
---|
54 | double L2;
|
---|
55 | double L5;
|
---|
56 | double L3;
|
---|
57 | ColumnVector xx;
|
---|
58 | ColumnVector vv;
|
---|
59 | double clk;
|
---|
60 | double eleSat;
|
---|
61 | double azSat;
|
---|
62 | double rho;
|
---|
63 | bool slipFlag;
|
---|
64 | double lambda3;
|
---|
65 | unsigned indexCode;
|
---|
66 | unsigned indexPhase;
|
---|
67 | char system() const {return prn.toAscii()[0];}
|
---|
68 | };
|
---|
69 |
|
---|
70 | class t_epoData {
|
---|
71 | public:
|
---|
72 | t_epoData() {}
|
---|
73 | ~t_epoData() {
|
---|
74 | QMapIterator<QString, t_satData*> itGPS(satDataGPS);
|
---|
75 | while (itGPS.hasNext()) {
|
---|
76 | itGPS.next();
|
---|
77 | delete itGPS.value();
|
---|
78 | }
|
---|
79 | QMapIterator<QString, t_satData*> itGlo(satDataGlo);
|
---|
80 | while (itGlo.hasNext()) {
|
---|
81 | itGlo.next();
|
---|
82 | delete itGlo.value();
|
---|
83 | }
|
---|
84 | QMapIterator<QString, t_satData*> itGal(satDataGal);
|
---|
85 | while (itGal.hasNext()) {
|
---|
86 | itGal.next();
|
---|
87 | delete itGal.value();
|
---|
88 | }
|
---|
89 | }
|
---|
90 | unsigned sizeGPS() const {return satDataGPS.size();}
|
---|
91 | unsigned sizeGlo() const {return satDataGlo.size();}
|
---|
92 | unsigned sizeGal() const {return satDataGal.size();}
|
---|
93 | unsigned sizeAll() const {return satDataGPS.size() + satDataGlo.size() +
|
---|
94 | satDataGal.size();}
|
---|
95 | bncTime tt;
|
---|
96 | QMap<QString, t_satData*> satDataGPS;
|
---|
97 | QMap<QString, t_satData*> satDataGlo;
|
---|
98 | QMap<QString, t_satData*> satDataGal;
|
---|
99 | };
|
---|
100 |
|
---|
101 | class t_corr {
|
---|
102 | public:
|
---|
103 | t_corr() {
|
---|
104 | raoSet = false;
|
---|
105 | dClkSet = false;
|
---|
106 | }
|
---|
107 | bool ready() {return raoSet && dClkSet;}
|
---|
108 | bncTime tt;
|
---|
109 | int iod;
|
---|
110 | double dClk;
|
---|
111 | double dotDClk;
|
---|
112 | double dotDotDClk;
|
---|
113 | ColumnVector rao;
|
---|
114 | ColumnVector dotRao;
|
---|
115 | ColumnVector dotDotRao;
|
---|
116 | bool raoSet;
|
---|
117 | bool dClkSet;
|
---|
118 | };
|
---|
119 |
|
---|
120 | class t_bias {
|
---|
121 | public:
|
---|
122 | t_bias() {
|
---|
123 | p1 = 0.0;
|
---|
124 | p2 = 0.0;
|
---|
125 | c1 = 0.0;
|
---|
126 | }
|
---|
127 | bncTime tt;
|
---|
128 | double p1;
|
---|
129 | double p2;
|
---|
130 | double c1;
|
---|
131 | };
|
---|
132 |
|
---|
133 | class bncPPPclient : public QObject {
|
---|
134 | Q_OBJECT
|
---|
135 |
|
---|
136 | public:
|
---|
137 | bncPPPclient(QByteArray staID);
|
---|
138 | ~bncPPPclient();
|
---|
139 | void putNewObs(const t_obs& pp);
|
---|
140 |
|
---|
141 | public slots:
|
---|
142 | void slotNewEphGPS(gpsephemeris gpseph);
|
---|
143 | void slotNewEphGlonass(glonassephemeris gloeph);
|
---|
144 | void slotNewEphGalileo(galileoephemeris galeph);
|
---|
145 | void slotNewCorrections(QList<QString> corrList);
|
---|
146 |
|
---|
147 | signals:
|
---|
148 | void newMessage(QByteArray msg, bool showOnScreen);
|
---|
149 | void newPosition(bncTime time, double x, double y, double z);
|
---|
150 | void newNMEAstr(QByteArray str);
|
---|
151 |
|
---|
152 | private:
|
---|
153 | class slipInfo {
|
---|
154 | public:
|
---|
155 | slipInfo() {
|
---|
156 | slipCntL1 = -1;
|
---|
157 | slipCntL2 = -1;
|
---|
158 | slipCntL5 = -1;
|
---|
159 | }
|
---|
160 | ~slipInfo(){}
|
---|
161 | int slipCntL1;
|
---|
162 | int slipCntL2;
|
---|
163 | int slipCntL5;
|
---|
164 | };
|
---|
165 |
|
---|
166 | class t_ephPair {
|
---|
167 | public:
|
---|
168 | t_ephPair() {
|
---|
169 | last = 0;
|
---|
170 | prev = 0;
|
---|
171 | }
|
---|
172 | ~t_ephPair() {
|
---|
173 | delete last;
|
---|
174 | delete prev;
|
---|
175 | }
|
---|
176 | t_eph* last;
|
---|
177 | t_eph* prev;
|
---|
178 | };
|
---|
179 |
|
---|
180 | t_irc getSatPos(const bncTime& tt, const QString& prn,
|
---|
181 | ColumnVector& xc, ColumnVector& vv);
|
---|
182 | void processEpochs();
|
---|
183 | void processFrontEpoch();
|
---|
184 | void applyCorr(const bncTime& tt, const t_corr* cc, ColumnVector& xc,
|
---|
185 | ColumnVector& vv);
|
---|
186 | t_irc cmpToT(t_satData* satData);
|
---|
187 |
|
---|
188 | QByteArray _staID;
|
---|
189 | QMutex _mutex;
|
---|
190 | QMap<QString, t_ephPair*> _eph;
|
---|
191 | QMap<QString, t_corr*> _corr;
|
---|
192 | QMap<QString, t_bias*> _bias;
|
---|
193 | std::queue<t_epoData*> _epoData;
|
---|
194 | bncModel* _model;
|
---|
195 | bool _useGlonass;
|
---|
196 | bool _useGalileo;
|
---|
197 | bool _pppMode;
|
---|
198 | QMap<QString, slipInfo> _slips;
|
---|
199 | };
|
---|
200 |
|
---|
201 | #endif
|
---|