nmea 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/packagetask'
6
6
  require 'rake/contrib/rubyforgepublisher'
7
7
 
8
8
  PKG_NAME = "nmea"
9
- PKG_VERSION = "0.1"
9
+ PKG_VERSION = "0.2"
10
10
  PKG_AUTHOR = "Max Lapshin"
11
11
  PKG_EMAIL = "max@maxidoors.ru"
12
12
  PKG_HOMEPAGE = "http://maxidoors.ru/"
@@ -1,3 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'mkmf'
3
- create_makefile 'nmea'
3
+ CONFIG["CPP"] = "g++ -E "
4
+ CONFIG["CC"] = "g++ -Wall -g "
5
+ CONFIG["LDSHARED"].gsub!(/^cc /,"g++ ")
6
+
7
+ $CFLAGS << " -I../parser -Wall -g "
8
+ $LDFLAGS << " -g "
9
+ create_makefile 'nmea_bin'
@@ -0,0 +1,4558 @@
1
+ #line 1 "nmea.rl"
2
+ #include "nmea.hpp"
3
+ namespace NMEA {
4
+
5
+ #line 95 "nmea.rl"
6
+
7
+
8
+
9
+
10
+ #line 11 "../ext/nmea.cpp"
11
+ static const int NMEA_start = 1;
12
+
13
+ static const int NMEA_error = 0;
14
+
15
+ #line 99 "nmea.rl"
16
+
17
+ bool scan(char *p, Handler& handler) throw (Error) {
18
+ char *pe;
19
+ int cs;
20
+
21
+ int current_digit = 0, current_frac = 0;
22
+ double current_float = 0;
23
+ int current_degrees = 0;
24
+ int bcd = 0;
25
+ Time utc;
26
+ Angle latitude, longitude;
27
+
28
+ char checksum[3];
29
+ checksum[2] = 0;
30
+ int sentence_len = strlen(p);
31
+ char current_string[sentence_len+1];
32
+ char *current_s = current_string;
33
+ char *sentence_begin = NULL, *sentence_end = NULL;
34
+
35
+ //RMC
36
+ bool rmc_valid = 0;
37
+ Double knot_speed, course, magnetic_variation;
38
+ //GSV
39
+ satellite_list satellites;
40
+ Int snr_db;
41
+ int total_gsv_number = 0, current_gsv_number = 0, total_satellites = 0, satellite_number = 0, elevation = 0, azimuth = 0;
42
+ //GSA
43
+ bool gsa_automatic;
44
+ GSA_MODE gsa_mode;
45
+ int gsa_prn_index = 0;
46
+ Double gsa_pdop, gsa_hdop, gsa_vdop;
47
+ satellite_numbers gsa_prns;
48
+ //GGA
49
+ GGA_FIX gps_quality;
50
+ Int dgps_station_id, active_satellite_count;
51
+ Double altitude, geoidal_height, dgps_data_age;
52
+ char altitude_units, geoidal_height_units;
53
+ //PSRFTXT
54
+ std::string psrf_key, psrf_value;
55
+ //VTG
56
+ Double true_course, magnetic_course, vtg_knot_speed, vtg_kmph_speed;
57
+ VTG_MODE vtg_mode = VTG_DEFAULT;
58
+ //BOD
59
+ std::string wpt_to, wpt_from;
60
+
61
+ #line 62 "../ext/nmea.cpp"
62
+ {
63
+ cs = NMEA_start;
64
+ }
65
+ #line 144 "nmea.rl"
66
+
67
+ pe = p + sentence_len;
68
+
69
+ #line 70 "../ext/nmea.cpp"
70
+ {
71
+ if ( p == pe )
72
+ goto _out;
73
+ switch ( cs )
74
+ {
75
+ case 1:
76
+ if ( (*p) == 36 )
77
+ goto tr0;
78
+ goto st0;
79
+ st0:
80
+ goto _out0;
81
+ tr0:
82
+ #line 65 "nmea.rl"
83
+ {
84
+ sentence_begin = p+1;
85
+ }
86
+ goto st2;
87
+ st2:
88
+ if ( ++p == pe )
89
+ goto _out2;
90
+ case 2:
91
+ #line 92 "../ext/nmea.cpp"
92
+ switch( (*p) ) {
93
+ case 71: goto st3;
94
+ case 80: goto st265;
95
+ }
96
+ goto st0;
97
+ st3:
98
+ if ( ++p == pe )
99
+ goto _out3;
100
+ case 3:
101
+ if ( (*p) == 80 )
102
+ goto st4;
103
+ goto st0;
104
+ st4:
105
+ if ( ++p == pe )
106
+ goto _out4;
107
+ case 4:
108
+ switch( (*p) ) {
109
+ case 66: goto st5;
110
+ case 71: goto st26;
111
+ case 82: goto st181;
112
+ case 86: goto st233;
113
+ }
114
+ goto st0;
115
+ st5:
116
+ if ( ++p == pe )
117
+ goto _out5;
118
+ case 5:
119
+ if ( (*p) == 79 )
120
+ goto st6;
121
+ goto st0;
122
+ st6:
123
+ if ( ++p == pe )
124
+ goto _out6;
125
+ case 6:
126
+ if ( (*p) == 68 )
127
+ goto st7;
128
+ goto st0;
129
+ st7:
130
+ if ( ++p == pe )
131
+ goto _out7;
132
+ case 7:
133
+ if ( (*p) == 44 )
134
+ goto st8;
135
+ goto st0;
136
+ st8:
137
+ if ( ++p == pe )
138
+ goto _out8;
139
+ case 8:
140
+ if ( (*p) == 44 )
141
+ goto st9;
142
+ if ( 48 <= (*p) && (*p) <= 57 )
143
+ goto tr13;
144
+ goto st0;
145
+ tr35:
146
+ #line 3 "nmea.rl"
147
+ {true_course = current_float; current_float = 0;}
148
+ goto st9;
149
+ st9:
150
+ if ( ++p == pe )
151
+ goto _out9;
152
+ case 9:
153
+ #line 154 "../ext/nmea.cpp"
154
+ if ( (*p) == 84 )
155
+ goto st10;
156
+ goto st0;
157
+ st10:
158
+ if ( ++p == pe )
159
+ goto _out10;
160
+ case 10:
161
+ if ( (*p) == 44 )
162
+ goto st11;
163
+ goto st0;
164
+ st11:
165
+ if ( ++p == pe )
166
+ goto _out11;
167
+ case 11:
168
+ if ( (*p) == 44 )
169
+ goto st12;
170
+ if ( 48 <= (*p) && (*p) <= 57 )
171
+ goto tr17;
172
+ goto st0;
173
+ tr32:
174
+ #line 4 "nmea.rl"
175
+ {magnetic_course = current_float; current_float = 0;}
176
+ goto st12;
177
+ st12:
178
+ if ( ++p == pe )
179
+ goto _out12;
180
+ case 12:
181
+ #line 182 "../ext/nmea.cpp"
182
+ if ( (*p) == 77 )
183
+ goto st13;
184
+ goto st0;
185
+ st13:
186
+ if ( ++p == pe )
187
+ goto _out13;
188
+ case 13:
189
+ if ( (*p) == 44 )
190
+ goto st14;
191
+ goto st0;
192
+ tr20:
193
+ #line 29 "nmea.rl"
194
+ {
195
+ *current_s = (*p);
196
+ current_s++;
197
+ *current_s = 0;
198
+ }
199
+ goto st14;
200
+ st14:
201
+ if ( ++p == pe )
202
+ goto _out14;
203
+ case 14:
204
+ #line 205 "../ext/nmea.cpp"
205
+ if ( (*p) == 44 )
206
+ goto st15;
207
+ goto tr20;
208
+ st15:
209
+ if ( ++p == pe )
210
+ goto _out15;
211
+ case 15:
212
+ if ( (*p) == 42 )
213
+ goto tr23;
214
+ goto tr22;
215
+ tr24:
216
+ #line 29 "nmea.rl"
217
+ {
218
+ *current_s = (*p);
219
+ current_s++;
220
+ *current_s = 0;
221
+ }
222
+ goto st16;
223
+ tr22:
224
+ #line 4 "nmea.rl"
225
+ {
226
+ if(*current_string) wpt_to = current_string;
227
+ current_s = current_string;
228
+ *current_s = 0;
229
+ }
230
+ #line 29 "nmea.rl"
231
+ {
232
+ *current_s = (*p);
233
+ current_s++;
234
+ *current_s = 0;
235
+ }
236
+ goto st16;
237
+ st16:
238
+ if ( ++p == pe )
239
+ goto _out16;
240
+ case 16:
241
+ #line 242 "../ext/nmea.cpp"
242
+ if ( (*p) == 42 )
243
+ goto tr25;
244
+ goto tr24;
245
+ tr23:
246
+ #line 4 "nmea.rl"
247
+ {
248
+ if(*current_string) wpt_to = current_string;
249
+ current_s = current_string;
250
+ *current_s = 0;
251
+ }
252
+ #line 10 "nmea.rl"
253
+ {
254
+ if(*current_string) wpt_from = current_string;
255
+ current_s = current_string;
256
+ *current_s = 0;
257
+ }
258
+ #line 82 "nmea.rl"
259
+ {sentence_end = p; }
260
+ goto st17;
261
+ tr25:
262
+ #line 10 "nmea.rl"
263
+ {
264
+ if(*current_string) wpt_from = current_string;
265
+ current_s = current_string;
266
+ *current_s = 0;
267
+ }
268
+ #line 82 "nmea.rl"
269
+ {sentence_end = p; }
270
+ goto st17;
271
+ st17:
272
+ if ( ++p == pe )
273
+ goto _out17;
274
+ case 17:
275
+ #line 276 "../ext/nmea.cpp"
276
+ if ( (*p) < 65 ) {
277
+ if ( 48 <= (*p) && (*p) <= 57 )
278
+ goto tr26;
279
+ } else if ( (*p) > 90 ) {
280
+ if ( 97 <= (*p) && (*p) <= 122 )
281
+ goto tr26;
282
+ } else
283
+ goto tr26;
284
+ goto st0;
285
+ tr26:
286
+ #line 82 "nmea.rl"
287
+ {checksum[0] = (*p);}
288
+ goto st18;
289
+ st18:
290
+ if ( ++p == pe )
291
+ goto _out18;
292
+ case 18:
293
+ #line 294 "../ext/nmea.cpp"
294
+ if ( (*p) < 65 ) {
295
+ if ( 48 <= (*p) && (*p) <= 57 )
296
+ goto tr27;
297
+ } else if ( (*p) > 90 ) {
298
+ if ( 97 <= (*p) && (*p) <= 122 )
299
+ goto tr27;
300
+ } else
301
+ goto tr27;
302
+ goto st0;
303
+ tr27:
304
+ #line 68 "nmea.rl"
305
+ {
306
+ checksum[1] = (*p);
307
+ unsigned char sum = 0, *ptr;
308
+ for(ptr = (unsigned char *)sentence_begin; ptr != (unsigned char*)sentence_end; ptr++) {
309
+ sum ^= *ptr;
310
+ }
311
+ unsigned int sum_provided;
312
+ sscanf(checksum, "%x", &sum_provided);
313
+ if(sum_provided != sum) {
314
+ char buf[BUFSIZ];
315
+ snprintf(buf, BUFSIZ, "Checksum didn't match: provided is %d, calculated is %d", sum_provided, sum);
316
+ throw DataError(buf);
317
+ }
318
+ }
319
+ goto st19;
320
+ st19:
321
+ if ( ++p == pe )
322
+ goto _out19;
323
+ case 19:
324
+ #line 325 "../ext/nmea.cpp"
325
+ switch( (*p) ) {
326
+ case 10: goto tr28;
327
+ case 13: goto tr29;
328
+ }
329
+ goto st0;
330
+ tr28:
331
+ #line 16 "nmea.rl"
332
+ {
333
+ handler.bod(true_course, magnetic_course, wpt_to, wpt_from);
334
+ }
335
+ goto st276;
336
+ tr77:
337
+ #line 8 "nmea.rl"
338
+ {
339
+ handler.gga(utc, latitude, longitude, gps_quality, active_satellite_count, gsa_hdop, altitude, geoidal_height, dgps_data_age, dgps_station_id);
340
+ }
341
+ goto st276;
342
+ tr135:
343
+ #line 4 "nmea.rl"
344
+ {
345
+ handler.gll(utc, latitude, longitude);
346
+ }
347
+ goto st276;
348
+ tr195:
349
+ #line 6 "nmea.rl"
350
+ {
351
+ handler.gsa(gsa_automatic, gsa_mode, gsa_prns, gsa_pdop, gsa_hdop, gsa_vdop);
352
+ gsa_prn_index = 0;
353
+ }
354
+ goto st276;
355
+ tr223:
356
+ #line 29 "nmea.rl"
357
+ {
358
+ GSV_FLAG flag = GSV_CONTINUE;
359
+ if(current_gsv_number == 1) {
360
+ flag = GSV_START;
361
+ } else if(current_gsv_number == total_gsv_number) {
362
+ flag = GSV_END;
363
+ }
364
+ handler.gsv(flag, satellites);
365
+ satellites.empty();
366
+ }
367
+ goto st276;
368
+ tr310:
369
+ #line 8 "nmea.rl"
370
+ {
371
+ handler.vtg(true_course, magnetic_course, vtg_knot_speed, vtg_kmph_speed, vtg_mode);
372
+ }
373
+ goto st276;
374
+ tr336:
375
+ #line 3 "nmea.rl"
376
+ {
377
+ psrf_key = current_string;
378
+ current_s = current_string;
379
+ *current_s = 0;
380
+ }
381
+ #line 14 "nmea.rl"
382
+ {
383
+ handler.psrftxt(psrf_key, psrf_value);
384
+ }
385
+ goto st276;
386
+ tr342:
387
+ #line 9 "nmea.rl"
388
+ {
389
+ psrf_value = current_string;
390
+ current_s = current_string;
391
+ *current_s = 0;
392
+ }
393
+ #line 14 "nmea.rl"
394
+ {
395
+ handler.psrftxt(psrf_key, psrf_value);
396
+ }
397
+ goto st276;
398
+ st276:
399
+ if ( ++p == pe )
400
+ goto _out276;
401
+ case 276:
402
+ #line 403 "../ext/nmea.cpp"
403
+ goto st0;
404
+ tr29:
405
+ #line 16 "nmea.rl"
406
+ {
407
+ handler.bod(true_course, magnetic_course, wpt_to, wpt_from);
408
+ }
409
+ goto st277;
410
+ tr78:
411
+ #line 8 "nmea.rl"
412
+ {
413
+ handler.gga(utc, latitude, longitude, gps_quality, active_satellite_count, gsa_hdop, altitude, geoidal_height, dgps_data_age, dgps_station_id);
414
+ }
415
+ goto st277;
416
+ tr136:
417
+ #line 4 "nmea.rl"
418
+ {
419
+ handler.gll(utc, latitude, longitude);
420
+ }
421
+ goto st277;
422
+ tr196:
423
+ #line 6 "nmea.rl"
424
+ {
425
+ handler.gsa(gsa_automatic, gsa_mode, gsa_prns, gsa_pdop, gsa_hdop, gsa_vdop);
426
+ gsa_prn_index = 0;
427
+ }
428
+ goto st277;
429
+ tr224:
430
+ #line 29 "nmea.rl"
431
+ {
432
+ GSV_FLAG flag = GSV_CONTINUE;
433
+ if(current_gsv_number == 1) {
434
+ flag = GSV_START;
435
+ } else if(current_gsv_number == total_gsv_number) {
436
+ flag = GSV_END;
437
+ }
438
+ handler.gsv(flag, satellites);
439
+ satellites.empty();
440
+ }
441
+ goto st277;
442
+ tr311:
443
+ #line 8 "nmea.rl"
444
+ {
445
+ handler.vtg(true_course, magnetic_course, vtg_knot_speed, vtg_kmph_speed, vtg_mode);
446
+ }
447
+ goto st277;
448
+ tr337:
449
+ #line 3 "nmea.rl"
450
+ {
451
+ psrf_key = current_string;
452
+ current_s = current_string;
453
+ *current_s = 0;
454
+ }
455
+ #line 14 "nmea.rl"
456
+ {
457
+ handler.psrftxt(psrf_key, psrf_value);
458
+ }
459
+ goto st277;
460
+ tr343:
461
+ #line 9 "nmea.rl"
462
+ {
463
+ psrf_value = current_string;
464
+ current_s = current_string;
465
+ *current_s = 0;
466
+ }
467
+ #line 14 "nmea.rl"
468
+ {
469
+ handler.psrftxt(psrf_key, psrf_value);
470
+ }
471
+ goto st277;
472
+ st277:
473
+ if ( ++p == pe )
474
+ goto _out277;
475
+ case 277:
476
+ #line 477 "../ext/nmea.cpp"
477
+ if ( (*p) == 10 )
478
+ goto st276;
479
+ goto st0;
480
+ tr17:
481
+ #line 11 "nmea.rl"
482
+ {
483
+ current_float = 0;
484
+ current_digit = current_digit*10 + ((*p) - '0');
485
+ }
486
+ goto st20;
487
+ st20:
488
+ if ( ++p == pe )
489
+ goto _out20;
490
+ case 20:
491
+ #line 492 "../ext/nmea.cpp"
492
+ if ( (*p) == 46 )
493
+ goto tr30;
494
+ if ( 48 <= (*p) && (*p) <= 57 )
495
+ goto tr17;
496
+ goto st0;
497
+ tr30:
498
+ #line 15 "nmea.rl"
499
+ {
500
+ current_frac = 10;
501
+ current_float = current_digit;
502
+ current_digit = 0;
503
+ }
504
+ goto st21;
505
+ st21:
506
+ if ( ++p == pe )
507
+ goto _out21;
508
+ case 21:
509
+ #line 510 "../ext/nmea.cpp"
510
+ if ( 48 <= (*p) && (*p) <= 57 )
511
+ goto tr31;
512
+ goto st0;
513
+ tr31:
514
+ #line 20 "nmea.rl"
515
+ {
516
+ current_float += ((*p) - '0')*1.0 / current_frac;
517
+ current_frac *= 10;
518
+ }
519
+ goto st22;
520
+ st22:
521
+ if ( ++p == pe )
522
+ goto _out22;
523
+ case 22:
524
+ #line 525 "../ext/nmea.cpp"
525
+ if ( (*p) == 44 )
526
+ goto tr32;
527
+ if ( 48 <= (*p) && (*p) <= 57 )
528
+ goto tr31;
529
+ goto st0;
530
+ tr13:
531
+ #line 11 "nmea.rl"
532
+ {
533
+ current_float = 0;
534
+ current_digit = current_digit*10 + ((*p) - '0');
535
+ }
536
+ goto st23;
537
+ st23:
538
+ if ( ++p == pe )
539
+ goto _out23;
540
+ case 23:
541
+ #line 542 "../ext/nmea.cpp"
542
+ if ( (*p) == 46 )
543
+ goto tr33;
544
+ if ( 48 <= (*p) && (*p) <= 57 )
545
+ goto tr13;
546
+ goto st0;
547
+ tr33:
548
+ #line 15 "nmea.rl"
549
+ {
550
+ current_frac = 10;
551
+ current_float = current_digit;
552
+ current_digit = 0;
553
+ }
554
+ goto st24;
555
+ st24:
556
+ if ( ++p == pe )
557
+ goto _out24;
558
+ case 24:
559
+ #line 560 "../ext/nmea.cpp"
560
+ if ( 48 <= (*p) && (*p) <= 57 )
561
+ goto tr34;
562
+ goto st0;
563
+ tr34:
564
+ #line 20 "nmea.rl"
565
+ {
566
+ current_float += ((*p) - '0')*1.0 / current_frac;
567
+ current_frac *= 10;
568
+ }
569
+ goto st25;
570
+ st25:
571
+ if ( ++p == pe )
572
+ goto _out25;
573
+ case 25:
574
+ #line 575 "../ext/nmea.cpp"
575
+ if ( (*p) == 44 )
576
+ goto tr35;
577
+ if ( 48 <= (*p) && (*p) <= 57 )
578
+ goto tr34;
579
+ goto st0;
580
+ st26:
581
+ if ( ++p == pe )
582
+ goto _out26;
583
+ case 26:
584
+ switch( (*p) ) {
585
+ case 71: goto st27;
586
+ case 76: goto st93;
587
+ case 83: goto st128;
588
+ }
589
+ goto st0;
590
+ st27:
591
+ if ( ++p == pe )
592
+ goto _out27;
593
+ case 27:
594
+ if ( (*p) == 65 )
595
+ goto st28;
596
+ goto st0;
597
+ st28:
598
+ if ( ++p == pe )
599
+ goto _out28;
600
+ case 28:
601
+ if ( (*p) == 44 )
602
+ goto st29;
603
+ goto st0;
604
+ st29:
605
+ if ( ++p == pe )
606
+ goto _out29;
607
+ case 29:
608
+ if ( 48 <= (*p) && (*p) <= 57 )
609
+ goto tr41;
610
+ goto st0;
611
+ tr41:
612
+ #line 24 "nmea.rl"
613
+ {bcd = 10*((*p) - '0');}
614
+ goto st30;
615
+ st30:
616
+ if ( ++p == pe )
617
+ goto _out30;
618
+ case 30:
619
+ #line 620 "../ext/nmea.cpp"
620
+ if ( 48 <= (*p) && (*p) <= 57 )
621
+ goto tr42;
622
+ goto st0;
623
+ tr42:
624
+ #line 24 "nmea.rl"
625
+ {bcd += (*p) - '0';}
626
+ #line 37 "nmea.rl"
627
+ { utc.hour = bcd; }
628
+ goto st31;
629
+ st31:
630
+ if ( ++p == pe )
631
+ goto _out31;
632
+ case 31:
633
+ #line 634 "../ext/nmea.cpp"
634
+ if ( 48 <= (*p) && (*p) <= 57 )
635
+ goto tr43;
636
+ goto st0;
637
+ tr43:
638
+ #line 24 "nmea.rl"
639
+ {bcd = 10*((*p) - '0');}
640
+ goto st32;
641
+ st32:
642
+ if ( ++p == pe )
643
+ goto _out32;
644
+ case 32:
645
+ #line 646 "../ext/nmea.cpp"
646
+ if ( 48 <= (*p) && (*p) <= 57 )
647
+ goto tr44;
648
+ goto st0;
649
+ tr44:
650
+ #line 24 "nmea.rl"
651
+ {bcd += (*p) - '0';}
652
+ #line 37 "nmea.rl"
653
+ { utc.minute = bcd;}
654
+ goto st33;
655
+ st33:
656
+ if ( ++p == pe )
657
+ goto _out33;
658
+ case 33:
659
+ #line 660 "../ext/nmea.cpp"
660
+ if ( 48 <= (*p) && (*p) <= 57 )
661
+ goto tr45;
662
+ goto st0;
663
+ tr45:
664
+ #line 24 "nmea.rl"
665
+ {bcd = 10*((*p) - '0');}
666
+ goto st34;
667
+ st34:
668
+ if ( ++p == pe )
669
+ goto _out34;
670
+ case 34:
671
+ #line 672 "../ext/nmea.cpp"
672
+ if ( 48 <= (*p) && (*p) <= 57 )
673
+ goto tr46;
674
+ goto st0;
675
+ tr46:
676
+ #line 24 "nmea.rl"
677
+ {bcd += (*p) - '0';}
678
+ #line 37 "nmea.rl"
679
+ { utc.second = bcd;}
680
+ goto st35;
681
+ st35:
682
+ if ( ++p == pe )
683
+ goto _out35;
684
+ case 35:
685
+ #line 686 "../ext/nmea.cpp"
686
+ switch( (*p) ) {
687
+ case 44: goto st36;
688
+ case 46: goto st89;
689
+ }
690
+ goto st0;
691
+ st36:
692
+ if ( ++p == pe )
693
+ goto _out36;
694
+ case 36:
695
+ if ( (*p) == 44 )
696
+ goto st37;
697
+ if ( 48 <= (*p) && (*p) <= 57 )
698
+ goto tr50;
699
+ goto st0;
700
+ tr110:
701
+ #line 46 "nmea.rl"
702
+ {
703
+ latitude.nil = false;
704
+ latitude.value.degrees = current_degrees;
705
+ latitude.value.minutes = current_float;
706
+ current_float = 0;
707
+ current_degrees = 0;
708
+ }
709
+ goto st37;
710
+ tr111:
711
+ #line 45 "nmea.rl"
712
+ {current_degrees *= -1;}
713
+ #line 46 "nmea.rl"
714
+ {
715
+ latitude.nil = false;
716
+ latitude.value.degrees = current_degrees;
717
+ latitude.value.minutes = current_float;
718
+ current_float = 0;
719
+ current_degrees = 0;
720
+ }
721
+ goto st37;
722
+ st37:
723
+ if ( ++p == pe )
724
+ goto _out37;
725
+ case 37:
726
+ #line 727 "../ext/nmea.cpp"
727
+ if ( (*p) == 44 )
728
+ goto st38;
729
+ goto st0;
730
+ st38:
731
+ if ( ++p == pe )
732
+ goto _out38;
733
+ case 38:
734
+ if ( (*p) == 44 )
735
+ goto st39;
736
+ if ( 48 <= (*p) && (*p) <= 57 )
737
+ goto tr53;
738
+ goto st0;
739
+ tr103:
740
+ #line 56 "nmea.rl"
741
+ {
742
+ longitude.nil = false;
743
+ longitude.value.degrees = current_degrees;
744
+ longitude.value.minutes = current_float;
745
+ current_degrees = 0;
746
+ current_float = 0;
747
+ }
748
+ goto st39;
749
+ tr104:
750
+ #line 55 "nmea.rl"
751
+ {current_degrees *= -1;}
752
+ #line 56 "nmea.rl"
753
+ {
754
+ longitude.nil = false;
755
+ longitude.value.degrees = current_degrees;
756
+ longitude.value.minutes = current_float;
757
+ current_degrees = 0;
758
+ current_float = 0;
759
+ }
760
+ goto st39;
761
+ st39:
762
+ if ( ++p == pe )
763
+ goto _out39;
764
+ case 39:
765
+ #line 766 "../ext/nmea.cpp"
766
+ if ( (*p) == 44 )
767
+ goto st40;
768
+ goto st0;
769
+ st40:
770
+ if ( ++p == pe )
771
+ goto _out40;
772
+ case 40:
773
+ if ( 48 <= (*p) && (*p) <= 56 )
774
+ goto tr55;
775
+ goto st0;
776
+ tr55:
777
+ #line 3 "nmea.rl"
778
+ {gps_quality = (GGA_FIX)((*p)-'0');}
779
+ goto st41;
780
+ st41:
781
+ if ( ++p == pe )
782
+ goto _out41;
783
+ case 41:
784
+ #line 785 "../ext/nmea.cpp"
785
+ if ( (*p) == 44 )
786
+ goto st42;
787
+ goto st0;
788
+ st42:
789
+ if ( ++p == pe )
790
+ goto _out42;
791
+ case 42:
792
+ if ( (*p) == 44 )
793
+ goto st43;
794
+ if ( 48 <= (*p) && (*p) <= 57 )
795
+ goto tr58;
796
+ goto st0;
797
+ tr96:
798
+ #line 4 "nmea.rl"
799
+ {active_satellite_count = bcd; }
800
+ goto st43;
801
+ st43:
802
+ if ( ++p == pe )
803
+ goto _out43;
804
+ case 43:
805
+ #line 806 "../ext/nmea.cpp"
806
+ if ( (*p) == 44 )
807
+ goto st44;
808
+ if ( 48 <= (*p) && (*p) <= 57 )
809
+ goto tr60;
810
+ goto st0;
811
+ tr94:
812
+ #line 11 "nmea.rl"
813
+ { gsa_hdop = current_float; current_float = 0;}
814
+ goto st44;
815
+ st44:
816
+ if ( ++p == pe )
817
+ goto _out44;
818
+ case 44:
819
+ #line 820 "../ext/nmea.cpp"
820
+ if ( (*p) == 44 )
821
+ goto st45;
822
+ if ( 48 <= (*p) && (*p) <= 57 )
823
+ goto tr62;
824
+ goto st0;
825
+ st45:
826
+ if ( ++p == pe )
827
+ goto _out45;
828
+ case 45:
829
+ if ( (*p) > 90 ) {
830
+ if ( 97 <= (*p) && (*p) <= 122 )
831
+ goto st46;
832
+ } else if ( (*p) >= 65 )
833
+ goto st46;
834
+ goto st0;
835
+ st46:
836
+ if ( ++p == pe )
837
+ goto _out46;
838
+ case 46:
839
+ if ( (*p) == 44 )
840
+ goto st47;
841
+ goto st0;
842
+ tr91:
843
+ #line 5 "nmea.rl"
844
+ {altitude = current_float; current_float = 0;}
845
+ goto st47;
846
+ st47:
847
+ if ( ++p == pe )
848
+ goto _out47;
849
+ case 47:
850
+ #line 851 "../ext/nmea.cpp"
851
+ if ( (*p) == 44 )
852
+ goto st48;
853
+ if ( 48 <= (*p) && (*p) <= 57 )
854
+ goto tr66;
855
+ goto st0;
856
+ st48:
857
+ if ( ++p == pe )
858
+ goto _out48;
859
+ case 48:
860
+ if ( (*p) == 44 )
861
+ goto st49;
862
+ goto st0;
863
+ tr86:
864
+ #line 6 "nmea.rl"
865
+ {geoidal_height = current_float; current_float = 0;}
866
+ goto st49;
867
+ st49:
868
+ if ( ++p == pe )
869
+ goto _out49;
870
+ case 49:
871
+ #line 872 "../ext/nmea.cpp"
872
+ if ( (*p) == 44 )
873
+ goto st50;
874
+ if ( 48 <= (*p) && (*p) <= 57 )
875
+ goto tr69;
876
+ goto st0;
877
+ tr81:
878
+ #line 7 "nmea.rl"
879
+ {dgps_data_age = current_float; current_float = 0;}
880
+ goto st50;
881
+ st50:
882
+ if ( ++p == pe )
883
+ goto _out50;
884
+ case 50:
885
+ #line 886 "../ext/nmea.cpp"
886
+ if ( 48 <= (*p) && (*p) <= 57 )
887
+ goto tr70;
888
+ goto st0;
889
+ tr70:
890
+ #line 24 "nmea.rl"
891
+ {bcd = 10*((*p) - '0');}
892
+ goto st51;
893
+ st51:
894
+ if ( ++p == pe )
895
+ goto _out51;
896
+ case 51:
897
+ #line 898 "../ext/nmea.cpp"
898
+ if ( 48 <= (*p) && (*p) <= 57 )
899
+ goto tr71;
900
+ goto st0;
901
+ tr71:
902
+ #line 24 "nmea.rl"
903
+ {bcd += (*p) - '0';}
904
+ goto st52;
905
+ st52:
906
+ if ( ++p == pe )
907
+ goto _out52;
908
+ case 52:
909
+ #line 910 "../ext/nmea.cpp"
910
+ if ( 48 <= (*p) && (*p) <= 57 )
911
+ goto tr72;
912
+ goto st0;
913
+ tr72:
914
+ #line 25 "nmea.rl"
915
+ {bcd = bcd*10 + ((*p) - '0');}
916
+ goto st53;
917
+ st53:
918
+ if ( ++p == pe )
919
+ goto _out53;
920
+ case 53:
921
+ #line 922 "../ext/nmea.cpp"
922
+ if ( 48 <= (*p) && (*p) <= 57 )
923
+ goto tr73;
924
+ goto st0;
925
+ tr73:
926
+ #line 26 "nmea.rl"
927
+ {bcd = bcd*10 + ((*p) - '0');}
928
+ #line 7 "nmea.rl"
929
+ {dgps_station_id = bcd;}
930
+ goto st54;
931
+ st54:
932
+ if ( ++p == pe )
933
+ goto _out54;
934
+ case 54:
935
+ #line 936 "../ext/nmea.cpp"
936
+ if ( (*p) == 42 )
937
+ goto tr74;
938
+ goto st0;
939
+ tr74:
940
+ #line 82 "nmea.rl"
941
+ {sentence_end = p; }
942
+ goto st55;
943
+ st55:
944
+ if ( ++p == pe )
945
+ goto _out55;
946
+ case 55:
947
+ #line 948 "../ext/nmea.cpp"
948
+ if ( (*p) < 65 ) {
949
+ if ( 48 <= (*p) && (*p) <= 57 )
950
+ goto tr75;
951
+ } else if ( (*p) > 90 ) {
952
+ if ( 97 <= (*p) && (*p) <= 122 )
953
+ goto tr75;
954
+ } else
955
+ goto tr75;
956
+ goto st0;
957
+ tr75:
958
+ #line 82 "nmea.rl"
959
+ {checksum[0] = (*p);}
960
+ goto st56;
961
+ st56:
962
+ if ( ++p == pe )
963
+ goto _out56;
964
+ case 56:
965
+ #line 966 "../ext/nmea.cpp"
966
+ if ( (*p) < 65 ) {
967
+ if ( 48 <= (*p) && (*p) <= 57 )
968
+ goto tr76;
969
+ } else if ( (*p) > 90 ) {
970
+ if ( 97 <= (*p) && (*p) <= 122 )
971
+ goto tr76;
972
+ } else
973
+ goto tr76;
974
+ goto st0;
975
+ tr76:
976
+ #line 68 "nmea.rl"
977
+ {
978
+ checksum[1] = (*p);
979
+ unsigned char sum = 0, *ptr;
980
+ for(ptr = (unsigned char *)sentence_begin; ptr != (unsigned char*)sentence_end; ptr++) {
981
+ sum ^= *ptr;
982
+ }
983
+ unsigned int sum_provided;
984
+ sscanf(checksum, "%x", &sum_provided);
985
+ if(sum_provided != sum) {
986
+ char buf[BUFSIZ];
987
+ snprintf(buf, BUFSIZ, "Checksum didn't match: provided is %d, calculated is %d", sum_provided, sum);
988
+ throw DataError(buf);
989
+ }
990
+ }
991
+ goto st57;
992
+ st57:
993
+ if ( ++p == pe )
994
+ goto _out57;
995
+ case 57:
996
+ #line 997 "../ext/nmea.cpp"
997
+ switch( (*p) ) {
998
+ case 10: goto tr77;
999
+ case 13: goto tr78;
1000
+ }
1001
+ goto st0;
1002
+ tr69:
1003
+ #line 11 "nmea.rl"
1004
+ {
1005
+ current_float = 0;
1006
+ current_digit = current_digit*10 + ((*p) - '0');
1007
+ }
1008
+ goto st58;
1009
+ st58:
1010
+ if ( ++p == pe )
1011
+ goto _out58;
1012
+ case 58:
1013
+ #line 1014 "../ext/nmea.cpp"
1014
+ if ( (*p) == 46 )
1015
+ goto tr79;
1016
+ if ( 48 <= (*p) && (*p) <= 57 )
1017
+ goto tr69;
1018
+ goto st0;
1019
+ tr79:
1020
+ #line 15 "nmea.rl"
1021
+ {
1022
+ current_frac = 10;
1023
+ current_float = current_digit;
1024
+ current_digit = 0;
1025
+ }
1026
+ goto st59;
1027
+ st59:
1028
+ if ( ++p == pe )
1029
+ goto _out59;
1030
+ case 59:
1031
+ #line 1032 "../ext/nmea.cpp"
1032
+ if ( 48 <= (*p) && (*p) <= 57 )
1033
+ goto tr80;
1034
+ goto st0;
1035
+ tr80:
1036
+ #line 20 "nmea.rl"
1037
+ {
1038
+ current_float += ((*p) - '0')*1.0 / current_frac;
1039
+ current_frac *= 10;
1040
+ }
1041
+ goto st60;
1042
+ st60:
1043
+ if ( ++p == pe )
1044
+ goto _out60;
1045
+ case 60:
1046
+ #line 1047 "../ext/nmea.cpp"
1047
+ if ( (*p) == 44 )
1048
+ goto tr81;
1049
+ if ( 48 <= (*p) && (*p) <= 57 )
1050
+ goto tr80;
1051
+ goto st0;
1052
+ tr66:
1053
+ #line 11 "nmea.rl"
1054
+ {
1055
+ current_float = 0;
1056
+ current_digit = current_digit*10 + ((*p) - '0');
1057
+ }
1058
+ goto st61;
1059
+ st61:
1060
+ if ( ++p == pe )
1061
+ goto _out61;
1062
+ case 61:
1063
+ #line 1064 "../ext/nmea.cpp"
1064
+ if ( (*p) == 46 )
1065
+ goto tr82;
1066
+ if ( 48 <= (*p) && (*p) <= 57 )
1067
+ goto tr66;
1068
+ goto st0;
1069
+ tr82:
1070
+ #line 15 "nmea.rl"
1071
+ {
1072
+ current_frac = 10;
1073
+ current_float = current_digit;
1074
+ current_digit = 0;
1075
+ }
1076
+ goto st62;
1077
+ st62:
1078
+ if ( ++p == pe )
1079
+ goto _out62;
1080
+ case 62:
1081
+ #line 1082 "../ext/nmea.cpp"
1082
+ if ( 48 <= (*p) && (*p) <= 57 )
1083
+ goto tr83;
1084
+ goto st0;
1085
+ tr83:
1086
+ #line 20 "nmea.rl"
1087
+ {
1088
+ current_float += ((*p) - '0')*1.0 / current_frac;
1089
+ current_frac *= 10;
1090
+ }
1091
+ goto st63;
1092
+ st63:
1093
+ if ( ++p == pe )
1094
+ goto _out63;
1095
+ case 63:
1096
+ #line 1097 "../ext/nmea.cpp"
1097
+ if ( (*p) == 44 )
1098
+ goto st64;
1099
+ if ( 48 <= (*p) && (*p) <= 57 )
1100
+ goto tr83;
1101
+ goto st0;
1102
+ st64:
1103
+ if ( ++p == pe )
1104
+ goto _out64;
1105
+ case 64:
1106
+ if ( (*p) > 90 ) {
1107
+ if ( 97 <= (*p) && (*p) <= 122 )
1108
+ goto tr85;
1109
+ } else if ( (*p) >= 65 )
1110
+ goto tr85;
1111
+ goto st0;
1112
+ tr85:
1113
+ #line 6 "nmea.rl"
1114
+ {geoidal_height_units = (*p);}
1115
+ goto st65;
1116
+ st65:
1117
+ if ( ++p == pe )
1118
+ goto _out65;
1119
+ case 65:
1120
+ #line 1121 "../ext/nmea.cpp"
1121
+ if ( (*p) == 44 )
1122
+ goto tr86;
1123
+ goto st0;
1124
+ tr62:
1125
+ #line 11 "nmea.rl"
1126
+ {
1127
+ current_float = 0;
1128
+ current_digit = current_digit*10 + ((*p) - '0');
1129
+ }
1130
+ goto st66;
1131
+ st66:
1132
+ if ( ++p == pe )
1133
+ goto _out66;
1134
+ case 66:
1135
+ #line 1136 "../ext/nmea.cpp"
1136
+ if ( (*p) == 46 )
1137
+ goto tr87;
1138
+ if ( 48 <= (*p) && (*p) <= 57 )
1139
+ goto tr62;
1140
+ goto st0;
1141
+ tr87:
1142
+ #line 15 "nmea.rl"
1143
+ {
1144
+ current_frac = 10;
1145
+ current_float = current_digit;
1146
+ current_digit = 0;
1147
+ }
1148
+ goto st67;
1149
+ st67:
1150
+ if ( ++p == pe )
1151
+ goto _out67;
1152
+ case 67:
1153
+ #line 1154 "../ext/nmea.cpp"
1154
+ if ( 48 <= (*p) && (*p) <= 57 )
1155
+ goto tr88;
1156
+ goto st0;
1157
+ tr88:
1158
+ #line 20 "nmea.rl"
1159
+ {
1160
+ current_float += ((*p) - '0')*1.0 / current_frac;
1161
+ current_frac *= 10;
1162
+ }
1163
+ goto st68;
1164
+ st68:
1165
+ if ( ++p == pe )
1166
+ goto _out68;
1167
+ case 68:
1168
+ #line 1169 "../ext/nmea.cpp"
1169
+ if ( (*p) == 44 )
1170
+ goto st69;
1171
+ if ( 48 <= (*p) && (*p) <= 57 )
1172
+ goto tr88;
1173
+ goto st0;
1174
+ st69:
1175
+ if ( ++p == pe )
1176
+ goto _out69;
1177
+ case 69:
1178
+ if ( (*p) > 90 ) {
1179
+ if ( 97 <= (*p) && (*p) <= 122 )
1180
+ goto tr90;
1181
+ } else if ( (*p) >= 65 )
1182
+ goto tr90;
1183
+ goto st0;
1184
+ tr90:
1185
+ #line 5 "nmea.rl"
1186
+ {altitude_units = (*p);}
1187
+ goto st70;
1188
+ st70:
1189
+ if ( ++p == pe )
1190
+ goto _out70;
1191
+ case 70:
1192
+ #line 1193 "../ext/nmea.cpp"
1193
+ if ( (*p) == 44 )
1194
+ goto tr91;
1195
+ goto st0;
1196
+ tr60:
1197
+ #line 11 "nmea.rl"
1198
+ {
1199
+ current_float = 0;
1200
+ current_digit = current_digit*10 + ((*p) - '0');
1201
+ }
1202
+ goto st71;
1203
+ st71:
1204
+ if ( ++p == pe )
1205
+ goto _out71;
1206
+ case 71:
1207
+ #line 1208 "../ext/nmea.cpp"
1208
+ if ( (*p) == 46 )
1209
+ goto tr92;
1210
+ if ( 48 <= (*p) && (*p) <= 57 )
1211
+ goto tr60;
1212
+ goto st0;
1213
+ tr92:
1214
+ #line 15 "nmea.rl"
1215
+ {
1216
+ current_frac = 10;
1217
+ current_float = current_digit;
1218
+ current_digit = 0;
1219
+ }
1220
+ goto st72;
1221
+ st72:
1222
+ if ( ++p == pe )
1223
+ goto _out72;
1224
+ case 72:
1225
+ #line 1226 "../ext/nmea.cpp"
1226
+ if ( 48 <= (*p) && (*p) <= 57 )
1227
+ goto tr93;
1228
+ goto st0;
1229
+ tr93:
1230
+ #line 20 "nmea.rl"
1231
+ {
1232
+ current_float += ((*p) - '0')*1.0 / current_frac;
1233
+ current_frac *= 10;
1234
+ }
1235
+ goto st73;
1236
+ st73:
1237
+ if ( ++p == pe )
1238
+ goto _out73;
1239
+ case 73:
1240
+ #line 1241 "../ext/nmea.cpp"
1241
+ if ( (*p) == 44 )
1242
+ goto tr94;
1243
+ if ( 48 <= (*p) && (*p) <= 57 )
1244
+ goto tr93;
1245
+ goto st0;
1246
+ tr58:
1247
+ #line 24 "nmea.rl"
1248
+ {bcd = 10*((*p) - '0');}
1249
+ goto st74;
1250
+ st74:
1251
+ if ( ++p == pe )
1252
+ goto _out74;
1253
+ case 74:
1254
+ #line 1255 "../ext/nmea.cpp"
1255
+ if ( 48 <= (*p) && (*p) <= 57 )
1256
+ goto tr95;
1257
+ goto st0;
1258
+ tr95:
1259
+ #line 24 "nmea.rl"
1260
+ {bcd += (*p) - '0';}
1261
+ goto st75;
1262
+ st75:
1263
+ if ( ++p == pe )
1264
+ goto _out75;
1265
+ case 75:
1266
+ #line 1267 "../ext/nmea.cpp"
1267
+ if ( (*p) == 44 )
1268
+ goto tr96;
1269
+ goto st0;
1270
+ tr53:
1271
+ #line 24 "nmea.rl"
1272
+ {bcd = 10*((*p) - '0');}
1273
+ goto st76;
1274
+ st76:
1275
+ if ( ++p == pe )
1276
+ goto _out76;
1277
+ case 76:
1278
+ #line 1279 "../ext/nmea.cpp"
1279
+ if ( 48 <= (*p) && (*p) <= 57 )
1280
+ goto tr97;
1281
+ goto st0;
1282
+ tr97:
1283
+ #line 24 "nmea.rl"
1284
+ {bcd += (*p) - '0';}
1285
+ goto st77;
1286
+ st77:
1287
+ if ( ++p == pe )
1288
+ goto _out77;
1289
+ case 77:
1290
+ #line 1291 "../ext/nmea.cpp"
1291
+ if ( 48 <= (*p) && (*p) <= 57 )
1292
+ goto tr98;
1293
+ goto st0;
1294
+ tr98:
1295
+ #line 25 "nmea.rl"
1296
+ {bcd = bcd*10 + ((*p) - '0');}
1297
+ #line 40 "nmea.rl"
1298
+ {
1299
+ current_degrees = bcd;
1300
+ bcd = 0;
1301
+ }
1302
+ goto st78;
1303
+ st78:
1304
+ if ( ++p == pe )
1305
+ goto _out78;
1306
+ case 78:
1307
+ #line 1308 "../ext/nmea.cpp"
1308
+ if ( 48 <= (*p) && (*p) <= 57 )
1309
+ goto tr99;
1310
+ goto st0;
1311
+ tr99:
1312
+ #line 11 "nmea.rl"
1313
+ {
1314
+ current_float = 0;
1315
+ current_digit = current_digit*10 + ((*p) - '0');
1316
+ }
1317
+ goto st79;
1318
+ st79:
1319
+ if ( ++p == pe )
1320
+ goto _out79;
1321
+ case 79:
1322
+ #line 1323 "../ext/nmea.cpp"
1323
+ if ( (*p) == 46 )
1324
+ goto tr100;
1325
+ if ( 48 <= (*p) && (*p) <= 57 )
1326
+ goto tr99;
1327
+ goto st0;
1328
+ tr100:
1329
+ #line 15 "nmea.rl"
1330
+ {
1331
+ current_frac = 10;
1332
+ current_float = current_digit;
1333
+ current_digit = 0;
1334
+ }
1335
+ goto st80;
1336
+ st80:
1337
+ if ( ++p == pe )
1338
+ goto _out80;
1339
+ case 80:
1340
+ #line 1341 "../ext/nmea.cpp"
1341
+ if ( 48 <= (*p) && (*p) <= 57 )
1342
+ goto tr101;
1343
+ goto st0;
1344
+ tr101:
1345
+ #line 20 "nmea.rl"
1346
+ {
1347
+ current_float += ((*p) - '0')*1.0 / current_frac;
1348
+ current_frac *= 10;
1349
+ }
1350
+ goto st81;
1351
+ st81:
1352
+ if ( ++p == pe )
1353
+ goto _out81;
1354
+ case 81:
1355
+ #line 1356 "../ext/nmea.cpp"
1356
+ if ( (*p) == 44 )
1357
+ goto st82;
1358
+ if ( 48 <= (*p) && (*p) <= 57 )
1359
+ goto tr101;
1360
+ goto st0;
1361
+ st82:
1362
+ if ( ++p == pe )
1363
+ goto _out82;
1364
+ case 82:
1365
+ switch( (*p) ) {
1366
+ case 69: goto tr103;
1367
+ case 87: goto tr104;
1368
+ }
1369
+ goto st0;
1370
+ tr50:
1371
+ #line 24 "nmea.rl"
1372
+ {bcd = 10*((*p) - '0');}
1373
+ goto st83;
1374
+ st83:
1375
+ if ( ++p == pe )
1376
+ goto _out83;
1377
+ case 83:
1378
+ #line 1379 "../ext/nmea.cpp"
1379
+ if ( 48 <= (*p) && (*p) <= 57 )
1380
+ goto tr105;
1381
+ goto st0;
1382
+ tr105:
1383
+ #line 24 "nmea.rl"
1384
+ {bcd += (*p) - '0';}
1385
+ #line 40 "nmea.rl"
1386
+ {
1387
+ current_degrees = bcd;
1388
+ bcd = 0;
1389
+ }
1390
+ goto st84;
1391
+ st84:
1392
+ if ( ++p == pe )
1393
+ goto _out84;
1394
+ case 84:
1395
+ #line 1396 "../ext/nmea.cpp"
1396
+ if ( 48 <= (*p) && (*p) <= 57 )
1397
+ goto tr106;
1398
+ goto st0;
1399
+ tr106:
1400
+ #line 11 "nmea.rl"
1401
+ {
1402
+ current_float = 0;
1403
+ current_digit = current_digit*10 + ((*p) - '0');
1404
+ }
1405
+ goto st85;
1406
+ st85:
1407
+ if ( ++p == pe )
1408
+ goto _out85;
1409
+ case 85:
1410
+ #line 1411 "../ext/nmea.cpp"
1411
+ if ( (*p) == 46 )
1412
+ goto tr107;
1413
+ if ( 48 <= (*p) && (*p) <= 57 )
1414
+ goto tr106;
1415
+ goto st0;
1416
+ tr107:
1417
+ #line 15 "nmea.rl"
1418
+ {
1419
+ current_frac = 10;
1420
+ current_float = current_digit;
1421
+ current_digit = 0;
1422
+ }
1423
+ goto st86;
1424
+ st86:
1425
+ if ( ++p == pe )
1426
+ goto _out86;
1427
+ case 86:
1428
+ #line 1429 "../ext/nmea.cpp"
1429
+ if ( 48 <= (*p) && (*p) <= 57 )
1430
+ goto tr108;
1431
+ goto st0;
1432
+ tr108:
1433
+ #line 20 "nmea.rl"
1434
+ {
1435
+ current_float += ((*p) - '0')*1.0 / current_frac;
1436
+ current_frac *= 10;
1437
+ }
1438
+ goto st87;
1439
+ st87:
1440
+ if ( ++p == pe )
1441
+ goto _out87;
1442
+ case 87:
1443
+ #line 1444 "../ext/nmea.cpp"
1444
+ if ( (*p) == 44 )
1445
+ goto st88;
1446
+ if ( 48 <= (*p) && (*p) <= 57 )
1447
+ goto tr108;
1448
+ goto st0;
1449
+ st88:
1450
+ if ( ++p == pe )
1451
+ goto _out88;
1452
+ case 88:
1453
+ switch( (*p) ) {
1454
+ case 78: goto tr110;
1455
+ case 83: goto tr111;
1456
+ }
1457
+ goto st0;
1458
+ st89:
1459
+ if ( ++p == pe )
1460
+ goto _out89;
1461
+ case 89:
1462
+ if ( 48 <= (*p) && (*p) <= 57 )
1463
+ goto tr112;
1464
+ goto st0;
1465
+ tr112:
1466
+ #line 24 "nmea.rl"
1467
+ {bcd = 10*((*p) - '0');}
1468
+ goto st90;
1469
+ st90:
1470
+ if ( ++p == pe )
1471
+ goto _out90;
1472
+ case 90:
1473
+ #line 1474 "../ext/nmea.cpp"
1474
+ if ( 48 <= (*p) && (*p) <= 57 )
1475
+ goto tr113;
1476
+ goto st0;
1477
+ tr113:
1478
+ #line 24 "nmea.rl"
1479
+ {bcd += (*p) - '0';}
1480
+ goto st91;
1481
+ st91:
1482
+ if ( ++p == pe )
1483
+ goto _out91;
1484
+ case 91:
1485
+ #line 1486 "../ext/nmea.cpp"
1486
+ if ( 48 <= (*p) && (*p) <= 57 )
1487
+ goto tr114;
1488
+ goto st0;
1489
+ tr114:
1490
+ #line 25 "nmea.rl"
1491
+ {bcd = bcd*10 + ((*p) - '0');}
1492
+ #line 37 "nmea.rl"
1493
+ { utc.usec = bcd;}
1494
+ goto st92;
1495
+ st92:
1496
+ if ( ++p == pe )
1497
+ goto _out92;
1498
+ case 92:
1499
+ #line 1500 "../ext/nmea.cpp"
1500
+ if ( (*p) == 44 )
1501
+ goto st36;
1502
+ goto st0;
1503
+ st93:
1504
+ if ( ++p == pe )
1505
+ goto _out93;
1506
+ case 93:
1507
+ if ( (*p) == 76 )
1508
+ goto st94;
1509
+ goto st0;
1510
+ st94:
1511
+ if ( ++p == pe )
1512
+ goto _out94;
1513
+ case 94:
1514
+ if ( (*p) == 44 )
1515
+ goto st95;
1516
+ goto st0;
1517
+ st95:
1518
+ if ( ++p == pe )
1519
+ goto _out95;
1520
+ case 95:
1521
+ if ( (*p) == 44 )
1522
+ goto st96;
1523
+ if ( 48 <= (*p) && (*p) <= 57 )
1524
+ goto tr118;
1525
+ goto st0;
1526
+ tr153:
1527
+ #line 46 "nmea.rl"
1528
+ {
1529
+ latitude.nil = false;
1530
+ latitude.value.degrees = current_degrees;
1531
+ latitude.value.minutes = current_float;
1532
+ current_float = 0;
1533
+ current_degrees = 0;
1534
+ }
1535
+ goto st96;
1536
+ tr154:
1537
+ #line 45 "nmea.rl"
1538
+ {current_degrees *= -1;}
1539
+ #line 46 "nmea.rl"
1540
+ {
1541
+ latitude.nil = false;
1542
+ latitude.value.degrees = current_degrees;
1543
+ latitude.value.minutes = current_float;
1544
+ current_float = 0;
1545
+ current_degrees = 0;
1546
+ }
1547
+ goto st96;
1548
+ st96:
1549
+ if ( ++p == pe )
1550
+ goto _out96;
1551
+ case 96:
1552
+ #line 1553 "../ext/nmea.cpp"
1553
+ if ( (*p) == 44 )
1554
+ goto st97;
1555
+ goto st0;
1556
+ st97:
1557
+ if ( ++p == pe )
1558
+ goto _out97;
1559
+ case 97:
1560
+ if ( (*p) == 44 )
1561
+ goto st98;
1562
+ if ( 48 <= (*p) && (*p) <= 57 )
1563
+ goto tr121;
1564
+ goto st0;
1565
+ tr146:
1566
+ #line 56 "nmea.rl"
1567
+ {
1568
+ longitude.nil = false;
1569
+ longitude.value.degrees = current_degrees;
1570
+ longitude.value.minutes = current_float;
1571
+ current_degrees = 0;
1572
+ current_float = 0;
1573
+ }
1574
+ goto st98;
1575
+ tr147:
1576
+ #line 55 "nmea.rl"
1577
+ {current_degrees *= -1;}
1578
+ #line 56 "nmea.rl"
1579
+ {
1580
+ longitude.nil = false;
1581
+ longitude.value.degrees = current_degrees;
1582
+ longitude.value.minutes = current_float;
1583
+ current_degrees = 0;
1584
+ current_float = 0;
1585
+ }
1586
+ goto st98;
1587
+ st98:
1588
+ if ( ++p == pe )
1589
+ goto _out98;
1590
+ case 98:
1591
+ #line 1592 "../ext/nmea.cpp"
1592
+ if ( (*p) == 44 )
1593
+ goto st99;
1594
+ goto st0;
1595
+ st99:
1596
+ if ( ++p == pe )
1597
+ goto _out99;
1598
+ case 99:
1599
+ if ( 48 <= (*p) && (*p) <= 57 )
1600
+ goto tr123;
1601
+ goto st0;
1602
+ tr123:
1603
+ #line 24 "nmea.rl"
1604
+ {bcd = 10*((*p) - '0');}
1605
+ goto st100;
1606
+ st100:
1607
+ if ( ++p == pe )
1608
+ goto _out100;
1609
+ case 100:
1610
+ #line 1611 "../ext/nmea.cpp"
1611
+ if ( 48 <= (*p) && (*p) <= 57 )
1612
+ goto tr124;
1613
+ goto st0;
1614
+ tr124:
1615
+ #line 24 "nmea.rl"
1616
+ {bcd += (*p) - '0';}
1617
+ #line 37 "nmea.rl"
1618
+ { utc.hour = bcd; }
1619
+ goto st101;
1620
+ st101:
1621
+ if ( ++p == pe )
1622
+ goto _out101;
1623
+ case 101:
1624
+ #line 1625 "../ext/nmea.cpp"
1625
+ if ( 48 <= (*p) && (*p) <= 57 )
1626
+ goto tr125;
1627
+ goto st0;
1628
+ tr125:
1629
+ #line 24 "nmea.rl"
1630
+ {bcd = 10*((*p) - '0');}
1631
+ goto st102;
1632
+ st102:
1633
+ if ( ++p == pe )
1634
+ goto _out102;
1635
+ case 102:
1636
+ #line 1637 "../ext/nmea.cpp"
1637
+ if ( 48 <= (*p) && (*p) <= 57 )
1638
+ goto tr126;
1639
+ goto st0;
1640
+ tr126:
1641
+ #line 24 "nmea.rl"
1642
+ {bcd += (*p) - '0';}
1643
+ #line 37 "nmea.rl"
1644
+ { utc.minute = bcd;}
1645
+ goto st103;
1646
+ st103:
1647
+ if ( ++p == pe )
1648
+ goto _out103;
1649
+ case 103:
1650
+ #line 1651 "../ext/nmea.cpp"
1651
+ if ( 48 <= (*p) && (*p) <= 57 )
1652
+ goto tr127;
1653
+ goto st0;
1654
+ tr127:
1655
+ #line 24 "nmea.rl"
1656
+ {bcd = 10*((*p) - '0');}
1657
+ goto st104;
1658
+ st104:
1659
+ if ( ++p == pe )
1660
+ goto _out104;
1661
+ case 104:
1662
+ #line 1663 "../ext/nmea.cpp"
1663
+ if ( 48 <= (*p) && (*p) <= 57 )
1664
+ goto tr128;
1665
+ goto st0;
1666
+ tr128:
1667
+ #line 24 "nmea.rl"
1668
+ {bcd += (*p) - '0';}
1669
+ #line 37 "nmea.rl"
1670
+ { utc.second = bcd;}
1671
+ goto st105;
1672
+ st105:
1673
+ if ( ++p == pe )
1674
+ goto _out105;
1675
+ case 105:
1676
+ #line 1677 "../ext/nmea.cpp"
1677
+ switch( (*p) ) {
1678
+ case 44: goto st106;
1679
+ case 46: goto st111;
1680
+ }
1681
+ goto st0;
1682
+ st106:
1683
+ if ( ++p == pe )
1684
+ goto _out106;
1685
+ case 106:
1686
+ switch( (*p) ) {
1687
+ case 65: goto st107;
1688
+ case 86: goto st107;
1689
+ }
1690
+ goto st0;
1691
+ st107:
1692
+ if ( ++p == pe )
1693
+ goto _out107;
1694
+ case 107:
1695
+ if ( (*p) == 42 )
1696
+ goto tr132;
1697
+ goto st0;
1698
+ tr132:
1699
+ #line 82 "nmea.rl"
1700
+ {sentence_end = p; }
1701
+ goto st108;
1702
+ st108:
1703
+ if ( ++p == pe )
1704
+ goto _out108;
1705
+ case 108:
1706
+ #line 1707 "../ext/nmea.cpp"
1707
+ if ( (*p) < 65 ) {
1708
+ if ( 48 <= (*p) && (*p) <= 57 )
1709
+ goto tr133;
1710
+ } else if ( (*p) > 90 ) {
1711
+ if ( 97 <= (*p) && (*p) <= 122 )
1712
+ goto tr133;
1713
+ } else
1714
+ goto tr133;
1715
+ goto st0;
1716
+ tr133:
1717
+ #line 82 "nmea.rl"
1718
+ {checksum[0] = (*p);}
1719
+ goto st109;
1720
+ st109:
1721
+ if ( ++p == pe )
1722
+ goto _out109;
1723
+ case 109:
1724
+ #line 1725 "../ext/nmea.cpp"
1725
+ if ( (*p) < 65 ) {
1726
+ if ( 48 <= (*p) && (*p) <= 57 )
1727
+ goto tr134;
1728
+ } else if ( (*p) > 90 ) {
1729
+ if ( 97 <= (*p) && (*p) <= 122 )
1730
+ goto tr134;
1731
+ } else
1732
+ goto tr134;
1733
+ goto st0;
1734
+ tr134:
1735
+ #line 68 "nmea.rl"
1736
+ {
1737
+ checksum[1] = (*p);
1738
+ unsigned char sum = 0, *ptr;
1739
+ for(ptr = (unsigned char *)sentence_begin; ptr != (unsigned char*)sentence_end; ptr++) {
1740
+ sum ^= *ptr;
1741
+ }
1742
+ unsigned int sum_provided;
1743
+ sscanf(checksum, "%x", &sum_provided);
1744
+ if(sum_provided != sum) {
1745
+ char buf[BUFSIZ];
1746
+ snprintf(buf, BUFSIZ, "Checksum didn't match: provided is %d, calculated is %d", sum_provided, sum);
1747
+ throw DataError(buf);
1748
+ }
1749
+ }
1750
+ goto st110;
1751
+ st110:
1752
+ if ( ++p == pe )
1753
+ goto _out110;
1754
+ case 110:
1755
+ #line 1756 "../ext/nmea.cpp"
1756
+ switch( (*p) ) {
1757
+ case 10: goto tr135;
1758
+ case 13: goto tr136;
1759
+ }
1760
+ goto st0;
1761
+ st111:
1762
+ if ( ++p == pe )
1763
+ goto _out111;
1764
+ case 111:
1765
+ if ( 48 <= (*p) && (*p) <= 57 )
1766
+ goto tr137;
1767
+ goto st0;
1768
+ tr137:
1769
+ #line 24 "nmea.rl"
1770
+ {bcd = 10*((*p) - '0');}
1771
+ goto st112;
1772
+ st112:
1773
+ if ( ++p == pe )
1774
+ goto _out112;
1775
+ case 112:
1776
+ #line 1777 "../ext/nmea.cpp"
1777
+ if ( 48 <= (*p) && (*p) <= 57 )
1778
+ goto tr138;
1779
+ goto st0;
1780
+ tr138:
1781
+ #line 24 "nmea.rl"
1782
+ {bcd += (*p) - '0';}
1783
+ goto st113;
1784
+ st113:
1785
+ if ( ++p == pe )
1786
+ goto _out113;
1787
+ case 113:
1788
+ #line 1789 "../ext/nmea.cpp"
1789
+ if ( 48 <= (*p) && (*p) <= 57 )
1790
+ goto tr139;
1791
+ goto st0;
1792
+ tr139:
1793
+ #line 25 "nmea.rl"
1794
+ {bcd = bcd*10 + ((*p) - '0');}
1795
+ #line 37 "nmea.rl"
1796
+ { utc.usec = bcd;}
1797
+ goto st114;
1798
+ st114:
1799
+ if ( ++p == pe )
1800
+ goto _out114;
1801
+ case 114:
1802
+ #line 1803 "../ext/nmea.cpp"
1803
+ if ( (*p) == 44 )
1804
+ goto st106;
1805
+ goto st0;
1806
+ tr121:
1807
+ #line 24 "nmea.rl"
1808
+ {bcd = 10*((*p) - '0');}
1809
+ goto st115;
1810
+ st115:
1811
+ if ( ++p == pe )
1812
+ goto _out115;
1813
+ case 115:
1814
+ #line 1815 "../ext/nmea.cpp"
1815
+ if ( 48 <= (*p) && (*p) <= 57 )
1816
+ goto tr140;
1817
+ goto st0;
1818
+ tr140:
1819
+ #line 24 "nmea.rl"
1820
+ {bcd += (*p) - '0';}
1821
+ goto st116;
1822
+ st116:
1823
+ if ( ++p == pe )
1824
+ goto _out116;
1825
+ case 116:
1826
+ #line 1827 "../ext/nmea.cpp"
1827
+ if ( 48 <= (*p) && (*p) <= 57 )
1828
+ goto tr141;
1829
+ goto st0;
1830
+ tr141:
1831
+ #line 25 "nmea.rl"
1832
+ {bcd = bcd*10 + ((*p) - '0');}
1833
+ #line 40 "nmea.rl"
1834
+ {
1835
+ current_degrees = bcd;
1836
+ bcd = 0;
1837
+ }
1838
+ goto st117;
1839
+ st117:
1840
+ if ( ++p == pe )
1841
+ goto _out117;
1842
+ case 117:
1843
+ #line 1844 "../ext/nmea.cpp"
1844
+ if ( 48 <= (*p) && (*p) <= 57 )
1845
+ goto tr142;
1846
+ goto st0;
1847
+ tr142:
1848
+ #line 11 "nmea.rl"
1849
+ {
1850
+ current_float = 0;
1851
+ current_digit = current_digit*10 + ((*p) - '0');
1852
+ }
1853
+ goto st118;
1854
+ st118:
1855
+ if ( ++p == pe )
1856
+ goto _out118;
1857
+ case 118:
1858
+ #line 1859 "../ext/nmea.cpp"
1859
+ if ( (*p) == 46 )
1860
+ goto tr143;
1861
+ if ( 48 <= (*p) && (*p) <= 57 )
1862
+ goto tr142;
1863
+ goto st0;
1864
+ tr143:
1865
+ #line 15 "nmea.rl"
1866
+ {
1867
+ current_frac = 10;
1868
+ current_float = current_digit;
1869
+ current_digit = 0;
1870
+ }
1871
+ goto st119;
1872
+ st119:
1873
+ if ( ++p == pe )
1874
+ goto _out119;
1875
+ case 119:
1876
+ #line 1877 "../ext/nmea.cpp"
1877
+ if ( 48 <= (*p) && (*p) <= 57 )
1878
+ goto tr144;
1879
+ goto st0;
1880
+ tr144:
1881
+ #line 20 "nmea.rl"
1882
+ {
1883
+ current_float += ((*p) - '0')*1.0 / current_frac;
1884
+ current_frac *= 10;
1885
+ }
1886
+ goto st120;
1887
+ st120:
1888
+ if ( ++p == pe )
1889
+ goto _out120;
1890
+ case 120:
1891
+ #line 1892 "../ext/nmea.cpp"
1892
+ if ( (*p) == 44 )
1893
+ goto st121;
1894
+ if ( 48 <= (*p) && (*p) <= 57 )
1895
+ goto tr144;
1896
+ goto st0;
1897
+ st121:
1898
+ if ( ++p == pe )
1899
+ goto _out121;
1900
+ case 121:
1901
+ switch( (*p) ) {
1902
+ case 69: goto tr146;
1903
+ case 87: goto tr147;
1904
+ }
1905
+ goto st0;
1906
+ tr118:
1907
+ #line 24 "nmea.rl"
1908
+ {bcd = 10*((*p) - '0');}
1909
+ goto st122;
1910
+ st122:
1911
+ if ( ++p == pe )
1912
+ goto _out122;
1913
+ case 122:
1914
+ #line 1915 "../ext/nmea.cpp"
1915
+ if ( 48 <= (*p) && (*p) <= 57 )
1916
+ goto tr148;
1917
+ goto st0;
1918
+ tr148:
1919
+ #line 24 "nmea.rl"
1920
+ {bcd += (*p) - '0';}
1921
+ #line 40 "nmea.rl"
1922
+ {
1923
+ current_degrees = bcd;
1924
+ bcd = 0;
1925
+ }
1926
+ goto st123;
1927
+ st123:
1928
+ if ( ++p == pe )
1929
+ goto _out123;
1930
+ case 123:
1931
+ #line 1932 "../ext/nmea.cpp"
1932
+ if ( 48 <= (*p) && (*p) <= 57 )
1933
+ goto tr149;
1934
+ goto st0;
1935
+ tr149:
1936
+ #line 11 "nmea.rl"
1937
+ {
1938
+ current_float = 0;
1939
+ current_digit = current_digit*10 + ((*p) - '0');
1940
+ }
1941
+ goto st124;
1942
+ st124:
1943
+ if ( ++p == pe )
1944
+ goto _out124;
1945
+ case 124:
1946
+ #line 1947 "../ext/nmea.cpp"
1947
+ if ( (*p) == 46 )
1948
+ goto tr150;
1949
+ if ( 48 <= (*p) && (*p) <= 57 )
1950
+ goto tr149;
1951
+ goto st0;
1952
+ tr150:
1953
+ #line 15 "nmea.rl"
1954
+ {
1955
+ current_frac = 10;
1956
+ current_float = current_digit;
1957
+ current_digit = 0;
1958
+ }
1959
+ goto st125;
1960
+ st125:
1961
+ if ( ++p == pe )
1962
+ goto _out125;
1963
+ case 125:
1964
+ #line 1965 "../ext/nmea.cpp"
1965
+ if ( 48 <= (*p) && (*p) <= 57 )
1966
+ goto tr151;
1967
+ goto st0;
1968
+ tr151:
1969
+ #line 20 "nmea.rl"
1970
+ {
1971
+ current_float += ((*p) - '0')*1.0 / current_frac;
1972
+ current_frac *= 10;
1973
+ }
1974
+ goto st126;
1975
+ st126:
1976
+ if ( ++p == pe )
1977
+ goto _out126;
1978
+ case 126:
1979
+ #line 1980 "../ext/nmea.cpp"
1980
+ if ( (*p) == 44 )
1981
+ goto st127;
1982
+ if ( 48 <= (*p) && (*p) <= 57 )
1983
+ goto tr151;
1984
+ goto st0;
1985
+ st127:
1986
+ if ( ++p == pe )
1987
+ goto _out127;
1988
+ case 127:
1989
+ switch( (*p) ) {
1990
+ case 78: goto tr153;
1991
+ case 83: goto tr154;
1992
+ }
1993
+ goto st0;
1994
+ st128:
1995
+ if ( ++p == pe )
1996
+ goto _out128;
1997
+ case 128:
1998
+ switch( (*p) ) {
1999
+ case 65: goto st129;
2000
+ case 86: goto st161;
2001
+ }
2002
+ goto st0;
2003
+ st129:
2004
+ if ( ++p == pe )
2005
+ goto _out129;
2006
+ case 129:
2007
+ if ( (*p) == 44 )
2008
+ goto st130;
2009
+ goto st0;
2010
+ st130:
2011
+ if ( ++p == pe )
2012
+ goto _out130;
2013
+ case 130:
2014
+ switch( (*p) ) {
2015
+ case 65: goto tr158;
2016
+ case 77: goto tr159;
2017
+ }
2018
+ goto st0;
2019
+ tr158:
2020
+ #line 3 "nmea.rl"
2021
+ {gsa_automatic = true; }
2022
+ goto st131;
2023
+ tr159:
2024
+ #line 3 "nmea.rl"
2025
+ {gsa_automatic = false;}
2026
+ goto st131;
2027
+ st131:
2028
+ if ( ++p == pe )
2029
+ goto _out131;
2030
+ case 131:
2031
+ #line 2032 "../ext/nmea.cpp"
2032
+ if ( (*p) == 44 )
2033
+ goto st132;
2034
+ goto st0;
2035
+ st132:
2036
+ if ( ++p == pe )
2037
+ goto _out132;
2038
+ case 132:
2039
+ if ( 49 <= (*p) && (*p) <= 51 )
2040
+ goto tr161;
2041
+ goto st0;
2042
+ tr161:
2043
+ #line 4 "nmea.rl"
2044
+ {gsa_mode = GSA_MODE((*p)-'0');}
2045
+ goto st133;
2046
+ st133:
2047
+ if ( ++p == pe )
2048
+ goto _out133;
2049
+ case 133:
2050
+ #line 2051 "../ext/nmea.cpp"
2051
+ if ( (*p) == 44 )
2052
+ goto tr162;
2053
+ goto st0;
2054
+ tr164:
2055
+ #line 11 "nmea.rl"
2056
+ {
2057
+ current_float = 0;
2058
+ current_digit = current_digit*10 + ((*p) - '0');
2059
+ }
2060
+ goto st134;
2061
+ tr162:
2062
+ #line 4 "nmea.rl"
2063
+ {gsa_prn_index = 0;}
2064
+ goto st134;
2065
+ st134:
2066
+ if ( ++p == pe )
2067
+ goto _out134;
2068
+ case 134:
2069
+ #line 2070 "../ext/nmea.cpp"
2070
+ if ( (*p) == 44 )
2071
+ goto tr163;
2072
+ if ( 48 <= (*p) && (*p) <= 57 )
2073
+ goto tr164;
2074
+ goto st0;
2075
+ tr166:
2076
+ #line 11 "nmea.rl"
2077
+ {
2078
+ current_float = 0;
2079
+ current_digit = current_digit*10 + ((*p) - '0');
2080
+ }
2081
+ goto st135;
2082
+ tr163:
2083
+ #line 5 "nmea.rl"
2084
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2085
+ goto st135;
2086
+ st135:
2087
+ if ( ++p == pe )
2088
+ goto _out135;
2089
+ case 135:
2090
+ #line 2091 "../ext/nmea.cpp"
2091
+ if ( (*p) == 44 )
2092
+ goto tr165;
2093
+ if ( 48 <= (*p) && (*p) <= 57 )
2094
+ goto tr166;
2095
+ goto st0;
2096
+ tr168:
2097
+ #line 11 "nmea.rl"
2098
+ {
2099
+ current_float = 0;
2100
+ current_digit = current_digit*10 + ((*p) - '0');
2101
+ }
2102
+ goto st136;
2103
+ tr165:
2104
+ #line 5 "nmea.rl"
2105
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2106
+ goto st136;
2107
+ st136:
2108
+ if ( ++p == pe )
2109
+ goto _out136;
2110
+ case 136:
2111
+ #line 2112 "../ext/nmea.cpp"
2112
+ if ( (*p) == 44 )
2113
+ goto tr167;
2114
+ if ( 48 <= (*p) && (*p) <= 57 )
2115
+ goto tr168;
2116
+ goto st0;
2117
+ tr170:
2118
+ #line 11 "nmea.rl"
2119
+ {
2120
+ current_float = 0;
2121
+ current_digit = current_digit*10 + ((*p) - '0');
2122
+ }
2123
+ goto st137;
2124
+ tr167:
2125
+ #line 5 "nmea.rl"
2126
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2127
+ goto st137;
2128
+ st137:
2129
+ if ( ++p == pe )
2130
+ goto _out137;
2131
+ case 137:
2132
+ #line 2133 "../ext/nmea.cpp"
2133
+ if ( (*p) == 44 )
2134
+ goto tr169;
2135
+ if ( 48 <= (*p) && (*p) <= 57 )
2136
+ goto tr170;
2137
+ goto st0;
2138
+ tr172:
2139
+ #line 11 "nmea.rl"
2140
+ {
2141
+ current_float = 0;
2142
+ current_digit = current_digit*10 + ((*p) - '0');
2143
+ }
2144
+ goto st138;
2145
+ tr169:
2146
+ #line 5 "nmea.rl"
2147
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2148
+ goto st138;
2149
+ st138:
2150
+ if ( ++p == pe )
2151
+ goto _out138;
2152
+ case 138:
2153
+ #line 2154 "../ext/nmea.cpp"
2154
+ if ( (*p) == 44 )
2155
+ goto tr171;
2156
+ if ( 48 <= (*p) && (*p) <= 57 )
2157
+ goto tr172;
2158
+ goto st0;
2159
+ tr174:
2160
+ #line 11 "nmea.rl"
2161
+ {
2162
+ current_float = 0;
2163
+ current_digit = current_digit*10 + ((*p) - '0');
2164
+ }
2165
+ goto st139;
2166
+ tr171:
2167
+ #line 5 "nmea.rl"
2168
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2169
+ goto st139;
2170
+ st139:
2171
+ if ( ++p == pe )
2172
+ goto _out139;
2173
+ case 139:
2174
+ #line 2175 "../ext/nmea.cpp"
2175
+ if ( (*p) == 44 )
2176
+ goto tr173;
2177
+ if ( 48 <= (*p) && (*p) <= 57 )
2178
+ goto tr174;
2179
+ goto st0;
2180
+ tr176:
2181
+ #line 11 "nmea.rl"
2182
+ {
2183
+ current_float = 0;
2184
+ current_digit = current_digit*10 + ((*p) - '0');
2185
+ }
2186
+ goto st140;
2187
+ tr173:
2188
+ #line 5 "nmea.rl"
2189
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2190
+ goto st140;
2191
+ st140:
2192
+ if ( ++p == pe )
2193
+ goto _out140;
2194
+ case 140:
2195
+ #line 2196 "../ext/nmea.cpp"
2196
+ if ( (*p) == 44 )
2197
+ goto tr175;
2198
+ if ( 48 <= (*p) && (*p) <= 57 )
2199
+ goto tr176;
2200
+ goto st0;
2201
+ tr178:
2202
+ #line 11 "nmea.rl"
2203
+ {
2204
+ current_float = 0;
2205
+ current_digit = current_digit*10 + ((*p) - '0');
2206
+ }
2207
+ goto st141;
2208
+ tr175:
2209
+ #line 5 "nmea.rl"
2210
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2211
+ goto st141;
2212
+ st141:
2213
+ if ( ++p == pe )
2214
+ goto _out141;
2215
+ case 141:
2216
+ #line 2217 "../ext/nmea.cpp"
2217
+ if ( (*p) == 44 )
2218
+ goto tr177;
2219
+ if ( 48 <= (*p) && (*p) <= 57 )
2220
+ goto tr178;
2221
+ goto st0;
2222
+ tr180:
2223
+ #line 11 "nmea.rl"
2224
+ {
2225
+ current_float = 0;
2226
+ current_digit = current_digit*10 + ((*p) - '0');
2227
+ }
2228
+ goto st142;
2229
+ tr177:
2230
+ #line 5 "nmea.rl"
2231
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2232
+ goto st142;
2233
+ st142:
2234
+ if ( ++p == pe )
2235
+ goto _out142;
2236
+ case 142:
2237
+ #line 2238 "../ext/nmea.cpp"
2238
+ if ( (*p) == 44 )
2239
+ goto tr179;
2240
+ if ( 48 <= (*p) && (*p) <= 57 )
2241
+ goto tr180;
2242
+ goto st0;
2243
+ tr182:
2244
+ #line 11 "nmea.rl"
2245
+ {
2246
+ current_float = 0;
2247
+ current_digit = current_digit*10 + ((*p) - '0');
2248
+ }
2249
+ goto st143;
2250
+ tr179:
2251
+ #line 5 "nmea.rl"
2252
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2253
+ goto st143;
2254
+ st143:
2255
+ if ( ++p == pe )
2256
+ goto _out143;
2257
+ case 143:
2258
+ #line 2259 "../ext/nmea.cpp"
2259
+ if ( (*p) == 44 )
2260
+ goto tr181;
2261
+ if ( 48 <= (*p) && (*p) <= 57 )
2262
+ goto tr182;
2263
+ goto st0;
2264
+ tr184:
2265
+ #line 11 "nmea.rl"
2266
+ {
2267
+ current_float = 0;
2268
+ current_digit = current_digit*10 + ((*p) - '0');
2269
+ }
2270
+ goto st144;
2271
+ tr181:
2272
+ #line 5 "nmea.rl"
2273
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2274
+ goto st144;
2275
+ st144:
2276
+ if ( ++p == pe )
2277
+ goto _out144;
2278
+ case 144:
2279
+ #line 2280 "../ext/nmea.cpp"
2280
+ if ( (*p) == 44 )
2281
+ goto tr183;
2282
+ if ( 48 <= (*p) && (*p) <= 57 )
2283
+ goto tr184;
2284
+ goto st0;
2285
+ tr186:
2286
+ #line 11 "nmea.rl"
2287
+ {
2288
+ current_float = 0;
2289
+ current_digit = current_digit*10 + ((*p) - '0');
2290
+ }
2291
+ goto st145;
2292
+ tr183:
2293
+ #line 5 "nmea.rl"
2294
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2295
+ goto st145;
2296
+ st145:
2297
+ if ( ++p == pe )
2298
+ goto _out145;
2299
+ case 145:
2300
+ #line 2301 "../ext/nmea.cpp"
2301
+ if ( (*p) == 44 )
2302
+ goto tr185;
2303
+ if ( 48 <= (*p) && (*p) <= 57 )
2304
+ goto tr186;
2305
+ goto st0;
2306
+ tr185:
2307
+ #line 5 "nmea.rl"
2308
+ {if(current_digit) {gsa_prns[gsa_prn_index] = current_digit;} gsa_prn_index++; current_digit = 0; }
2309
+ goto st146;
2310
+ st146:
2311
+ if ( ++p == pe )
2312
+ goto _out146;
2313
+ case 146:
2314
+ #line 2315 "../ext/nmea.cpp"
2315
+ if ( (*p) == 44 )
2316
+ goto st147;
2317
+ if ( 48 <= (*p) && (*p) <= 57 )
2318
+ goto tr188;
2319
+ goto st0;
2320
+ tr204:
2321
+ #line 10 "nmea.rl"
2322
+ { gsa_pdop = current_float; current_float = 0;}
2323
+ goto st147;
2324
+ st147:
2325
+ if ( ++p == pe )
2326
+ goto _out147;
2327
+ case 147:
2328
+ #line 2329 "../ext/nmea.cpp"
2329
+ if ( (*p) == 44 )
2330
+ goto st148;
2331
+ if ( 48 <= (*p) && (*p) <= 57 )
2332
+ goto tr190;
2333
+ goto st0;
2334
+ tr201:
2335
+ #line 11 "nmea.rl"
2336
+ { gsa_hdop = current_float; current_float = 0;}
2337
+ goto st148;
2338
+ st148:
2339
+ if ( ++p == pe )
2340
+ goto _out148;
2341
+ case 148:
2342
+ #line 2343 "../ext/nmea.cpp"
2343
+ if ( (*p) == 42 )
2344
+ goto tr191;
2345
+ if ( 48 <= (*p) && (*p) <= 57 )
2346
+ goto tr192;
2347
+ goto st0;
2348
+ tr191:
2349
+ #line 82 "nmea.rl"
2350
+ {sentence_end = p; }
2351
+ goto st149;
2352
+ st149:
2353
+ if ( ++p == pe )
2354
+ goto _out149;
2355
+ case 149:
2356
+ #line 2357 "../ext/nmea.cpp"
2357
+ if ( (*p) < 65 ) {
2358
+ if ( 48 <= (*p) && (*p) <= 57 )
2359
+ goto tr193;
2360
+ } else if ( (*p) > 90 ) {
2361
+ if ( 97 <= (*p) && (*p) <= 122 )
2362
+ goto tr193;
2363
+ } else
2364
+ goto tr193;
2365
+ goto st0;
2366
+ tr193:
2367
+ #line 82 "nmea.rl"
2368
+ {checksum[0] = (*p);}
2369
+ goto st150;
2370
+ st150:
2371
+ if ( ++p == pe )
2372
+ goto _out150;
2373
+ case 150:
2374
+ #line 2375 "../ext/nmea.cpp"
2375
+ if ( (*p) < 65 ) {
2376
+ if ( 48 <= (*p) && (*p) <= 57 )
2377
+ goto tr194;
2378
+ } else if ( (*p) > 90 ) {
2379
+ if ( 97 <= (*p) && (*p) <= 122 )
2380
+ goto tr194;
2381
+ } else
2382
+ goto tr194;
2383
+ goto st0;
2384
+ tr194:
2385
+ #line 68 "nmea.rl"
2386
+ {
2387
+ checksum[1] = (*p);
2388
+ unsigned char sum = 0, *ptr;
2389
+ for(ptr = (unsigned char *)sentence_begin; ptr != (unsigned char*)sentence_end; ptr++) {
2390
+ sum ^= *ptr;
2391
+ }
2392
+ unsigned int sum_provided;
2393
+ sscanf(checksum, "%x", &sum_provided);
2394
+ if(sum_provided != sum) {
2395
+ char buf[BUFSIZ];
2396
+ snprintf(buf, BUFSIZ, "Checksum didn't match: provided is %d, calculated is %d", sum_provided, sum);
2397
+ throw DataError(buf);
2398
+ }
2399
+ }
2400
+ goto st151;
2401
+ st151:
2402
+ if ( ++p == pe )
2403
+ goto _out151;
2404
+ case 151:
2405
+ #line 2406 "../ext/nmea.cpp"
2406
+ switch( (*p) ) {
2407
+ case 10: goto tr195;
2408
+ case 13: goto tr196;
2409
+ }
2410
+ goto st0;
2411
+ tr192:
2412
+ #line 11 "nmea.rl"
2413
+ {
2414
+ current_float = 0;
2415
+ current_digit = current_digit*10 + ((*p) - '0');
2416
+ }
2417
+ goto st152;
2418
+ st152:
2419
+ if ( ++p == pe )
2420
+ goto _out152;
2421
+ case 152:
2422
+ #line 2423 "../ext/nmea.cpp"
2423
+ if ( (*p) == 46 )
2424
+ goto tr197;
2425
+ if ( 48 <= (*p) && (*p) <= 57 )
2426
+ goto tr192;
2427
+ goto st0;
2428
+ tr197:
2429
+ #line 15 "nmea.rl"
2430
+ {
2431
+ current_frac = 10;
2432
+ current_float = current_digit;
2433
+ current_digit = 0;
2434
+ }
2435
+ goto st153;
2436
+ st153:
2437
+ if ( ++p == pe )
2438
+ goto _out153;
2439
+ case 153:
2440
+ #line 2441 "../ext/nmea.cpp"
2441
+ if ( 48 <= (*p) && (*p) <= 57 )
2442
+ goto tr198;
2443
+ goto st0;
2444
+ tr198:
2445
+ #line 20 "nmea.rl"
2446
+ {
2447
+ current_float += ((*p) - '0')*1.0 / current_frac;
2448
+ current_frac *= 10;
2449
+ }
2450
+ #line 12 "nmea.rl"
2451
+ { gsa_vdop = current_float; current_float = 0;}
2452
+ goto st154;
2453
+ st154:
2454
+ if ( ++p == pe )
2455
+ goto _out154;
2456
+ case 154:
2457
+ #line 2458 "../ext/nmea.cpp"
2458
+ if ( (*p) == 42 )
2459
+ goto tr191;
2460
+ if ( 48 <= (*p) && (*p) <= 57 )
2461
+ goto tr198;
2462
+ goto st0;
2463
+ tr190:
2464
+ #line 11 "nmea.rl"
2465
+ {
2466
+ current_float = 0;
2467
+ current_digit = current_digit*10 + ((*p) - '0');
2468
+ }
2469
+ goto st155;
2470
+ st155:
2471
+ if ( ++p == pe )
2472
+ goto _out155;
2473
+ case 155:
2474
+ #line 2475 "../ext/nmea.cpp"
2475
+ if ( (*p) == 46 )
2476
+ goto tr199;
2477
+ if ( 48 <= (*p) && (*p) <= 57 )
2478
+ goto tr190;
2479
+ goto st0;
2480
+ tr199:
2481
+ #line 15 "nmea.rl"
2482
+ {
2483
+ current_frac = 10;
2484
+ current_float = current_digit;
2485
+ current_digit = 0;
2486
+ }
2487
+ goto st156;
2488
+ st156:
2489
+ if ( ++p == pe )
2490
+ goto _out156;
2491
+ case 156:
2492
+ #line 2493 "../ext/nmea.cpp"
2493
+ if ( 48 <= (*p) && (*p) <= 57 )
2494
+ goto tr200;
2495
+ goto st0;
2496
+ tr200:
2497
+ #line 20 "nmea.rl"
2498
+ {
2499
+ current_float += ((*p) - '0')*1.0 / current_frac;
2500
+ current_frac *= 10;
2501
+ }
2502
+ goto st157;
2503
+ st157:
2504
+ if ( ++p == pe )
2505
+ goto _out157;
2506
+ case 157:
2507
+ #line 2508 "../ext/nmea.cpp"
2508
+ if ( (*p) == 44 )
2509
+ goto tr201;
2510
+ if ( 48 <= (*p) && (*p) <= 57 )
2511
+ goto tr200;
2512
+ goto st0;
2513
+ tr188:
2514
+ #line 11 "nmea.rl"
2515
+ {
2516
+ current_float = 0;
2517
+ current_digit = current_digit*10 + ((*p) - '0');
2518
+ }
2519
+ goto st158;
2520
+ st158:
2521
+ if ( ++p == pe )
2522
+ goto _out158;
2523
+ case 158:
2524
+ #line 2525 "../ext/nmea.cpp"
2525
+ if ( (*p) == 46 )
2526
+ goto tr202;
2527
+ if ( 48 <= (*p) && (*p) <= 57 )
2528
+ goto tr188;
2529
+ goto st0;
2530
+ tr202:
2531
+ #line 15 "nmea.rl"
2532
+ {
2533
+ current_frac = 10;
2534
+ current_float = current_digit;
2535
+ current_digit = 0;
2536
+ }
2537
+ goto st159;
2538
+ st159:
2539
+ if ( ++p == pe )
2540
+ goto _out159;
2541
+ case 159:
2542
+ #line 2543 "../ext/nmea.cpp"
2543
+ if ( 48 <= (*p) && (*p) <= 57 )
2544
+ goto tr203;
2545
+ goto st0;
2546
+ tr203:
2547
+ #line 20 "nmea.rl"
2548
+ {
2549
+ current_float += ((*p) - '0')*1.0 / current_frac;
2550
+ current_frac *= 10;
2551
+ }
2552
+ goto st160;
2553
+ st160:
2554
+ if ( ++p == pe )
2555
+ goto _out160;
2556
+ case 160:
2557
+ #line 2558 "../ext/nmea.cpp"
2558
+ if ( (*p) == 44 )
2559
+ goto tr204;
2560
+ if ( 48 <= (*p) && (*p) <= 57 )
2561
+ goto tr203;
2562
+ goto st0;
2563
+ st161:
2564
+ if ( ++p == pe )
2565
+ goto _out161;
2566
+ case 161:
2567
+ if ( (*p) == 44 )
2568
+ goto st162;
2569
+ goto st0;
2570
+ st162:
2571
+ if ( ++p == pe )
2572
+ goto _out162;
2573
+ case 162:
2574
+ if ( 48 <= (*p) && (*p) <= 57 )
2575
+ goto tr206;
2576
+ goto st0;
2577
+ tr206:
2578
+ #line 11 "nmea.rl"
2579
+ {
2580
+ current_float = 0;
2581
+ current_digit = current_digit*10 + ((*p) - '0');
2582
+ }
2583
+ goto st163;
2584
+ st163:
2585
+ if ( ++p == pe )
2586
+ goto _out163;
2587
+ case 163:
2588
+ #line 2589 "../ext/nmea.cpp"
2589
+ if ( (*p) == 44 )
2590
+ goto tr207;
2591
+ if ( 48 <= (*p) && (*p) <= 57 )
2592
+ goto tr206;
2593
+ goto st0;
2594
+ tr207:
2595
+ #line 4 "nmea.rl"
2596
+ {total_gsv_number = current_digit; current_digit = 0;}
2597
+ goto st164;
2598
+ st164:
2599
+ if ( ++p == pe )
2600
+ goto _out164;
2601
+ case 164:
2602
+ #line 2603 "../ext/nmea.cpp"
2603
+ if ( 48 <= (*p) && (*p) <= 57 )
2604
+ goto tr208;
2605
+ goto st0;
2606
+ tr208:
2607
+ #line 11 "nmea.rl"
2608
+ {
2609
+ current_float = 0;
2610
+ current_digit = current_digit*10 + ((*p) - '0');
2611
+ }
2612
+ goto st165;
2613
+ st165:
2614
+ if ( ++p == pe )
2615
+ goto _out165;
2616
+ case 165:
2617
+ #line 2618 "../ext/nmea.cpp"
2618
+ if ( (*p) == 44 )
2619
+ goto tr209;
2620
+ if ( 48 <= (*p) && (*p) <= 57 )
2621
+ goto tr208;
2622
+ goto st0;
2623
+ tr209:
2624
+ #line 6 "nmea.rl"
2625
+ {
2626
+ current_gsv_number = current_digit;
2627
+ current_digit = 0;
2628
+ }
2629
+ goto st166;
2630
+ st166:
2631
+ if ( ++p == pe )
2632
+ goto _out166;
2633
+ case 166:
2634
+ #line 2635 "../ext/nmea.cpp"
2635
+ if ( 48 <= (*p) && (*p) <= 57 )
2636
+ goto tr210;
2637
+ goto st0;
2638
+ tr210:
2639
+ #line 11 "nmea.rl"
2640
+ {
2641
+ current_float = 0;
2642
+ current_digit = current_digit*10 + ((*p) - '0');
2643
+ }
2644
+ goto st167;
2645
+ st167:
2646
+ if ( ++p == pe )
2647
+ goto _out167;
2648
+ case 167:
2649
+ #line 2650 "../ext/nmea.cpp"
2650
+ if ( (*p) == 44 )
2651
+ goto tr211;
2652
+ if ( 48 <= (*p) && (*p) <= 57 )
2653
+ goto tr210;
2654
+ goto st0;
2655
+ tr211:
2656
+ #line 11 "nmea.rl"
2657
+ {total_satellites = current_digit; current_digit = 0;}
2658
+ goto st168;
2659
+ st168:
2660
+ if ( ++p == pe )
2661
+ goto _out168;
2662
+ case 168:
2663
+ #line 2664 "../ext/nmea.cpp"
2664
+ if ( 48 <= (*p) && (*p) <= 57 )
2665
+ goto tr212;
2666
+ goto st0;
2667
+ tr212:
2668
+ #line 11 "nmea.rl"
2669
+ {
2670
+ current_float = 0;
2671
+ current_digit = current_digit*10 + ((*p) - '0');
2672
+ }
2673
+ goto st169;
2674
+ tr225:
2675
+ #line 18 "nmea.rl"
2676
+ {
2677
+ SatelliteInfo satellite;
2678
+ satellite.number = satellite_number;
2679
+ satellite.elevation = elevation;
2680
+ satellite.azimuth = azimuth;
2681
+ satellite.signal_level = snr_db;
2682
+ snr_db.nil = true;
2683
+ satellites.push_back(satellite);
2684
+ }
2685
+ #line 11 "nmea.rl"
2686
+ {
2687
+ current_float = 0;
2688
+ current_digit = current_digit*10 + ((*p) - '0');
2689
+ }
2690
+ goto st169;
2691
+ st169:
2692
+ if ( ++p == pe )
2693
+ goto _out169;
2694
+ case 169:
2695
+ #line 2696 "../ext/nmea.cpp"
2696
+ if ( (*p) == 44 )
2697
+ goto tr213;
2698
+ if ( 48 <= (*p) && (*p) <= 57 )
2699
+ goto tr212;
2700
+ goto st0;
2701
+ tr213:
2702
+ #line 14 "nmea.rl"
2703
+ {satellite_number = current_digit; current_digit = 0; }
2704
+ goto st170;
2705
+ st170:
2706
+ if ( ++p == pe )
2707
+ goto _out170;
2708
+ case 170:
2709
+ #line 2710 "../ext/nmea.cpp"
2710
+ if ( 48 <= (*p) && (*p) <= 57 )
2711
+ goto tr214;
2712
+ goto st0;
2713
+ tr214:
2714
+ #line 11 "nmea.rl"
2715
+ {
2716
+ current_float = 0;
2717
+ current_digit = current_digit*10 + ((*p) - '0');
2718
+ }
2719
+ goto st171;
2720
+ st171:
2721
+ if ( ++p == pe )
2722
+ goto _out171;
2723
+ case 171:
2724
+ #line 2725 "../ext/nmea.cpp"
2725
+ if ( (*p) == 44 )
2726
+ goto tr215;
2727
+ if ( 48 <= (*p) && (*p) <= 57 )
2728
+ goto tr214;
2729
+ goto st0;
2730
+ tr215:
2731
+ #line 15 "nmea.rl"
2732
+ {elevation = current_digit; current_digit = 0;}
2733
+ goto st172;
2734
+ st172:
2735
+ if ( ++p == pe )
2736
+ goto _out172;
2737
+ case 172:
2738
+ #line 2739 "../ext/nmea.cpp"
2739
+ if ( 48 <= (*p) && (*p) <= 57 )
2740
+ goto tr216;
2741
+ goto st0;
2742
+ tr216:
2743
+ #line 11 "nmea.rl"
2744
+ {
2745
+ current_float = 0;
2746
+ current_digit = current_digit*10 + ((*p) - '0');
2747
+ }
2748
+ goto st173;
2749
+ st173:
2750
+ if ( ++p == pe )
2751
+ goto _out173;
2752
+ case 173:
2753
+ #line 2754 "../ext/nmea.cpp"
2754
+ if ( (*p) == 44 )
2755
+ goto tr217;
2756
+ if ( 48 <= (*p) && (*p) <= 57 )
2757
+ goto tr216;
2758
+ goto st0;
2759
+ tr217:
2760
+ #line 16 "nmea.rl"
2761
+ {azimuth = current_digit; current_digit = 0; }
2762
+ goto st174;
2763
+ st174:
2764
+ if ( ++p == pe )
2765
+ goto _out174;
2766
+ case 174:
2767
+ #line 2768 "../ext/nmea.cpp"
2768
+ switch( (*p) ) {
2769
+ case 42: goto tr218;
2770
+ case 44: goto st178;
2771
+ }
2772
+ if ( 48 <= (*p) && (*p) <= 57 )
2773
+ goto tr220;
2774
+ goto st0;
2775
+ tr218:
2776
+ #line 18 "nmea.rl"
2777
+ {
2778
+ SatelliteInfo satellite;
2779
+ satellite.number = satellite_number;
2780
+ satellite.elevation = elevation;
2781
+ satellite.azimuth = azimuth;
2782
+ satellite.signal_level = snr_db;
2783
+ snr_db.nil = true;
2784
+ satellites.push_back(satellite);
2785
+ }
2786
+ #line 82 "nmea.rl"
2787
+ {sentence_end = p; }
2788
+ goto st175;
2789
+ st175:
2790
+ if ( ++p == pe )
2791
+ goto _out175;
2792
+ case 175:
2793
+ #line 2794 "../ext/nmea.cpp"
2794
+ if ( (*p) < 65 ) {
2795
+ if ( 48 <= (*p) && (*p) <= 57 )
2796
+ goto tr221;
2797
+ } else if ( (*p) > 90 ) {
2798
+ if ( 97 <= (*p) && (*p) <= 122 )
2799
+ goto tr221;
2800
+ } else
2801
+ goto tr221;
2802
+ goto st0;
2803
+ tr221:
2804
+ #line 82 "nmea.rl"
2805
+ {checksum[0] = (*p);}
2806
+ goto st176;
2807
+ st176:
2808
+ if ( ++p == pe )
2809
+ goto _out176;
2810
+ case 176:
2811
+ #line 2812 "../ext/nmea.cpp"
2812
+ if ( (*p) < 65 ) {
2813
+ if ( 48 <= (*p) && (*p) <= 57 )
2814
+ goto tr222;
2815
+ } else if ( (*p) > 90 ) {
2816
+ if ( 97 <= (*p) && (*p) <= 122 )
2817
+ goto tr222;
2818
+ } else
2819
+ goto tr222;
2820
+ goto st0;
2821
+ tr222:
2822
+ #line 68 "nmea.rl"
2823
+ {
2824
+ checksum[1] = (*p);
2825
+ unsigned char sum = 0, *ptr;
2826
+ for(ptr = (unsigned char *)sentence_begin; ptr != (unsigned char*)sentence_end; ptr++) {
2827
+ sum ^= *ptr;
2828
+ }
2829
+ unsigned int sum_provided;
2830
+ sscanf(checksum, "%x", &sum_provided);
2831
+ if(sum_provided != sum) {
2832
+ char buf[BUFSIZ];
2833
+ snprintf(buf, BUFSIZ, "Checksum didn't match: provided is %d, calculated is %d", sum_provided, sum);
2834
+ throw DataError(buf);
2835
+ }
2836
+ }
2837
+ goto st177;
2838
+ st177:
2839
+ if ( ++p == pe )
2840
+ goto _out177;
2841
+ case 177:
2842
+ #line 2843 "../ext/nmea.cpp"
2843
+ switch( (*p) ) {
2844
+ case 10: goto tr223;
2845
+ case 13: goto tr224;
2846
+ }
2847
+ goto st0;
2848
+ st178:
2849
+ if ( ++p == pe )
2850
+ goto _out178;
2851
+ case 178:
2852
+ if ( 48 <= (*p) && (*p) <= 57 )
2853
+ goto tr225;
2854
+ goto st0;
2855
+ tr220:
2856
+ #line 24 "nmea.rl"
2857
+ {bcd = 10*((*p) - '0');}
2858
+ goto st179;
2859
+ st179:
2860
+ if ( ++p == pe )
2861
+ goto _out179;
2862
+ case 179:
2863
+ #line 2864 "../ext/nmea.cpp"
2864
+ if ( 48 <= (*p) && (*p) <= 57 )
2865
+ goto tr226;
2866
+ goto st0;
2867
+ tr226:
2868
+ #line 24 "nmea.rl"
2869
+ {bcd += (*p) - '0';}
2870
+ #line 17 "nmea.rl"
2871
+ {snr_db = bcd;}
2872
+ goto st180;
2873
+ st180:
2874
+ if ( ++p == pe )
2875
+ goto _out180;
2876
+ case 180:
2877
+ #line 2878 "../ext/nmea.cpp"
2878
+ switch( (*p) ) {
2879
+ case 42: goto tr218;
2880
+ case 44: goto st178;
2881
+ }
2882
+ goto st0;
2883
+ st181:
2884
+ if ( ++p == pe )
2885
+ goto _out181;
2886
+ case 181:
2887
+ if ( (*p) == 77 )
2888
+ goto st182;
2889
+ goto st0;
2890
+ st182:
2891
+ if ( ++p == pe )
2892
+ goto _out182;
2893
+ case 182:
2894
+ if ( (*p) == 67 )
2895
+ goto st183;
2896
+ goto st0;
2897
+ st183:
2898
+ if ( ++p == pe )
2899
+ goto _out183;
2900
+ case 183:
2901
+ if ( (*p) == 44 )
2902
+ goto st184;
2903
+ goto st0;
2904
+ st184:
2905
+ if ( ++p == pe )
2906
+ goto _out184;
2907
+ case 184:
2908
+ if ( 48 <= (*p) && (*p) <= 57 )
2909
+ goto tr230;
2910
+ goto st0;
2911
+ tr230:
2912
+ #line 24 "nmea.rl"
2913
+ {bcd = 10*((*p) - '0');}
2914
+ goto st185;
2915
+ st185:
2916
+ if ( ++p == pe )
2917
+ goto _out185;
2918
+ case 185:
2919
+ #line 2920 "../ext/nmea.cpp"
2920
+ if ( 48 <= (*p) && (*p) <= 57 )
2921
+ goto tr231;
2922
+ goto st0;
2923
+ tr231:
2924
+ #line 24 "nmea.rl"
2925
+ {bcd += (*p) - '0';}
2926
+ #line 37 "nmea.rl"
2927
+ { utc.hour = bcd; }
2928
+ goto st186;
2929
+ st186:
2930
+ if ( ++p == pe )
2931
+ goto _out186;
2932
+ case 186:
2933
+ #line 2934 "../ext/nmea.cpp"
2934
+ if ( 48 <= (*p) && (*p) <= 57 )
2935
+ goto tr232;
2936
+ goto st0;
2937
+ tr232:
2938
+ #line 24 "nmea.rl"
2939
+ {bcd = 10*((*p) - '0');}
2940
+ goto st187;
2941
+ st187:
2942
+ if ( ++p == pe )
2943
+ goto _out187;
2944
+ case 187:
2945
+ #line 2946 "../ext/nmea.cpp"
2946
+ if ( 48 <= (*p) && (*p) <= 57 )
2947
+ goto tr233;
2948
+ goto st0;
2949
+ tr233:
2950
+ #line 24 "nmea.rl"
2951
+ {bcd += (*p) - '0';}
2952
+ #line 37 "nmea.rl"
2953
+ { utc.minute = bcd;}
2954
+ goto st188;
2955
+ st188:
2956
+ if ( ++p == pe )
2957
+ goto _out188;
2958
+ case 188:
2959
+ #line 2960 "../ext/nmea.cpp"
2960
+ if ( 48 <= (*p) && (*p) <= 57 )
2961
+ goto tr234;
2962
+ goto st0;
2963
+ tr234:
2964
+ #line 24 "nmea.rl"
2965
+ {bcd = 10*((*p) - '0');}
2966
+ goto st189;
2967
+ st189:
2968
+ if ( ++p == pe )
2969
+ goto _out189;
2970
+ case 189:
2971
+ #line 2972 "../ext/nmea.cpp"
2972
+ if ( 48 <= (*p) && (*p) <= 57 )
2973
+ goto tr235;
2974
+ goto st0;
2975
+ tr235:
2976
+ #line 24 "nmea.rl"
2977
+ {bcd += (*p) - '0';}
2978
+ #line 37 "nmea.rl"
2979
+ { utc.second = bcd;}
2980
+ goto st190;
2981
+ st190:
2982
+ if ( ++p == pe )
2983
+ goto _out190;
2984
+ case 190:
2985
+ #line 2986 "../ext/nmea.cpp"
2986
+ switch( (*p) ) {
2987
+ case 44: goto st191;
2988
+ case 46: goto st229;
2989
+ }
2990
+ goto st0;
2991
+ st191:
2992
+ if ( ++p == pe )
2993
+ goto _out191;
2994
+ case 191:
2995
+ switch( (*p) ) {
2996
+ case 65: goto tr238;
2997
+ case 86: goto tr239;
2998
+ }
2999
+ goto st0;
3000
+ tr238:
3001
+ #line 5 "nmea.rl"
3002
+ {rmc_valid = true;}
3003
+ goto st192;
3004
+ tr239:
3005
+ #line 5 "nmea.rl"
3006
+ {rmc_valid = false;}
3007
+ goto st192;
3008
+ st192:
3009
+ if ( ++p == pe )
3010
+ goto _out192;
3011
+ case 192:
3012
+ #line 3013 "../ext/nmea.cpp"
3013
+ if ( (*p) == 44 )
3014
+ goto st193;
3015
+ goto st0;
3016
+ st193:
3017
+ if ( ++p == pe )
3018
+ goto _out193;
3019
+ case 193:
3020
+ if ( (*p) == 44 )
3021
+ goto st194;
3022
+ if ( 48 <= (*p) && (*p) <= 57 )
3023
+ goto tr242;
3024
+ goto st0;
3025
+ tr283:
3026
+ #line 46 "nmea.rl"
3027
+ {
3028
+ latitude.nil = false;
3029
+ latitude.value.degrees = current_degrees;
3030
+ latitude.value.minutes = current_float;
3031
+ current_float = 0;
3032
+ current_degrees = 0;
3033
+ }
3034
+ goto st194;
3035
+ tr284:
3036
+ #line 45 "nmea.rl"
3037
+ {current_degrees *= -1;}
3038
+ #line 46 "nmea.rl"
3039
+ {
3040
+ latitude.nil = false;
3041
+ latitude.value.degrees = current_degrees;
3042
+ latitude.value.minutes = current_float;
3043
+ current_float = 0;
3044
+ current_degrees = 0;
3045
+ }
3046
+ goto st194;
3047
+ st194:
3048
+ if ( ++p == pe )
3049
+ goto _out194;
3050
+ case 194:
3051
+ #line 3052 "../ext/nmea.cpp"
3052
+ if ( (*p) == 44 )
3053
+ goto st195;
3054
+ goto st0;
3055
+ st195:
3056
+ if ( ++p == pe )
3057
+ goto _out195;
3058
+ case 195:
3059
+ if ( (*p) == 44 )
3060
+ goto st196;
3061
+ if ( 48 <= (*p) && (*p) <= 57 )
3062
+ goto tr245;
3063
+ goto st0;
3064
+ tr276:
3065
+ #line 56 "nmea.rl"
3066
+ {
3067
+ longitude.nil = false;
3068
+ longitude.value.degrees = current_degrees;
3069
+ longitude.value.minutes = current_float;
3070
+ current_degrees = 0;
3071
+ current_float = 0;
3072
+ }
3073
+ goto st196;
3074
+ tr277:
3075
+ #line 55 "nmea.rl"
3076
+ {current_degrees *= -1;}
3077
+ #line 56 "nmea.rl"
3078
+ {
3079
+ longitude.nil = false;
3080
+ longitude.value.degrees = current_degrees;
3081
+ longitude.value.minutes = current_float;
3082
+ current_degrees = 0;
3083
+ current_float = 0;
3084
+ }
3085
+ goto st196;
3086
+ st196:
3087
+ if ( ++p == pe )
3088
+ goto _out196;
3089
+ case 196:
3090
+ #line 3091 "../ext/nmea.cpp"
3091
+ if ( (*p) == 44 )
3092
+ goto st197;
3093
+ goto st0;
3094
+ st197:
3095
+ if ( ++p == pe )
3096
+ goto _out197;
3097
+ case 197:
3098
+ if ( (*p) == 44 )
3099
+ goto st198;
3100
+ if ( 48 <= (*p) && (*p) <= 57 )
3101
+ goto tr248;
3102
+ goto st0;
3103
+ tr269:
3104
+ #line 6 "nmea.rl"
3105
+ {knot_speed = current_float; current_float = 0;}
3106
+ goto st198;
3107
+ st198:
3108
+ if ( ++p == pe )
3109
+ goto _out198;
3110
+ case 198:
3111
+ #line 3112 "../ext/nmea.cpp"
3112
+ if ( (*p) == 44 )
3113
+ goto st199;
3114
+ if ( 48 <= (*p) && (*p) <= 57 )
3115
+ goto tr250;
3116
+ goto st0;
3117
+ tr266:
3118
+ #line 7 "nmea.rl"
3119
+ {course = current_float; current_float = 0;}
3120
+ goto st199;
3121
+ st199:
3122
+ if ( ++p == pe )
3123
+ goto _out199;
3124
+ case 199:
3125
+ #line 3126 "../ext/nmea.cpp"
3126
+ if ( 48 <= (*p) && (*p) <= 57 )
3127
+ goto tr251;
3128
+ goto st0;
3129
+ tr251:
3130
+ #line 24 "nmea.rl"
3131
+ {bcd = 10*((*p) - '0');}
3132
+ goto st200;
3133
+ st200:
3134
+ if ( ++p == pe )
3135
+ goto _out200;
3136
+ case 200:
3137
+ #line 3138 "../ext/nmea.cpp"
3138
+ if ( 48 <= (*p) && (*p) <= 57 )
3139
+ goto tr252;
3140
+ goto st0;
3141
+ tr252:
3142
+ #line 24 "nmea.rl"
3143
+ {bcd += (*p) - '0';}
3144
+ #line 38 "nmea.rl"
3145
+ { utc.day = bcd; }
3146
+ goto st201;
3147
+ st201:
3148
+ if ( ++p == pe )
3149
+ goto _out201;
3150
+ case 201:
3151
+ #line 3152 "../ext/nmea.cpp"
3152
+ if ( 48 <= (*p) && (*p) <= 57 )
3153
+ goto tr253;
3154
+ goto st0;
3155
+ tr253:
3156
+ #line 24 "nmea.rl"
3157
+ {bcd = 10*((*p) - '0');}
3158
+ goto st202;
3159
+ st202:
3160
+ if ( ++p == pe )
3161
+ goto _out202;
3162
+ case 202:
3163
+ #line 3164 "../ext/nmea.cpp"
3164
+ if ( 48 <= (*p) && (*p) <= 57 )
3165
+ goto tr254;
3166
+ goto st0;
3167
+ tr254:
3168
+ #line 24 "nmea.rl"
3169
+ {bcd += (*p) - '0';}
3170
+ #line 38 "nmea.rl"
3171
+ { utc.month = bcd;}
3172
+ goto st203;
3173
+ st203:
3174
+ if ( ++p == pe )
3175
+ goto _out203;
3176
+ case 203:
3177
+ #line 3178 "../ext/nmea.cpp"
3178
+ if ( 48 <= (*p) && (*p) <= 57 )
3179
+ goto tr255;
3180
+ goto st0;
3181
+ tr255:
3182
+ #line 24 "nmea.rl"
3183
+ {bcd = 10*((*p) - '0');}
3184
+ goto st204;
3185
+ st204:
3186
+ if ( ++p == pe )
3187
+ goto _out204;
3188
+ case 204:
3189
+ #line 3190 "../ext/nmea.cpp"
3190
+ if ( 48 <= (*p) && (*p) <= 57 )
3191
+ goto tr256;
3192
+ goto st0;
3193
+ tr256:
3194
+ #line 24 "nmea.rl"
3195
+ {bcd += (*p) - '0';}
3196
+ #line 38 "nmea.rl"
3197
+ { utc.year = bcd > 70 ? 1900+bcd : 2000+bcd;}
3198
+ goto st205;
3199
+ st205:
3200
+ if ( ++p == pe )
3201
+ goto _out205;
3202
+ case 205:
3203
+ #line 3204 "../ext/nmea.cpp"
3204
+ if ( (*p) == 44 )
3205
+ goto st206;
3206
+ goto st0;
3207
+ st206:
3208
+ if ( ++p == pe )
3209
+ goto _out206;
3210
+ case 206:
3211
+ if ( (*p) == 44 )
3212
+ goto st207;
3213
+ if ( 48 <= (*p) && (*p) <= 57 )
3214
+ goto tr259;
3215
+ goto st0;
3216
+ tr262:
3217
+ #line 8 "nmea.rl"
3218
+ { magnetic_variation = current_degrees; }
3219
+ goto st207;
3220
+ tr263:
3221
+ #line 55 "nmea.rl"
3222
+ {current_degrees *= -1;}
3223
+ #line 8 "nmea.rl"
3224
+ { magnetic_variation = current_degrees; }
3225
+ goto st207;
3226
+ st207:
3227
+ if ( ++p == pe )
3228
+ goto _out207;
3229
+ case 207:
3230
+ #line 3231 "../ext/nmea.cpp"
3231
+ switch( (*p) ) {
3232
+ case 10: goto tr260;
3233
+ case 13: goto tr260;
3234
+ }
3235
+ goto st207;
3236
+ tr260:
3237
+ #line 10 "nmea.rl"
3238
+ {
3239
+ handler.rmc(utc, latitude, longitude, knot_speed, course, magnetic_variation);
3240
+ }
3241
+ goto st278;
3242
+ st278:
3243
+ if ( ++p == pe )
3244
+ goto _out278;
3245
+ case 278:
3246
+ #line 3247 "../ext/nmea.cpp"
3247
+ switch( (*p) ) {
3248
+ case 10: goto tr260;
3249
+ case 13: goto tr260;
3250
+ }
3251
+ goto st207;
3252
+ tr259:
3253
+ #line 11 "nmea.rl"
3254
+ {
3255
+ current_float = 0;
3256
+ current_digit = current_digit*10 + ((*p) - '0');
3257
+ }
3258
+ goto st208;
3259
+ st208:
3260
+ if ( ++p == pe )
3261
+ goto _out208;
3262
+ case 208:
3263
+ #line 3264 "../ext/nmea.cpp"
3264
+ if ( (*p) == 44 )
3265
+ goto tr261;
3266
+ if ( 48 <= (*p) && (*p) <= 57 )
3267
+ goto tr259;
3268
+ goto st0;
3269
+ tr261:
3270
+ #line 8 "nmea.rl"
3271
+ {current_degrees = current_digit; current_digit = 0;}
3272
+ goto st209;
3273
+ st209:
3274
+ if ( ++p == pe )
3275
+ goto _out209;
3276
+ case 209:
3277
+ #line 3278 "../ext/nmea.cpp"
3278
+ switch( (*p) ) {
3279
+ case 69: goto tr262;
3280
+ case 87: goto tr263;
3281
+ }
3282
+ goto st0;
3283
+ tr250:
3284
+ #line 11 "nmea.rl"
3285
+ {
3286
+ current_float = 0;
3287
+ current_digit = current_digit*10 + ((*p) - '0');
3288
+ }
3289
+ goto st210;
3290
+ st210:
3291
+ if ( ++p == pe )
3292
+ goto _out210;
3293
+ case 210:
3294
+ #line 3295 "../ext/nmea.cpp"
3295
+ if ( (*p) == 46 )
3296
+ goto tr264;
3297
+ if ( 48 <= (*p) && (*p) <= 57 )
3298
+ goto tr250;
3299
+ goto st0;
3300
+ tr264:
3301
+ #line 15 "nmea.rl"
3302
+ {
3303
+ current_frac = 10;
3304
+ current_float = current_digit;
3305
+ current_digit = 0;
3306
+ }
3307
+ goto st211;
3308
+ st211:
3309
+ if ( ++p == pe )
3310
+ goto _out211;
3311
+ case 211:
3312
+ #line 3313 "../ext/nmea.cpp"
3313
+ if ( 48 <= (*p) && (*p) <= 57 )
3314
+ goto tr265;
3315
+ goto st0;
3316
+ tr265:
3317
+ #line 20 "nmea.rl"
3318
+ {
3319
+ current_float += ((*p) - '0')*1.0 / current_frac;
3320
+ current_frac *= 10;
3321
+ }
3322
+ goto st212;
3323
+ st212:
3324
+ if ( ++p == pe )
3325
+ goto _out212;
3326
+ case 212:
3327
+ #line 3328 "../ext/nmea.cpp"
3328
+ if ( (*p) == 44 )
3329
+ goto tr266;
3330
+ if ( 48 <= (*p) && (*p) <= 57 )
3331
+ goto tr265;
3332
+ goto st0;
3333
+ tr248:
3334
+ #line 11 "nmea.rl"
3335
+ {
3336
+ current_float = 0;
3337
+ current_digit = current_digit*10 + ((*p) - '0');
3338
+ }
3339
+ goto st213;
3340
+ st213:
3341
+ if ( ++p == pe )
3342
+ goto _out213;
3343
+ case 213:
3344
+ #line 3345 "../ext/nmea.cpp"
3345
+ if ( (*p) == 46 )
3346
+ goto tr267;
3347
+ if ( 48 <= (*p) && (*p) <= 57 )
3348
+ goto tr248;
3349
+ goto st0;
3350
+ tr267:
3351
+ #line 15 "nmea.rl"
3352
+ {
3353
+ current_frac = 10;
3354
+ current_float = current_digit;
3355
+ current_digit = 0;
3356
+ }
3357
+ goto st214;
3358
+ st214:
3359
+ if ( ++p == pe )
3360
+ goto _out214;
3361
+ case 214:
3362
+ #line 3363 "../ext/nmea.cpp"
3363
+ if ( 48 <= (*p) && (*p) <= 57 )
3364
+ goto tr268;
3365
+ goto st0;
3366
+ tr268:
3367
+ #line 20 "nmea.rl"
3368
+ {
3369
+ current_float += ((*p) - '0')*1.0 / current_frac;
3370
+ current_frac *= 10;
3371
+ }
3372
+ goto st215;
3373
+ st215:
3374
+ if ( ++p == pe )
3375
+ goto _out215;
3376
+ case 215:
3377
+ #line 3378 "../ext/nmea.cpp"
3378
+ if ( (*p) == 44 )
3379
+ goto tr269;
3380
+ if ( 48 <= (*p) && (*p) <= 57 )
3381
+ goto tr268;
3382
+ goto st0;
3383
+ tr245:
3384
+ #line 24 "nmea.rl"
3385
+ {bcd = 10*((*p) - '0');}
3386
+ goto st216;
3387
+ st216:
3388
+ if ( ++p == pe )
3389
+ goto _out216;
3390
+ case 216:
3391
+ #line 3392 "../ext/nmea.cpp"
3392
+ if ( 48 <= (*p) && (*p) <= 57 )
3393
+ goto tr270;
3394
+ goto st0;
3395
+ tr270:
3396
+ #line 24 "nmea.rl"
3397
+ {bcd += (*p) - '0';}
3398
+ goto st217;
3399
+ st217:
3400
+ if ( ++p == pe )
3401
+ goto _out217;
3402
+ case 217:
3403
+ #line 3404 "../ext/nmea.cpp"
3404
+ if ( 48 <= (*p) && (*p) <= 57 )
3405
+ goto tr271;
3406
+ goto st0;
3407
+ tr271:
3408
+ #line 25 "nmea.rl"
3409
+ {bcd = bcd*10 + ((*p) - '0');}
3410
+ #line 40 "nmea.rl"
3411
+ {
3412
+ current_degrees = bcd;
3413
+ bcd = 0;
3414
+ }
3415
+ goto st218;
3416
+ st218:
3417
+ if ( ++p == pe )
3418
+ goto _out218;
3419
+ case 218:
3420
+ #line 3421 "../ext/nmea.cpp"
3421
+ if ( 48 <= (*p) && (*p) <= 57 )
3422
+ goto tr272;
3423
+ goto st0;
3424
+ tr272:
3425
+ #line 11 "nmea.rl"
3426
+ {
3427
+ current_float = 0;
3428
+ current_digit = current_digit*10 + ((*p) - '0');
3429
+ }
3430
+ goto st219;
3431
+ st219:
3432
+ if ( ++p == pe )
3433
+ goto _out219;
3434
+ case 219:
3435
+ #line 3436 "../ext/nmea.cpp"
3436
+ if ( (*p) == 46 )
3437
+ goto tr273;
3438
+ if ( 48 <= (*p) && (*p) <= 57 )
3439
+ goto tr272;
3440
+ goto st0;
3441
+ tr273:
3442
+ #line 15 "nmea.rl"
3443
+ {
3444
+ current_frac = 10;
3445
+ current_float = current_digit;
3446
+ current_digit = 0;
3447
+ }
3448
+ goto st220;
3449
+ st220:
3450
+ if ( ++p == pe )
3451
+ goto _out220;
3452
+ case 220:
3453
+ #line 3454 "../ext/nmea.cpp"
3454
+ if ( 48 <= (*p) && (*p) <= 57 )
3455
+ goto tr274;
3456
+ goto st0;
3457
+ tr274:
3458
+ #line 20 "nmea.rl"
3459
+ {
3460
+ current_float += ((*p) - '0')*1.0 / current_frac;
3461
+ current_frac *= 10;
3462
+ }
3463
+ goto st221;
3464
+ st221:
3465
+ if ( ++p == pe )
3466
+ goto _out221;
3467
+ case 221:
3468
+ #line 3469 "../ext/nmea.cpp"
3469
+ if ( (*p) == 44 )
3470
+ goto st222;
3471
+ if ( 48 <= (*p) && (*p) <= 57 )
3472
+ goto tr274;
3473
+ goto st0;
3474
+ st222:
3475
+ if ( ++p == pe )
3476
+ goto _out222;
3477
+ case 222:
3478
+ switch( (*p) ) {
3479
+ case 69: goto tr276;
3480
+ case 87: goto tr277;
3481
+ }
3482
+ goto st0;
3483
+ tr242:
3484
+ #line 24 "nmea.rl"
3485
+ {bcd = 10*((*p) - '0');}
3486
+ goto st223;
3487
+ st223:
3488
+ if ( ++p == pe )
3489
+ goto _out223;
3490
+ case 223:
3491
+ #line 3492 "../ext/nmea.cpp"
3492
+ if ( 48 <= (*p) && (*p) <= 57 )
3493
+ goto tr278;
3494
+ goto st0;
3495
+ tr278:
3496
+ #line 24 "nmea.rl"
3497
+ {bcd += (*p) - '0';}
3498
+ #line 40 "nmea.rl"
3499
+ {
3500
+ current_degrees = bcd;
3501
+ bcd = 0;
3502
+ }
3503
+ goto st224;
3504
+ st224:
3505
+ if ( ++p == pe )
3506
+ goto _out224;
3507
+ case 224:
3508
+ #line 3509 "../ext/nmea.cpp"
3509
+ if ( 48 <= (*p) && (*p) <= 57 )
3510
+ goto tr279;
3511
+ goto st0;
3512
+ tr279:
3513
+ #line 11 "nmea.rl"
3514
+ {
3515
+ current_float = 0;
3516
+ current_digit = current_digit*10 + ((*p) - '0');
3517
+ }
3518
+ goto st225;
3519
+ st225:
3520
+ if ( ++p == pe )
3521
+ goto _out225;
3522
+ case 225:
3523
+ #line 3524 "../ext/nmea.cpp"
3524
+ if ( (*p) == 46 )
3525
+ goto tr280;
3526
+ if ( 48 <= (*p) && (*p) <= 57 )
3527
+ goto tr279;
3528
+ goto st0;
3529
+ tr280:
3530
+ #line 15 "nmea.rl"
3531
+ {
3532
+ current_frac = 10;
3533
+ current_float = current_digit;
3534
+ current_digit = 0;
3535
+ }
3536
+ goto st226;
3537
+ st226:
3538
+ if ( ++p == pe )
3539
+ goto _out226;
3540
+ case 226:
3541
+ #line 3542 "../ext/nmea.cpp"
3542
+ if ( 48 <= (*p) && (*p) <= 57 )
3543
+ goto tr281;
3544
+ goto st0;
3545
+ tr281:
3546
+ #line 20 "nmea.rl"
3547
+ {
3548
+ current_float += ((*p) - '0')*1.0 / current_frac;
3549
+ current_frac *= 10;
3550
+ }
3551
+ goto st227;
3552
+ st227:
3553
+ if ( ++p == pe )
3554
+ goto _out227;
3555
+ case 227:
3556
+ #line 3557 "../ext/nmea.cpp"
3557
+ if ( (*p) == 44 )
3558
+ goto st228;
3559
+ if ( 48 <= (*p) && (*p) <= 57 )
3560
+ goto tr281;
3561
+ goto st0;
3562
+ st228:
3563
+ if ( ++p == pe )
3564
+ goto _out228;
3565
+ case 228:
3566
+ switch( (*p) ) {
3567
+ case 78: goto tr283;
3568
+ case 83: goto tr284;
3569
+ }
3570
+ goto st0;
3571
+ st229:
3572
+ if ( ++p == pe )
3573
+ goto _out229;
3574
+ case 229:
3575
+ if ( 48 <= (*p) && (*p) <= 57 )
3576
+ goto tr285;
3577
+ goto st0;
3578
+ tr285:
3579
+ #line 24 "nmea.rl"
3580
+ {bcd = 10*((*p) - '0');}
3581
+ goto st230;
3582
+ st230:
3583
+ if ( ++p == pe )
3584
+ goto _out230;
3585
+ case 230:
3586
+ #line 3587 "../ext/nmea.cpp"
3587
+ if ( 48 <= (*p) && (*p) <= 57 )
3588
+ goto tr286;
3589
+ goto st0;
3590
+ tr286:
3591
+ #line 24 "nmea.rl"
3592
+ {bcd += (*p) - '0';}
3593
+ goto st231;
3594
+ st231:
3595
+ if ( ++p == pe )
3596
+ goto _out231;
3597
+ case 231:
3598
+ #line 3599 "../ext/nmea.cpp"
3599
+ if ( 48 <= (*p) && (*p) <= 57 )
3600
+ goto tr287;
3601
+ goto st0;
3602
+ tr287:
3603
+ #line 25 "nmea.rl"
3604
+ {bcd = bcd*10 + ((*p) - '0');}
3605
+ #line 37 "nmea.rl"
3606
+ { utc.usec = bcd;}
3607
+ goto st232;
3608
+ st232:
3609
+ if ( ++p == pe )
3610
+ goto _out232;
3611
+ case 232:
3612
+ #line 3613 "../ext/nmea.cpp"
3613
+ if ( (*p) == 44 )
3614
+ goto st191;
3615
+ goto st0;
3616
+ st233:
3617
+ if ( ++p == pe )
3618
+ goto _out233;
3619
+ case 233:
3620
+ if ( (*p) == 84 )
3621
+ goto st234;
3622
+ goto st0;
3623
+ st234:
3624
+ if ( ++p == pe )
3625
+ goto _out234;
3626
+ case 234:
3627
+ if ( (*p) == 71 )
3628
+ goto st235;
3629
+ goto st0;
3630
+ st235:
3631
+ if ( ++p == pe )
3632
+ goto _out235;
3633
+ case 235:
3634
+ if ( (*p) == 44 )
3635
+ goto st236;
3636
+ goto st0;
3637
+ st236:
3638
+ if ( ++p == pe )
3639
+ goto _out236;
3640
+ case 236:
3641
+ if ( (*p) == 44 )
3642
+ goto st237;
3643
+ if ( 48 <= (*p) && (*p) <= 57 )
3644
+ goto tr292;
3645
+ goto st0;
3646
+ tr327:
3647
+ #line 3 "nmea.rl"
3648
+ {true_course = current_float; current_float = 0;}
3649
+ goto st237;
3650
+ st237:
3651
+ if ( ++p == pe )
3652
+ goto _out237;
3653
+ case 237:
3654
+ #line 3655 "../ext/nmea.cpp"
3655
+ if ( (*p) == 84 )
3656
+ goto st238;
3657
+ goto st0;
3658
+ st238:
3659
+ if ( ++p == pe )
3660
+ goto _out238;
3661
+ case 238:
3662
+ if ( (*p) == 44 )
3663
+ goto st239;
3664
+ goto st0;
3665
+ st239:
3666
+ if ( ++p == pe )
3667
+ goto _out239;
3668
+ case 239:
3669
+ if ( (*p) == 44 )
3670
+ goto st240;
3671
+ if ( 48 <= (*p) && (*p) <= 57 )
3672
+ goto tr296;
3673
+ goto st0;
3674
+ tr324:
3675
+ #line 4 "nmea.rl"
3676
+ {magnetic_course = current_float; current_float = 0;}
3677
+ goto st240;
3678
+ st240:
3679
+ if ( ++p == pe )
3680
+ goto _out240;
3681
+ case 240:
3682
+ #line 3683 "../ext/nmea.cpp"
3683
+ if ( (*p) == 77 )
3684
+ goto st241;
3685
+ goto st0;
3686
+ st241:
3687
+ if ( ++p == pe )
3688
+ goto _out241;
3689
+ case 241:
3690
+ if ( (*p) == 44 )
3691
+ goto st242;
3692
+ goto st0;
3693
+ st242:
3694
+ if ( ++p == pe )
3695
+ goto _out242;
3696
+ case 242:
3697
+ if ( (*p) == 44 )
3698
+ goto st243;
3699
+ if ( 48 <= (*p) && (*p) <= 57 )
3700
+ goto tr300;
3701
+ goto st0;
3702
+ tr321:
3703
+ #line 5 "nmea.rl"
3704
+ {vtg_knot_speed = current_float; current_float = 0;}
3705
+ goto st243;
3706
+ st243:
3707
+ if ( ++p == pe )
3708
+ goto _out243;
3709
+ case 243:
3710
+ #line 3711 "../ext/nmea.cpp"
3711
+ if ( (*p) == 78 )
3712
+ goto st244;
3713
+ goto st0;
3714
+ st244:
3715
+ if ( ++p == pe )
3716
+ goto _out244;
3717
+ case 244:
3718
+ if ( (*p) == 44 )
3719
+ goto st245;
3720
+ goto st0;
3721
+ st245:
3722
+ if ( ++p == pe )
3723
+ goto _out245;
3724
+ case 245:
3725
+ if ( (*p) == 44 )
3726
+ goto st246;
3727
+ if ( 48 <= (*p) && (*p) <= 57 )
3728
+ goto tr304;
3729
+ goto st0;
3730
+ tr318:
3731
+ #line 6 "nmea.rl"
3732
+ {vtg_kmph_speed = current_float; current_float = 0;}
3733
+ goto st246;
3734
+ st246:
3735
+ if ( ++p == pe )
3736
+ goto _out246;
3737
+ case 246:
3738
+ #line 3739 "../ext/nmea.cpp"
3739
+ if ( (*p) == 75 )
3740
+ goto st247;
3741
+ goto st0;
3742
+ st247:
3743
+ if ( ++p == pe )
3744
+ goto _out247;
3745
+ case 247:
3746
+ switch( (*p) ) {
3747
+ case 42: goto tr306;
3748
+ case 44: goto st251;
3749
+ }
3750
+ goto st0;
3751
+ tr306:
3752
+ #line 82 "nmea.rl"
3753
+ {sentence_end = p; }
3754
+ goto st248;
3755
+ st248:
3756
+ if ( ++p == pe )
3757
+ goto _out248;
3758
+ case 248:
3759
+ #line 3760 "../ext/nmea.cpp"
3760
+ if ( (*p) < 65 ) {
3761
+ if ( 48 <= (*p) && (*p) <= 57 )
3762
+ goto tr308;
3763
+ } else if ( (*p) > 90 ) {
3764
+ if ( 97 <= (*p) && (*p) <= 122 )
3765
+ goto tr308;
3766
+ } else
3767
+ goto tr308;
3768
+ goto st0;
3769
+ tr308:
3770
+ #line 82 "nmea.rl"
3771
+ {checksum[0] = (*p);}
3772
+ goto st249;
3773
+ st249:
3774
+ if ( ++p == pe )
3775
+ goto _out249;
3776
+ case 249:
3777
+ #line 3778 "../ext/nmea.cpp"
3778
+ if ( (*p) < 65 ) {
3779
+ if ( 48 <= (*p) && (*p) <= 57 )
3780
+ goto tr309;
3781
+ } else if ( (*p) > 90 ) {
3782
+ if ( 97 <= (*p) && (*p) <= 122 )
3783
+ goto tr309;
3784
+ } else
3785
+ goto tr309;
3786
+ goto st0;
3787
+ tr309:
3788
+ #line 68 "nmea.rl"
3789
+ {
3790
+ checksum[1] = (*p);
3791
+ unsigned char sum = 0, *ptr;
3792
+ for(ptr = (unsigned char *)sentence_begin; ptr != (unsigned char*)sentence_end; ptr++) {
3793
+ sum ^= *ptr;
3794
+ }
3795
+ unsigned int sum_provided;
3796
+ sscanf(checksum, "%x", &sum_provided);
3797
+ if(sum_provided != sum) {
3798
+ char buf[BUFSIZ];
3799
+ snprintf(buf, BUFSIZ, "Checksum didn't match: provided is %d, calculated is %d", sum_provided, sum);
3800
+ throw DataError(buf);
3801
+ }
3802
+ }
3803
+ goto st250;
3804
+ st250:
3805
+ if ( ++p == pe )
3806
+ goto _out250;
3807
+ case 250:
3808
+ #line 3809 "../ext/nmea.cpp"
3809
+ switch( (*p) ) {
3810
+ case 10: goto tr310;
3811
+ case 13: goto tr311;
3812
+ }
3813
+ goto st0;
3814
+ st251:
3815
+ if ( ++p == pe )
3816
+ goto _out251;
3817
+ case 251:
3818
+ switch( (*p) ) {
3819
+ case 65: goto tr312;
3820
+ case 68: goto tr313;
3821
+ case 69: goto tr314;
3822
+ case 78: goto tr315;
3823
+ }
3824
+ goto st0;
3825
+ tr312:
3826
+ #line 7 "nmea.rl"
3827
+ {vtg_mode = VTG_AUTONOMUS;}
3828
+ goto st252;
3829
+ tr313:
3830
+ #line 7 "nmea.rl"
3831
+ {vtg_mode = VTG_DIFFERENTIAL;}
3832
+ goto st252;
3833
+ tr314:
3834
+ #line 7 "nmea.rl"
3835
+ {vtg_mode = VTG_ESTIMATED;}
3836
+ goto st252;
3837
+ tr315:
3838
+ #line 7 "nmea.rl"
3839
+ {vtg_mode = VTG_INVALID;}
3840
+ goto st252;
3841
+ st252:
3842
+ if ( ++p == pe )
3843
+ goto _out252;
3844
+ case 252:
3845
+ #line 3846 "../ext/nmea.cpp"
3846
+ if ( (*p) == 42 )
3847
+ goto tr306;
3848
+ goto st0;
3849
+ tr304:
3850
+ #line 11 "nmea.rl"
3851
+ {
3852
+ current_float = 0;
3853
+ current_digit = current_digit*10 + ((*p) - '0');
3854
+ }
3855
+ goto st253;
3856
+ st253:
3857
+ if ( ++p == pe )
3858
+ goto _out253;
3859
+ case 253:
3860
+ #line 3861 "../ext/nmea.cpp"
3861
+ if ( (*p) == 46 )
3862
+ goto tr316;
3863
+ if ( 48 <= (*p) && (*p) <= 57 )
3864
+ goto tr304;
3865
+ goto st0;
3866
+ tr316:
3867
+ #line 15 "nmea.rl"
3868
+ {
3869
+ current_frac = 10;
3870
+ current_float = current_digit;
3871
+ current_digit = 0;
3872
+ }
3873
+ goto st254;
3874
+ st254:
3875
+ if ( ++p == pe )
3876
+ goto _out254;
3877
+ case 254:
3878
+ #line 3879 "../ext/nmea.cpp"
3879
+ if ( 48 <= (*p) && (*p) <= 57 )
3880
+ goto tr317;
3881
+ goto st0;
3882
+ tr317:
3883
+ #line 20 "nmea.rl"
3884
+ {
3885
+ current_float += ((*p) - '0')*1.0 / current_frac;
3886
+ current_frac *= 10;
3887
+ }
3888
+ goto st255;
3889
+ st255:
3890
+ if ( ++p == pe )
3891
+ goto _out255;
3892
+ case 255:
3893
+ #line 3894 "../ext/nmea.cpp"
3894
+ if ( (*p) == 44 )
3895
+ goto tr318;
3896
+ if ( 48 <= (*p) && (*p) <= 57 )
3897
+ goto tr317;
3898
+ goto st0;
3899
+ tr300:
3900
+ #line 11 "nmea.rl"
3901
+ {
3902
+ current_float = 0;
3903
+ current_digit = current_digit*10 + ((*p) - '0');
3904
+ }
3905
+ goto st256;
3906
+ st256:
3907
+ if ( ++p == pe )
3908
+ goto _out256;
3909
+ case 256:
3910
+ #line 3911 "../ext/nmea.cpp"
3911
+ if ( (*p) == 46 )
3912
+ goto tr319;
3913
+ if ( 48 <= (*p) && (*p) <= 57 )
3914
+ goto tr300;
3915
+ goto st0;
3916
+ tr319:
3917
+ #line 15 "nmea.rl"
3918
+ {
3919
+ current_frac = 10;
3920
+ current_float = current_digit;
3921
+ current_digit = 0;
3922
+ }
3923
+ goto st257;
3924
+ st257:
3925
+ if ( ++p == pe )
3926
+ goto _out257;
3927
+ case 257:
3928
+ #line 3929 "../ext/nmea.cpp"
3929
+ if ( 48 <= (*p) && (*p) <= 57 )
3930
+ goto tr320;
3931
+ goto st0;
3932
+ tr320:
3933
+ #line 20 "nmea.rl"
3934
+ {
3935
+ current_float += ((*p) - '0')*1.0 / current_frac;
3936
+ current_frac *= 10;
3937
+ }
3938
+ goto st258;
3939
+ st258:
3940
+ if ( ++p == pe )
3941
+ goto _out258;
3942
+ case 258:
3943
+ #line 3944 "../ext/nmea.cpp"
3944
+ if ( (*p) == 44 )
3945
+ goto tr321;
3946
+ if ( 48 <= (*p) && (*p) <= 57 )
3947
+ goto tr320;
3948
+ goto st0;
3949
+ tr296:
3950
+ #line 11 "nmea.rl"
3951
+ {
3952
+ current_float = 0;
3953
+ current_digit = current_digit*10 + ((*p) - '0');
3954
+ }
3955
+ goto st259;
3956
+ st259:
3957
+ if ( ++p == pe )
3958
+ goto _out259;
3959
+ case 259:
3960
+ #line 3961 "../ext/nmea.cpp"
3961
+ if ( (*p) == 46 )
3962
+ goto tr322;
3963
+ if ( 48 <= (*p) && (*p) <= 57 )
3964
+ goto tr296;
3965
+ goto st0;
3966
+ tr322:
3967
+ #line 15 "nmea.rl"
3968
+ {
3969
+ current_frac = 10;
3970
+ current_float = current_digit;
3971
+ current_digit = 0;
3972
+ }
3973
+ goto st260;
3974
+ st260:
3975
+ if ( ++p == pe )
3976
+ goto _out260;
3977
+ case 260:
3978
+ #line 3979 "../ext/nmea.cpp"
3979
+ if ( 48 <= (*p) && (*p) <= 57 )
3980
+ goto tr323;
3981
+ goto st0;
3982
+ tr323:
3983
+ #line 20 "nmea.rl"
3984
+ {
3985
+ current_float += ((*p) - '0')*1.0 / current_frac;
3986
+ current_frac *= 10;
3987
+ }
3988
+ goto st261;
3989
+ st261:
3990
+ if ( ++p == pe )
3991
+ goto _out261;
3992
+ case 261:
3993
+ #line 3994 "../ext/nmea.cpp"
3994
+ if ( (*p) == 44 )
3995
+ goto tr324;
3996
+ if ( 48 <= (*p) && (*p) <= 57 )
3997
+ goto tr323;
3998
+ goto st0;
3999
+ tr292:
4000
+ #line 11 "nmea.rl"
4001
+ {
4002
+ current_float = 0;
4003
+ current_digit = current_digit*10 + ((*p) - '0');
4004
+ }
4005
+ goto st262;
4006
+ st262:
4007
+ if ( ++p == pe )
4008
+ goto _out262;
4009
+ case 262:
4010
+ #line 4011 "../ext/nmea.cpp"
4011
+ if ( (*p) == 46 )
4012
+ goto tr325;
4013
+ if ( 48 <= (*p) && (*p) <= 57 )
4014
+ goto tr292;
4015
+ goto st0;
4016
+ tr325:
4017
+ #line 15 "nmea.rl"
4018
+ {
4019
+ current_frac = 10;
4020
+ current_float = current_digit;
4021
+ current_digit = 0;
4022
+ }
4023
+ goto st263;
4024
+ st263:
4025
+ if ( ++p == pe )
4026
+ goto _out263;
4027
+ case 263:
4028
+ #line 4029 "../ext/nmea.cpp"
4029
+ if ( 48 <= (*p) && (*p) <= 57 )
4030
+ goto tr326;
4031
+ goto st0;
4032
+ tr326:
4033
+ #line 20 "nmea.rl"
4034
+ {
4035
+ current_float += ((*p) - '0')*1.0 / current_frac;
4036
+ current_frac *= 10;
4037
+ }
4038
+ goto st264;
4039
+ st264:
4040
+ if ( ++p == pe )
4041
+ goto _out264;
4042
+ case 264:
4043
+ #line 4044 "../ext/nmea.cpp"
4044
+ if ( (*p) == 44 )
4045
+ goto tr327;
4046
+ if ( 48 <= (*p) && (*p) <= 57 )
4047
+ goto tr326;
4048
+ goto st0;
4049
+ st265:
4050
+ if ( ++p == pe )
4051
+ goto _out265;
4052
+ case 265:
4053
+ if ( (*p) == 83 )
4054
+ goto st266;
4055
+ goto st0;
4056
+ st266:
4057
+ if ( ++p == pe )
4058
+ goto _out266;
4059
+ case 266:
4060
+ if ( (*p) == 82 )
4061
+ goto st267;
4062
+ goto st0;
4063
+ st267:
4064
+ if ( ++p == pe )
4065
+ goto _out267;
4066
+ case 267:
4067
+ if ( (*p) == 70 )
4068
+ goto st268;
4069
+ goto st0;
4070
+ st268:
4071
+ if ( ++p == pe )
4072
+ goto _out268;
4073
+ case 268:
4074
+ if ( (*p) == 84 )
4075
+ goto st269;
4076
+ goto st0;
4077
+ st269:
4078
+ if ( ++p == pe )
4079
+ goto _out269;
4080
+ case 269:
4081
+ if ( (*p) == 88 )
4082
+ goto st270;
4083
+ goto st0;
4084
+ st270:
4085
+ if ( ++p == pe )
4086
+ goto _out270;
4087
+ case 270:
4088
+ if ( (*p) == 84 )
4089
+ goto st271;
4090
+ goto st0;
4091
+ st271:
4092
+ if ( ++p == pe )
4093
+ goto _out271;
4094
+ case 271:
4095
+ if ( (*p) == 44 )
4096
+ goto st272;
4097
+ goto st0;
4098
+ st272:
4099
+ if ( ++p == pe )
4100
+ goto _out272;
4101
+ case 272:
4102
+ switch( (*p) ) {
4103
+ case 32: goto st272;
4104
+ case 36: goto tr335;
4105
+ case 42: goto tr335;
4106
+ case 95: goto tr335;
4107
+ }
4108
+ if ( (*p) < 48 ) {
4109
+ if ( (*p) > 13 ) {
4110
+ if ( 44 <= (*p) && (*p) <= 46 )
4111
+ goto tr335;
4112
+ } else if ( (*p) >= 9 )
4113
+ goto st272;
4114
+ } else if ( (*p) > 57 ) {
4115
+ if ( (*p) > 90 ) {
4116
+ if ( 97 <= (*p) && (*p) <= 122 )
4117
+ goto tr335;
4118
+ } else if ( (*p) >= 65 )
4119
+ goto tr335;
4120
+ } else
4121
+ goto tr335;
4122
+ goto st0;
4123
+ tr335:
4124
+ #line 29 "nmea.rl"
4125
+ {
4126
+ *current_s = (*p);
4127
+ current_s++;
4128
+ *current_s = 0;
4129
+ }
4130
+ goto st273;
4131
+ st273:
4132
+ if ( ++p == pe )
4133
+ goto _out273;
4134
+ case 273:
4135
+ #line 4136 "../ext/nmea.cpp"
4136
+ switch( (*p) ) {
4137
+ case 9: goto tr335;
4138
+ case 10: goto tr336;
4139
+ case 13: goto tr337;
4140
+ case 32: goto tr335;
4141
+ case 36: goto tr335;
4142
+ case 42: goto tr335;
4143
+ case 58: goto tr338;
4144
+ case 95: goto tr335;
4145
+ }
4146
+ if ( (*p) < 48 ) {
4147
+ if ( 44 <= (*p) && (*p) <= 46 )
4148
+ goto tr335;
4149
+ } else if ( (*p) > 57 ) {
4150
+ if ( (*p) > 90 ) {
4151
+ if ( 97 <= (*p) && (*p) <= 122 )
4152
+ goto tr335;
4153
+ } else if ( (*p) >= 65 )
4154
+ goto tr335;
4155
+ } else
4156
+ goto tr335;
4157
+ goto st0;
4158
+ tr338:
4159
+ #line 3 "nmea.rl"
4160
+ {
4161
+ psrf_key = current_string;
4162
+ current_s = current_string;
4163
+ *current_s = 0;
4164
+ }
4165
+ goto st274;
4166
+ st274:
4167
+ if ( ++p == pe )
4168
+ goto _out274;
4169
+ case 274:
4170
+ #line 4171 "../ext/nmea.cpp"
4171
+ switch( (*p) ) {
4172
+ case 10: goto tr340;
4173
+ case 13: goto tr340;
4174
+ case 32: goto st274;
4175
+ case 36: goto tr341;
4176
+ case 42: goto tr341;
4177
+ case 95: goto tr341;
4178
+ }
4179
+ if ( (*p) < 48 ) {
4180
+ if ( (*p) > 12 ) {
4181
+ if ( 44 <= (*p) && (*p) <= 46 )
4182
+ goto tr341;
4183
+ } else if ( (*p) >= 9 )
4184
+ goto st274;
4185
+ } else if ( (*p) > 58 ) {
4186
+ if ( (*p) > 90 ) {
4187
+ if ( 97 <= (*p) && (*p) <= 122 )
4188
+ goto tr341;
4189
+ } else if ( (*p) >= 65 )
4190
+ goto tr341;
4191
+ } else
4192
+ goto tr341;
4193
+ goto st0;
4194
+ tr340:
4195
+ #line 9 "nmea.rl"
4196
+ {
4197
+ psrf_value = current_string;
4198
+ current_s = current_string;
4199
+ *current_s = 0;
4200
+ }
4201
+ #line 14 "nmea.rl"
4202
+ {
4203
+ handler.psrftxt(psrf_key, psrf_value);
4204
+ }
4205
+ goto st279;
4206
+ st279:
4207
+ if ( ++p == pe )
4208
+ goto _out279;
4209
+ case 279:
4210
+ #line 4211 "../ext/nmea.cpp"
4211
+ switch( (*p) ) {
4212
+ case 10: goto tr340;
4213
+ case 13: goto tr340;
4214
+ case 32: goto st274;
4215
+ case 36: goto tr341;
4216
+ case 42: goto tr341;
4217
+ case 95: goto tr341;
4218
+ }
4219
+ if ( (*p) < 48 ) {
4220
+ if ( (*p) > 12 ) {
4221
+ if ( 44 <= (*p) && (*p) <= 46 )
4222
+ goto tr341;
4223
+ } else if ( (*p) >= 9 )
4224
+ goto st274;
4225
+ } else if ( (*p) > 58 ) {
4226
+ if ( (*p) > 90 ) {
4227
+ if ( 97 <= (*p) && (*p) <= 122 )
4228
+ goto tr341;
4229
+ } else if ( (*p) >= 65 )
4230
+ goto tr341;
4231
+ } else
4232
+ goto tr341;
4233
+ goto st0;
4234
+ tr341:
4235
+ #line 29 "nmea.rl"
4236
+ {
4237
+ *current_s = (*p);
4238
+ current_s++;
4239
+ *current_s = 0;
4240
+ }
4241
+ goto st275;
4242
+ st275:
4243
+ if ( ++p == pe )
4244
+ goto _out275;
4245
+ case 275:
4246
+ #line 4247 "../ext/nmea.cpp"
4247
+ switch( (*p) ) {
4248
+ case 9: goto tr341;
4249
+ case 10: goto tr342;
4250
+ case 13: goto tr343;
4251
+ case 32: goto tr341;
4252
+ case 36: goto tr341;
4253
+ case 42: goto tr341;
4254
+ case 95: goto tr341;
4255
+ }
4256
+ if ( (*p) < 48 ) {
4257
+ if ( 44 <= (*p) && (*p) <= 46 )
4258
+ goto tr341;
4259
+ } else if ( (*p) > 58 ) {
4260
+ if ( (*p) > 90 ) {
4261
+ if ( 97 <= (*p) && (*p) <= 122 )
4262
+ goto tr341;
4263
+ } else if ( (*p) >= 65 )
4264
+ goto tr341;
4265
+ } else
4266
+ goto tr341;
4267
+ goto st0;
4268
+ }
4269
+ _out0: cs = 0; goto _out;
4270
+ _out2: cs = 2; goto _out;
4271
+ _out3: cs = 3; goto _out;
4272
+ _out4: cs = 4; goto _out;
4273
+ _out5: cs = 5; goto _out;
4274
+ _out6: cs = 6; goto _out;
4275
+ _out7: cs = 7; goto _out;
4276
+ _out8: cs = 8; goto _out;
4277
+ _out9: cs = 9; goto _out;
4278
+ _out10: cs = 10; goto _out;
4279
+ _out11: cs = 11; goto _out;
4280
+ _out12: cs = 12; goto _out;
4281
+ _out13: cs = 13; goto _out;
4282
+ _out14: cs = 14; goto _out;
4283
+ _out15: cs = 15; goto _out;
4284
+ _out16: cs = 16; goto _out;
4285
+ _out17: cs = 17; goto _out;
4286
+ _out18: cs = 18; goto _out;
4287
+ _out19: cs = 19; goto _out;
4288
+ _out276: cs = 276; goto _out;
4289
+ _out277: cs = 277; goto _out;
4290
+ _out20: cs = 20; goto _out;
4291
+ _out21: cs = 21; goto _out;
4292
+ _out22: cs = 22; goto _out;
4293
+ _out23: cs = 23; goto _out;
4294
+ _out24: cs = 24; goto _out;
4295
+ _out25: cs = 25; goto _out;
4296
+ _out26: cs = 26; goto _out;
4297
+ _out27: cs = 27; goto _out;
4298
+ _out28: cs = 28; goto _out;
4299
+ _out29: cs = 29; goto _out;
4300
+ _out30: cs = 30; goto _out;
4301
+ _out31: cs = 31; goto _out;
4302
+ _out32: cs = 32; goto _out;
4303
+ _out33: cs = 33; goto _out;
4304
+ _out34: cs = 34; goto _out;
4305
+ _out35: cs = 35; goto _out;
4306
+ _out36: cs = 36; goto _out;
4307
+ _out37: cs = 37; goto _out;
4308
+ _out38: cs = 38; goto _out;
4309
+ _out39: cs = 39; goto _out;
4310
+ _out40: cs = 40; goto _out;
4311
+ _out41: cs = 41; goto _out;
4312
+ _out42: cs = 42; goto _out;
4313
+ _out43: cs = 43; goto _out;
4314
+ _out44: cs = 44; goto _out;
4315
+ _out45: cs = 45; goto _out;
4316
+ _out46: cs = 46; goto _out;
4317
+ _out47: cs = 47; goto _out;
4318
+ _out48: cs = 48; goto _out;
4319
+ _out49: cs = 49; goto _out;
4320
+ _out50: cs = 50; goto _out;
4321
+ _out51: cs = 51; goto _out;
4322
+ _out52: cs = 52; goto _out;
4323
+ _out53: cs = 53; goto _out;
4324
+ _out54: cs = 54; goto _out;
4325
+ _out55: cs = 55; goto _out;
4326
+ _out56: cs = 56; goto _out;
4327
+ _out57: cs = 57; goto _out;
4328
+ _out58: cs = 58; goto _out;
4329
+ _out59: cs = 59; goto _out;
4330
+ _out60: cs = 60; goto _out;
4331
+ _out61: cs = 61; goto _out;
4332
+ _out62: cs = 62; goto _out;
4333
+ _out63: cs = 63; goto _out;
4334
+ _out64: cs = 64; goto _out;
4335
+ _out65: cs = 65; goto _out;
4336
+ _out66: cs = 66; goto _out;
4337
+ _out67: cs = 67; goto _out;
4338
+ _out68: cs = 68; goto _out;
4339
+ _out69: cs = 69; goto _out;
4340
+ _out70: cs = 70; goto _out;
4341
+ _out71: cs = 71; goto _out;
4342
+ _out72: cs = 72; goto _out;
4343
+ _out73: cs = 73; goto _out;
4344
+ _out74: cs = 74; goto _out;
4345
+ _out75: cs = 75; goto _out;
4346
+ _out76: cs = 76; goto _out;
4347
+ _out77: cs = 77; goto _out;
4348
+ _out78: cs = 78; goto _out;
4349
+ _out79: cs = 79; goto _out;
4350
+ _out80: cs = 80; goto _out;
4351
+ _out81: cs = 81; goto _out;
4352
+ _out82: cs = 82; goto _out;
4353
+ _out83: cs = 83; goto _out;
4354
+ _out84: cs = 84; goto _out;
4355
+ _out85: cs = 85; goto _out;
4356
+ _out86: cs = 86; goto _out;
4357
+ _out87: cs = 87; goto _out;
4358
+ _out88: cs = 88; goto _out;
4359
+ _out89: cs = 89; goto _out;
4360
+ _out90: cs = 90; goto _out;
4361
+ _out91: cs = 91; goto _out;
4362
+ _out92: cs = 92; goto _out;
4363
+ _out93: cs = 93; goto _out;
4364
+ _out94: cs = 94; goto _out;
4365
+ _out95: cs = 95; goto _out;
4366
+ _out96: cs = 96; goto _out;
4367
+ _out97: cs = 97; goto _out;
4368
+ _out98: cs = 98; goto _out;
4369
+ _out99: cs = 99; goto _out;
4370
+ _out100: cs = 100; goto _out;
4371
+ _out101: cs = 101; goto _out;
4372
+ _out102: cs = 102; goto _out;
4373
+ _out103: cs = 103; goto _out;
4374
+ _out104: cs = 104; goto _out;
4375
+ _out105: cs = 105; goto _out;
4376
+ _out106: cs = 106; goto _out;
4377
+ _out107: cs = 107; goto _out;
4378
+ _out108: cs = 108; goto _out;
4379
+ _out109: cs = 109; goto _out;
4380
+ _out110: cs = 110; goto _out;
4381
+ _out111: cs = 111; goto _out;
4382
+ _out112: cs = 112; goto _out;
4383
+ _out113: cs = 113; goto _out;
4384
+ _out114: cs = 114; goto _out;
4385
+ _out115: cs = 115; goto _out;
4386
+ _out116: cs = 116; goto _out;
4387
+ _out117: cs = 117; goto _out;
4388
+ _out118: cs = 118; goto _out;
4389
+ _out119: cs = 119; goto _out;
4390
+ _out120: cs = 120; goto _out;
4391
+ _out121: cs = 121; goto _out;
4392
+ _out122: cs = 122; goto _out;
4393
+ _out123: cs = 123; goto _out;
4394
+ _out124: cs = 124; goto _out;
4395
+ _out125: cs = 125; goto _out;
4396
+ _out126: cs = 126; goto _out;
4397
+ _out127: cs = 127; goto _out;
4398
+ _out128: cs = 128; goto _out;
4399
+ _out129: cs = 129; goto _out;
4400
+ _out130: cs = 130; goto _out;
4401
+ _out131: cs = 131; goto _out;
4402
+ _out132: cs = 132; goto _out;
4403
+ _out133: cs = 133; goto _out;
4404
+ _out134: cs = 134; goto _out;
4405
+ _out135: cs = 135; goto _out;
4406
+ _out136: cs = 136; goto _out;
4407
+ _out137: cs = 137; goto _out;
4408
+ _out138: cs = 138; goto _out;
4409
+ _out139: cs = 139; goto _out;
4410
+ _out140: cs = 140; goto _out;
4411
+ _out141: cs = 141; goto _out;
4412
+ _out142: cs = 142; goto _out;
4413
+ _out143: cs = 143; goto _out;
4414
+ _out144: cs = 144; goto _out;
4415
+ _out145: cs = 145; goto _out;
4416
+ _out146: cs = 146; goto _out;
4417
+ _out147: cs = 147; goto _out;
4418
+ _out148: cs = 148; goto _out;
4419
+ _out149: cs = 149; goto _out;
4420
+ _out150: cs = 150; goto _out;
4421
+ _out151: cs = 151; goto _out;
4422
+ _out152: cs = 152; goto _out;
4423
+ _out153: cs = 153; goto _out;
4424
+ _out154: cs = 154; goto _out;
4425
+ _out155: cs = 155; goto _out;
4426
+ _out156: cs = 156; goto _out;
4427
+ _out157: cs = 157; goto _out;
4428
+ _out158: cs = 158; goto _out;
4429
+ _out159: cs = 159; goto _out;
4430
+ _out160: cs = 160; goto _out;
4431
+ _out161: cs = 161; goto _out;
4432
+ _out162: cs = 162; goto _out;
4433
+ _out163: cs = 163; goto _out;
4434
+ _out164: cs = 164; goto _out;
4435
+ _out165: cs = 165; goto _out;
4436
+ _out166: cs = 166; goto _out;
4437
+ _out167: cs = 167; goto _out;
4438
+ _out168: cs = 168; goto _out;
4439
+ _out169: cs = 169; goto _out;
4440
+ _out170: cs = 170; goto _out;
4441
+ _out171: cs = 171; goto _out;
4442
+ _out172: cs = 172; goto _out;
4443
+ _out173: cs = 173; goto _out;
4444
+ _out174: cs = 174; goto _out;
4445
+ _out175: cs = 175; goto _out;
4446
+ _out176: cs = 176; goto _out;
4447
+ _out177: cs = 177; goto _out;
4448
+ _out178: cs = 178; goto _out;
4449
+ _out179: cs = 179; goto _out;
4450
+ _out180: cs = 180; goto _out;
4451
+ _out181: cs = 181; goto _out;
4452
+ _out182: cs = 182; goto _out;
4453
+ _out183: cs = 183; goto _out;
4454
+ _out184: cs = 184; goto _out;
4455
+ _out185: cs = 185; goto _out;
4456
+ _out186: cs = 186; goto _out;
4457
+ _out187: cs = 187; goto _out;
4458
+ _out188: cs = 188; goto _out;
4459
+ _out189: cs = 189; goto _out;
4460
+ _out190: cs = 190; goto _out;
4461
+ _out191: cs = 191; goto _out;
4462
+ _out192: cs = 192; goto _out;
4463
+ _out193: cs = 193; goto _out;
4464
+ _out194: cs = 194; goto _out;
4465
+ _out195: cs = 195; goto _out;
4466
+ _out196: cs = 196; goto _out;
4467
+ _out197: cs = 197; goto _out;
4468
+ _out198: cs = 198; goto _out;
4469
+ _out199: cs = 199; goto _out;
4470
+ _out200: cs = 200; goto _out;
4471
+ _out201: cs = 201; goto _out;
4472
+ _out202: cs = 202; goto _out;
4473
+ _out203: cs = 203; goto _out;
4474
+ _out204: cs = 204; goto _out;
4475
+ _out205: cs = 205; goto _out;
4476
+ _out206: cs = 206; goto _out;
4477
+ _out207: cs = 207; goto _out;
4478
+ _out278: cs = 278; goto _out;
4479
+ _out208: cs = 208; goto _out;
4480
+ _out209: cs = 209; goto _out;
4481
+ _out210: cs = 210; goto _out;
4482
+ _out211: cs = 211; goto _out;
4483
+ _out212: cs = 212; goto _out;
4484
+ _out213: cs = 213; goto _out;
4485
+ _out214: cs = 214; goto _out;
4486
+ _out215: cs = 215; goto _out;
4487
+ _out216: cs = 216; goto _out;
4488
+ _out217: cs = 217; goto _out;
4489
+ _out218: cs = 218; goto _out;
4490
+ _out219: cs = 219; goto _out;
4491
+ _out220: cs = 220; goto _out;
4492
+ _out221: cs = 221; goto _out;
4493
+ _out222: cs = 222; goto _out;
4494
+ _out223: cs = 223; goto _out;
4495
+ _out224: cs = 224; goto _out;
4496
+ _out225: cs = 225; goto _out;
4497
+ _out226: cs = 226; goto _out;
4498
+ _out227: cs = 227; goto _out;
4499
+ _out228: cs = 228; goto _out;
4500
+ _out229: cs = 229; goto _out;
4501
+ _out230: cs = 230; goto _out;
4502
+ _out231: cs = 231; goto _out;
4503
+ _out232: cs = 232; goto _out;
4504
+ _out233: cs = 233; goto _out;
4505
+ _out234: cs = 234; goto _out;
4506
+ _out235: cs = 235; goto _out;
4507
+ _out236: cs = 236; goto _out;
4508
+ _out237: cs = 237; goto _out;
4509
+ _out238: cs = 238; goto _out;
4510
+ _out239: cs = 239; goto _out;
4511
+ _out240: cs = 240; goto _out;
4512
+ _out241: cs = 241; goto _out;
4513
+ _out242: cs = 242; goto _out;
4514
+ _out243: cs = 243; goto _out;
4515
+ _out244: cs = 244; goto _out;
4516
+ _out245: cs = 245; goto _out;
4517
+ _out246: cs = 246; goto _out;
4518
+ _out247: cs = 247; goto _out;
4519
+ _out248: cs = 248; goto _out;
4520
+ _out249: cs = 249; goto _out;
4521
+ _out250: cs = 250; goto _out;
4522
+ _out251: cs = 251; goto _out;
4523
+ _out252: cs = 252; goto _out;
4524
+ _out253: cs = 253; goto _out;
4525
+ _out254: cs = 254; goto _out;
4526
+ _out255: cs = 255; goto _out;
4527
+ _out256: cs = 256; goto _out;
4528
+ _out257: cs = 257; goto _out;
4529
+ _out258: cs = 258; goto _out;
4530
+ _out259: cs = 259; goto _out;
4531
+ _out260: cs = 260; goto _out;
4532
+ _out261: cs = 261; goto _out;
4533
+ _out262: cs = 262; goto _out;
4534
+ _out263: cs = 263; goto _out;
4535
+ _out264: cs = 264; goto _out;
4536
+ _out265: cs = 265; goto _out;
4537
+ _out266: cs = 266; goto _out;
4538
+ _out267: cs = 267; goto _out;
4539
+ _out268: cs = 268; goto _out;
4540
+ _out269: cs = 269; goto _out;
4541
+ _out270: cs = 270; goto _out;
4542
+ _out271: cs = 271; goto _out;
4543
+ _out272: cs = 272; goto _out;
4544
+ _out273: cs = 273; goto _out;
4545
+ _out274: cs = 274; goto _out;
4546
+ _out279: cs = 279; goto _out;
4547
+ _out275: cs = 275; goto _out;
4548
+
4549
+ _out: {}
4550
+ }
4551
+ #line 147 "nmea.rl"
4552
+ if(cs == NMEA_error) {
4553
+ return false;
4554
+ }
4555
+ return true;
4556
+ }
4557
+ }
4558
+