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; }
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; }
static void ReadIGCMetaData(const TCHAR *path, IGCHeader &header, BrokenDate &date) { strcpy(header.manufacturer, "XXX"); strcpy(header.id, "000"); header.flight = 0; FileLineReaderA reader(path); if (reader.error()) { date = BrokenDate::TodayUTC(); return; } char *line = reader.ReadLine(); if (line != NULL) IGCParseHeader(line, header); line = reader.ReadLine(); if (line == NULL || !IGCParseDateRecord(line, date)) date = BrokenDate::TodayUTC(); }
static void TestDate() { BrokenDate date; ok1(!IGCParseDateRecord("", date)); ok1(!IGCParseDateRecord("B1122385103117N00742367EA004900048700000", date)); ok1(!IGCParseDateRecord("HFDTEXXX", date)); ok1(IGCParseDateRecord("HFDTE040910", date)); ok1(date.year == 2010); ok1(date.month == 9); ok1(date.day == 4); ok1(IGCParseDateRecord("HFDTE010100", date)); ok1(date.year == 2000); ok1(date.month == 1); ok1(date.day == 1); ok1(IGCParseDateRecord("HFDTE311299", date)); ok1(date.year == 1999); ok1(date.month == 12); ok1(date.day == 31); }