[297] | 1 | // Part of BNC, a utility for retrieving decoding and
|
---|
[464] | 2 | // converting GNSS data streams from NTRIP broadcasters.
|
---|
[297] | 3 | //
|
---|
[464] | 4 | // Copyright (C) 2007
|
---|
[297] | 5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
---|
| 6 | // http://www.bkg.bund.de
|
---|
[464] | 7 | // Czech Technical University Prague, Department of Geodesy
|
---|
[297] | 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.
|
---|
[35] | 24 |
|
---|
[222] | 25 | #ifndef GPSDECODER_H
|
---|
| 26 | #define GPSDECODER_H
|
---|
| 27 |
|
---|
[625] | 28 | #include <iostream>
|
---|
[621] | 29 | #include <QPointer>
|
---|
| 30 | #include <QList>
|
---|
[35] | 31 |
|
---|
[649] | 32 | #include "bncconst.h"
|
---|
| 33 |
|
---|
[622] | 34 | class t_obsInternal {
|
---|
| 35 | public:
|
---|
[1044] | 36 |
|
---|
| 37 | t_obsInternal() :
|
---|
| 38 | flags(0),
|
---|
| 39 | satSys(' '),
|
---|
| 40 | satNum(0),
|
---|
| 41 | slot(0),
|
---|
| 42 | GPSWeek(0),
|
---|
| 43 | GPSWeeks(0.0),
|
---|
| 44 | C1(0.0),
|
---|
| 45 | C2(0.0),
|
---|
| 46 | P1(0.0),
|
---|
| 47 | P2(0.0),
|
---|
| 48 | L1(0.0),
|
---|
| 49 | L2(0.0),
|
---|
| 50 | slip_cnt_L1(-1),
|
---|
| 51 | slip_cnt_L2(-1),
|
---|
| 52 | lock_timei_L1(-1),
|
---|
| 53 | lock_timei_L2(-1),
|
---|
| 54 | S1(0.0),
|
---|
| 55 | S2(0.0),
|
---|
| 56 | SNR1(0),
|
---|
| 57 | SNR2(0) {
|
---|
| 58 | StatID[0] = '\x0';
|
---|
| 59 | }
|
---|
[222] | 60 | int flags;
|
---|
[1044] | 61 | char StatID[20+1]; // Station ID
|
---|
| 62 | char satSys; // Satellite System ('G' or 'R')
|
---|
| 63 | int satNum; // Satellite Number (PRN for GPS NAVSTAR)
|
---|
| 64 | int slot; // Slot Number (for Glonass)
|
---|
| 65 | int GPSWeek; // Week of GPS-Time
|
---|
| 66 | double GPSWeeks; // Second of Week (GPS-Time)
|
---|
| 67 | double C1; // CA-code pseudorange (meters)
|
---|
| 68 | double C2; // CA-code pseudorange (meters)
|
---|
| 69 | double P1; // P1-code pseudorange (meters)
|
---|
| 70 | double P2; // P2-code pseudorange (meters)
|
---|
| 71 | double L1; // L1 carrier phase (cycles)
|
---|
| 72 | double L2; // L2 carrier phase (cycles)
|
---|
| 73 | int slip_cnt_L1; // L1 cumulative loss of continuity indicator (negative value = undefined)
|
---|
| 74 | int slip_cnt_L2; // L2 cumulative loss of continuity indicator (negative value = undefined)
|
---|
| 75 | int lock_timei_L1; // L1 last lock time indicator (negative value = undefined)
|
---|
| 76 | int lock_timei_L2; // L2 last lock time indicator (negative value = undefined)
|
---|
| 77 | double S1; // L1 signal-to noise ratio
|
---|
| 78 | double S2; // L2 signal-to noise ratio
|
---|
| 79 | int SNR1; // L1 signal-to noise ratio (mapped to integer)
|
---|
| 80 | int SNR2; // L2 signal-to noise ratio (mapped to integer)
|
---|
[222] | 81 | };
|
---|
[35] | 82 |
|
---|
[622] | 83 | class t_obs : public QObject{
|
---|
| 84 | public:
|
---|
[623] | 85 | enum t_obs_status {initial, posted, received};
|
---|
[621] | 86 |
|
---|
[622] | 87 | t_obs() {
|
---|
[623] | 88 | _status = initial;
|
---|
| 89 |
|
---|
[1044] | 90 | _o.flags = 0;
|
---|
| 91 | _o.StatID[0] = '\0';
|
---|
| 92 | _o.satSys = 'G';
|
---|
| 93 | _o.satNum = 0;
|
---|
| 94 | _o.slot = 0;
|
---|
| 95 | _o.GPSWeek = 0;
|
---|
| 96 | _o.GPSWeeks = 0.0;
|
---|
| 97 | _o.C1 = 0.0;
|
---|
| 98 | _o.C2 = 0.0;
|
---|
| 99 | _o.P1 = 0.0;
|
---|
| 100 | _o.P2 = 0.0;
|
---|
| 101 | _o.L1 = 0.0;
|
---|
| 102 | _o.L2 = 0.0;
|
---|
| 103 | _o.S1 = 0.0;
|
---|
| 104 | _o.S2 = 0.0;
|
---|
| 105 | _o.slip_cnt_L1 = -1;
|
---|
| 106 | _o.slip_cnt_L2 = -1;
|
---|
| 107 | _o.lock_timei_L1 = -1;
|
---|
| 108 | _o.lock_timei_L2 = -1;
|
---|
| 109 | _o.SNR1 = 0;
|
---|
| 110 | _o.SNR2 = 0;
|
---|
[622] | 111 | }
|
---|
| 112 |
|
---|
[626] | 113 | ~t_obs() {}
|
---|
[625] | 114 |
|
---|
[622] | 115 | t_obsInternal _o;
|
---|
[623] | 116 | t_obs_status _status;
|
---|
[622] | 117 | };
|
---|
| 118 |
|
---|
| 119 | typedef QPointer<t_obs> p_obs;
|
---|
| 120 |
|
---|
[35] | 121 | class GPSDecoder {
|
---|
[622] | 122 | public:
|
---|
[649] | 123 | virtual t_irc Decode(char* buffer, int bufLen) = 0;
|
---|
[622] | 124 |
|
---|
| 125 | virtual ~GPSDecoder() {
|
---|
| 126 | QListIterator<p_obs> it(_obsList);
|
---|
| 127 | while (it.hasNext()) {
|
---|
[624] | 128 | p_obs obs = it.next();
|
---|
[625] | 129 | if (!obs.isNull() && obs->_status == t_obs::initial) {
|
---|
[624] | 130 | delete obs;
|
---|
| 131 | }
|
---|
[622] | 132 | }
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 | QList<p_obs> _obsList;
|
---|
[1030] | 136 | QList<int> _typeList; // RTCM message types
|
---|
[1035] | 137 | QList<int> _epochList; // RTCM message types
|
---|
[222] | 138 | };
|
---|
[35] | 139 |
|
---|
| 140 | #endif
|
---|