| 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 <iomanip>
|
|---|
| 30 | #include <vector>
|
|---|
| 31 | #include <string>
|
|---|
| 32 |
|
|---|
| 33 | #include <QtCore>
|
|---|
| 34 |
|
|---|
| 35 | #include "bncconst.h"
|
|---|
| 36 | #include "bnctime.h"
|
|---|
| 37 | #include "satObs.h"
|
|---|
| 38 | #include "crs.h"
|
|---|
| 39 |
|
|---|
| 40 | class bncRinex;
|
|---|
| 41 | using namespace std;
|
|---|
| 42 |
|
|---|
| 43 | class GPSDecoder {
|
|---|
| 44 | public:
|
|---|
| 45 | GPSDecoder();
|
|---|
| 46 | virtual ~GPSDecoder();
|
|---|
| 47 |
|
|---|
| 48 | virtual t_irc Decode(char* buffer, int bufLen,
|
|---|
| 49 | std::vector<std::string>& errmsg) = 0;
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 | virtual int corrGPSEpochTime() const {return -1;}
|
|---|
| 53 |
|
|---|
| 54 | void initRinex(const QByteArray& staID, const QUrl& mountPoint,
|
|---|
| 55 | const QByteArray& latitude, const QByteArray& longitude,
|
|---|
| 56 | const QByteArray& nmea, const QByteArray& ntripVersion);
|
|---|
| 57 |
|
|---|
| 58 | void dumpRinexEpoch(const t_satObs& obs, const QByteArray& format);
|
|---|
| 59 |
|
|---|
| 60 | void setRinexReconnectFlag(bool flag);
|
|---|
| 61 |
|
|---|
| 62 | struct t_typeInfo {
|
|---|
| 63 | t_typeInfo() {
|
|---|
| 64 | _type = 0;
|
|---|
| 65 | _size = 0;
|
|---|
| 66 | };
|
|---|
| 67 | int _type;
|
|---|
| 68 | size_t _size;
|
|---|
| 69 | };
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 | struct t_antRefPoint {
|
|---|
| 73 | enum t_type { ARP, APC };
|
|---|
| 74 |
|
|---|
| 75 | t_antRefPoint() {
|
|---|
| 76 | _xx = _yy = _zz = _height = 0.0;
|
|---|
| 77 | _type = ARP;
|
|---|
| 78 | _height_f = false;
|
|---|
| 79 | _message = 0;
|
|---|
| 80 | };
|
|---|
| 81 |
|
|---|
| 82 | double _xx;
|
|---|
| 83 | double _yy;
|
|---|
| 84 | double _zz;
|
|---|
| 85 | t_type _type;
|
|---|
| 86 | double _height;
|
|---|
| 87 | bool _height_f;
|
|---|
| 88 | int _message;
|
|---|
| 89 | };
|
|---|
| 90 |
|
|---|
| 91 | struct t_antInfo {
|
|---|
| 92 | t_antInfo() {
|
|---|
| 93 | };
|
|---|
| 94 | char _descriptor[256];
|
|---|
| 95 | char _serialnumber[256];
|
|---|
| 96 | };
|
|---|
| 97 |
|
|---|
| 98 | struct t_recInfo {
|
|---|
| 99 | t_recInfo() {
|
|---|
| 100 | };
|
|---|
| 101 | char _descriptor[256];
|
|---|
| 102 | char _serialnumber[256];
|
|---|
| 103 | char _firmware[256];
|
|---|
| 104 | };
|
|---|
| 105 |
|
|---|
| 106 | class t_GloBiasInfo {
|
|---|
| 107 | public:
|
|---|
| 108 | t_GloBiasInfo() {
|
|---|
| 109 | init();
|
|---|
| 110 | };
|
|---|
| 111 | bool operator!=(const t_GloBiasInfo& gloBiasInfo2) {
|
|---|
| 112 |
|
|---|
| 113 | if (_staID != gloBiasInfo2._staID ||
|
|---|
| 114 | _indicator != gloBiasInfo2._indicator ||
|
|---|
| 115 | (fabs(_L1C_value - gloBiasInfo2._L1C_value) > 0.000000000001 ) ||
|
|---|
| 116 | (fabs(_L1P_value - gloBiasInfo2._L1P_value) > 0.000000000001 ) ||
|
|---|
| 117 | (fabs(_L2C_value - gloBiasInfo2._L2C_value) > 0.000000000001 ) ||
|
|---|
| 118 | (fabs(_L2P_value - gloBiasInfo2._L2P_value) > 0.000000000001 ) ) {
|
|---|
| 119 | setChanged(true);
|
|---|
| 120 | return true;
|
|---|
| 121 | }
|
|---|
| 122 | else {
|
|---|
| 123 | setChanged(false);
|
|---|
| 124 | return false;
|
|---|
| 125 | }
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 128 | void set(const t_GloBiasInfo& gloBiasInfo) {
|
|---|
| 129 | _staID = gloBiasInfo._staID;
|
|---|
| 130 | _indicator = gloBiasInfo._indicator;
|
|---|
| 131 | _L1C_value = gloBiasInfo._L1C_value;
|
|---|
| 132 | _L1P_value = gloBiasInfo._L1P_value;
|
|---|
| 133 | _L2C_value = gloBiasInfo._L2C_value;
|
|---|
| 134 | _L2P_value = gloBiasInfo._L2P_value;
|
|---|
| 135 | }
|
|---|
| 136 | void setChanged(bool changed) {
|
|---|
| 137 | _changed = changed;
|
|---|
| 138 | }
|
|---|
| 139 | bool changed() {return _changed;};
|
|---|
| 140 | void init() {
|
|---|
| 141 | _staID = 0;
|
|---|
| 142 | _indicator = 1;
|
|---|
| 143 | _L1C_value = 0.0;
|
|---|
| 144 | _L1P_value = 0.0;
|
|---|
| 145 | _L2C_value = 0.0;
|
|---|
| 146 | _L2P_value = 0.0;
|
|---|
| 147 | _changed = false;
|
|---|
| 148 | }
|
|---|
| 149 | QString toString() {
|
|---|
| 150 | QString biasIndicator = (_indicator == 1) ? QString("aligned") : QString("unaligned");
|
|---|
| 151 | QString biasesStr =
|
|---|
| 152 | QString(": GLONASS L1/L2 Code-Phase Biases: staID=%1 indicator=%2 L1C=%3 L1P=%4 L2C=%5 L2P=%6")
|
|---|
| 153 | .arg(_staID).arg(biasIndicator)
|
|---|
| 154 | .arg(_L1C_value, 0, 'f', 2)
|
|---|
| 155 | .arg(_L1P_value, 0, 'f', 2)
|
|---|
| 156 | .arg(_L2C_value, 0, 'f', 2)
|
|---|
| 157 | .arg(_L2P_value, 0, 'f', 2);
|
|---|
| 158 |
|
|---|
| 159 | return biasesStr;
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | int _staID;
|
|---|
| 163 | int _indicator;
|
|---|
| 164 | double _L1C_value;
|
|---|
| 165 | double _L1P_value;
|
|---|
| 166 | double _L2C_value;
|
|---|
| 167 | double _L2P_value;
|
|---|
| 168 | bool _changed;
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 | };
|
|---|
| 172 |
|
|---|
| 173 | /** List of observations */
|
|---|
| 174 | QList<t_satObs> _obsList;
|
|---|
| 175 | QList<t_typeInfo> _typeList; // RTCM message type as message size
|
|---|
| 176 | QList<t_antInfo> _antType; // RTCM antenna descriptor
|
|---|
| 177 | QList<t_recInfo> _recType; // RTCM receiver descriptor
|
|---|
| 178 | QList<t_antRefPoint> _antList; // RTCM antenna XYZ
|
|---|
| 179 | QList<t_helmertPar> _helmertPar; // List of Helmert parameter sets
|
|---|
| 180 | QList<t_serviceCrs> _serviceCrs; // Service CRS
|
|---|
| 181 | QList<t_rtcmCrs> _rtcmCrs; // RTCM CRS
|
|---|
| 182 | QString _gloFrq; // GLONASS slot
|
|---|
| 183 | t_GloBiasInfo _gloBiasInfo; // RTCM GLO bias information message
|
|---|
| 184 | bncRinex* _rnx; // RINEX writer
|
|---|
| 185 | };
|
|---|
| 186 |
|
|---|
| 187 | #endif
|
|---|