Exemplo n.º 1
0
 /** Stop all the PVs, disconnect from JMS */
 public void stop() {
   if (nag_timer != null) {
     nag_timer.cancel();
     nag_timer = null;
   }
   messenger.sendAnnunciation("Alarm server exiting");
   stopPVs();
   messenger.stop();
 }
Exemplo n.º 2
0
  /** Start all the PVs, connect to JMS */
  public void start() {
    messenger.start();
    messenger.sendAnnunciation(Messages.StartupMessage);
    startPVs();

    // Conditionally enable nagging
    double nag_period;
    try {
      nag_period = AlarmServerPreferences.getNagPeriod();
    } catch (Exception ex) {
      Activator.getLogger()
          .log(
              Level.WARNING,
              "Invalid '"
                  + AlarmServerPreferences.NAG_PERIOD
                  + "', repeated annunciations disabled",
              ex);
      nag_period = 0.0;
    }
    if (nag_period > 0) {
      nag_timer =
          new NagTimer(
              Math.round(nag_period * 1000),
              new NagTimerHandler() {
                @Override
                public int getActiveAlarmCount() {
                  int active = 0;
                  // Sync on access to pv_list
                  synchronized (AlarmServer.this) {
                    for (AlarmPV pv : pv_list)
                      if (pv.getAlarmLogic().getAlarmState().getSeverity().isActive()) ++active;
                  }
                  return active;
                }

                @Override
                public void nagAboutActiveAlarms(final int active) {
                  final String message;
                  if (active == 1) message = "There is 1 active alarm";
                  else message = NLS.bind("There are {0} active alarms", active);
                  messenger.sendAnnunciation(message);
                }
              });
      nag_timer.start();
    }
  }
Exemplo n.º 3
0
 /**
  * Perform annunciation
  *
  * @param level Alarm severity
  * @param message Text message to send to annunciator
  */
 public void sendAnnunciation(final SeverityLevel level, final String message) {
   resetNagTimer();
   messenger.sendAnnunciation(level, message);
 }