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

Last change on this file since 10534 was 10534, checked in by stuerze, 8 weeks ago

Service and RTCM CRS encoding and decoding as well as Helmert parameter decoding added + some re-organisation

File size: 9.3 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://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 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 /**
63 * Extract a RTCM3 message. Data is passed in the follow fields:<br>
64 * {@link _Message}: contains the message bytes<br>
65 * {@link _MessageSize}: contains to current amount of bytes in the buffer<br>
66 * {@link _SkipBytes}: amount of bytes to skip at the beginning of the buffer
67 *
68 * The functions sets following variables:<br>
69 * {@link _NeedBytes}: Minimum number of bytes needed on next call<br>
70 * {@link _SkipBytes}: internal, Bytes to skip before next call (usually the amount of
71 * found bytes)<br>
72 * {@link _MessageSize}: Updated size after processed bytes have been removed from buffer
73 * @return message number when message found, 0 otherwise
74 */
75 int GetMessage(void);
76 /**
77 * Extract data from old 1001-1004 RTCM3 messages.
78 * @param buffer the buffer containing an 1001-1004 RTCM block
79 * @param bufLen the length of the buffer (the message length including header+crc)
80 * @return <code>true</code> when data block is finished and transfered into
81 * {@link GPSDecoder::_obsList} variable
82 * @see DecodeRTCM3GLONASS()
83 * @see DecodeRTCM3MSM()
84 */
85 bool DecodeRTCM3GPS(unsigned char* buffer, int bufLen);
86 /**
87 * Extract data from old 1009-1012 RTCM3 messages.
88 * @param buffer the buffer containing an 1009-1012 RTCM block
89 * @param bufLen the length of the buffer (the message length including header+crc)
90 * @return <code>true</code> when data block is finished and transfered into
91 * {@link GPSDecoder::_obsList} variable
92 * @see DecodeRTCM3GPS()
93 * @see DecodeRTCM3MSM()
94 */
95 bool DecodeRTCM3GLONASS(unsigned char* buffer, int bufLen);
96 /**
97 * Extract data from MSM 1070-1237 RTCM3 messages.
98 * @param buffer the buffer containing an 1070-1237 RTCM block
99 * @param bufLen the length of the buffer (the message length including header+crc)
100 * @return <code>true</code> when data block is finished and transfered into
101 * {@link GPSDecoder::_obsList} variable
102 * @see DecodeRTCM3GPS()
103 * @see DecodeRTCM3GLONASS()
104 */
105 bool DecodeRTCM3MSM(unsigned char* buffer, int bufLen);
106 /**
107 * Extract ephemeris data from 1019 RTCM3 messages.
108 * @param buffer the buffer containing an 1019 RTCM block
109 * @param bufLen the length of the buffer (the message length including header+crc)
110 * @return <code>true</code> when data block was decodable
111 */
112 bool DecodeGPSEphemeris(unsigned char* buffer, int bufLen);
113 /**
114 * Extract ephemeris data from 1020 RTCM3 messages.
115 * @param buffer the buffer containing an 1020 RTCM block
116 * @param bufLen the length of the buffer (the message length including header+crc)
117 * @return <code>true</code> when data block was decodable
118 */
119 bool DecodeGLONASSEphemeris(unsigned char* buffer, int bufLen);
120 /**
121 * Extract ephemeris data from 1043 RTCM3 messages.
122 * @param buffer the buffer containing an 1043 RTCM block
123 * @param bufLen the length of the buffer (the message length including header+crc)
124 * @return <code>true</code> when data block was decodable
125 */
126 bool DecodeSBASEphemeris(unsigned char* buffer, int bufLen);
127 /**
128 * Extract ephemeris data from 1044 RTCM3 messages.
129 * @param buffer the buffer containing an 1044 RTCM block
130 * @param bufLen the length of the buffer (the message length including header+crc)
131 * @return <code>true</code> when data block was decodable
132 */
133 bool DecodeQZSSEphemeris(unsigned char* buffer, int bufLen);
134 /**
135 * Extract ephemeris data from 29 (allocated for testing) RTCM3 messages.
136 * @param buffer the buffer containing an 29 RTCM block
137 * @param bufLen the length of the buffer (the message length including header+crc)
138 * @return <code>true</code> when data block was decodable
139 */
140 bool DecodeIRNSSEphemeris(unsigned char* buffer, int bufLen);
141 /**
142 * Extract ephemeris data from 1045 and 1046 RTCM3 messages.
143 * @param buffer the buffer containing an 1045 and 1046 RTCM block
144 * @param bufLen the length of the buffer (the message length including header+crc)
145 * @return <code>true</code> when data block was decodable
146 */
147 bool DecodeGalileoEphemeris(unsigned char* buffer, int bufLen);
148 /**
149 * Extract ephemeris data from BDS RTCM3 messages.
150 * @param buffer the buffer containing an BDS RTCM block
151 * @param bufLen the length of the buffer (the message length including header+crc)
152 * @return <code>true</code> when data block was decodable
153 */
154 bool DecodeBDSEphemeris(unsigned char* buffer, int bufLen);
155 /**
156 * Extract antenna type from 1007, 1008 or 1033 RTCM3 messages
157 * and extract receiver type from 1033 RTCM3 messages
158 * @param buffer the buffer containing an antenna (and receiver) RTCM block
159 * @param bufLen the length of the buffer (the message length including header+crc)
160 * @return <code>true</code> when data block was decodable
161 */
162 bool DecodeAntennaReceiver(unsigned char* buffer, int bufLen);
163 /**
164 * Extract antenna type from 1005 or 1006 RTCM3 messages.
165 * @param buffer the buffer containing an antenna RTCM block
166 * @param bufLen the length of the buffer (the message length including header+crc)
167 * @return <code>true</code> when data block was decodable
168 */
169 bool DecodeAntennaPosition(unsigned char* buffer, int bufLen);
170 /**
171 * Extract service CRS from 1300 RTCM3 messages
172 * @param buffer the buffer containing CRS name and epoch RTCM block
173 * @param bufLen the length of the buffer (the message length including header+crc)
174 * @return <code>true</code> when data block was decodable
175 */
176 bool DecodeServiceCRS(unsigned char* buffer, int bufLen);
177 /**
178 * Extract Helmert transformation parameters from 1301 RTCM3 messages
179 * @param buffer the buffer containing Helmert transformation parameters RTCM block
180 * @param bufLen the length of the buffer (the message length including header+crc)
181 * @return <code>true</code> when data block was decodable
182 */
183 bool DecodeHelmertTrafoParameters(unsigned char* buffer, int bufLen);
184 /**
185 * Extract RTCM CRS data from 1302 RTCM3 messages
186 * @param buffer the buffer containing a database link RTCM block
187 * @param bufLen the length of the buffer (the message length including header+crc)
188 * @return <code>true</code> when data block was decodable
189 */
190 bool DecodeRTCMCRS(unsigned char* buffer, int bufLen);
191 /** Current station description, dynamic in case of raw input file handling */
192 QString _staID;
193 /** Raw input file for post processing, required to extract station ID */
194 bncRawFile* _rawFile;
195
196 /** List of decoders for Clock and Orbit data */
197 QMap<QByteArray, RTCM3coDecoder*> _coDecoders;
198
199 /** Message buffer for input parsing */
200 unsigned char _Message[2048];
201 /** Current size of the message buffer */
202 size_t _MessageSize;
203 /** Minimum bytes required to have success during next {@link GetMessage()} call */
204 size_t _NeedBytes;
205 /** Bytes to skip in next {@link GetMessage()} call, intrnal to that function */
206 size_t _SkipBytes;
207 /** Size of the current RTCM3 block beginning at buffer start after a successful
208 * {@link GetMessage()} call
209 */
210 size_t _BlockSize;
211
212 /**
213 * Current observation epoch. Used to link together blocks in one epoch.
214 */
215 bncTime _CurrentTime;
216 /** Current observation data block list, Filled by {@link DecodeRTCM3GPS()},
217 * {@link DecodeRTCM3GLONASS()} and {@link DecodeRTCM3MSM()} functions.
218 */
219 QList<t_satObs> _CurrentObsList;
220
221};
222
223#endif
224
Note: See TracBrowser for help on using the repository browser.