//By Apps
def lock() {
locks[0].lock()
+ lockLatestValue = lockState
+ lockState = "locked"
+ currentLock = "locked"
}
def lock(LinkedHashMap metaData) {
def task = timers.runAfter(metaData["delay"]) {
locks[0].lock()
+ lockLatestValue = lockState
+ lockState = "locked"
+ currentLock = "locked"
}
}
def unlock() {
locks[0].unlock()
+ lockLatestValue = lockState
+ lockState = "unlocked"
+ currentLock = "unlocked"
}
def unlock(LinkedHashMap metaData) {
def task = timers.runAfter(metaData["delay"]) {
locks[0].unlock()
+ lockLatestValue = lockState
+ lockState = "unlocked"
+ currentLock = "unlocked"
}
}
//By Model Checker
def setValue(LinkedHashMap eventDataMap) {
- locks[0].setValue(eventDataMap["value"])
- this.lockState = locks[0].lockState
- this.currentLock = locks[0].lockState
- this.lockLatestValue = locks[0].lockLatestValue
- sendEvent(eventDataMap)
+ if (eventDataMap["value"] != locks[0].lockState) {
+ locks[0].setValue(eventDataMap["value"])
+ this.lockState = locks[0].lockState
+ this.currentLock = locks[0].lockState
+ this.lockLatestValue = locks[0].lockLatestValue
+ sendEvent(eventDataMap)
+ }
}
def currentValue(String deviceFeature) {