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

Last change on this file since 282 was 282, checked in by mervart, 17 years ago

* empty log message *

File size: 5.1 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
30#define GNSSENTRY_C1DATA 0
31#define GNSSENTRY_C2DATA 1
32#define GNSSENTRY_P1DATA 2
33#define GNSSENTRY_P2DATA 3
34#define GNSSENTRY_L1CDATA 4
35#define GNSSENTRY_L1PDATA 5
36#define GNSSENTRY_L2CDATA 6
37#define GNSSENTRY_L2PDATA 7
38#define GNSSENTRY_D1CDATA 8
39#define GNSSENTRY_D1PDATA 9
40#define GNSSENTRY_D2CDATA 10
41#define GNSSENTRY_D2PDATA 11
42#define GNSSENTRY_S1CDATA 12
43#define GNSSENTRY_S1PDATA 13
44#define GNSSENTRY_S2CDATA 14
45#define GNSSENTRY_S2PDATA 15
46#define GNSSENTRY_NUMBER 16 /* number of types!!! */
47
48/* Data flags. These flags are used in the dataflags field of gpsdata structure
49 and are used the determine, which data fields are filled with valid data. */
50#define GNSSDF_C1DATA (1<<GNSSENTRY_C1DATA)
51#define GNSSDF_C2DATA (1<<GNSSENTRY_C2DATA)
52#define GNSSDF_P1DATA (1<<GNSSENTRY_P1DATA)
53#define GNSSDF_P2DATA (1<<GNSSENTRY_P2DATA)
54#define GNSSDF_L1CDATA (1<<GNSSENTRY_L1CDATA)
55#define GNSSDF_L1PDATA (1<<GNSSENTRY_L1PDATA)
56#define GNSSDF_L2CDATA (1<<GNSSENTRY_L2CDATA)
57#define GNSSDF_L2PDATA (1<<GNSSENTRY_L2PDATA)
58#define GNSSDF_D1CDATA (1<<GNSSENTRY_D1CDATA)
59#define GNSSDF_D1PDATA (1<<GNSSENTRY_D1PDATA)
60#define GNSSDF_D2CDATA (1<<GNSSENTRY_D2CDATA)
61#define GNSSDF_D2PDATA (1<<GNSSENTRY_D2PDATA)
62#define GNSSDF_S1CDATA (1<<GNSSENTRY_S1CDATA)
63#define GNSSDF_S1PDATA (1<<GNSSENTRY_S1PDATA)
64#define GNSSDF_S2CDATA (1<<GNSSENTRY_S2CDATA)
65#define GNSSDF_S2PDATA (1<<GNSSENTRY_S2PDATA)
66
67#define RINEXENTRY_C1DATA 0
68#define RINEXENTRY_C2DATA 1
69#define RINEXENTRY_P1DATA 2
70#define RINEXENTRY_P2DATA 3
71#define RINEXENTRY_L1DATA 4
72#define RINEXENTRY_L2DATA 5
73#define RINEXENTRY_D1DATA 6
74#define RINEXENTRY_D2DATA 7
75#define RINEXENTRY_S1DATA 8
76#define RINEXENTRY_S2DATA 9
77#define RINEXENTRY_NUMBER 10
78
79#define LIGHTSPEED 2.99792458e8 /* m/sec */
80#define GPS_FREQU_L1 1575420000.0 /* Hz */
81#define GPS_FREQU_L2 1227600000.0 /* Hz */
82#define GPS_WAVELENGTH_L1 (LIGHTSPEED / GPS_FREQU_L1) /* m */
83#define GPS_WAVELENGTH_L2 (LIGHTSPEED / GPS_FREQU_L2) /* m */
84
85/* unimportant, only for approx. time needed */
86#define LEAPSECONDS 14
87
88/* Additional flags for the data field, which tell us more. */
89#define GNSSDF_LOCKLOSSL1 (1<<29) /* lost lock on L1 */
90#define GNSSDF_LOCKLOSSL2 (1<<30) /* lost lock on L2 */
91
92struct gnssdata {
93 int flags; /* GPSF_xxx */
94 int week; /* week number of GPS date */
95 int numsats;
96 double timeofweek; /* milliseconds in GPS week */
97 double measdata[24][GNSSENTRY_NUMBER]; /* data fields */
98 int dataflags[24]; /* GPSDF_xxx */
99 int satellites[24]; /* SV - IDs */
100 int snrL1[24]; /* Important: all the 5 SV-specific fields must */
101 int snrL2[24]; /* have the same SV-order */
102};
103
104struct RTCM3ParserData {
105 unsigned char Message[2048]; /* input-buffer */
106 int MessageSize; /* current buffer size */
107 int NeedBytes; /* bytes wanted for next run */
108 int SkipBytes; /* bytes to skip in next round */
109 int GPSWeek;
110 int GPSTOW; /* in seconds */
111 struct gnssdata Data;
112 int size;
113 int lastlockl1[64];
114 int lastlockl2[64];
115 int datapos[RINEXENTRY_NUMBER];
116 int dataflag[RINEXENTRY_NUMBER];
117 int numdatatypes;
118 int validwarning;
119 int init;
120 const char * headerfile;
121};
122
123struct converttimeinfo {
124 int second; /* seconds of GPS time [0..59] */
125 int minute; /* minutes of GPS time [0..59] */
126 int hour; /* hour of GPS time [0..24] */
127 int day; /* day of GPS time [1..28..30(31)*/
128 int month; /* month of GPS time [1..12]*/
129 int year; /* year of GPS time [1980..] */
130};
131
132void HandleHeader(struct RTCM3ParserData *Parser);
133int RTCM3Parser(struct RTCM3ParserData *handle);
134void HandleByte(struct RTCM3ParserData *Parser, unsigned int byte);
135void converttime(struct converttimeinfo *c, int week, int tow);
136
137#endif /* RTCM3TORINEX_H */
Note: See TracBrowser for help on using the repository browser.