source: ntrip/trunk/BNC/src/RTCM3/RTCM3Decoder.h@ 11047

Last change on this file since 11047 was 11047, checked in by stuerze, 23 hours ago

updates regarding RTCM-SSR and some ovarall improvements

File size: 9.9 KB
Line 
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://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 RTCM3DECODER_H
26#define RTCM3DECODER_H
27
28#include <QtCore>
29#include <map>
30
31#include <stdint.h>
32#include "GPSDecoder.h"
33#include "RTCM3coDecoder.h"
34#include "crs.h"
35#include "bncrawfile.h"
36#include "ephemeris.h"
37
38class RTCM3Decoder : public QObject, public GPSDecoder {
39Q_OBJECT
40 public:
41 RTCM3Decoder(const QString& staID, bncRawFile* rawFile);
42 virtual ~RTCM3Decoder();
43 virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg);
44 virtual int corrGPSEpochTime() const;
45 /**
46 * CRC24Q checksum calculation function (only full bytes supported).
47 * @param size Size of the passed data
48 * @param buf Data buffer containing the data to checksum
49 * @return the CRC24Q checksum of the data
50 */
51 static uint32_t CRC24(long size, const unsigned char *buf);
52
53 signals:
54 void newMessage(QByteArray msg,bool showOnScreen);
55 void newGPSEph(t_ephGPS eph);
56 void newGlonassEph(t_ephGlo eph);
57 void newSBASEph(t_ephSBAS eph);
58 void newGalileoEph(t_ephGal eph);
59 void newBDSEph(t_ephBDS eph);
60
61 private:
62 // Log (once per satellite) a satellite number outside BNC's supported
63 // range (t_prn::MAXPRN_*); such satellites map to the unused index 0.
64 void checkPrnRange(const t_prn& prn);
65 QSet<QString> _prnOutOfRangeLogged;
66 /**
67 * Extract a RTCM3 message. Data is passed in the follow fields:<br>
68 * {@link _Message}: contains the message bytes<br>
69 * {@link _MessageSize}: contains to current amount of bytes in the buffer<br>
70 * {@link _SkipBytes}: amount of bytes to skip at the beginning of the buffer
71 *
72 * The functions sets following variables:<br>
73 * {@link _NeedBytes}: Minimum number of bytes needed on next call<br>
74 * {@link _SkipBytes}: internal, Bytes to skip before next call (usually the amount of
75 * found bytes)<br>
76 * {@link _MessageSize}: Updated size after processed bytes have been removed from buffer
77 * @return message number when message found, 0 otherwise
78 */
79 int GetMessage(void);
80 /**
81 * Extract data from old 1001-1004 RTCM3 messages.
82 * @param buffer the buffer containing an 1001-1004 RTCM block
83 * @param bufLen the length of the buffer (the message length including header+crc)
84 * @return <code>true</code> when data block is finished and transfered into
85 * {@link GPSDecoder::_obsList} variable
86 * @see DecodeRTCM3GLONASS()
87 * @see DecodeRTCM3MSM()
88 */
89 bool DecodeRTCM3GPS(unsigned char* buffer, int bufLen);
90 /**
91 * Extract data from old 1009-1012 RTCM3 messages.
92 * @param buffer the buffer containing an 1009-1012 RTCM block
93 * @param bufLen the length of the buffer (the message length including header+crc)
94 * @return <code>true</code> when data block is finished and transfered into
95 * {@link GPSDecoder::_obsList} variable
96 * @see DecodeRTCM3GPS()
97 * @see DecodeRTCM3MSM()
98 */
99 bool DecodeRTCM3GLONASS(unsigned char* buffer, int bufLen);
100 /**
101 * Extract data from MSM 1070-1237 RTCM3 messages.
102 * @param buffer the buffer containing an 1070-1237 RTCM block
103 * @param bufLen the length of the buffer (the message length including header+crc)
104 * @return <code>true</code> when data block is finished and transfered into
105 * {@link GPSDecoder::_obsList} variable
106 * @see DecodeRTCM3GPS()
107 * @see DecodeRTCM3GLONASS()
108 */
109 bool DecodeRTCM3MSM(unsigned char* buffer, int bufLen);
110 /**
111 * Extract ephemeris data from 1019 RTCM3 messages.
112 * @param buffer the buffer containing an 1019 RTCM block
113 * @param bufLen the length of the buffer (the message length including header+crc)
114 * @return <code>true</code> when data block was decodable
115 */
116 bool DecodeGPSEphemeris(unsigned char* buffer, int bufLen);
117 /**
118 * Extract ephemeris data from 1020 RTCM3 messages.
119 * @param buffer the buffer containing an 1020 RTCM block
120 * @param bufLen the length of the buffer (the message length including header+crc)
121 * @return <code>true</code> when data block was decodable
122 */
123 bool DecodeGLONASSEphemeris(unsigned char* buffer, int bufLen);
124 /**
125 * Extract ephemeris data from 1043 RTCM3 messages.
126 * @param buffer the buffer containing an 1043 RTCM block
127 * @param bufLen the length of the buffer (the message length including header+crc)
128 * @return <code>true</code> when data block was decodable
129 */
130 bool DecodeSBASEphemeris(unsigned char* buffer, int bufLen);
131 /**
132 * Extract ephemeris data from 1044 RTCM3 messages.
133 * @param buffer the buffer containing an 1044 RTCM block
134 * @param bufLen the length of the buffer (the message length including header+crc)
135 * @return <code>true</code> when data block was decodable
136 */
137 bool DecodeQZSSEphemeris(unsigned char* buffer, int bufLen);
138 /**
139 * Extract ephemeris data from 29 (allocated for testing) RTCM3 messages.
140 * @param buffer the buffer containing an 29 RTCM block
141 * @param bufLen the length of the buffer (the message length including header+crc)
142 * @return <code>true</code> when data block was decodable
143 */
144 bool DecodeNavICEphemeris(unsigned char* buffer, int bufLen);
145 /**
146 * Extract ephemeris data from 1045 and 1046 RTCM3 messages.
147 * @param buffer the buffer containing an 1045 and 1046 RTCM block
148 * @param bufLen the length of the buffer (the message length including header+crc)
149 * @return <code>true</code> when data block was decodable
150 */
151 bool DecodeGalileoEphemeris(unsigned char* buffer, int bufLen);
152 /**
153 * Extract ephemeris data from BDS RTCM3 messages.
154 * @param buffer the buffer containing an BDS RTCM block
155 * @param bufLen the length of the buffer (the message length including header+crc)
156 * @return <code>true</code> when data block was decodable
157 */
158 bool DecodeBDSEphemeris(unsigned char* buffer, int bufLen);
159 /**
160 * Extract antenna type from 1007, 1008 or 1033 RTCM3 messages
161 * and extract receiver type from 1033 RTCM3 messages
162 * @param buffer the buffer containing an antenna (and receiver) RTCM block
163 * @param bufLen the length of the buffer (the message length including header+crc)
164 * @return <code>true</code> when data block was decodable
165 */
166 bool DecodeAntennaReceiver(unsigned char* buffer, int bufLen);
167 /**
168 * Extract antenna type from 1005 or 1006 RTCM3 messages.
169 * @param buffer the buffer containing an antenna RTCM block
170 * @param bufLen the length of the buffer (the message length including header+crc)
171 * @return <code>true</code> when data block was decodable
172 */
173 bool DecodeAntennaPosition(unsigned char* buffer, int bufLen);
174 /**
175 * Extract service CRS from 1300 RTCM3 messages
176 * @param buffer the buffer containing CRS name and epoch RTCM block
177 * @param bufLen the length of the buffer (the message length including header+crc)
178 * @return <code>true</code> when data block was decodable
179 */
180 bool DecodeServiceCRS(unsigned char* buffer, int bufLen);
181 /**
182 * Extract GLONASS L1 and L2 Code-Phase bias messages from 1230 RTCM3 messages
183 * @param buffer the buffer containing CLONASS L1 and L2 Code-Phase biases per station
184 * @param bufLen the length of the buffer (the message length including header+crc)
185 * @return <code>true</code> when data block was decodable
186 */
187 bool DecodeGLONASSCodePhaseBiases(unsigned char* buffer, int bufLen);
188 /**
189 * Extract Helmert transformation parameters from 1301 RTCM3 messages
190 * @param buffer the buffer containing Helmert transformation parameters RTCM block
191 * @param bufLen the length of the buffer (the message length including header+crc)
192 * @return <code>true</code> when data block was decodable
193 */
194 bool DecodeHelmertTrafoParameters(unsigned char* buffer, int bufLen);
195 /**
196 * Extract RTCM CRS data from 1302 RTCM3 messages
197 * @param buffer the buffer containing a database link RTCM block
198 * @param bufLen the length of the buffer (the message length including header+crc)
199 * @return <code>true</code> when data block was decodable
200 */
201 bool DecodeRTCMCRS(unsigned char* buffer, int bufLen);
202
203 /** Current station description, dynamic in case of raw input file handling */
204 QString _staID;
205 /** Raw input file for post processing, required to extract station ID */
206 bncRawFile* _rawFile;
207
208 /** List of decoders for Clock and Orbit data */
209 QMap<QByteArray, RTCM3coDecoder*> _coDecoders;
210
211 /** Message buffer for input parsing */
212 unsigned char _Message[2048];
213 /** Current size of the message buffer */
214 size_t _MessageSize;
215 /** Minimum bytes required to have success during next {@link GetMessage()} call */
216 size_t _NeedBytes;
217 /** Bytes to skip in next {@link GetMessage()} call, intrnal to that function */
218 size_t _SkipBytes;
219 /** Size of the current RTCM3 block beginning at buffer start after a successful
220 * {@link GetMessage()} call
221 */
222 size_t _BlockSize;
223
224 /**
225 * Current observation epoch. Used to link together blocks in one epoch.
226 */
227 bncTime _CurrentTime;
228 /** Current observation data block list, Filled by {@link DecodeRTCM3GPS()},
229 * {@link DecodeRTCM3GLONASS()} and {@link DecodeRTCM3MSM()} functions.
230 */
231 QList<t_satObs> _CurrentObsList;
232
233};
234
235#endif
236
Note: See TracBrowser for help on using the repository browser.