예제 #1
0
int
main(int argc, char *argv[])
{
  if (argc < 2) {
    printf("Usage: %s <code>[ <code> ...]\n", argv[0]);
    printf("   <code> is the four letter ICAO code (upper case)\n");
    printf("          of the airport(s) you are requesting\n\n");
    printf("   Example: %s EDDL\n", argv[0]);
    return 1;
  }

  NOAAStore store;
  for (int i = 1; i < argc; i++) {
    printf("Adding station %s\n", argv[i]);
    store.AddStation(argv[i]);
  }

  Net::Initialise();

  printf("Updating METAR and TAF ...\n");
  ConsoleJobRunner runner;
  NOAAUpdater::Update(store, runner);

  for (auto i = store.begin(), end = store.end(); i != end; ++i) {
    printf("---\n");
    printf("Station %s:\n\n", i->code);
    DisplayMETAR(*i);
    DisplayTAF(*i);
  }

  Net::Deinitialise();

  return 0;
}
예제 #2
0
bool
NOAAUpdater::Update(NOAAStore &store, JobRunner &runner)
{
  bool result = true;
  for (auto i = store.begin(), e = store.end(); i != e; ++i)
    result = Update(*i, runner) && result;

  return result;
}
예제 #3
0
파일: Builder.cpp 프로젝트: rkohel/XCSoar
void
MapItemListBuilder::AddWeatherStations(NOAAStore &store)
{
  for (auto it = store.begin(), end = store.end(); it != end; ++it) {
    if (list.full())
      break;

    if (it->parsed_metar_available &&
        it->parsed_metar.location_available &&
        location.DistanceS(it->parsed_metar.location) < range)
      list.checked_append(new WeatherStationMapItem(it));
  }
}