MRTKLIB
0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_foundation.h
Go to the documentation of this file.
1
/*------------------------------------------------------------------------------
2
* mrtk_foundation.h : common types, standard includes, and system constants
3
*
4
* Copyright (C) 2026 H.SHIONO (MRTKLIB Project)
5
* Copyright (C) 2023-2025 Cabinet Office, Japan
6
* Copyright (C) 2024-2025 Lighthouse Technology & Consulting Co. Ltd.
7
* Copyright (C) 2023-2025 Japan Aerospace Exploration Agency
8
* Copyright (C) 2023-2025 TOSHIBA ELECTRONIC TECHNOLOGIES CORPORATION
9
* Copyright (C) 2015- Mitsubishi Electric Corp.
10
* Copyright (C) 2014 Geospatial Information Authority of Japan
11
* Copyright (C) 2014 T.SUZUKI
12
* Copyright (C) 2007-2023 T.TAKASU
13
*
14
* SPDX-License-Identifier: BSD-2-Clause
15
*----------------------------------------------------------------------------*/
16
/**
17
* @file mrtk_foundation.h
18
* @brief MRTKLIB Foundation — Common types, standard includes, and system
19
* constants (MAXSAT, NFREQ, MAXOBS, observation codes, etc.).
20
*
21
* Every public mrtk_*.h header includes this file so that downstream users
22
* get a consistent set of base types and array-size constants.
23
*
24
* @note Constellation satellite counts (MAXSAT) depend on compile-time flags
25
* (ENAGLO, ENAGAL, ENAQZS, ENACMP, ENAIRN). These flags are set via
26
* target_compile_definitions on the mrtklib CMake target and propagate
27
* to rtklib through PUBLIC link dependency.
28
*/
29
#ifndef MRTK_FOUNDATION_H
30
#define MRTK_FOUNDATION_H
31
32
#ifdef __cplusplus
33
extern
"C"
{
34
#endif
35
36
#include <stdbool.h>
37
#include <stddef.h>
38
#include <stdint.h>
39
40
/*============================================================================
41
* Frequency / Observation Constants
42
*===========================================================================*/
43
44
#ifndef NFREQ
45
#define NFREQ 3
/* number of carrier frequencies */
46
#endif
47
#define NFREQGLO 2
/* number of carrier frequencies of GLONASS */
48
#define NFREQPCV 12
/* number of carrier frequencies for pcv_t */
49
50
#ifndef NEXOBS
51
#define NEXOBS 0
/* number of extended obs codes */
52
#endif
53
54
#define SNR_UNIT 0.001
/* SNR unit (dBHz) */
55
56
/*============================================================================
57
* Constellation PRN / Satellite Count Defines
58
*===========================================================================*/
59
60
#define MINPRNGPS 1
/* min satellite PRN number of GPS */
61
#define MAXPRNGPS 32
/* max satellite PRN number of GPS */
62
#define NSATGPS (MAXPRNGPS - MINPRNGPS + 1)
/* number of GPS satellites */
63
#define NSYSGPS 1
64
65
#ifdef ENAGLO
66
#define MINPRNGLO 1
/* min satellite slot number of GLONASS */
67
#define MAXPRNGLO 27
/* max satellite slot number of GLONASS */
68
#define NSATGLO (MAXPRNGLO - MINPRNGLO + 1)
/* number of GLONASS satellites */
69
#define NSYSGLO 1
70
#else
71
#define MINPRNGLO 0
72
#define MAXPRNGLO 0
73
#define NSATGLO 0
74
#define NSYSGLO 0
75
#endif
76
#ifdef ENAGAL
77
#define MINPRNGAL 1
/* min satellite PRN number of Galileo */
78
#define MAXPRNGAL 36
/* max satellite PRN number of Galileo */
79
#define NSATGAL (MAXPRNGAL - MINPRNGAL + 1)
/* number of Galileo satellites */
80
#define NSYSGAL 1
81
#else
82
#define MINPRNGAL 0
83
#define MAXPRNGAL 0
84
#define NSATGAL 0
85
#define NSYSGAL 0
86
#endif
87
#ifdef ENAQZS
88
#define MINPRNQZS 193
/* min satellite PRN number of QZSS */
89
#define MAXPRNQZS 202
/* max satellite PRN number of QZSS */
90
#define MINPRNQZS_S 183
/* min satellite PRN number of QZSS L1S */
91
#define MAXPRNQZS_S 191
/* max satellite PRN number of QZSS L1S */
92
#define NSATQZS (MAXPRNQZS - MINPRNQZS + 1)
/* number of QZSS satellites */
93
#define NSYSQZS 1
94
#else
95
#define MINPRNQZS 0
96
#define MAXPRNQZS 0
97
#define MINPRNQZS_S 0
98
#define MAXPRNQZS_S 0
99
#define NSATQZS 0
100
#define NSYSQZS 0
101
#endif
102
#ifdef ENACMP
103
#define MINPRNCMP 1
/* min satellite sat number of BeiDou */
104
#define MAXPRNCMP 63
/* max satellite sat number of BeiDou */
105
#define NSATCMP (MAXPRNCMP - MINPRNCMP + 1)
/* number of BeiDou satellites */
106
#define NSYSCMP 1
107
#define MINPRNBDS3 19
/* min satellite sat number of BeiDou-3 */
108
#else
109
#define MINPRNCMP 0
110
#define MAXPRNCMP 0
111
#define NSATCMP 0
112
#define NSYSCMP 0
113
#endif
114
#ifdef ENAIRN
115
#define MINPRNIRN 1
/* min satellite sat number of IRNSS */
116
#define MAXPRNIRN 14
/* max satellite sat number of IRNSS */
117
#define NSATIRN (MAXPRNIRN - MINPRNIRN + 1)
/* number of IRNSS satellites */
118
#define NSYSIRN 1
119
#else
120
#define MINPRNIRN 0
121
#define MAXPRNIRN 0
122
#define NSATIRN 0
123
#define NSYSIRN 0
124
#endif
125
#ifdef ENALEO
126
#define MINPRNLEO 1
/* min satellite sat number of LEO */
127
#define MAXPRNLEO 10
/* max satellite sat number of LEO */
128
#define NSATLEO (MAXPRNLEO - MINPRNLEO + 1)
/* number of LEO satellites */
129
#define NSYSLEO 1
130
#else
131
#define MINPRNLEO 0
132
#define MAXPRNLEO 0
133
#define NSATLEO 0
134
#define NSYSLEO 0
135
#endif
136
#define NSYS (NSYSGPS + NSYSGLO + NSYSGAL + NSYSQZS + NSYSCMP + NSYSIRN + NSYSLEO)
/* number of systems */
137
138
#define MINPRNSBS 120
/* min satellite PRN number of SBAS */
139
#define MAXPRNSBS 158
/* max satellite PRN number of SBAS */
140
#define NSATSBS (MAXPRNSBS - MINPRNSBS + 1)
/* number of SBAS satellites */
141
142
#define MAXSAT (NSATGPS + NSATGLO + NSATGAL + NSATQZS + NSATCMP + NSATIRN + NSATSBS + NSATLEO)
143
/* max satellite number (1 to MAXSAT) */
144
#define MAXSTA 255
145
146
/*============================================================================
147
* Array-Size Constants
148
*===========================================================================*/
149
150
#ifndef MAXOBS
151
#define MAXOBS 96
/* max number of obs in an epoch */
152
#endif
153
#define MAXRCV 64
/* max receiver number (1 to MAXRCV) */
154
#define MAXOBSTYPE 64
/* max number of obs type in RINEX */
155
#ifdef OBS_100HZ
156
#define DTTOL 0.005
/* tolerance of time difference (s) */
157
#else
158
#define DTTOL 0.025
/* tolerance of time difference (s) */
159
#endif
160
#define MAXEXFILE 1024
/* max number of expanded files */
161
#define SSR_CH_NUM 2
/* number of SSR input channels */
162
#define MAXBAND 10
/* max SBAS band of IGP */
163
#define MAXNIGP 201
/* max number of IGP in SBAS band */
164
#define MAXNGEO 4
/* max number of GEO satellites */
165
#define MAXCOMMENT 100
/* max number of RINEX comments */
166
#define MAXSTRPATH 1024
/* max length of stream path */
167
#define MAXSTRMSG 1024
/* max length of stream message */
168
#define MAXSTRRTK 8
/* max number of stream in RTK server */
169
#define MAXSBSMSG 32
/* max number of SBAS msg in RTK server */
170
#define MAXSOLMSG 8191
/* max length of solution message */
171
#define MAXRAWLEN 16384
/* max length of receiver raw message */
172
#define MAXERRMSG 4096
/* max length of error/warning message */
173
#define MAXANT 64
/* max length of station name/antenna type */
174
#define MAXSOLBUF 256
/* max number of solution buffer */
175
#define MAXOBSBUF 128
/* max number of observation data buffer */
176
#define MAXNRPOS 16
/* max number of reference positions */
177
#define MAXLEAPS 64
/* max number of leap seconds table */
178
#define MAXGISLAYER 32
/* max number of GIS data layers */
179
#define MAXRCVCMD 4096
/* max length of receiver commands */
180
181
/*============================================================================
182
* Observation Code Constants
183
*===========================================================================*/
184
185
#define CODE_NONE 0
/* obs code: none or unknown */
186
#define CODE_L1C 1
/* obs code: L1C/A,G1C/A,E1C (GPS,GLO,GAL,QZS,SBS) */
187
#define CODE_L1P 2
/* obs code: L1P,G1P,B1C(P) (GPS,GLO,BDS) */
188
#define CODE_L1W 3
/* obs code: L1 Z-track (GPS) */
189
#define CODE_L1Y 4
/* obs code: L1Y (GPS) */
190
#define CODE_L1M 5
/* obs code: L1M (GPS) */
191
#define CODE_L1N 6
/* obs code: L1codeless,B1codeless (GPS,BDS) */
192
#define CODE_L1S 7
/* obs code: L1C(D),B1A(D) (GPS,QZS,BDS) */
193
#define CODE_L1L 8
/* obs code: L1C(P),B1A(P) (GPS,QZS,BDS) */
194
#define CODE_L1E 9
/* (not used) */
195
#define CODE_L1A 10
/* obs code: E1A (GAL) */
196
#define CODE_L1B 11
/* obs code: E1B,L1Sb (GAL,QZS) */
197
#define CODE_L1X 12
/* obs code: E1B+C,L1C(D+P),B1C(D+P) (GAL,QZS,BDS) */
198
#define CODE_L1Z 13
/* obs code: E1A+B+C,L1S,B1A(D+P) (GAL,QZS,BDS) */
199
#define CODE_L2C 14
/* obs code: L2C/A,G1C/A (GPS,GLO) */
200
#define CODE_L2D 15
/* obs code: L2 L1C/A-(P2-P1) (GPS) */
201
#define CODE_L2S 16
/* obs code: L2C(M) (GPS,QZS) */
202
#define CODE_L2L 17
/* obs code: L2C(L) (GPS,QZS) */
203
#define CODE_L2X 18
/* obs code: L2C(M+L),B1_2I+Q (GPS,QZS,BDS) */
204
#define CODE_L2P 19
/* obs code: L2P,G2P (GPS,GLO) */
205
#define CODE_L2W 20
/* obs code: L2 Z-track (GPS) */
206
#define CODE_L2Y 21
/* obs code: L2Y (GPS) */
207
#define CODE_L2M 22
/* obs code: L2M (GPS) */
208
#define CODE_L2N 23
/* obs code: L2codeless (GPS) */
209
#define CODE_L5I 24
/* obs code: L5I,E5aI (GPS,GAL,QZS,SBS) */
210
#define CODE_L5Q 25
/* obs code: L5Q,E5aQ (GPS,GAL,QZS,SBS) */
211
#define CODE_L5X 26
/* obs code: L5I+Q,E5aI+Q,L5B+C,B2aD+P (GPS,GAL,QZS,IRN,SBS,BDS) */
212
#define CODE_L7I 27
/* obs code: E5bI,B2bI (GAL,BDS) */
213
#define CODE_L7Q 28
/* obs code: E5bQ,B2bQ (GAL,BDS) */
214
#define CODE_L7X 29
/* obs code: E5bI+Q,B2bI+Q (GAL,BDS) */
215
#define CODE_L6A 30
/* obs code: E6A,B3A (GAL,BDS) */
216
#define CODE_L6B 31
/* obs code: E6B (GAL) */
217
#define CODE_L6C 32
/* obs code: E6C (GAL) */
218
#define CODE_L6X 33
/* obs code: E6B+C,L6(D+P),B3I+Q (GAL,QZS,BDS) */
219
#define CODE_L6Z 34
/* obs code: E6A+B+C,L6(D+E),B3A(D+P) (GAL,QZS,BDS) */
220
#define CODE_L6S 35
/* obs code: L6D (QZS) */
221
#define CODE_L6L 36
/* obs code: L6P (QZS) */
222
#define CODE_L8I 37
/* obs code: E5abI (GAL) */
223
#define CODE_L8Q 38
/* obs code: E5abQ (GAL) */
224
#define CODE_L8X 39
/* obs code: E5abI+Q,B2abD+P (GAL,BDS) */
225
#define CODE_L2I 40
/* obs code: B1_2I (BDS) */
226
#define CODE_L2Q 41
/* obs code: B1_2Q (BDS) */
227
#define CODE_L6I 42
/* obs code: B3I (BDS) */
228
#define CODE_L6Q 43
/* obs code: B3Q (BDS) */
229
#define CODE_L3I 44
/* obs code: G3I (GLO) */
230
#define CODE_L3Q 45
/* obs code: G3Q (GLO) */
231
#define CODE_L3X 46
/* obs code: G3I+Q (GLO) */
232
#define CODE_L1I 47
/* obs code: B1I (BDS) (obsolute) */
233
#define CODE_L1Q 48
/* obs code: B1Q (BDS) (obsolute) */
234
#define CODE_L5A 49
/* obs code: L5A SPS (IRN) */
235
#define CODE_L5B 50
/* obs code: L5B RS(D) (IRN) */
236
#define CODE_L5C 51
/* obs code: L5C RS(P) (IRN) */
237
#define CODE_L9A 52
/* obs code: SA SPS (IRN) */
238
#define CODE_L9B 53
/* obs code: SB RS(D) (IRN) */
239
#define CODE_L9C 54
/* obs code: SC RS(P) (IRN) */
240
#define CODE_L9X 55
/* obs code: SB+C (IRN) */
241
#define CODE_L1D 56
/* obs code: B1D (BDS) */
242
#define CODE_L5D 57
/* obs code: L5S(I),B2aD (QZS,BDS) */
243
#define CODE_L5P 58
/* obs code: L5S(Q),B2aP (QZS,BDS) */
244
#define CODE_L5Z 59
/* obs code: L5S(I+Q) (QZS) */
245
#define CODE_L6E 60
/* obs code: L6E (QZS) */
246
#define CODE_L7D 61
/* obs code: B2bD (BDS) */
247
#define CODE_L7P 62
/* obs code: B2bP (BDS) */
248
#define CODE_L7Z 63
/* obs code: B2bD+P (BDS) */
249
#define CODE_L8D 64
/* obs code: B2abD (BDS) */
250
#define CODE_L8P 65
/* obs code: B2abP (BDS) */
251
#define CODE_L4A 66
/* obs code: G1aL1OCd (GLO) */
252
#define CODE_L4B 67
/* obs code: G1aL1OCd (GLO) */
253
#define CODE_L4X 68
/* obs code: G1al1OCd+p (GLO) */
254
#define CODE_L6D 69
/* obs code: B3A(D) (BDS) */
255
#define CODE_L6P 70
/* obs code: B3A(P) (BDS) */
256
#define MAXCODE 70
/* max number of obs code */
257
258
/*============================================================================
259
* Physical Frequency Band Identifiers
260
*
261
* Per-constellation band names for unambiguous signal identification.
262
* Bands sharing the same physical frequency (e.g., GPS L1 = GAL E1 = 1575.42 MHz)
263
* are distinguished by constellation for clarity in configuration and RINEX mapping.
264
*===========================================================================*/
265
266
typedef
enum
{
267
MRTK_BAND_UNKNOWN
= 0,
268
/* GPS */
269
MRTK_BAND_GPS_L1
,
/* 1575.42 MHz */
270
MRTK_BAND_GPS_L2
,
/* 1227.60 MHz */
271
MRTK_BAND_GPS_L5
,
/* 1176.45 MHz */
272
/* GLONASS */
273
MRTK_BAND_GLO_G1
,
/* ~1602 MHz (FDMA) */
274
MRTK_BAND_GLO_G2
,
/* ~1246 MHz (FDMA) */
275
MRTK_BAND_GLO_G3
,
/* 1202.025 MHz */
276
/* Galileo */
277
MRTK_BAND_GAL_E1
,
/* 1575.42 MHz */
278
MRTK_BAND_GAL_E5a
,
/* 1176.45 MHz */
279
MRTK_BAND_GAL_E5b
,
/* 1207.14 MHz */
280
MRTK_BAND_GAL_E6
,
/* 1278.75 MHz */
281
MRTK_BAND_GAL_E5ab
,
/* 1191.795 MHz */
282
/* QZSS */
283
MRTK_BAND_QZS_L1
,
/* 1575.42 MHz */
284
MRTK_BAND_QZS_L2
,
/* 1227.60 MHz */
285
MRTK_BAND_QZS_L5
,
/* 1176.45 MHz */
286
MRTK_BAND_QZS_L6
,
/* 1278.75 MHz */
287
/* SBAS */
288
MRTK_BAND_SBS_L1
,
/* 1575.42 MHz */
289
MRTK_BAND_SBS_L5
,
/* 1176.45 MHz */
290
/* BDS */
291
MRTK_BAND_BDS_B1I
,
/* 1561.098 MHz */
292
MRTK_BAND_BDS_B1C
,
/* 1575.42 MHz */
293
MRTK_BAND_BDS_B2a
,
/* 1176.45 MHz */
294
MRTK_BAND_BDS_B2b
,
/* 1207.14 MHz */
295
MRTK_BAND_BDS_B2ab
,
/* 1191.795 MHz */
296
MRTK_BAND_BDS_B3
,
/* 1268.52 MHz */
297
/* NavIC */
298
MRTK_BAND_IRN_L5
,
/* 1176.45 MHz */
299
MRTK_BAND_IRN_S
,
/* 2492.028 MHz */
300
MRTK_BAND_MAX
301
}
mrtk_band_t
;
302
303
/*============================================================================
304
* Other Size Constants (used by nav_t and related types)
305
*===========================================================================*/
306
307
#define MAXBSNXSYS 7
/* BIAS-SINEX Supported GNSS(G,R,E,J,C,I,S) */
308
309
#define MAXSITES 256
/* max number of stat input streams */
310
#define MAXBLK 32
/* max number of block */
311
#define MAXTRPSTA 512
/* max number of tropospheric station blocks */
312
#define MAXIONSTA 256
/* max number of ionospheric station blocks */
313
#define MAX_REJ_SITES 5
/* max number of reject sites */
314
315
/*============================================================================
316
* MADOCA-PPP L6D Ionospheric Correction Constants
317
*===========================================================================*/
318
319
#define MIONO_MAX_RID 256
/* max region id (IS-QZSS-MDC-002 Table 6.3.2-4) */
320
#define MIONO_MAX_ANUM 32
/* max area number (Table 6.3.2-4) */
321
#define MIONO_MAX_PRN (2 + 1)
/* max MADOCA-PPP L6D signal (Table 3-1) + 1 reserved */
322
323
/*============================================================================
324
* Platform-Dependent Lock / Thread Types
325
*===========================================================================*/
326
327
#include <pthread.h>
328
#define rtk_thread_t pthread_t
329
#define rtk_lock_t pthread_mutex_t
330
#define rtk_initlock(f) pthread_mutex_init(f, NULL)
331
#define rtk_lock(f) pthread_mutex_lock(f)
332
#define rtk_unlock(f) pthread_mutex_unlock(f)
333
#define FILEPATHSEP '/'
334
335
#ifdef __cplusplus
336
}
337
#endif
338
339
#endif
/* MRTK_FOUNDATION_H */
mrtk_band_t
mrtk_band_t
Definition
mrtk_foundation.h:266
MRTK_BAND_GAL_E1
@ MRTK_BAND_GAL_E1
Definition
mrtk_foundation.h:277
MRTK_BAND_SBS_L5
@ MRTK_BAND_SBS_L5
Definition
mrtk_foundation.h:289
MRTK_BAND_BDS_B1I
@ MRTK_BAND_BDS_B1I
Definition
mrtk_foundation.h:291
MRTK_BAND_QZS_L1
@ MRTK_BAND_QZS_L1
Definition
mrtk_foundation.h:283
MRTK_BAND_GAL_E6
@ MRTK_BAND_GAL_E6
Definition
mrtk_foundation.h:280
MRTK_BAND_GAL_E5a
@ MRTK_BAND_GAL_E5a
Definition
mrtk_foundation.h:278
MRTK_BAND_BDS_B3
@ MRTK_BAND_BDS_B3
Definition
mrtk_foundation.h:296
MRTK_BAND_BDS_B2b
@ MRTK_BAND_BDS_B2b
Definition
mrtk_foundation.h:294
MRTK_BAND_GLO_G3
@ MRTK_BAND_GLO_G3
Definition
mrtk_foundation.h:275
MRTK_BAND_UNKNOWN
@ MRTK_BAND_UNKNOWN
Definition
mrtk_foundation.h:267
MRTK_BAND_GPS_L2
@ MRTK_BAND_GPS_L2
Definition
mrtk_foundation.h:270
MRTK_BAND_GLO_G1
@ MRTK_BAND_GLO_G1
Definition
mrtk_foundation.h:273
MRTK_BAND_IRN_L5
@ MRTK_BAND_IRN_L5
Definition
mrtk_foundation.h:298
MRTK_BAND_GAL_E5b
@ MRTK_BAND_GAL_E5b
Definition
mrtk_foundation.h:279
MRTK_BAND_BDS_B1C
@ MRTK_BAND_BDS_B1C
Definition
mrtk_foundation.h:292
MRTK_BAND_GPS_L1
@ MRTK_BAND_GPS_L1
Definition
mrtk_foundation.h:269
MRTK_BAND_MAX
@ MRTK_BAND_MAX
Definition
mrtk_foundation.h:300
MRTK_BAND_SBS_L1
@ MRTK_BAND_SBS_L1
Definition
mrtk_foundation.h:288
MRTK_BAND_GLO_G2
@ MRTK_BAND_GLO_G2
Definition
mrtk_foundation.h:274
MRTK_BAND_GAL_E5ab
@ MRTK_BAND_GAL_E5ab
Definition
mrtk_foundation.h:281
MRTK_BAND_QZS_L2
@ MRTK_BAND_QZS_L2
Definition
mrtk_foundation.h:284
MRTK_BAND_BDS_B2a
@ MRTK_BAND_BDS_B2a
Definition
mrtk_foundation.h:293
MRTK_BAND_IRN_S
@ MRTK_BAND_IRN_S
Definition
mrtk_foundation.h:299
MRTK_BAND_BDS_B2ab
@ MRTK_BAND_BDS_B2ab
Definition
mrtk_foundation.h:295
MRTK_BAND_QZS_L6
@ MRTK_BAND_QZS_L6
Definition
mrtk_foundation.h:286
MRTK_BAND_GPS_L5
@ MRTK_BAND_GPS_L5
Definition
mrtk_foundation.h:271
MRTK_BAND_QZS_L5
@ MRTK_BAND_QZS_L5
Definition
mrtk_foundation.h:285
include
mrtklib
mrtk_foundation.h
Generated by
1.15.0