-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtcm.h
816 lines (740 loc) · 42.2 KB
/
rtcm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
/*------------------------------------------------------------------------------
* rtcm.h : RTKLIB constants, types and function prototypes
*
* Copyright (C) 2007-2020 by T.TAKASU, All rights reserved.
*
* options : -DENAGLO enable GLONASS
* -DENAGAL enable Galileo
* -DENAQZS enable QZSS
* -DENACMP enable BeiDou
* -DENAIRN enable IRNSS
* -DNFREQ=n set number of obs codes/frequencies
* -DNEXOBS=n set number of extended obs codes
* -DMAXOBS=n set max number of obs data in an epoch
* -DWIN32 use WIN32 API
* -DWIN_DLL generate library as Windows DLL
*
* version : $Revision:$ $Date:$
* history : 2007/01/13 1.0 rtklib ver.1.0.0
* 2007/03/20 1.1 rtklib ver.1.1.0
* 2008/07/15 1.2 rtklib ver.2.1.0
* 2008/10/19 1.3 rtklib ver.2.1.1
* 2009/01/31 1.4 rtklib ver.2.2.0
* 2009/04/30 1.5 rtklib ver.2.2.1
* 2009/07/30 1.6 rtklib ver.2.2.2
* 2009/12/25 1.7 rtklib ver.2.3.0
* 2010/07/29 1.8 rtklib ver.2.4.0
* 2011/05/27 1.9 rtklib ver.2.4.1
* 2013/03/28 1.10 rtklib ver.2.4.2
* 2020/11/30 1.11 rtklib ver.2.4.3 b34
*-----------------------------------------------------------------------------*/
#ifndef RTCM_H
#define RTCM_H
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef WIN_DLL
#define EXPORT __declspec(dllexport) /* for Windows DLL */
#else
#define EXPORT
#endif
/* constants -----------------------------------------------------------------*/
#define VER_RTKLIB "2.4.3" /* library version */
#define PATCH_LEVEL "b34" /* patch level */
#define COPYRIGHT_RTKLIB \
"Copyright (C) 2007-2020 T.Takasu\nAll rights reserved."
#define RTCM3PREAMB 0xD3 /* rtcm ver.3 frame preamble */
#define PI 3.1415926535897932 /* pi */
#define D2R (PI/180.0) /* deg to rad */
#define R2D (180.0/PI) /* rad to deg */
#define CLIGHT 299792458.0 /* speed of light (m/s) */
#define SC2RAD 3.1415926535898 /* semi-circle to radian (IS-GPS) */
#define AU 149597870691.0 /* 1 AU (m) */
#define AS2R (D2R/3600.0) /* arc sec to radian */
#define OMGE 7.2921151467E-5 /* earth angular velocity (IS-GPS) (rad/s) */
#define RE_WGS84 6378137.0 /* earth semimajor axis (WGS84) (m) */
#define FE_WGS84 (1.0/298.257223563) /* earth flattening (WGS84) */
#define HION 350000.0 /* ionosphere height (m) */
#define MAXFREQ 7 /* max NFREQ */
#define FREQ1 1.57542E9 /* L1/E1/B1C frequency (Hz) */
#define FREQ2 1.22760E9 /* L2 frequency (Hz) */
#define FREQ5 1.17645E9 /* L5/E5a/B2a frequency (Hz) */
#define FREQ6 1.27875E9 /* E6/L6 frequency (Hz) */
#define FREQ7 1.20714E9 /* E5b frequency (Hz) */
#define FREQ8 1.191795E9 /* E5a+b frequency (Hz) */
#define FREQ9 2.492028E9 /* S frequency (Hz) */
#define FREQ1_GLO 1.60200E9 /* GLONASS G1 base frequency (Hz) */
#define DFRQ1_GLO 0.56250E6 /* GLONASS G1 bias frequency (Hz/n) */
#define FREQ2_GLO 1.24600E9 /* GLONASS G2 base frequency (Hz) */
#define DFRQ2_GLO 0.43750E6 /* GLONASS G2 bias frequency (Hz/n) */
#define FREQ3_GLO 1.202025E9 /* GLONASS G3 frequency (Hz) */
#define FREQ1a_GLO 1.600995E9 /* GLONASS G1a frequency (Hz) */
#define FREQ2a_GLO 1.248060E9 /* GLONASS G2a frequency (Hz) */
#define FREQ1_CMP 1.561098E9 /* BDS B1I frequency (Hz) */
#define FREQ2_CMP 1.20714E9 /* BDS B2I/B2b frequency (Hz) */
#define FREQ3_CMP 1.26852E9 /* BDS B3 frequency (Hz) */
#define EFACT_GPS 1.0 /* error factor: GPS */
#define EFACT_GLO 1.5 /* error factor: GLONASS */
#define EFACT_GAL 1.0 /* error factor: Galileo */
#define EFACT_QZS 1.0 /* error factor: QZSS */
#define EFACT_CMP 1.0 /* error factor: BeiDou */
#define EFACT_IRN 1.5 /* error factor: IRNSS */
#define EFACT_SBS 3.0 /* error factor: SBAS */
#define SYS_NONE 0x00 /* navigation system: none */
#define SYS_GPS 0x01 /* navigation system: GPS */
#define SYS_SBS 0x02 /* navigation system: SBAS */
#define SYS_GLO 0x04 /* navigation system: GLONASS */
#define SYS_GAL 0x08 /* navigation system: Galileo */
#define SYS_QZS 0x10 /* navigation system: QZSS */
#define SYS_CMP 0x20 /* navigation system: BeiDou */
#define SYS_IRN 0x40 /* navigation system: IRNS */
#define SYS_LEO 0x80 /* navigation system: LEO */
#define SYS_ALL 0xFF /* navigation system: all */
#define TSYS_GPS 0 /* time system: GPS time */
#define TSYS_UTC 1 /* time system: UTC */
#define TSYS_GLO 2 /* time system: GLONASS time */
#define TSYS_GAL 3 /* time system: Galileo time */
#define TSYS_QZS 4 /* time system: QZSS time */
#define TSYS_CMP 5 /* time system: BeiDou time */
#define TSYS_IRN 6 /* time system: IRNSS time */
#ifndef NFREQ
#define NFREQ 3 /* number of carrier frequencies */
#endif
#define NFREQGLO 2 /* number of carrier frequencies of GLONASS */
#ifndef NEXOBS
#define NEXOBS 0 /* number of extended obs codes */
#endif
#define SNR_UNIT 0.001 /* SNR unit (dBHz) */
#define MINPRNGPS 1 /* min satellite PRN number of GPS */
#define MAXPRNGPS 32 /* max satellite PRN number of GPS */
#define NSATGPS (MAXPRNGPS-MINPRNGPS+1) /* number of GPS satellites */
#define NSYSGPS 1
#ifdef ENAGLO
#define MINPRNGLO 1 /* min satellite slot number of GLONASS */
#define MAXPRNGLO 27 /* max satellite slot number of GLONASS */
#define NSATGLO (MAXPRNGLO-MINPRNGLO+1) /* number of GLONASS satellites */
#define NSYSGLO 1
#else
#define MINPRNGLO 0
#define MAXPRNGLO 0
#define NSATGLO 0
#define NSYSGLO 0
#endif
#ifdef ENAGAL
#define MINPRNGAL 1 /* min satellite PRN number of Galileo */
#define MAXPRNGAL 36 /* max satellite PRN number of Galileo */
#define NSATGAL (MAXPRNGAL-MINPRNGAL+1) /* number of Galileo satellites */
#define NSYSGAL 1
#else
#define MINPRNGAL 0
#define MAXPRNGAL 0
#define NSATGAL 0
#define NSYSGAL 0
#endif
#ifdef ENAQZS
#define MINPRNQZS 193 /* min satellite PRN number of QZSS */
#define MAXPRNQZS 202 /* max satellite PRN number of QZSS */
#define MINPRNQZS_S 183 /* min satellite PRN number of QZSS L1S */
#define MAXPRNQZS_S 191 /* max satellite PRN number of QZSS L1S */
#define NSATQZS (MAXPRNQZS-MINPRNQZS+1) /* number of QZSS satellites */
#define NSYSQZS 1
#else
#define MINPRNQZS 0
#define MAXPRNQZS 0
#define MINPRNQZS_S 0
#define MAXPRNQZS_S 0
#define NSATQZS 0
#define NSYSQZS 0
#endif
#ifdef ENACMP
#define MINPRNCMP 1 /* min satellite sat number of BeiDou */
#define MAXPRNCMP 63 /* max satellite sat number of BeiDou */
#define NSATCMP (MAXPRNCMP-MINPRNCMP+1) /* number of BeiDou satellites */
#define NSYSCMP 1
#else
#define MINPRNCMP 0
#define MAXPRNCMP 0
#define NSATCMP 0
#define NSYSCMP 0
#endif
#ifdef ENAIRN
#define MINPRNIRN 1 /* min satellite sat number of IRNSS */
#define MAXPRNIRN 14 /* max satellite sat number of IRNSS */
#define NSATIRN (MAXPRNIRN-MINPRNIRN+1) /* number of IRNSS satellites */
#define NSYSIRN 1
#else
#define MINPRNIRN 0
#define MAXPRNIRN 0
#define NSATIRN 0
#define NSYSIRN 0
#endif
#ifdef ENALEO
#define MINPRNLEO 1 /* min satellite sat number of LEO */
#define MAXPRNLEO 10 /* max satellite sat number of LEO */
#define NSATLEO (MAXPRNLEO-MINPRNLEO+1) /* number of LEO satellites */
#define NSYSLEO 1
#else
#define MINPRNLEO 0
#define MAXPRNLEO 0
#define NSATLEO 0
#define NSYSLEO 0
#endif
#define NSYS (NSYSGPS+NSYSGLO+NSYSGAL+NSYSQZS+NSYSCMP+NSYSIRN+NSYSLEO) /* number of systems */
#define MINPRNSBS 120 /* min satellite PRN number of SBAS */
#define MAXPRNSBS 158 /* max satellite PRN number of SBAS */
#define NSATSBS (MAXPRNSBS-MINPRNSBS+1) /* number of SBAS satellites */
#define MAXSAT (NSATGPS+NSATGLO+NSATGAL+NSATQZS+NSATCMP+NSATIRN+NSATSBS+NSATLEO)
/* max satellite number (1 to MAXSAT) */
#define MAXSTA 255
#ifndef MAXOBS
#define MAXOBS 96 /* max number of obs in an epoch */
#endif
#define MAXRCV 64 /* max receiver number (1 to MAXRCV) */
#define MAXOBSTYPE 64 /* max number of obs type in RINEX */
#ifdef OBS_100HZ
#define DTTOL 0.005 /* tolerance of time difference (s) */
#else
#define DTTOL 0.025 /* tolerance of time difference (s) */
#endif
#define MAXDTOE 7200.0 /* max time difference to GPS Toe (s) */
#define MAXDTOE_QZS 7200.0 /* max time difference to QZSS Toe (s) */
#define MAXDTOE_GAL 14400.0 /* max time difference to Galileo Toe (s) */
#define MAXDTOE_CMP 21600.0 /* max time difference to BeiDou Toe (s) */
#define MAXDTOE_GLO 1800.0 /* max time difference to GLONASS Toe (s) */
#define MAXDTOE_IRN 7200.0 /* max time difference to IRNSS Toe (s) */
#define MAXDTOE_SBS 360.0 /* max time difference to SBAS Toe (s) */
#define MAXDTOE_S 86400.0 /* max time difference to ephem toe (s) for other */
#define MAXGDOP 300.0 /* max GDOP */
#define INT_SWAP_TRAC 86400.0 /* swap interval of trace file (s) */
#define INT_SWAP_STAT 86400.0 /* swap interval of solution status file (s) */
#define MAXEXFILE 1024 /* max number of expanded files */
#define MAXSBSAGEF 30.0 /* max age of SBAS fast correction (s) */
#define MAXSBSAGEL 1800.0 /* max age of SBAS long term corr (s) */
#define MAXSBSURA 8 /* max URA of SBAS satellite */
#define MAXBAND 10 /* max SBAS band of IGP */
#define MAXNIGP 201 /* max number of IGP in SBAS band */
#define MAXNGEO 4 /* max number of GEO satellites */
#define MAXCOMMENT 100 /* max number of RINEX comments */
#define MAXSTRPATH 1024 /* max length of stream path */
#define MAXSTRMSG 1024 /* max length of stream message */
#define MAXSTRRTK 8 /* max number of stream in RTK server */
#define MAXSBSMSG 32 /* max number of SBAS msg in RTK server */
#define MAXSOLMSG 8191 /* max length of solution message */
#define MAXRAWLEN 16384 /* max length of receiver raw message */
#define MAXERRMSG 4096 /* max length of error/warning message */
#define MAXANT 64 /* max length of station name/antenna type */
#define MAXSOLBUF 256 /* max number of solution buffer */
#define MAXOBSBUF 128 /* max number of observation data buffer */
#define MAXNRPOS 16 /* max number of reference positions */
#define MAXLEAPS 64 /* max number of leap seconds table */
#define MAXGISLAYER 32 /* max number of GIS data layers */
#define MAXRCVCMD 4096 /* max length of receiver commands */
#define RNX2VER 2.10 /* RINEX ver.2 default output version */
#define RNX3VER 3.00 /* RINEX ver.3 default output version */
#define OBSTYPE_PR 0x01 /* observation type: pseudorange */
#define OBSTYPE_CP 0x02 /* observation type: carrier-phase */
#define OBSTYPE_DOP 0x04 /* observation type: doppler-freq */
#define OBSTYPE_SNR 0x08 /* observation type: SNR */
#define OBSTYPE_ALL 0xFF /* observation type: all */
#define FREQTYPE_L1 0x01 /* frequency type: L1/E1/B1 */
#define FREQTYPE_L2 0x02 /* frequency type: L2/E5b/B2 */
#define FREQTYPE_L3 0x04 /* frequency type: L5/E5a/L3 */
#define FREQTYPE_L4 0x08 /* frequency type: L6/E6/B3 */
#define FREQTYPE_L5 0x10 /* frequency type: E5ab */
#define FREQTYPE_ALL 0xFF /* frequency type: all */
#define CODE_NONE 0 /* obs code: none or unknown */
#define CODE_L1C 1 /* obs code: L1C/A,G1C/A,E1C (GPS,GLO,GAL,QZS,SBS) */
#define CODE_L1P 2 /* obs code: L1P,G1P,B1P (GPS,GLO,BDS) */
#define CODE_L1W 3 /* obs code: L1 Z-track (GPS) */
#define CODE_L1Y 4 /* obs code: L1Y (GPS) */
#define CODE_L1M 5 /* obs code: L1M (GPS) */
#define CODE_L1N 6 /* obs code: L1codeless,B1codeless (GPS,BDS) */
#define CODE_L1S 7 /* obs code: L1C(D) (GPS,QZS) */
#define CODE_L1L 8 /* obs code: L1C(P) (GPS,QZS) */
#define CODE_L1E 9 /* (not used) */
#define CODE_L1A 10 /* obs code: E1A,B1A (GAL,BDS) */
#define CODE_L1B 11 /* obs code: E1B (GAL) */
#define CODE_L1X 12 /* obs code: E1B+C,L1C(D+P),B1D+P (GAL,QZS,BDS) */
#define CODE_L1Z 13 /* obs code: E1A+B+C,L1S (GAL,QZS) */
#define CODE_L2C 14 /* obs code: L2C/A,G1C/A (GPS,GLO) */
#define CODE_L2D 15 /* obs code: L2 L1C/A-(P2-P1) (GPS) */
#define CODE_L2S 16 /* obs code: L2C(M) (GPS,QZS) */
#define CODE_L2L 17 /* obs code: L2C(L) (GPS,QZS) */
#define CODE_L2X 18 /* obs code: L2C(M+L),B1_2I+Q (GPS,QZS,BDS) */
#define CODE_L2P 19 /* obs code: L2P,G2P (GPS,GLO) */
#define CODE_L2W 20 /* obs code: L2 Z-track (GPS) */
#define CODE_L2Y 21 /* obs code: L2Y (GPS) */
#define CODE_L2M 22 /* obs code: L2M (GPS) */
#define CODE_L2N 23 /* obs code: L2codeless (GPS) */
#define CODE_L5I 24 /* obs code: L5I,E5aI (GPS,GAL,QZS,SBS) */
#define CODE_L5Q 25 /* obs code: L5Q,E5aQ (GPS,GAL,QZS,SBS) */
#define CODE_L5X 26 /* obs code: L5I+Q,E5aI+Q,L5B+C,B2aD+P (GPS,GAL,QZS,IRN,SBS,BDS) */
#define CODE_L7I 27 /* obs code: E5bI,B2bI (GAL,BDS) */
#define CODE_L7Q 28 /* obs code: E5bQ,B2bQ (GAL,BDS) */
#define CODE_L7X 29 /* obs code: E5bI+Q,B2bI+Q (GAL,BDS) */
#define CODE_L6A 30 /* obs code: E6A,B3A (GAL,BDS) */
#define CODE_L6B 31 /* obs code: E6B (GAL) */
#define CODE_L6C 32 /* obs code: E6C (GAL) */
#define CODE_L6X 33 /* obs code: E6B+C,LEXS+L,B3I+Q (GAL,QZS,BDS) */
#define CODE_L6Z 34 /* obs code: E6A+B+C,L6D+E (GAL,QZS) */
#define CODE_L6S 35 /* obs code: L6S (QZS) */
#define CODE_L6L 36 /* obs code: L6L (QZS) */
#define CODE_L8I 37 /* obs code: E5abI (GAL) */
#define CODE_L8Q 38 /* obs code: E5abQ (GAL) */
#define CODE_L8X 39 /* obs code: E5abI+Q,B2abD+P (GAL,BDS) */
#define CODE_L2I 40 /* obs code: B1_2I (BDS) */
#define CODE_L2Q 41 /* obs code: B1_2Q (BDS) */
#define CODE_L6I 42 /* obs code: B3I (BDS) */
#define CODE_L6Q 43 /* obs code: B3Q (BDS) */
#define CODE_L3I 44 /* obs code: G3I (GLO) */
#define CODE_L3Q 45 /* obs code: G3Q (GLO) */
#define CODE_L3X 46 /* obs code: G3I+Q (GLO) */
#define CODE_L1I 47 /* obs code: B1I (BDS) (obsolute) */
#define CODE_L1Q 48 /* obs code: B1Q (BDS) (obsolute) */
#define CODE_L5A 49 /* obs code: L5A SPS (IRN) */
#define CODE_L5B 50 /* obs code: L5B RS(D) (IRN) */
#define CODE_L5C 51 /* obs code: L5C RS(P) (IRN) */
#define CODE_L9A 52 /* obs code: SA SPS (IRN) */
#define CODE_L9B 53 /* obs code: SB RS(D) (IRN) */
#define CODE_L9C 54 /* obs code: SC RS(P) (IRN) */
#define CODE_L9X 55 /* obs code: SB+C (IRN) */
#define CODE_L1D 56 /* obs code: B1D (BDS) */
#define CODE_L5D 57 /* obs code: L5D(L5S),B2aD (QZS,BDS) */
#define CODE_L5P 58 /* obs code: L5P(L5S),B2aP (QZS,BDS) */
#define CODE_L5Z 59 /* obs code: L5D+P(L5S) (QZS) */
#define CODE_L6E 60 /* obs code: L6E (QZS) */
#define CODE_L7D 61 /* obs code: B2bD (BDS) */
#define CODE_L7P 62 /* obs code: B2bP (BDS) */
#define CODE_L7Z 63 /* obs code: B2bD+P (BDS) */
#define CODE_L8D 64 /* obs code: B2abD (BDS) */
#define CODE_L8P 65 /* obs code: B2abP (BDS) */
#define CODE_L4A 66 /* obs code: G1aL1OCd (GLO) */
#define CODE_L4B 67 /* obs code: G1aL1OCd (GLO) */
#define CODE_L4X 68 /* obs code: G1al1OCd+p (GLO) */
#define MAXCODE 68 /* max number of obs code */
#define PMODE_SINGLE 0 /* positioning mode: single */
#define PMODE_DGPS 1 /* positioning mode: DGPS/DGNSS */
#define PMODE_KINEMA 2 /* positioning mode: kinematic */
#define PMODE_STATIC 3 /* positioning mode: static */
#define PMODE_MOVEB 4 /* positioning mode: moving-base */
#define PMODE_FIXED 5 /* positioning mode: fixed */
#define PMODE_PPP_KINEMA 6 /* positioning mode: PPP-kinemaric */
#define PMODE_PPP_STATIC 7 /* positioning mode: PPP-static */
#define PMODE_PPP_FIXED 8 /* positioning mode: PPP-fixed */
#define SOLF_LLH 0 /* solution format: lat/lon/height */
#define SOLF_XYZ 1 /* solution format: x/y/z-ecef */
#define SOLF_ENU 2 /* solution format: e/n/u-baseline */
#define SOLF_NMEA 3 /* solution format: NMEA-183 */
#define SOLF_STAT 4 /* solution format: solution status */
#define SOLF_GSIF 5 /* solution format: GSI F1/F2 */
#define SOLQ_NONE 0 /* solution status: no solution */
#define SOLQ_FIX 1 /* solution status: fix */
#define SOLQ_FLOAT 2 /* solution status: float */
#define SOLQ_SBAS 3 /* solution status: SBAS */
#define SOLQ_DGPS 4 /* solution status: DGPS/DGNSS */
#define SOLQ_SINGLE 5 /* solution status: single */
#define SOLQ_PPP 6 /* solution status: PPP */
#define SOLQ_DR 7 /* solution status: dead reconing */
#define MAXSOLQ 7 /* max number of solution status */
#define TIMES_GPST 0 /* time system: gps time */
#define TIMES_UTC 1 /* time system: utc */
#define TIMES_JST 2 /* time system: jst */
#define IONOOPT_OFF 0 /* ionosphere option: correction off */
#define IONOOPT_BRDC 1 /* ionosphere option: broadcast model */
#define IONOOPT_SBAS 2 /* ionosphere option: SBAS model */
#define IONOOPT_IFLC 3 /* ionosphere option: L1/L2 iono-free LC */
#define IONOOPT_EST 4 /* ionosphere option: estimation */
#define IONOOPT_TEC 5 /* ionosphere option: IONEX TEC model */
#define IONOOPT_QZS 6 /* ionosphere option: QZSS broadcast model */
#define IONOOPT_STEC 8 /* ionosphere option: SLANT TEC model */
#define TROPOPT_OFF 0 /* troposphere option: correction off */
#define TROPOPT_SAAS 1 /* troposphere option: Saastamoinen model */
#define TROPOPT_SBAS 2 /* troposphere option: SBAS model */
#define TROPOPT_EST 3 /* troposphere option: ZTD estimation */
#define TROPOPT_ESTG 4 /* troposphere option: ZTD+grad estimation */
#define TROPOPT_ZTD 5 /* troposphere option: ZTD correction */
#define EPHOPT_BRDC 0 /* ephemeris option: broadcast ephemeris */
#define EPHOPT_PREC 1 /* ephemeris option: precise ephemeris */
#define EPHOPT_SBAS 2 /* ephemeris option: broadcast + SBAS */
#define EPHOPT_SSRAPC 3 /* ephemeris option: broadcast + SSR_APC */
#define EPHOPT_SSRCOM 4 /* ephemeris option: broadcast + SSR_COM */
#define ARMODE_OFF 0 /* AR mode: off */
#define ARMODE_CONT 1 /* AR mode: continuous */
#define ARMODE_INST 2 /* AR mode: instantaneous */
#define ARMODE_FIXHOLD 3 /* AR mode: fix and hold */
#define ARMODE_WLNL 4 /* AR mode: wide lane/narrow lane */
#define ARMODE_TCAR 5 /* AR mode: triple carrier ar */
#define SBSOPT_LCORR 1 /* SBAS option: long term correction */
#define SBSOPT_FCORR 2 /* SBAS option: fast correction */
#define SBSOPT_ICORR 4 /* SBAS option: ionosphere correction */
#define SBSOPT_RANGE 8 /* SBAS option: ranging */
#define POSOPT_POS 0 /* pos option: LLH/XYZ */
#define POSOPT_SINGLE 1 /* pos option: average of single pos */
#define POSOPT_FILE 2 /* pos option: read from pos file */
#define POSOPT_RINEX 3 /* pos option: rinex header pos */
#define POSOPT_RTCM 4 /* pos option: rtcm/raw station pos */
#define STR_NONE 0 /* stream type: none */
#define STR_SERIAL 1 /* stream type: serial */
#define STR_FILE 2 /* stream type: file */
#define STR_TCPSVR 3 /* stream type: TCP server */
#define STR_TCPCLI 4 /* stream type: TCP client */
#define STR_NTRIPSVR 5 /* stream type: NTRIP server */
#define STR_NTRIPCLI 6 /* stream type: NTRIP client */
#define STR_FTP 7 /* stream type: ftp */
#define STR_HTTP 8 /* stream type: http */
#define STR_NTRIPCAS 9 /* stream type: NTRIP caster */
#define STR_UDPSVR 10 /* stream type: UDP server */
#define STR_UDPCLI 11 /* stream type: UDP server */
#define STR_MEMBUF 12 /* stream type: memory buffer */
#define STRFMT_RTCM2 0 /* stream format: RTCM 2 */
#define STRFMT_RTCM3 1 /* stream format: RTCM 3 */
#define STRFMT_OEM4 2 /* stream format: NovAtel OEMV/4 */
#define STRFMT_OEM3 3 /* stream format: NovAtel OEM3 */
#define STRFMT_UBX 4 /* stream format: u-blox LEA-*T */
#define STRFMT_SS2 5 /* stream format: NovAtel Superstar II */
#define STRFMT_CRES 6 /* stream format: Hemisphere */
#define STRFMT_STQ 7 /* stream format: SkyTraq S1315F */
#define STRFMT_JAVAD 8 /* stream format: JAVAD GRIL/GREIS */
#define STRFMT_NVS 9 /* stream format: NVS NVC08C */
#define STRFMT_BINEX 10 /* stream format: BINEX */
#define STRFMT_RT17 11 /* stream format: Trimble RT17 */
#define STRFMT_SEPT 12 /* stream format: Septentrio */
#define STRFMT_RINEX 13 /* stream format: RINEX */
#define STRFMT_SP3 14 /* stream format: SP3 */
#define STRFMT_RNXCLK 15 /* stream format: RINEX CLK */
#define STRFMT_SBAS 16 /* stream format: SBAS messages */
#define STRFMT_NMEA 17 /* stream format: NMEA 0183 */
#define MAXRCVFMT 12 /* max number of receiver format */
#define STR_MODE_R 0x1 /* stream mode: read */
#define STR_MODE_W 0x2 /* stream mode: write */
#define STR_MODE_RW 0x3 /* stream mode: read/write */
#define GEOID_EMBEDDED 0 /* geoid model: embedded geoid */
#define GEOID_EGM96_M150 1 /* geoid model: EGM96 15x15" */
#define GEOID_EGM2008_M25 2 /* geoid model: EGM2008 2.5x2.5" */
#define GEOID_EGM2008_M10 3 /* geoid model: EGM2008 1.0x1.0" */
#define GEOID_GSI2000_M15 4 /* geoid model: GSI geoid 2000 1.0x1.5" */
#define GEOID_RAF09 5 /* geoid model: IGN RAF09 for France 1.5"x2" */
#define COMMENTH "%" /* comment line indicator for solution */
#define MSG_DISCONN "$_DISCONNECT\r\n" /* disconnect message */
#define DLOPT_FORCE 0x01 /* download option: force download existing */
#define DLOPT_KEEPCMP 0x02 /* download option: keep compressed file */
#define DLOPT_HOLDERR 0x04 /* download option: hold on error file */
#define DLOPT_HOLDLST 0x08 /* download option: hold on listing file */
#define LLI_SLIP 0x01 /* LLI: cycle-slip */
#define LLI_HALFC 0x02 /* LLI: half-cycle not resovled */
#define LLI_BOCTRK 0x04 /* LLI: boc tracking of mboc signal */
#define LLI_HALFA 0x40 /* LLI: half-cycle added */
#define LLI_HALFS 0x80 /* LLI: half-cycle subtracted */
#define P2_5 0.03125 /* 2^-5 */
#define P2_6 0.015625 /* 2^-6 */
#define P2_11 4.882812500000000E-04 /* 2^-11 */
#define P2_15 3.051757812500000E-05 /* 2^-15 */
#define P2_17 7.629394531250000E-06 /* 2^-17 */
#define P2_19 1.907348632812500E-06 /* 2^-19 */
#define P2_20 9.536743164062500E-07 /* 2^-20 */
#define P2_21 4.768371582031250E-07 /* 2^-21 */
#define P2_23 1.192092895507810E-07 /* 2^-23 */
#define P2_24 5.960464477539063E-08 /* 2^-24 */
#define P2_27 7.450580596923828E-09 /* 2^-27 */
#define P2_29 1.862645149230957E-09 /* 2^-29 */
#define P2_30 9.313225746154785E-10 /* 2^-30 */
#define P2_31 4.656612873077393E-10 /* 2^-31 */
#define P2_32 2.328306436538696E-10 /* 2^-32 */
#define P2_33 1.164153218269348E-10 /* 2^-33 */
#define P2_35 2.910383045673370E-11 /* 2^-35 */
#define P2_38 3.637978807091710E-12 /* 2^-38 */
#define P2_39 1.818989403545856E-12 /* 2^-39 */
#define P2_40 9.094947017729280E-13 /* 2^-40 */
#define P2_43 1.136868377216160E-13 /* 2^-43 */
#define P2_48 3.552713678800501E-15 /* 2^-48 */
#define P2_50 8.881784197001252E-16 /* 2^-50 */
#define P2_55 2.775557561562891E-17 /* 2^-55 */
/* type definitions ----------------------------------------------------------*/
typedef struct { /* time struct */
time_t time; /* time (s) expressed by standard time_t */
double sec; /* fraction of second under 1 s */
} gtime_t;
typedef struct { /* observation data record */
gtime_t time; /* receiver sampling time (GPST) */
uint8_t sat,rcv; /* satellite/receiver number */
uint16_t SNR[NFREQ+NEXOBS]; /* signal strength (0.001 dBHz) */
uint8_t LLI[NFREQ+NEXOBS]; /* loss of lock indicator */
uint8_t code[NFREQ+NEXOBS]; /* code indicator (CODE_???) */
double L[NFREQ+NEXOBS]; /* observation data carrier-phase (cycle) */
double P[NFREQ+NEXOBS]; /* observation data pseudorange (m) */
float D[NFREQ+NEXOBS]; /* observation data doppler frequency (Hz) */
} obsd_t;
typedef struct { /* observation data */
int n,nmax; /* number of obervation data/allocated */
obsd_t *data; /* observation data records */
} obs_t;
typedef struct { /* earth rotation parameter data type */
double mjd; /* mjd (days) */
double xp,yp; /* pole offset (rad) */
double xpr,ypr; /* pole offset rate (rad/day) */
double ut1_utc; /* ut1-utc (s) */
double lod; /* length of day (s/day) */
} erpd_t;
typedef struct { /* earth rotation parameter type */
int n,nmax; /* number and max number of data */
erpd_t *data; /* earth rotation parameter data */
} erp_t;
typedef struct { /* antenna parameter type */
int sat; /* satellite number (0:receiver) */
char type[MAXANT]; /* antenna type */
char code[MAXANT]; /* serial number or satellite code */
gtime_t ts,te; /* valid time start and end */
double off[NFREQ][ 3]; /* phase center offset e/n/u or x/y/z (m) */
double var[NFREQ][19]; /* phase center variation (m) */
/* el=90,85,...,0 or nadir=0,1,2,3,... (deg) */
} pcv_t;
typedef struct { /* almanac type */
int sat; /* satellite number */
int svh; /* sv health (0:ok) */
int svconf; /* as and sv config */
int week; /* GPS/QZS: gps week, GAL: galileo week */
gtime_t toa; /* Toa */
/* SV orbit parameters */
double A,e,i0,OMG0,omg,M0,OMGd;
double toas; /* Toa (s) in week */
double f0,f1; /* SV clock parameters (af0,af1) */
} alm_t;
typedef struct { /* GPS/QZS/GAL broadcast ephemeris type */
int sat; /* satellite number */
int iode,iodc; /* IODE,IODC */
int sva; /* SV accuracy (URA index) */
int svh; /* SV health (0:ok) */
int week; /* GPS/QZS: gps week, GAL: galileo week */
int code; /* GPS/QZS: code on L2 */
/* GAL: data source defined as rinex 3.03 */
/* BDS: data source (0:unknown,1:B1I,2:B1Q,3:B2I,4:B2Q,5:B3I,6:B3Q) */
int flag; /* GPS/QZS: L2 P data flag */
/* BDS: nav type (0:unknown,1:IGSO/MEO,2:GEO) */
gtime_t toe,toc,ttr; /* Toe,Toc,T_trans */
/* SV orbit parameters */
double A,e,i0,OMG0,omg,M0,deln,OMGd,idot;
double crc,crs,cuc,cus,cic,cis;
double toes; /* Toe (s) in week */
double fit; /* fit interval (h) */
double f0,f1,f2; /* SV clock parameters (af0,af1,af2) */
double tgd[6]; /* group delay parameters */
/* GPS/QZS:tgd[0]=TGD */
/* GAL:tgd[0]=BGD_E1E5a,tgd[1]=BGD_E1E5b */
/* CMP:tgd[0]=TGD_B1I ,tgd[1]=TGD_B2I/B2b,tgd[2]=TGD_B1Cp */
/* tgd[3]=TGD_B2ap,tgd[4]=ISC_B1Cd ,tgd[5]=ISC_B2ad */
double Adot,ndot; /* Adot,ndot for CNAV */
} eph_t;
typedef struct { /* GLONASS broadcast ephemeris type */
int sat; /* satellite number */
int iode; /* IODE (0-6 bit of tb field) */
int frq; /* satellite frequency number */
int svh,sva,age; /* satellite health, accuracy, age of operation */
gtime_t toe; /* epoch of epherides (gpst) */
gtime_t tof; /* message frame time (gpst) */
double pos[3]; /* satellite position (ecef) (m) */
double vel[3]; /* satellite velocity (ecef) (m/s) */
double acc[3]; /* satellite acceleration (ecef) (m/s^2) */
double taun,gamn; /* SV clock bias (s)/relative freq bias */
double dtaun; /* delay between L1 and L2 (s) */
} geph_t;
typedef struct { /* precise ephemeris type */
gtime_t time; /* time (GPST) */
int index; /* ephemeris index for multiple files */
double pos[MAXSAT][4]; /* satellite position/clock (ecef) (m|s) */
float std[MAXSAT][4]; /* satellite position/clock std (m|s) */
double vel[MAXSAT][4]; /* satellite velocity/clk-rate (m/s|s/s) */
float vst[MAXSAT][4]; /* satellite velocity/clk-rate std (m/s|s/s) */
float cov[MAXSAT][3]; /* satellite position covariance (m^2) */
float vco[MAXSAT][3]; /* satellite velocity covariance (m^2) */
} peph_t;
typedef struct { /* precise clock type */
gtime_t time; /* time (GPST) */
int index; /* clock index for multiple files */
double clk[MAXSAT][1]; /* satellite clock (s) */
float std[MAXSAT][1]; /* satellite clock std (s) */
} pclk_t;
typedef struct { /* SBAS ephemeris type */
int sat; /* satellite number */
gtime_t t0; /* reference epoch time (GPST) */
gtime_t tof; /* time of message frame (GPST) */
int sva; /* SV accuracy (URA index) */
int svh; /* SV health (0:ok) */
double pos[3]; /* satellite position (m) (ecef) */
double vel[3]; /* satellite velocity (m/s) (ecef) */
double acc[3]; /* satellite acceleration (m/s^2) (ecef) */
double af0,af1; /* satellite clock-offset/drift (s,s/s) */
} seph_t;
typedef struct { /* TEC grid type */
gtime_t time; /* epoch time (GPST) */
int ndata[3]; /* TEC grid data size {nlat,nlon,nhgt} */
double rb; /* earth radius (km) */
double lats[3]; /* latitude start/interval (deg) */
double lons[3]; /* longitude start/interval (deg) */
double hgts[3]; /* heights start/interval (km) */
double *data; /* TEC grid data (tecu) */
float *rms; /* RMS values (tecu) */
} tec_t;
typedef struct { /* SBAS fast correction type */
gtime_t t0; /* time of applicability (TOF) */
double prc; /* pseudorange correction (PRC) (m) */
double rrc; /* range-rate correction (RRC) (m/s) */
double dt; /* range-rate correction delta-time (s) */
int iodf; /* IODF (issue of date fast corr) */
int16_t udre; /* UDRE+1 */
int16_t ai; /* degradation factor indicator */
} sbsfcorr_t;
typedef struct { /* SBAS long term satellite error correction type */
gtime_t t0; /* correction time */
int iode; /* IODE (issue of date ephemeris) */
double dpos[3]; /* delta position (m) (ecef) */
double dvel[3]; /* delta velocity (m/s) (ecef) */
double daf0,daf1; /* delta clock-offset/drift (s,s/s) */
} sbslcorr_t;
typedef struct { /* SBAS satellite correction type */
int sat; /* satellite number */
sbsfcorr_t fcorr; /* fast correction */
sbslcorr_t lcorr; /* long term correction */
} sbssatp_t;
typedef struct { /* SBAS satellite corrections type */
int iodp; /* IODP (issue of date mask) */
int nsat; /* number of satellites */
int tlat; /* system latency (s) */
sbssatp_t sat[MAXSAT]; /* satellite correction */
} sbssat_t;
typedef struct { /* SBAS ionospheric correction type */
gtime_t t0; /* correction time */
int16_t lat,lon; /* latitude/longitude (deg) */
int16_t give; /* GIVI+1 */
float delay; /* vertical delay estimate (m) */
} sbsigp_t;
typedef struct { /* SBAS ionospheric corrections type */
int iodi; /* IODI (issue of date ionos corr) */
int nigp; /* number of igps */
sbsigp_t igp[MAXNIGP]; /* ionospheric correction */
} sbsion_t;
typedef struct { /* DGPS/GNSS correction type */
gtime_t t0; /* correction time */
double prc; /* pseudorange correction (PRC) (m) */
double rrc; /* range rate correction (RRC) (m/s) */
int iod; /* issue of data (IOD) */
double udre; /* UDRE */
} dgps_t;
typedef struct { /* SSR correction type */
gtime_t t0[6]; /* epoch time (GPST) {eph,clk,hrclk,ura,bias,pbias} */
double udi[6]; /* SSR update interval (s) */
int iod[6]; /* iod ssr {eph,clk,hrclk,ura,bias,pbias} */
int iode; /* issue of data */
int iodcrc; /* issue of data crc for beidou/sbas */
int ura; /* URA indicator */
int refd; /* sat ref datum (0:ITRF,1:regional) */
double deph [3]; /* delta orbit {radial,along,cross} (m) */
double ddeph[3]; /* dot delta orbit {radial,along,cross} (m/s) */
double dclk [3]; /* delta clock {c0,c1,c2} (m,m/s,m/s^2) */
double hrclk; /* high-rate clock corection (m) */
float cbias[MAXCODE]; /* code biases (m) */
double pbias[MAXCODE]; /* phase biases (m) */
float stdpb[MAXCODE]; /* std-dev of phase biases (m) */
double yaw_ang,yaw_rate; /* yaw angle and yaw rate (deg,deg/s) */
uint8_t update; /* update flag (0:no update,1:update) */
} ssr_t;
typedef struct { /* navigation data type */
int n,nmax; /* number of broadcast ephemeris */
int ng,ngmax; /* number of glonass ephemeris */
int ns,nsmax; /* number of sbas ephemeris */
int ne,nemax; /* number of precise ephemeris */
int nc,ncmax; /* number of precise clock */
int na,namax; /* number of almanac data */
int nt,ntmax; /* number of tec grid data */
eph_t *eph; /* GPS/QZS/GAL/BDS/IRN ephemeris */
geph_t *geph; /* GLONASS ephemeris */
seph_t *seph; /* SBAS ephemeris */
peph_t *peph; /* precise ephemeris */
pclk_t *pclk; /* precise clock */
alm_t *alm; /* almanac data */
tec_t *tec; /* tec grid data */
erp_t erp; /* earth rotation parameters */
double utc_gps[8]; /* GPS delta-UTC parameters {A0,A1,Tot,WNt,dt_LS,WN_LSF,DN,dt_LSF} */
double utc_glo[8]; /* GLONASS UTC time parameters {tau_C,tau_GPS} */
double utc_gal[8]; /* Galileo UTC parameters */
double utc_qzs[8]; /* QZS UTC parameters */
double utc_cmp[8]; /* BeiDou UTC parameters */
double utc_irn[9]; /* IRNSS UTC parameters {A0,A1,Tot,...,dt_LSF,A2} */
double utc_sbs[4]; /* SBAS UTC parameters */
double ion_gps[8]; /* GPS iono model parameters {a0,a1,a2,a3,b0,b1,b2,b3} */
double ion_gal[4]; /* Galileo iono model parameters {ai0,ai1,ai2,0} */
double ion_qzs[8]; /* QZSS iono model parameters {a0,a1,a2,a3,b0,b1,b2,b3} */
double ion_cmp[8]; /* BeiDou iono model parameters {a0,a1,a2,a3,b0,b1,b2,b3} */
double ion_irn[8]; /* IRNSS iono model parameters {a0,a1,a2,a3,b0,b1,b2,b3} */
int glo_fcn[32]; /* GLONASS FCN + 8 */
double cbias[MAXSAT][3]; /* satellite DCB (0:P1-P2,1:P1-C1,2:P2-C2) (m) */
double rbias[MAXRCV][2][3]; /* receiver DCB (0:P1-P2,1:P1-C1,2:P2-C2) (m) */
pcv_t pcvs[MAXSAT]; /* satellite antenna pcv */
sbssat_t sbssat; /* SBAS satellite corrections */
sbsion_t sbsion[MAXBAND+1]; /* SBAS ionosphere corrections */
dgps_t dgps[MAXSAT]; /* DGPS corrections */
ssr_t ssr[MAXSAT]; /* SSR corrections */
} nav_t;
typedef struct { /* station parameter type */
char name [MAXANT]; /* marker name */
char marker [MAXANT]; /* marker number */
char antdes [MAXANT]; /* antenna descriptor */
char antsno [MAXANT]; /* antenna serial number */
char rectype[MAXANT]; /* receiver type descriptor */
char recver [MAXANT]; /* receiver firmware version */
char recsno [MAXANT]; /* receiver serial number */
int antsetup; /* antenna setup id */
int itrf; /* ITRF realization year */
int deltype; /* antenna delta type (0:enu,1:xyz) */
double pos[3]; /* station position (ecef) (m) */
double del[3]; /* antenna position delta (e/n/u or x/y/z) (m) */
double hgt; /* antenna height (m) */
int glo_cp_align; /* GLONASS code-phase alignment (0:no,1:yes) */
double glo_cp_bias[4]; /* GLONASS code-phase biases {1C,1P,2C,2P} (m) */
} sta_t;
typedef struct { /* RTCM control struct type */
int mtype; /* message type */
int crc; /* crc error */
int staid; /* station id */
int outtype; /* output message type */
gtime_t time; /* message time */
gtime_t time_s; /* message start time */
obs_t obs; /* observation data (uncorrected) */
nav_t nav; /* satellite ephemerides */
sta_t sta; /* station parameters */
dgps_t *dgps; /* output of dgps corrections */
ssr_t ssr[MAXSAT]; /* output of ssr corrections */
char msg[128]; /* special message */
char msgtype[256]; /* last message type */
char msmtype[7][128]; /* msm signal types */
int obsflag; /* obs data complete flag (1:ok,0:not complete) */
int ephsat; /* input ephemeris satellite number */
int ephset; /* input ephemeris set (0-1) */
double cp[MAXSAT][NFREQ+NEXOBS]; /* carrier-phase measurement */
uint16_t lock[MAXSAT][NFREQ+NEXOBS]; /* lock time */
uint16_t loss[MAXSAT][NFREQ+NEXOBS]; /* loss of lock count */
gtime_t lltime[MAXSAT][NFREQ+NEXOBS]; /* last lock time */
int nbyte; /* number of bytes in message buffer */
int nbit; /* number of bits in word buffer */
int len; /* message length (bytes) */
uint8_t buff[1200]; /* message buffer */
// uint32_t word; /* word buffer for rtcm 2 */
// uint32_t nmsg2[100]; /* message count of RTCM 2 (1-99:1-99,0:other) */
// uint32_t nmsg3[400]; /* message count of RTCM 3 (1-299:1001-1299,300-329:4070-4099,0:ohter) */
char opt[256]; /* RTCM dependent options */
} rtcm_t;
/* rtcm functions ------------------------------------------------------------*/
EXPORT int init_rtcm (rtcm_t *rtcm);
EXPORT void free_rtcm (rtcm_t *rtcm);
EXPORT int input_rtcm3 (rtcm_t *rtcm, uint8_t data);
#ifdef __cplusplus
}
#endif
#endif /* RTCM_H */