def find(Closure Input) {
switches.find(Input)
}
+ def sort(Closure Input) {
+ switches.sort(Input)
+ }
def collect(Closure Input) {
switches.collect(Input)
}
//By Apps
def setLevel(int level) {
- switches[0].setLevel(level)
currentLevel = level
+ switches[0].setLevel(level)
}
def on() {
- switches[0].on()
- switchLatestValue = switchState
+ switchLatestValue = "on"
switchState = "on"
currentSwitch = "on"
+ switches[0].on()
}
def on(LinkedHashMap metaData) {
def task = timers.runAfter(metaData["delay"]) {
- switches[0].on()
- switchLatestValue = switchState
+ switchLatestValue = "on"
switchState = "on"
currentSwitch = "on"
+ switches[0].on()
}
}
def off() {
- switches[0].off()
- switchLatestValue = switchState
+ switchLatestValue = "off"
switchState = "off"
currentSwitch = "off"
+ switches[0].off()
}
def off(LinkedHashMap metaData) {
def task = timers.runAfter(metaData["delay"]) {
- switches[0].off()
- switchLatestValue = switchState
+ switchLatestValue = "off"
switchState = "off"
currentSwitch = "off"
+ switches[0].off()
}
}
//By Model Checker
def setValue(LinkedHashMap eventDataMap) {
if (eventDataMap["value"] != switches[0].switchState) {
+ this.switchState = eventDataMap["value"]
+ this.switchLatestValue = eventDataMap["value"]
switches[0].setValue(eventDataMap["value"])
- this.switchState = switches[0].switchState
- this.switchLatestValue = switches[0].switchLatestValue
sendEvent(eventDataMap)
}
}