1 //Create a class for alarm device
3 import Timer.SimulatedTimer
11 //If we have only one device
12 private String id = "alarmID0"
13 private String label = "alarm0"
14 private String displayName = "alarm0"
15 private String alarm = "off"
16 private String currentAlarm = "off"
17 private String alarmLatestValue = "off"
19 Alarms(Closure sendEvent, int deviceNumbers) {
20 this.sendEvent = sendEvent
21 this.timers = new SimulatedTimer()
22 this.deviceNumbers = deviceNumbers
25 alarms.add(new Alarm(sendEvent, id, label, displayName, this.alarm, this.currentAlarm, this.alarmLatestValue))
28 //Methods for closures
29 def count(Closure Input) {
35 def each(Closure Input) {
38 def find(Closure Input) {
41 def collect(Closure Input) {
48 alarmLatestValue = alarm
55 alarmLatestValue = alarm
66 alarmLatestValue = alarm
68 currentAlarm = "siren"
73 alarmLatestValue = alarm
75 currentAlarm = "strobe"
78 def currentValue(String deviceFeature) {
79 alarms[0].currentValue(deviceFeature)
82 def latestValue(String deviceFeature) {
83 alarms[0].latestValue(deviceFeature)