Example #1
0
int main(int argc, char **argv)
{
  plan_tests(11);

  Validity v;
  v.Clear();
  ok1(!v.IsValid());
  v.Update(100);
  ok1(v.IsValid());
  v.Expire(101, 5);
  ok1(v.IsValid());
  v.Expire(105, 5);
  ok1(v.IsValid());
  v.Expire(106, 5);
  ok1(!v.IsValid());

  v.Update(100);
  ok1(v.Modified(Validity(99)));
  ok1(!v.Modified(Validity(100)));
  ok1(!v.Modified(Validity(101)));
  ok1(!v.Complement(Validity(1)));

  v.Clear();
  ok1(!v.Complement(invalid()));
  ok1(v.Complement(Validity(1)));

  return exit_status();
}
Example #2
0
static bool
MacCreadyProcessTimer()
{
  bool modified = false;

  static ExternalSettings last_external_settings;
  static Validity last_auto_mac_cready;

  const NMEAInfo &basic = CommonInterface::Basic();
  const DerivedInfo &calculated = CommonInterface::Calculated();

  if (last_auto_mac_cready.Modified(calculated.auto_mac_cready_available)) {
    /* time warp, reset */
    last_auto_mac_cready.Clear();
    modified = true;
  }

  if (basic.settings.mac_cready_available.Modified(last_external_settings.mac_cready_available)) {
    ActionInterface::SetMacCready(basic.settings.mac_cready, false);
    modified = true;
  } else if (calculated.auto_mac_cready_available.Modified(last_auto_mac_cready)) {
    last_auto_mac_cready = calculated.auto_mac_cready_available;
    ActionInterface::SetMacCready(calculated.auto_mac_cready);
    modified = true;
  }

  last_external_settings = basic.settings;

  return modified;
}
Example #3
0
void
ProcessTimer::AirspaceProcessTimer()
{
  static Validity previous;

  const AirspaceWarningsInfo &warnings =
    CommonInterface::Calculated().airspace_warnings;

  if (previous.Modified(warnings.latest))
    /* time warp, reset */
    previous.Clear();

  if (warnings.latest.Modified(previous)) {
    previous = warnings.latest;
    CommonInterface::main_window.SendAirspaceWarning();
  }
}