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