1 | #define PRN_GPS_START 1
|
---|
2 | #define PRN_GPS_END 32
|
---|
3 | #define PRN_GLONASS_START 38
|
---|
4 | #define PRN_GLONASS_END 61
|
---|
5 |
|
---|
6 | #define GNSSENTRY_C1DATA 0
|
---|
7 | #define GNSSENTRY_C2DATA 1
|
---|
8 | #define GNSSENTRY_P1DATA 2
|
---|
9 | #define GNSSENTRY_P2DATA 3
|
---|
10 | #define GNSSENTRY_L1CDATA 4
|
---|
11 | #define GNSSENTRY_L1PDATA 5
|
---|
12 | #define GNSSENTRY_L2CDATA 6
|
---|
13 | #define GNSSENTRY_L2PDATA 7
|
---|
14 | #define GNSSENTRY_D1CDATA 8
|
---|
15 | #define GNSSENTRY_D1PDATA 9
|
---|
16 | #define GNSSENTRY_D2CDATA 10
|
---|
17 | #define GNSSENTRY_D2PDATA 11
|
---|
18 | #define GNSSENTRY_S1CDATA 12
|
---|
19 | #define GNSSENTRY_S1PDATA 13
|
---|
20 | #define GNSSENTRY_S2CDATA 14
|
---|
21 | #define GNSSENTRY_S2PDATA 15
|
---|
22 | #define GNSSENTRY_NUMBER 16 /* number of types!!! */
|
---|
23 |
|
---|
24 | /* Data flags. These flags are used in the dataflags field of gpsdata structure
|
---|
25 | and are used the determine, which data fields are filled with valid data. */
|
---|
26 | #define GNSSDF_C1DATA (1<<GNSSENTRY_C1DATA)
|
---|
27 | #define GNSSDF_C2DATA (1<<GNSSENTRY_C2DATA)
|
---|
28 | #define GNSSDF_P1DATA (1<<GNSSENTRY_P1DATA)
|
---|
29 | #define GNSSDF_P2DATA (1<<GNSSENTRY_P2DATA)
|
---|
30 | #define GNSSDF_L1CDATA (1<<GNSSENTRY_L1CDATA)
|
---|
31 | #define GNSSDF_L1PDATA (1<<GNSSENTRY_L1PDATA)
|
---|
32 | #define GNSSDF_L2CDATA (1<<GNSSENTRY_L2CDATA)
|
---|
33 | #define GNSSDF_L2PDATA (1<<GNSSENTRY_L2PDATA)
|
---|
34 | #define GNSSDF_D1CDATA (1<<GNSSENTRY_D1CDATA)
|
---|
35 | #define GNSSDF_D1PDATA (1<<GNSSENTRY_D1PDATA)
|
---|
36 | #define GNSSDF_D2CDATA (1<<GNSSENTRY_D2CDATA)
|
---|
37 | #define GNSSDF_D2PDATA (1<<GNSSENTRY_D2PDATA)
|
---|
38 | #define GNSSDF_S1CDATA (1<<GNSSENTRY_S1CDATA)
|
---|
39 | #define GNSSDF_S1PDATA (1<<GNSSENTRY_S1PDATA)
|
---|
40 | #define GNSSDF_S2CDATA (1<<GNSSENTRY_S2CDATA)
|
---|
41 | #define GNSSDF_S2PDATA (1<<GNSSENTRY_S2PDATA)
|
---|
42 |
|
---|
43 | #define RINEXENTRY_C1DATA 0
|
---|
44 | #define RINEXENTRY_C2DATA 1
|
---|
45 | #define RINEXENTRY_P1DATA 2
|
---|
46 | #define RINEXENTRY_P2DATA 3
|
---|
47 | #define RINEXENTRY_L1DATA 4
|
---|
48 | #define RINEXENTRY_L2DATA 5
|
---|
49 | #define RINEXENTRY_D1DATA 6
|
---|
50 | #define RINEXENTRY_D2DATA 7
|
---|
51 | #define RINEXENTRY_S1DATA 8
|
---|
52 | #define RINEXENTRY_S2DATA 9
|
---|
53 | #define RINEXENTRY_NUMBER 10
|
---|
54 |
|
---|
55 | /* unimportant, only for approx. time needed */
|
---|
56 | #define LEAPSECONDS 14
|
---|
57 |
|
---|
58 | /* Additional flags for the data field, which tell us more. */
|
---|
59 | #define GNSSDF_LOCKLOSSL1 (1<<29) /* lost lock on L1 */
|
---|
60 | #define GNSSDF_LOCKLOSSL2 (1<<30) /* lost lock on L2 */
|
---|
61 |
|
---|
62 | struct gnssdata {
|
---|
63 | int flags; /* GPSF_xxx */
|
---|
64 | int week; /* week number of GPS date */
|
---|
65 | int numsats;
|
---|
66 | double timeofweek; /* milliseconds in GPS week */
|
---|
67 | double measdata[24][GNSSENTRY_NUMBER]; /* data fields */
|
---|
68 | int dataflags[24]; /* GPSDF_xxx */
|
---|
69 | int satellites[24]; /* SV - IDs */
|
---|
70 | int snrL1[24]; /* Important: all the 5 SV-specific fields must */
|
---|
71 | int snrL2[24]; /* have the same SV-order */
|
---|
72 | };
|
---|
73 |
|
---|
74 | struct RTCM3ParserData {
|
---|
75 | unsigned char Message[2048]; /* input-buffer */
|
---|
76 | int MessageSize; /* current buffer size */
|
---|
77 | int NeedBytes; /* bytes wanted for next run */
|
---|
78 | int SkipBytes; /* bytes to skip in next round */
|
---|
79 | int GPSWeek;
|
---|
80 | int GPSTOW; /* in seconds */
|
---|
81 | struct gnssdata Data;
|
---|
82 | int size;
|
---|
83 | int lastlockl1[64];
|
---|
84 | int lastlockl2[64];
|
---|
85 | int datapos[RINEXENTRY_NUMBER];
|
---|
86 | int dataflag[RINEXENTRY_NUMBER];
|
---|
87 | int numdatatypes;
|
---|
88 | int validwarning;
|
---|
89 | int init;
|
---|
90 | const char * headerfile;
|
---|
91 | };
|
---|
92 |
|
---|
93 | struct converttimeinfo {
|
---|
94 | int second; /* seconds of GPS time [0..59] */
|
---|
95 | int minute; /* minutes of GPS time [0..59] */
|
---|
96 | int hour; /* hour of GPS time [0..24] */
|
---|
97 | int day; /* day of GPS time [1..28..30(31)*/
|
---|
98 | int month; /* month of GPS time [1..12]*/
|
---|
99 | int year; /* year of GPS time [1980..] */
|
---|
100 | };
|
---|
101 |
|
---|
102 | void HandleHeader(struct RTCM3ParserData *Parser);
|
---|
103 | int RTCM3Parser(struct RTCM3ParserData *handle);
|
---|
104 | void HandleByte(struct RTCM3ParserData *Parser, unsigned int byte);
|
---|
105 | void converttime(struct converttimeinfo *c, int week, int tow);
|
---|
106 |
|
---|