source: ntrip/trunk/rtcm3torinex/rtcm3torinex.h@ 317

Last change on this file since 317 was 270, checked in by stoecker, 18 years ago

added GLONASS

File size: 5.3 KB
Line 
1#ifndef RTCM3TORINEX_H
2#define RTCM3TORINES_H
3
4/*
5 Converter for RTCM3 data to RINEX.
6 $Id: rtcm3torinex.h,v 1.1 2006/11/02 13:34:00 stoecker Exp $
7 Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@euronik.eu>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 or read http://www.gnu.org/licenses/gpl.txt
23*/
24
25#define PRN_GPS_START 1
26#define PRN_GPS_END 32
27#define PRN_GLONASS_START 38
28#define PRN_GLONASS_END 61
29#define PRN_WAAS_START 120
30#define PRN_WAAS_END 138
31
32#define GNSSENTRY_C1DATA 0
33#define GNSSENTRY_C2DATA 1
34#define GNSSENTRY_P1DATA 2
35#define GNSSENTRY_P2DATA 3
36#define GNSSENTRY_L1CDATA 4
37#define GNSSENTRY_L1PDATA 5
38#define GNSSENTRY_L2CDATA 6
39#define GNSSENTRY_L2PDATA 7
40#define GNSSENTRY_D1CDATA 8
41#define GNSSENTRY_D1PDATA 9
42#define GNSSENTRY_D2CDATA 10
43#define GNSSENTRY_D2PDATA 11
44#define GNSSENTRY_S1CDATA 12
45#define GNSSENTRY_S1PDATA 13
46#define GNSSENTRY_S2CDATA 14
47#define GNSSENTRY_S2PDATA 15
48#define GNSSENTRY_NUMBER 16 /* number of types!!! */
49
50/* Data flags. These flags are used in the dataflags field of gpsdata structure
51 and are used the determine, which data fields are filled with valid data. */
52#define GNSSDF_C1DATA (1<<GNSSENTRY_C1DATA)
53#define GNSSDF_C2DATA (1<<GNSSENTRY_C2DATA)
54#define GNSSDF_P1DATA (1<<GNSSENTRY_P1DATA)
55#define GNSSDF_P2DATA (1<<GNSSENTRY_P2DATA)
56#define GNSSDF_L1CDATA (1<<GNSSENTRY_L1CDATA)
57#define GNSSDF_L1PDATA (1<<GNSSENTRY_L1PDATA)
58#define GNSSDF_L2CDATA (1<<GNSSENTRY_L2CDATA)
59#define GNSSDF_L2PDATA (1<<GNSSENTRY_L2PDATA)
60#define GNSSDF_D1CDATA (1<<GNSSENTRY_D1CDATA)
61#define GNSSDF_D1PDATA (1<<GNSSENTRY_D1PDATA)
62#define GNSSDF_D2CDATA (1<<GNSSENTRY_D2CDATA)
63#define GNSSDF_D2PDATA (1<<GNSSENTRY_D2PDATA)
64#define GNSSDF_S1CDATA (1<<GNSSENTRY_S1CDATA)
65#define GNSSDF_S1PDATA (1<<GNSSENTRY_S1PDATA)
66#define GNSSDF_S2CDATA (1<<GNSSENTRY_S2CDATA)
67#define GNSSDF_S2PDATA (1<<GNSSENTRY_S2PDATA)
68
69#define RINEXENTRY_C1DATA 0
70#define RINEXENTRY_C2DATA 1
71#define RINEXENTRY_P1DATA 2
72#define RINEXENTRY_P2DATA 3
73#define RINEXENTRY_L1DATA 4
74#define RINEXENTRY_L2DATA 5
75#define RINEXENTRY_D1DATA 6
76#define RINEXENTRY_D2DATA 7
77#define RINEXENTRY_S1DATA 8
78#define RINEXENTRY_S2DATA 9
79#define RINEXENTRY_NUMBER 10
80
81#define LIGHTSPEED 2.99792458e8 /* m/sec */
82#define GPS_FREQU_L1 1575420000.0 /* Hz */
83#define GPS_FREQU_L2 1227600000.0 /* Hz */
84#define GPS_WAVELENGTH_L1 (LIGHTSPEED / GPS_FREQU_L1) /* m */
85#define GPS_WAVELENGTH_L2 (LIGHTSPEED / GPS_FREQU_L2) /* m */
86
87#define GLO_FREQU_L1_BASE 1602000000.0 /* Hz */
88#define GLO_FREQU_L2_BASE 1246000000.0 /* Hz */
89#define GLO_FREQU_L1_STEP 562500.0 /* Hz */
90#define GLO_FREQU_L2_STEP 437500.0 /* Hz */
91#define GLO_FREQU_L1(a) (GLO_FREQU_L1_BASE+(a)*GLO_FREQU_L1_STEP)
92#define GLO_FREQU_L2(a) (GLO_FREQU_L2_BASE+(a)*GLO_FREQU_L2_STEP)
93#define GLO_WAVELENGTH_L1(a) (LIGHTSPEED / GLO_FREQU_L1(a)) /* m */
94#define GLO_WAVELENGTH_L2(a) (LIGHTSPEED / GLO_FREQU_L2(a)) /* m */
95
96/* unimportant, only for approx. time needed */
97#define LEAPSECONDS 14
98
99/* Additional flags for the data field, which tell us more. */
100#define GNSSDF_LOCKLOSSL1 (1<<29) /* lost lock on L1 */
101#define GNSSDF_LOCKLOSSL2 (1<<30) /* lost lock on L2 */
102
103struct gnssdata {
104 int flags; /* GPSF_xxx */
105 int week; /* week number of GPS date */
106 int numsats;
107 double timeofweek; /* milliseconds in GPS week */
108 double measdata[24][GNSSENTRY_NUMBER]; /* data fields */
109 int dataflags[24]; /* GPSDF_xxx */
110 int satellites[24]; /* SV - IDs */
111 int snrL1[24]; /* Important: all the 5 SV-specific fields must */
112 int snrL2[24]; /* have the same SV-order */
113};
114
115struct RTCM3ParserData {
116 unsigned char Message[2048]; /* input-buffer */
117 int MessageSize; /* current buffer size */
118 int NeedBytes; /* bytes wanted for next run */
119 int SkipBytes; /* bytes to skip in next round */
120 int GPSWeek;
121 int GPSTOW; /* in seconds */
122 struct gnssdata Data;
123 struct gnssdata DataNew;
124 int size;
125 int lastlockl1[64];
126 int lastlockl2[64];
127 int datapos[RINEXENTRY_NUMBER];
128 int dataflag[RINEXENTRY_NUMBER];
129 int numdatatypes;
130 int validwarning;
131 int init;
132 const char * headerfile;
133};
134
135void HandleHeader(struct RTCM3ParserData *Parser);
136int RTCM3Parser(struct RTCM3ParserData *handle);
137void HandleByte(struct RTCM3ParserData *Parser, unsigned int byte);
138
139#endif /* RTCM3TORINEX_H */
Note: See TracBrowser for help on using the repository browser.