-
Notifications
You must be signed in to change notification settings - Fork 3
/
NMEAParser.cs
2241 lines (2024 loc) · 98.6 KB
/
NMEAParser.cs
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
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
namespace UCNLNMEA
{
/// <summary>
/// Talkers identifiers
/// </summary>
public enum TalkerIdentifiers
{
AG,
AP,
CD,
CR,
CS,
CT,
CV,
CX,
DE,
DF,
EC,
EP,
ER,
GA, // 03-JUN-2020
GB, // 02-JUN-2020
GL,
GP,
GN,
HC,
HE,
HN,
II,
IN,
LA,
LC,
OM,
P,
RA,
SD,
SN,
TR,
SS,
TI,
VD,
DM,
VW,
WI,
YX,
ZA,
ZC,
ZQ,
ZV,
unknown
}
/// <summary>
/// Sentences identifiers
/// </summary>
public enum SentenceIdentifiers
{
AAM,
ALM,
APA,
APB,
ASD,
BEC,
BOD,
BWC,
BWR,
BWW,
DBK,
DBS,
DBT,
DCN,
DPT,
DSC,
DSE,
DSI,
DSR,
DTM,
FSI,
GBS,
GGA,
GLC,
GLL,
GNS,
GRS,
GST,
GSA,
GSV,
GTD,
GXA,
HDG,
HDM,
HDT,
HEV,
HSC,
LCD,
MSK,
MSS,
MWD,
MTW,
MWV,
OLN,
OSD,
ROO,
RMA,
RMB,
RMC,
ROT,
RPM,
RSA,
RSD,
RTE,
SFI,
STN,
TLL,
TRF,
TTM,
TXT,
VBW,
VDR,
VHW,
VLW,
VPW,
VTG,
VWR,
WCV,
WDC,
WDR,
WNC,
WPL,
XDR,
XTE,
XTR,
ZDA,
ZDL,
ZFO,
ZTG,
unknown
}
/// <summary>
/// Manufacturers codes
/// </summary>
public enum ManufacturerCodes
{
AAR,
ACE,
ACR,
ACS,
ACT,
AGI,
AHA,
AIP,
ALD,
AMR,
AMT,
ANS,
ANX,
ANZ,
APC,
APL,
APN,
APX,
AQC,
AQD,
AQM,
ASP,
ATE,
ATM,
ATR,
ATV,
AVN,
AWA,
AZM,
BAT,
BBL,
BBR,
BDV,
BEC,
BGS,
BGT,
BHE,
BHR,
BLB,
BME,
BNI,
BNS,
BRM,
BRY,
BTH,
BTK,
BTS,
BXA,
CAT,
CBN,
CCA,
CCC,
CCL,
CCM,
CDC,
CEC,
CHI,
CKM,
CMA,
CMC,
CME,
CMP,
CMS,
CMV,
CNV,
CNX,
CPL,
CPN,
CPS,
CPT,
CRE,
CRO,
CRY,
CSI,
CSM,
CST,
CSV,
CTA,
CTB,
CTC,
CTE,
CTL,
CNI,
CWD,
CWV,
CYZ,
DBG,
DCC,
DEB,
DFI,
DGC,
DME,
DMI,
DNS,
DNT,
DPS,
DRL,
DSC,
DYN,
DYT,
EBC,
ECT,
EEV,
EFC,
ELD,
EMC,
EMS,
ENA,
ENC,
EPM,
EPT,
ERC,
ESA,
FDN,
FEC,
FHE,
FJN,
FMM,
FNT,
FRC,
FTG,
FUJ,
FUG,
FUR,
GAM,
GCA,
GES,
GFC,
GIS,
GPI,
GRM,
GSC,
GTO,
GVE,
GVT,
HAL,
HAR,
HDN,
HIG,
HIT,
HPK,
HRC,
HRT,
HTI,
HUL,
HWM,
ICO,
IFD,
IFI,
IME,
IMI,
IMM,
IMP,
IMT,
INM,
INT,
IRT,
IST,
ITM,
ITR,
JAN,
JFR,
JMT,
JRC,
JRI,
JTC,
JTR,
KBE,
KBM,
KLA,
KMR,
KNG,
KOD,
KRP,
KVH,
KYI,
LAT,
LEC,
LMM,
LNA,
LRD,
LSE,
LSP,
LTF,
LWR,
MCL,
MCP,
MDL,
MEC,
MEG,
MFR,
MFW,
MGN,
MGS,
MIE,
MIM,
MLE,
MLN,
MLP,
MLT,
MMB,
MME,
MMP,
MMS,
MNI,
MNT,
MNX,
MOT,
MPN,
MQS,
MRC,
MRE,
MRP,
MRR,
MRS,
MSB,
MSE,
MSM,
MST,
MTA,
MTG,
MTK,
MTR,
MTS,
MUR,
MVX,
MXX,
MES,
NEF,
NMR,
NGS,
NOM,
NOV,
NSM,
NTK,
NVC,
NVL,
NVS,
NVO,
OAR,
ODE,
ODN,
OIN,
OKI,
OLY,
OMN,
ORE,
OTK,
PCE,
PCH,
PDM,
PLA,
PLI,
PMI,
PMP,
PRK,
PSM,
PTC,
PTG,
PTH,
RAC,
RAE,
RAY,
RCA,
RCH,
RCI,
RDI,
RDM,
REC,
RFP,
RGC,
RGY,
RLF,
RMR,
RPH,
RSL,
RSM,
RWE,
RWI,
RWL,
RME,
RTN,
SAI,
SBR,
SCR,
SEA,
SEC,
SEP,
SFN,
SGC,
SIG,
SIM,
SKA,
SKP,
SLI,
SME,
SMF,
SML,
SMI,
SNV,
SOM,
SOV,
SPL,
SPT,
SRD,
SRF, // added 08 december 2013
SRS,
SRT,
SSI,
STC,
STI,
STM,
SVY,
SWI,
TBB,
TCN,
TDL,
THR,
TLS,
TMT,
TNL,
TNT,
TRC,
TSI,
TTK,
TTS,
TWC,
TXI,
UCN,
UME,
UNA,
UNI,
UNP,
UNF,
UNV,
UWV,
VAN,
VAR,
VCM,
VEX,
VIS,
VLB,
VMR,
VSN,
WAL,
WBG,
WEC,
WHA,
WMM,
WMR,
WNG,
WSE,
WTC,
WST,
YAS,
ZMA,
any,
unknown
}
/// <summary>
/// Earth hemisperes cardinals
/// </summary>
[Flags]
public enum Cardinals
{
North,
South,
East,
West,
undefined
}
/// <summary>
/// Structure represents geographical dimension
/// </summary>
public struct GeographicDimension
{
public Cardinals Cardinal;
public double Angle;
public override string ToString()
{
int degree = (int)Math.Floor(Angle);
int minutes = (int)Math.Floor((Angle - degree) * 60.0);
double seconds = (Angle - degree) * 3600 - minutes * 60.0;
return string.Format(CultureInfo.InvariantCulture, "{0}°{1}\'{2:F04}\" {3}", degree, minutes, seconds, Cardinal);
}
public GeographicDimension(double angle, Cardinals cardinal)
{
Angle = angle;
Cardinal = cardinal;
}
public static double AsSignedAngle(GeographicDimension dimension)
{
double result = dimension.Angle;
if ((dimension.Cardinal == Cardinals.North) || (dimension.Cardinal == Cardinals.West))
result = -dimension.Angle;
return result;
}
}
/// <summary>
/// Struct represents geographical position
/// </summary>
public struct GeographicPosition
{
public GeographicDimension Latitude;
public GeographicDimension Longitude;
public override string ToString()
{
return string.Format("{0}, {1}", Latitude.ToString(), Longitude.ToString());
}
}
/// <summary>
/// NMEA0183 2.0 Sentences parser/builder
/// (C) Aleksander Dikarev, 2011-2023
/// </summary>
public static class NMEAParser
{
#region Properties
#region Commons
#region expression delimiters
public static readonly string StandartID = "NMEA 0183 2.0";
public static readonly int MaxFullSentenceLength = 4255;//82;
public static readonly int MaxSentenceLength = 4252;//79;
public static readonly char SentenceStartDelimiter = '$';
public static readonly string SentenceEndDelimiter = "\r\n";
public static readonly char FieldDelimiter = ',';
public static readonly char CheckSumFieldDelimiter = '*';
private static char[] arrayBrackets = new char[] { '[', ']' };
public static string arrayOpenBracket = "[";
public static string arrayCloseBracket = "]";
public static char[] formatTokenDelimiters = new char[] { ',' };
public static char[] formatEnumDelimiters = new char[] { '|' };
private static string formatEnumPairDelimiter = "=";
public static char[] formatEnumPairDelimiters = new char[] { '=' };
private static string etcFormat = "...";
#endregion
#region Talker descriptions
private static Dictionary<TalkerIdentifiers, string> TalkerDescriptions =
new Dictionary<TalkerIdentifiers, string>() { { TalkerIdentifiers.AG, "Autopilot - General" },
{ TalkerIdentifiers.AP, "Autopilot - Magnetic" },
{ TalkerIdentifiers.CD, "Communications - Digital Selective Calling (DSC)" },
{ TalkerIdentifiers.CR, "Communications - Receiver / Beacon Receiver" },
{ TalkerIdentifiers.CS, "Communications - Sattelite" },
{ TalkerIdentifiers.CT, "Communications - Radio-Telephone (MF/HF)" },
{ TalkerIdentifiers.CV, "Communications - Radio-Telephone (VHF)" },
{ TalkerIdentifiers.CX, "Communications - Scanning Receiver" },
{ TalkerIdentifiers.DF, "Direction Finder" },
{ TalkerIdentifiers.EC, "Electronic Chart Display & Information System (ECDIS)" },
{ TalkerIdentifiers.EP, "Emergency Position Indicating Beacon (EPIRB)" },
{ TalkerIdentifiers.ER, "Engine Room Monitoring Systems" },
{ TalkerIdentifiers.GP, "Global Positioning System (GPS)" },
{ TalkerIdentifiers.HC, "Heading - Magnetic Compass" },
{ TalkerIdentifiers.HE, "Heading - North Seeking Gyro" },
{ TalkerIdentifiers.HN, "Heading - Non North Seeking Gyro" },
{ TalkerIdentifiers.II, "Integrated instrumentation" },
{ TalkerIdentifiers.IN, "Integrated Navigation" },
{ TalkerIdentifiers.LC, "Loran C" },
{ TalkerIdentifiers.P, "Proprietary Code" },
{ TalkerIdentifiers.RA, "RADAR and/or ARPA" },
{ TalkerIdentifiers.SD, "Sounder, Depth" },
{ TalkerIdentifiers.SN, "Electronic Positioning System, other/general" },
{ TalkerIdentifiers.SS, "Souder, Scanning" },
{ TalkerIdentifiers.TI, "Turn Rate Indicator" },
{ TalkerIdentifiers.VD, "Velocity Sensor, Doppler, other/general" },
{ TalkerIdentifiers.DM, "Velocity Sensor, Speed Log, Water, Magnetic" },
{ TalkerIdentifiers.VW, "Velocity Sensor, Speed Log, Water, Mechanical" },
{ TalkerIdentifiers.WI, "Weather Instruments" },
{ TalkerIdentifiers.YX, "Transduser" },
{ TalkerIdentifiers.ZA, "Timekeeper - Atomic Clock" },
{ TalkerIdentifiers.ZC, "Timekeeper - Chronometer" },
{ TalkerIdentifiers.ZQ, "Timekeeper - Quartz" },
{ TalkerIdentifiers.ZV, "Radio Update, WWV or WWVH" }
};
#endregion
#region Sentences descriptions
private static Dictionary<SentenceIdentifiers, string> SentencesDescriptions =
new Dictionary<SentenceIdentifiers, string>() { { SentenceIdentifiers.AAM, "Waypoint Arrival Alarm" },
{ SentenceIdentifiers.ALM, "GPS Almanac Data" },
{ SentenceIdentifiers.APB, "Autopilot Sentence \"B\"" },
{ SentenceIdentifiers.APA, "Autopilot Sentence \"A\"" },
{ SentenceIdentifiers.ASD, "Autopilot System Data" },
{ SentenceIdentifiers.BEC, "Bearing & Distance to Waypoint, Dead reckoning" },
{ SentenceIdentifiers.BOD, "Bearing, Origin to Destination" },
{ SentenceIdentifiers.BWC, "Bearing & Distance to Waypoint, Great Circle" },
{ SentenceIdentifiers.BWR, "Bearing & Distance to Waypoint, Rhumb Line" },
{ SentenceIdentifiers.BWW, "Bearing, Waypoint to Waypoint" },
{ SentenceIdentifiers.DBK, "Depth Below Keel" },
{ SentenceIdentifiers.DBS, "Depth Below Surface" },
{ SentenceIdentifiers.DBT, "Depth Below Transduser" },
{ SentenceIdentifiers.DCN, "[Obsolete] Decca Position" },
{ SentenceIdentifiers.DPT, "Depth" },
{ SentenceIdentifiers.DSC, "Digital Selective Calling Information" },
{ SentenceIdentifiers.DSE, "Extended DSC" },
{ SentenceIdentifiers.DSI, "DSC Transponder Initiate" },
{ SentenceIdentifiers.DSR, "DSC Transponder Response" },
{ SentenceIdentifiers.DTM, "Datum Reference" },
{ SentenceIdentifiers.FSI, "Frequency Set Information" },
{ SentenceIdentifiers.GBS, "GBS Satellite Fault Detection" },
{ SentenceIdentifiers.GGA, "Global Positioning System Fix Data" },
{ SentenceIdentifiers.GLC, "Geographic Position, Loran-C" },
{ SentenceIdentifiers.GLL, "Geographic Position, Latitude/Longitude" },
{ SentenceIdentifiers.GRS, "GPS Range Residuals" },
{ SentenceIdentifiers.GSA, "GPS DOP and Active Satellites" },
{ SentenceIdentifiers.GST, "GPS Pseudorange Noise Statistics" },
{ SentenceIdentifiers.GSV, "GPS Sattelites in View" },
{ SentenceIdentifiers.GTD, "Geograpic Location in Time Differences" },
{ SentenceIdentifiers.GXA, "Transit Position" },
{ SentenceIdentifiers.HDG, "Heading, Deviation & Variation" },
{ SentenceIdentifiers.HDM, "Heading, Magnetic" },
{ SentenceIdentifiers.HDT, "Heading, True" },
{ SentenceIdentifiers.HSC, "Heading Steering Command" },
{ SentenceIdentifiers.LCD, "Loran-C Signal Data" },
{ SentenceIdentifiers.MSK, "MSK Receiver Interface (for DGPS Beacon Receivers)" },
{ SentenceIdentifiers.MSS, "MSK Receiver Signal Status" },
{ SentenceIdentifiers.MTW, "Water Temperature" },
{ SentenceIdentifiers.MWD, "Wind Direction & Speed" },
{ SentenceIdentifiers.MWV, "Wind Speed & Angle" },
{ SentenceIdentifiers.OLN, "[Obsolete] Omega Line Numbers" },
{ SentenceIdentifiers.OSD, "Own Ship Data" },
{ SentenceIdentifiers.RMA, "Recommend Minimum Specific Loran-C Data" },
{ SentenceIdentifiers.RMB, "Recommend Minimum Navigation Information" },
{ SentenceIdentifiers.RMC, "Recommend Minimum Specific GPS/TRANSIT Data" },
{ SentenceIdentifiers.ROO, "Waypoints in Active Route" },
{ SentenceIdentifiers.ROT, "Rate of Turn" },
{ SentenceIdentifiers.RPM, "Revolutions" },
{ SentenceIdentifiers.RSA, "Rudder Sensor Angle" },
{ SentenceIdentifiers.RSD, "RADAR System Data" },
{ SentenceIdentifiers.RTE, "Routes" },
{ SentenceIdentifiers.SFI, "Scanning Frequency Information" },
{ SentenceIdentifiers.STN, "Multiple Data ID" },
{ SentenceIdentifiers.TLL, "Target Latitude & Longitude" },
{ SentenceIdentifiers.TRF, "[Obsolete] TRANSIT Fix Data" },
{ SentenceIdentifiers.TTM, "Tracked Target Message" },
{ SentenceIdentifiers.VBW, "Dual Ground/Water Speed" },
{ SentenceIdentifiers.VDR, "Set and Drift" },
{ SentenceIdentifiers.VHW, "Water Speed and Heading" },
{ SentenceIdentifiers.VLW, "Distance Traveled through Water" },
{ SentenceIdentifiers.VPW, "Speed, Measured Parallel to Wind" },
{ SentenceIdentifiers.VTG, "Track Made Good and Ground Speed" },
{ SentenceIdentifiers.VWR, "Relative Wind Speed & Angle" },
{ SentenceIdentifiers.WCV, "Waypoint Closure Velocity" },
{ SentenceIdentifiers.WDC, "Distance to Waypoint, Great Circle" },
{ SentenceIdentifiers.WDR, "Distance to Waypoint, Rhumb Line" },
{ SentenceIdentifiers.WNC, "Distance, Waypoint to Waypoint" },
{ SentenceIdentifiers.WPL, "Waypoint Location" },
{ SentenceIdentifiers.XDR, "Transducer Measurement" },
{ SentenceIdentifiers.XTE, "Cross-Track Error, Measured" },
{ SentenceIdentifiers.XTR, "Cross-Track Error, Dead Reckoning" },
{ SentenceIdentifiers.ZDA, "Time & Date" },
{ SentenceIdentifiers.ZDL, "Time & Distance to Variable Point" },
{ SentenceIdentifiers.ZFO, "UTC & Time from Origin Waypoint" },
{ SentenceIdentifiers.ZTG, "UTC & Time to Destination Waypoint" }
};
#endregion
#region Datum dictionary
private static Dictionary<int, string> Datums = new Dictionary<int, string>()
{
{ 0, "WGS1984 (International)" },
{ 1, "Tokyo (Japan)" },
{ 2, "Tokyo (Mean for Japan, South Korea, Okinawa)" },
{ 3, "User setting" },
{ 4, "Adindan (Burkina Faso)" },
{ 5, "Adindan (Cameroon)" },
{ 6, "Adindan (Ethiopia)" },
{ 7, "Adindan (Mali)" },
{ 8, "Adindan (Mean for Ethiopia, Sudan)" },
{ 9, "Adindan (Senegal)" },
{ 10, "Adindan (Sudan)" },
{ 11, "Afgooye (Somalia)" },
{ 12, "Ain El Abd1970 (Bahrain)" },
{ 13, "Ain El Abd1970 (Saudi Arabia)" },
{ 14, "American Samoa1962 (American Samoa islands)" },
{ 15, "Anna 1 Astro1965 (Cocos Island)" },
{ 16, "Antigua Island Astro1943 (Antigua (Leeward Islands))" },
{ 17, "Arc1950 (Botswana)" },
{ 18, "Arc1950 (Burundi)" },
{ 19, "Arc1950 (Lesotho)" },
{ 20, "Arc1950 (Malawi)" },
{ 21, "Arc1950 (Mean for Botswana, Lesotho, Malawi, Swaziland, Zaire, Zambia, Zimbabwe)" },
{ 22, "Arc1950 (Swaziland)" },
{ 23, "Arc1950 (Zaire)" },
{ 24, "Arc1950 (Zambia)" },
{ 25, "Arc1950 (Zimbabwe)" },
{ 26, "Arc1960 (Mean for Kenya Tanzania)" },
{ 27, "Arc1960 (Kenya)" },
{ 28, "Arc1960 (Tanzania)" },
{ 29, "Ascension Island 1958 (Ascension Island)" },
{ 30, "Astro Beacon E 1945 (Iwo Jima)" },
{ 31, "Astro Dos 71/4 (St Helena Island)" },
{ 32, "Astro Tern Island (FRIG) 1961 (Tern Island)" },
{ 33, "Astronomical Station 1952 (Marcus Island)" },
{ 34, "Australian Geodetic 1966 (Mercus Island)" },
{ 35, "Australian Geodetic 1984 (Australia, Tasmania)" },
{ 36, "Ayabelle Lighthouse (Djibouti)" },
{ 37, "Bellevue (IGN) (Efate and Erromango Islands)" },
{ 38, "Bermuda 1957 (Bermuda)" },
{ 39, "Bissau (Guuinea-Bissau)" },
{ 40, "Bogota Observatory (Colombia)" },
{ 41, "Bukit Rimpah (Indonesia (Bangka and Belitung Ids))" },
{ 42, "Camp Area Astro (Antarctica (McMurdi Camp Area))" },
{ 43, "Campo Inchauspe (Argentina)" },
{ 44, "Canton Astro1966 (Phoenix Island)" },
{ 45, "Cape (South Africa)" },
{ 46, "Cape Canaveral (Bahamas, Florida)" },
{ 47, "Carthage (Tunisia)" },
{ 48, "Chatham Island Astro1971 (New Zealand(Chatham Island))" },
{ 49, "Chua Astro (Paraguay)" },
{ 50, "Corrego Alegre (Brazil)" },
{ 51, "Dabola (Guinea)" },
{ 52, "Deception Island (Deception Island, Antarctica)" },
{ 53, "Djakarta (Batavia) (Indonesia (Sumatra))" },
{ 54, "Dos 1968 (New Georgia Islands (Gizo Island)" },
{ 55, "Easter Island 1967 (Easter Island)" },
{ 56, "Estonia Coordinate System 1937 (Estonia)" },
{ 57, "European 1950 (Cyprus)" },
{ 58, "European 1950 (Egypt)" },
{ 59, "European 1950 (England, Channel Isnalds, Scotland, Shetland Islands)" },
{ 60, "European 1950 (England, Ireland, Scotland, Shetland Islands)" },
{ 61, "European 1950 (Finland, Norway" },
{ 62, "European 1950 (Greece)" },
{ 63, "European 1950 (Iran)" },
{ 64, "European 1950 (Italy (Sardinia))" },
{ 65, "European 1950 (Italy (Sicily))" },
{ 66, "European 1950 (Malta)" },
{ 67, "European 1950 (Mean for Austria, Belgium, Danmark, Finland, France, W. Germany, Gibraltar, Greece, Italy, Luxemburg, Netherlands, Norway, Portugal, Spain, Sweden, Switzerland)" },
{ 68, "European 1950 (Mean for Austria, Denmark, France, W. Germany, Netherland, Switzerland)" },
{ 69, "European 1950 (Mean for Iraq, Israel, Jordan, Lebanon, Kuwait, Saudi Arabia, Syria)" },
{ 70, "European 1950 (Portugal, Spain)" },
{ 71, "European 1950 (Tunisia)" },
{ 72, "European 1950 (Mean for Austria, Finland, Netherlands, Norway, Spain, Sweden, Switzerland)" },
{ 73, "Fort Thomas 1955 (Nevis St. Kitts (Leeward Islands))" },
{ 74, "Gan 1970 (Republic of Maldives)" },
{ 75, "Geodetic Datum 1970 (New Zeland)" },
{ 76, "Graciosa Base SW1948 (Azores (Fial, Graciosa, Pico, Sao, Jorge, Terceria))" },
{ 77, "Guam1963 (Guam)" },
{ 78, "Gunung Segara (Indonesia (Kalimantan))" },
{ 79, "Gux I Astro (Guadalcanal Island)" },
{ 80, "Herat North (Afganistan)" },
{ 81, "Hermannskogel Datum (Croatia-Serbia, Bosnia-Herzegovina)" },
{ 82, "Hjorsey 1955 (Iceland)" },
{ 83, "Hongkong 1963 (Hongkong)" },
{ 84, "Hu Tzu Shan (Taiwan)" },
{ 85, "Indian (Bangladesh)" },
{ 86, "Indian (India, Nepal)" },
{ 87, "Indian (Pakistan)" },
{ 88, "Indian 1954 (Thailand)" },
{ 89, "Indian 1960 (Vietnam (Con Son Island)" },
{ 90, "Indian 1960 (Vietnam (Near 16 deg N))" },
{ 91, "Indian 1975 (Thailand)" },
{ 92, "Indonesian 1974 (Indonesian)" },
{ 93, "Ireland 1965 (Ireland)" },
{ 94, "ISTS 061 Astro 1968 (South Georgia Islands)" },
{ 95, "ISTS 073 Astro 1969 (Diego Garcia)" },
{ 96, "Johnston Island 1961 (Johnston Island)" },
{ 97, "Kandawala (Sri Lanka)" },
{ 98, "Kerguelen Island 1949 (Kerguelen Island)" },
{ 99, "Kertau 1948 (West Malaysia and Singapore)" },
{ 100, "Kusaie Astro 1951 (Caroline Island)" },
{ 101, "Korean Geodetic System (South Korea)" },
{ 102, "LC5 Astro 1961 (Cayman Brac Island)" },
{ 103, "Leigon (Ghana)" },
{ 104, "Liberia 1964 (Liberia)" },
{ 105, "Luzon (Philippines (Excluding Mindanao))" },
{ 106, "Luzon (Philippines (Mindanao))" },
{ 107, "M\'Poraloko (Gabon)" },
{ 108, "Mahe 1971 (Mahe Island)" },
{ 109, "Massawa (Ethopia (Eritrea))" },
{ 110, "Merchich (Morocco)" },
{ 111, "Midway Astro 1961 (Midway Islands)" },
{ 112, "Minna (Cameroon)" },
{ 113, "Minna (Nigeria)" },
{ 114, "Montserrat Island Astro 1958 (Monserat (Leeward Island))" },
{ 115, "Nahrwan (Oman (Masirah Island))" },
{ 116, "Nahrwan (Saudi Arabia)" },
{ 117, "Nahrwan (United Arab Emirates)" },
{ 118, "Naparima BWI (Trinidad and Tobago)" },
{ 119, "North American 1927 (Alaska (Excluding Aleutian Islands))" },
{ 120, "North American 1927 (Alaska (Aleutian Islands East of 180 deg. W)" },
{ 121, "North American 1927 (Alaska (Aleutian Islands West of 180 deg. W)" },
{ 122, "North American 1927 (Bahamas (Except San Salvador Islands))" },
{ 123, "North American 1927 (Bahamas (San Salvador Islands))" },
{ 124, "North American 1927 (Canada (Alberta, British Columbia))" },
{ 125, "North American 1927 (Canada (Manitoba, Ontario))" },
{ 126, "North American 1927 (Canada (New Brunswick, Newfoundland, Nova Scotia, Quebec))" },
{ 127, "North American 1927 (Canada (Northwest Territories, Saskatchewan))" },
{ 128, "North American 1927 (Canada (Youkon))" },
{ 129, "North American 1927 (Canal Zone)" },
{ 130, "North American 1927 (Cuba)" },
{ 131, "North American 1927 (Greenland (Hayes Peninsula))" },
{ 132, "North American 1927 (Mean for Antigua, Barbados, Barbuda, Caicos Islands, Cuba, Dominican, Grand Cayman, Jamaica, Turks Islands)" },
{ 133, "North American 1927 (Mean for Belize, Costa Rica, El Salvador, Guatemala, Honduras, Nicaragua)" },
{ 134, "North American 1927 (Mean for Canada)" },
{ 135, "North American 1927 (Mean for Conus)" },
{ 136, "North American 1927 (Mean for Conus (East of Mississippi, River Including Louisiana, Missouri, Minnesota)" },
{ 137, "North American 1927 (Mean for Conus (West of Mississippi, River Excluding Louisiana, Missouri, Minnesota)" },
{ 138, "North American 1927 (Mexico)" },
{ 139, "North American 1983 (Alaska (Excluding Aleutian Islands))" },
{ 140, "North American 1983 (Aleutian Islands)" },
{ 141, "North American 1983 (Canada)" },
{ 142, "North American 1983 (Conus)" },
{ 143, "North American 1983 (Hahawii)" },
{ 144, "North American 1983 (Mexico, Central America)" },
{ 145, "North Sahara 1959 (Algeria)" },
{ 146, "Observatorio Meteorologico 1939 (Azores (Corvo and Flores Islands))" },
{ 147, "Old Egyptian 1907 (Egypt)" },
{ 148, "Old Hawaiian (Hawaii)" },
{ 149, "Old Hawaiian (Kauai)" },
{ 150, "Old Hawaiian (Maui)" },
{ 151, "Old Hawaiian (Mean for Hawaii, Kauai, Maui, Oahu)" },
{ 152, "Old Hawaiian (Oahu)" },
{ 153, "Oman (Oman)" },
{ 154, "Ordnance Survey Great Britain 1936 (England)" },
{ 155, "Ordnance Survey Great Britain 1936 (England, Isle of Man, Wales)" },
{ 156, "Ordnance Survey Great Britain 1936 (Mean for England, Isle of Man, Scotland, Shetland Islands, Wales)" },
{ 157, "Ordnance Survey Great Britain 1936 (Scotland, Shetland Islands)" },
{ 158, "Ordnance Survey Great Britain 1936 (Wales)" },
{ 159, "Pico de las Nieves (Canary Islands)" },
{ 160, "Pitcairn Astro 1967 (Pitcairn Island)" },
{ 161, "Point 58 (Mean for Burkina Faso and Niger)" },
{ 162, "Pointe Noire 1948 (Congo)" },
{ 163, "Porto Santo 1936 (Porto Santo, Maderia Islands)" },
{ 164, "Provisional South American 1956 (Bolivia)" },
{ 165, "Provisional South American 1956 (Chilie (Norther Near 19 deg S))" },
{ 166, "Provisional South American 1956 (Chilie (Southern Near 43 deg S))" },
{ 167, "Provisional South American 1956 (Colombia)" },
{ 168, "Provisional South American 1956 (Ecuador)" },
{ 169, "Provisional South American 1956 (Guyana)" },
{ 170, "Provisional South American 1956 (Mean for Bolivia, Chilie, Colombia, Ecuador, Guyana, Peru, Venezuela)" },
{ 171, "Provisional South American 1956 (Peru)" },
{ 172, "Provisional South American 1956 (Venezuela)" },
{ 173, "Provisional South Chilean 1963 (Chilie (Near 53 deg S) (Hito XVIII))" },
{ 174, "Puerto Rico (Puerto Rico, Virgin Islands)" },
{ 175, "Pulkovo 1942 (Russia)" },
{ 176, "Quatar National (Quatar)" },
{ 177, "Qornoq (Greenland (South))" },
{ 178, "Reunion (Mascarene Island)" },
{ 179, "Rome 1940 (Italy (Sardinia))" },
{ 180, "S-42 (Pulkovo 1942) (Hungary)" },
{ 181, "S-42 (Pulkovo 1942) (Poland)" },
{ 182, "S-42 (Pulkovo 1942) (Czechoslavakia)" },
{ 183, "S-42 (Pulkovo 1942) (Latvia)" },
{ 184, "S-42 (Pulkovo 1942) (Kazakhstan)" },
{ 185, "S-42 (Pulkovo 1942) (Albania)" },
{ 186, "S-42 (Pulkovo 1942) (Romania)" },
{ 187, "S-JTSK (Czechoslavakia (Prior 1 Jan 1993))" },
{ 188, "Santo (Dos) 1965 (Espirito Santo Island)" },
{ 189, "Sao Braz (Azores (San Miguel, Santa Maria Islands))" },
{ 190, "Sapper Hill" },
{ 191, "Schwarzeck (Namibia)" },
{ 192, "Selvagem Grande 1938 (Salvage Islands)" },
{ 193, "Sierra Leone 1960 (Sierra Leone)" },
{ 194, "South American 1969 (Argentina)" },
{ 195, "South American 1969 (Bolivia)" },
{ 196, "South American 1969 (Brazil)" },
{ 197, "South American 1969 (Chilie)" },
{ 198, "South American 1969 (Colombia)" },
{ 199, "South American 1969 (Ecuador)" },
{ 200, "South American 1969 (Ecuador (Baltra, Galapagos))" },
{ 201, "South American 1969 (Guyana)" },
{ 202, "South American 1969 (Mean for Argentina, Bolivia, Brazil, Chilie, Colombia, Ecuador, Guayana, Paraguay, Peru, Trinidad and Tobago, Venezuela)" },
{ 203, "South American 1969 (Paraguay)" },
{ 204, "South American 1969 (Peru)" },
{ 205, "South American 1969 (Trinidad and Tobago)" },
{ 206, "South American 1969 (Venezuela)" },
{ 207, "South Asia (Singapore)" },
{ 208, "Tananarive Observatory 1925 (Madagascar)" },
{ 209, "Timbalai 1948 (Brunei, E. Malaysia (Sabah Sarawak))" },
{ 210, "Tokyo (Japan)" },
{ 211, "Tokyo (Mean for Japan, South Korea, Okinawa)" },
{ 212, "Tokyo (Okinawa)" },
{ 213, "Tokyo (South Korea)" },
{ 214, "Tristan Astro 1968 (Tristam Da Cunha)" },
{ 215, "Viti Levu 1916 (Fiji (Viti Levu Island))" },
{ 216, "Voirol 1960 (Algeria)" },
{ 217, "Wake Island Astro 1952 (Wake Atoll)" },
{ 218, "Wake-Eniwetok 1960 (Marshall Islands)" },
{ 219, "WGS 1972 (Global Definition)" },
{ 220, "WGS 1984 (Global Definition)" },
{ 221, "Yacare (Uruguay)" },
{ 222, "Zanderij (Suriname)" }
};
#endregion
#region Sentences formats
/// <summary>
/// Format string for sentences must be as "param_1_format, param_2_format, ..."
/// valid formats are:
/// x - integer
/// x.x - double
/// c--c - ASCII char string
/// hh - hexadecimal byte
/// hhhh - hexadecimal short int
/// hhhhhhhh - hexadecimal int
/// hhmmss.ss - time: hours, minutes, seconds, fractional part of seconds
/// llll.ll - longitude
/// yyyyy.yy - latitude
/// </summary>
#region Standart sentences
private static Dictionary<SentenceIdentifiers, string> SentencesFormats =
new Dictionary<SentenceIdentifiers, string>() { { SentenceIdentifiers.AAM, "A=Arrival circled entered|V=V,A=Perpendicular passed at way point|V=V,x.x,N=nm|K=km,c--c" },
{ SentenceIdentifiers.ALM, "x.x,x.x,xx,x.x,hh,hhhh,hh,hhhh,hhhhhh,hhhhhh,hhhhhh,hhhhhh,hhh,hhh" },
{ SentenceIdentifiers.APB, "V=Loran-C Blink or SNR warning|A=general warning flag,V=Loran-C Cycle Lock warning flag|A=OK or not used,x.x,R=Right|L=Left,N=nm|K=km,A=Arrival circled entered|V=Invalid,A=Perpendicular passed at way point|V=Invalid,x.x,M=Magnetic|T=True,c--c,x.x,M=Magnetic|T=True,x.x,M=Magnetic|T=True" },
{ SentenceIdentifiers.APA, "V=Loran-C Blink or SNR warning|A=general warning flag,V=Loran-C Cycle Lock warning flag|A=OK or not used,x.xx,R=Right|L=Left,N=nm|K=km,A=Arrival circled entered|V=Invalid,A=Perpendicular passed at way point|V=Invalid,xxx,M=Magnetic|T=True,c---c" },
{ SentenceIdentifiers.ASD, "" },
{ SentenceIdentifiers.BEC, "hhmmss.ss,llll.ll,N=N|S=S,yyyyy.y,N=N|S=S,x.x,E=E|W=W,x.x,T=True|M=Magnetic,x.x,N=nm|K=km,c--c" },
{ SentenceIdentifiers.BOD, "x.x,T=True|M=Magnetic,x.x,T=True|M=Magnetic,c--c,c--c" },
{ SentenceIdentifiers.BWC, "hhmmss.ss,llll.ll,N=N|S=S,yyyyy.yy,E=E|W=W,x.x,T=True|M=Magnetic,x.x,T=True|M=Magnetic,x.x,N=nm|K=km,c--c" },
{ SentenceIdentifiers.BWR, "hhmmss.ss,llll.ll,N=N|S=S,yyyyy.yy,E=E|W=W,x.x,T=True|M=Magnetic,x.x,T=True|M=Magnetic,x.x,N=nm|K=km,c--c" },
{ SentenceIdentifiers.BWW, "x.x,T=True|M=Magnetic,x.x,T=True|M=Magnetic,c--c,c--c" },
{ SentenceIdentifiers.DBK, "x.x,f=ft|M=m,x.x,f=ft|M=m,x.x,F" },
{ SentenceIdentifiers.DBS, "x.x,f=ft|M=m,x.x,f=ft|M=m,x.x,F" },
{ SentenceIdentifiers.DBT, "x.x,f=ft|M=m,x.x,f=ft|M=m,x.x,F" },
{ SentenceIdentifiers.DCN, "xx,cc,x.x,A,cc,x.x,A,cc,x.x,A,A,A,A,x.x,N=nm|K=km,1=Normal pattern|2=Lane identification pattern|3=Lane identification transmissions" },
{ SentenceIdentifiers.DPT, "x.x,x.x" },
{ SentenceIdentifiers.DSC, "" },
{ SentenceIdentifiers.DSE, "" },
{ SentenceIdentifiers.DSI, "" },
{ SentenceIdentifiers.DSR, "" },
{ SentenceIdentifiers.DTM, "xxx,x,xx.xxxx,x,xx.xxxx,x,c--c,xxx" },
{ SentenceIdentifiers.FSI, "xxxxxx,xxxxxx,c,x" },
{ SentenceIdentifiers.GBS, "hhmmss.ss,x.x,x.x,x.x,x.x,x.x,x.x,x.x" },
{ SentenceIdentifiers.GGA, "hhmmss.ss,llll.ll,a,yyyyy.yy,a,0=Fix not availible|1=GPS fix|2=DGPS fix,xx,x.x,x.x,M,x.x,M,x.x,xxxx" },
{ SentenceIdentifiers.GLC, "xxxx,x.x,a,x.x,a,x.x,a,x.x,a,x.x,a,x.x,B=Blink|C=Cycle|S=SNR|A=Valid" },
{ SentenceIdentifiers.GLL, "llll.ll,N=N|S=S,yyyyy.yy,E=E|W=W,hhmmss.ss,A=Valid|V=Invalid,A=Valid|V=Invalid" },