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

Last change on this file since 461 was 365, checked in by stoecker, 18 years ago

fixed typos

File size: 5.6 KB
Line 
1#ifndef RTCM3TORINEX_H
2#define RTCM3TORINEX_H
3
4/*
5 Converter for RTCM3 data to RINEX.
6 $Id: rtcm3torinex.h,v 1.5 2007/01/11 14:10:13 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/* Additional flags for the data field, which tell us more. */
97#define GNSSDF_LOCKLOSSL1 (1<<29) /* lost lock on L1 */
98#define GNSSDF_LOCKLOSSL2 (1<<30) /* lost lock on L2 */
99
100struct gnssdata {
101 int flags; /* GPSF_xxx */
102 int week; /* week number of GPS date */
103 int numsats;
104 double timeofweek; /* milliseconds in GPS week */
105 double measdata[24][GNSSENTRY_NUMBER]; /* data fields */
106 int dataflags[24]; /* GPSDF_xxx */
107 int satellites[24]; /* SV - IDs */
108 int snrL1[24]; /* Important: all the 5 SV-specific fields must */
109 int snrL2[24]; /* have the same SV-order */
110};
111
112struct RTCM3ParserData {
113 unsigned char Message[2048]; /* input-buffer */
114 int MessageSize; /* current buffer size */
115 int NeedBytes; /* bytes wanted for next run */
116 int SkipBytes; /* bytes to skip in next round */
117 int GPSWeek;
118 int GPSTOW; /* in seconds */
119 struct gnssdata Data;
120 struct gnssdata DataNew;
121 int size;
122 int lastlockl1[64];
123 int lastlockl2[64];
124 int datapos[RINEXENTRY_NUMBER];
125 int dataflag[RINEXENTRY_NUMBER];
126 int datapos2[RINEXENTRY_NUMBER];
127 int dataflag2[RINEXENTRY_NUMBER];
128 int numdatatypes;
129 int validwarning;
130 int init;
131 int startflags;
132 const char * headerfile;
133};
134
135#ifndef PRINTFARG
136#ifdef __GNUC__
137#define PRINTFARG(a,b) __attribute__ ((format(printf, a, b)))
138#else /* __GNUC__ */
139#define PRINTFARG(a,b)
140#endif /* __GNUC__ */
141#endif /* PRINTFARG */
142
143void HandleHeader(struct RTCM3ParserData *Parser);
144int RTCM3Parser(struct RTCM3ParserData *handle);
145void HandleByte(struct RTCM3ParserData *Parser, unsigned int byte);
146void PRINTFARG(1,2) RTCM3Error(const char *fmt, ...);
147void PRINTFARG(1,2) RTCM3Text(const char *fmt, ...);
148
149#endif /* RTCM3TORINEX_H */
Note: See TracBrowser for help on using the repository browser.