source: ntrip/trunk/BNC/RTCM3/rtcm3torinex.h@ 372

Last change on this file since 372 was 366, checked in by mervart, 18 years ago

* empty log message *

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