X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartthings-infrastructure.git;a=blobdiff_plain;f=Lock%2FLocks.groovy;h=8b73dc55ac20e393cd311655c2ddd4f03a2859c9;hp=409058f6fe90b87e9fde1f61733562c1dc9971c9;hb=de35dfa319418baf7ba4bc2eeb4dbfc0fd20230a;hpb=d3802bd96ca8963ae52b9740443f9be6896f0e18 diff --git a/Lock/Locks.groovy b/Lock/Locks.groovy index 409058f..8b73dc5 100644 --- a/Lock/Locks.groovy +++ b/Lock/Locks.groovy @@ -39,30 +39,33 @@ public class Locks{ //By Apps def lock() { if (lockState != "locked") { - locks[0].lock() - lockLatestValue = lockState + //lockLatestValue = lockState + lockLatestValue = "locked" lockState = "locked" currentLock = "locked" + locks[0].lock() } } def lock(LinkedHashMap metaData) { if (lockState != "locked") { def task = timers.runAfter(metaData["delay"]) { - locks[0].lock() - lockLatestValue = lockState + //lockLatestValue = lockState + lockLatestValue = "locked" lockState = "locked" currentLock = "locked" + locks[0].lock() } } } def unlock() { if (lockState != "unlocked") { - locks[0].unlock() - lockLatestValue = lockState + //lockLatestValue = lockState + lockLatestValue = "unlocked" lockState = "unlocked" currentLock = "unlocked" + locks[0].unlock() } } @@ -70,10 +73,11 @@ public class Locks{ def unlock(LinkedHashMap metaData) { if (lockState != "unlocked") { def task = timers.runAfter(metaData["delay"]) { - locks[0].unlock() - lockLatestValue = lockState + //lockLatestValue = lockState + lockLatestValue = "unlocked" lockState = "unlocked" currentLock = "unlocked" + locks[0].unlock() } } }