bool DebugReplayIGC::Next() { last_basic = computed_basic; const char *line; while ((line = reader->ReadLine()) != NULL) { if (line[0] == 'B') { IGCFix fix; if (IGCParseFix(line, extensions, fix)) { CopyFromFix(fix); Compute(); return true; } } else if (line[0] == 'H') { BrokenDate date; if (memcmp(line, "HFDTE", 5) == 0 && IGCParseDateRecord(line, date)) { (BrokenDate &)raw_basic.date_time_utc = date; raw_basic.time_available.Clear(); } } else if (line[0] == 'I') { IGCParseExtensions(line, extensions); } } if (computed_basic.time_available) flying_computer.Finish(calculated.flight, computed_basic.time); return false; }
bool DebugReplayIGC::Next() { last_basic = basic; last_calculated = calculated; const char *line; while ((line = reader->read()) != NULL) { if (line[0] == 'B') { IGCFix fix; if (IGCParseFix(line, extensions, fix) && fix.gps_valid) { CopyFromFix(fix); Compute(); return true; } } else if (line[0] == 'H') { BrokenDate date; if (memcmp(line, "HFDTE", 5) == 0 && IGCParseDateRecord(line, date)) { (BrokenDate &)basic.date_time_utc = date; basic.date_available = true; } } else if (line[0] == 'I') { IGCParseExtensions(line, extensions); } } return false; }
static void TestExtensions() { IGCExtensions extensions; ok1(!IGCParseExtensions("", extensions)); ok1(!IGCParseExtensions("B1122385103117N00742367EA004900048700000", extensions)); ok1(!IGCParseExtensions("AXYZAA", extensions)); ok1(IGCParseExtensions("I043638FXA3941ENL4246GSP4749TRT", extensions)); ok1(extensions.size() == 4); ok1(extensions[0].start == 36); ok1(extensions[0].finish == 38); ok1(strcmp(extensions[0].code, "FXA") == 0); ok1(extensions[1].start == 39); ok1(extensions[1].finish == 41); ok1(strcmp(extensions[1].code, "ENL") == 0); ok1(extensions[2].start == 42); ok1(extensions[2].finish == 46); ok1(strcmp(extensions[2].code, "GSP") == 0); ok1(extensions[3].start == 47); ok1(extensions[3].finish == 49); ok1(strcmp(extensions[3].code, "TRT") == 0); }
inline bool IgcReplay::ScanBuffer(const char *buffer, IGCFix &fix, NMEAInfo &basic) { if (IGCParseFix(buffer, extensions, fix) && fix.gps_valid) return true; BrokenDate date; if (IGCParseDateRecord(buffer, date)) basic.ProvideDate(date); else IGCParseExtensions(buffer, extensions); return false; }