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