KNOWLEDGE BASE

face-white

Terminal Programming

13.12.2006 10:51

KB050141 | ALARM ACKNOWLEDGE/SWICTH OFF ALARM SOUND VIA PUSH BUTTON

INF

Product: Elvis
Version: 2.5
Stand: 2006-12-13

Summary

For acknowledging an alarm the following options exist in Elvis:

  • Via the built-in alarm list (double-click and then click Acknowledge)
  • Via the AlarmListControl (same functionality)
  • Implicitely by successfully delivering a message (if the check boc in the column Acknowledge is set)

This article describes how to alternatively acknowledge all alarms via StateButton placed on a page.

Sometimes it is just required to switch off the sound that has been configured via Extras/Options/Alarm; this is also described.

Details

First place a StateButton on the page. It is sufficient if it has only one state. Assign the picture or text to the states “-” (unknown) and “0”.

Then add some code to be executed on mouse click via “Events..” (Context menu).

To acknowledge all pending alarms, the code should look like this:

//CODE:vb:Sub NameDesKontrollelements_Click()
Dim alarm As Object
Set alarm = Database.AlarmHistory
Do While alarm.EventType <> 0 And alarm.Time >= CDate(CDbl(Now)-1)
If alarm.Datapoint.AlarmState = Asc(“A”) Then
alarm.Datapoint.AcknowledgeAlarm(“”)
End If
alarm.Next
Loop
End Sub//CODE

Explanation: With Database.AlarmHistory, you get the most recent alarm event; alarm.Next walks the alarm history in direction to the past. As termination condition of the While loop we use EventType (no more events) and Time (event older than one day).

If only the alarm tone shall be switched off, this is really simple:

//CODE:vb:Sub NameDesKontrollelements_Click()
Application.PlaySound(“”)
End Sub //CODE