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

Last change on this file since 6912 was 6812, checked in by stoecker, 10 years ago

integrate RTCM3 parsing into BNC and directly fill target structures, add doxygen documentation

File size: 7.8 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 "bncrawfile.h"
35#include "ephemeris.h"
36
37class RTCM3Decoder : public QObject, public GPSDecoder {
38Q_OBJECT
39 public:
40 RTCM3Decoder(const QString& staID, bncRawFile* rawFile);
41 virtual ~RTCM3Decoder();
42 virtual t_irc Decode(char* buffer, int bufLen, std::vector<std::string>& errmsg);
43 virtual int corrGPSEpochTime() const;
44 /**
45 * CRC24Q checksum calculation function (only full bytes supported).
46 * @param size Size of the passed data
47 * @param buf Data buffer containing the data to checksum
48 * @return the CRC24Q checksum of the data
49 */
50 static uint32_t CRC24(long size, const unsigned char *buf);
51
52 signals:
53 void newMessage(QByteArray msg,bool showOnScreen);
54 void newGPSEph(t_ephGPS eph);
55 void newGlonassEph(t_ephGlo eph);
56 void newSBASEph(t_ephSBAS eph);
57 void newGalileoEph(t_ephGal eph);
58 void newBDSEph(t_ephBDS eph);
59
60 private:
61 /**
62 * Extract a RTCM3 message. Data is passed in the follow fields:<br>
63 * {@link _Message}: contains the message bytes<br>
64 * {@link _MessageSize}: contains to current amount of bytes in the buffer<br>
65 * {@link _SkipBytes}: amount of bytes to skip at the beginning of the buffer
66 *
67 * The functions sets following variables:<br>
68 * {@link _NeedBytes}: Minimum number of bytes needed on next call<br>
69 * {@link _SkipBytes}: internal, Bytes to skip before next call (usually the amount of
70 * found bytes)<br>
71 * {@link _MessageSize}: Updated size after processed bytes have been removed from buffer
72 * @return message number when message found, 0 otherwise
73 */
74 int GetMessage(void);
75 /**
76 * Extract data from old 1001-1004 RTCM3 messages.
77 * @param buffer the buffer containing an 1001-1004 RTCM block
78 * @param bufLen the length of the buffer (the message length including header+crc)
79 * @return <code>true</code> when data block is finished and transfered into
80 * {@link GPSDecoder::_obsList} variable
81 * @see DecodeRTCM3GLONASS()
82 * @see DecodeRTCM3MSM()
83 */
84 bool DecodeRTCM3GPS(unsigned char* buffer, int bufLen);
85 /**
86 * Extract data from old 1009-1012 RTCM3 messages.
87 * @param buffer the buffer containing an 1009-1012 RTCM block
88 * @param bufLen the length of the buffer (the message length including header+crc)
89 * @return <code>true</code> when data block is finished and transfered into
90 * {@link GPSDecoder::_obsList} variable
91 * @see DecodeRTCM3GPS()
92 * @see DecodeRTCM3MSM()
93 */
94 bool DecodeRTCM3GLONASS(unsigned char* buffer, int bufLen);
95 /**
96 * Extract data from MSM 1070-1229 RTCM3 messages.
97 * @param buffer the buffer containing an 1070-1229 RTCM block
98 * @param bufLen the length of the buffer (the message length including header+crc)
99 * @return <code>true</code> when data block is finished and transfered into
100 * {@link GPSDecoder::_obsList} variable
101 * @see DecodeRTCM3GPS()
102 * @see DecodeRTCM3GLONASS()
103 */
104 bool DecodeRTCM3MSM(unsigned char* buffer, int bufLen);
105 /**
106 * Extract ephemeris data from 1019 RTCM3 messages.
107 * @param buffer the buffer containing an 1019 RTCM block
108 * @param bufLen the length of the buffer (the message length including header+crc)
109 * @return <code>true</code> when data block was decodable
110 */
111 bool DecodeGPSEphemeris(unsigned char* buffer, int bufLen);
112 /**
113 * Extract ephemeris data from 1020 RTCM3 messages.
114 * @param buffer the buffer containing an 1020 RTCM block
115 * @param bufLen the length of the buffer (the message length including header+crc)
116 * @return <code>true</code> when data block was decodable
117 */
118 bool DecodeGLONASSEphemeris(unsigned char* buffer, int bufLen);
119 /**
120 * Extract ephemeris data from 1043 RTCM3 messages.
121 * @param buffer the buffer containing an 1043 RTCM block
122 * @param bufLen the length of the buffer (the message length including header+crc)
123 * @return <code>true</code> when data block was decodable
124 */
125 bool DecodeSBASEphemeris(unsigned char* buffer, int bufLen);
126 /**
127 * Extract ephemeris data from 1044 RTCM3 messages.
128 * @param buffer the buffer containing an 1044 RTCM block
129 * @param bufLen the length of the buffer (the message length including header+crc)
130 * @return <code>true</code> when data block was decodable
131 */
132 bool DecodeQZSSEphemeris(unsigned char* buffer, int bufLen);
133 /**
134 * Extract ephemeris data from 1045 and 1046 RTCM3 messages.
135 * @param buffer the buffer containing an 1045 and 1046 RTCM block
136 * @param bufLen the length of the buffer (the message length including header+crc)
137 * @return <code>true</code> when data block was decodable
138 */
139 bool DecodeGalileoEphemeris(unsigned char* buffer, int bufLen);
140 /**
141 * Extract ephemeris data from BDS RTCM3 messages.
142 * @param buffer the buffer containing an BDS RTCM block
143 * @param bufLen the length of the buffer (the message length including header+crc)
144 * @return <code>true</code> when data block was decodable
145 */
146 bool DecodeBDSEphemeris(unsigned char* buffer, int bufLen);
147 /**
148 * Extract antenna type from 1007, 1008 or 1033 RTCM3 messages.
149 * @param buffer the buffer containing an antenna RTCM block
150 * @param bufLen the length of the buffer (the message length including header+crc)
151 * @return <code>true</code> when data block was decodable
152 */
153 bool DecodeAntenna(unsigned char* buffer, int bufLen);
154 /**
155 * Extract antenna type from 1005 or 1006 RTCM3 messages.
156 * @param buffer the buffer containing an antenna RTCM block
157 * @param bufLen the length of the buffer (the message length including header+crc)
158 * @return <code>true</code> when data block was decodable
159 */
160 bool DecodeAntennaPosition(unsigned char* buffer, int bufLen);
161
162 /** Current station description, dynamic in case of raw input file handling */
163 QString _staID;
164 /** Raw input file for post processing, required to extract station ID */
165 bncRawFile* _rawFile;
166
167 /** List of decoders for Clock and Orbit data */
168 QMap<QByteArray, RTCM3coDecoder*> _coDecoders;
169
170 /** Message buffer for input parsing */
171 unsigned char _Message[2048];
172 /** Current size of the message buffer */
173 size_t _MessageSize;
174 /** Minimum bytes required to have success during next {@link GetMessage()} call */
175 size_t _NeedBytes;
176 /** Bytes to skip in next {@link GetMessage()} call, intrnal to that function */
177 size_t _SkipBytes;
178 /** Size of the current RTCM3 block beginning at buffer start after a successful
179 * {@link GetMessage()} call
180 */
181 size_t _BlockSize;
182
183 /**
184 * Current observation epoch. Used to link together blocks in one epoch.
185 */
186 bncTime _CurrentTime;
187 /** Current observation data block list, Filled by {@link DecodeRTCM3GPS()},
188 * {@link DecodeRTCM3GLONASS()} and {@link DecodeRTCM3MSM()} functions.
189 */
190 QList<t_satObs> _CurrentObsList;
191};
192
193#endif
194
Note: See TracBrowser for help on using the repository browser.