X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=SmokeDetector%2FSmokeDetectors.groovy;h=d2c61291ae4e0a3b023af747fd68886f302d2710;hb=43db66bdb5ba7a2f07e9cbb04e0c44fddd6510be;hp=e7aec2f7aa5279456a837eb2af5f219026802670;hpb=9a9f34091fe2231e5f0010987ac3a24800aaae78;p=smartthings-infrastructure.git diff --git a/SmokeDetector/SmokeDetectors.groovy b/SmokeDetector/SmokeDetectors.groovy index e7aec2f..d2c6129 100644 --- a/SmokeDetector/SmokeDetectors.groovy +++ b/SmokeDetector/SmokeDetectors.groovy @@ -2,9 +2,6 @@ package SmokeDetector import Timer.SimulatedTimer -//JPF's Verify API -import gov.nasa.jpf.vm.Verify - public class SmokeDetectors { private int deviceNumbers private List smokeDetectors @@ -21,39 +18,35 @@ public class SmokeDetectors { private String currentCarbonMonoxideValue = "clear" private String carbonMonoxideLatestValue = "clear" private int battery = 50 + private int batteryValue = 50 private int batteryLatestValue = 50 - SmokeDetectors(Closure sendEvent, int deviceNumbers) { + SmokeDetectors(Closure sendEvent, int deviceNumbers, boolean init) { this.sendEvent = sendEvent this.deviceNumbers = deviceNumbers this.smokeDetectors = [] - /*def init = Verify.getInt(0,2) - if (init == 0) { + if (init) { this.currentSmokeValue = "clear" this.smokeLatestValue = "clear" - } else if (initSmoke == 1) { - this.currentSmokeValue = "detected" - this.smokeLatestValue = "detected" - } else { - this.currentSmokeValue = "tested" - this.smokeLatestValue = "tested" - } - - def initCarbonMonoxide = Verify.getInt(0,2) - if (initCarbonMonoxide == 0) { + this.carbonMonoxide = "clear" this.currentCarbonMonoxideValue = "clear" this.carbonMonoxideLatestValue = "clear" - } else if (initCarbonMonoxide == 1) { + this.battery = 50 + this.batteryValue = 50 + this.batteryLatestValue = 50 + } else { + this.currentSmokeValue = "detected" + this.smokeLatestValue = "detected" + this.carbonMonoxide = "detected" this.currentCarbonMonoxideValue = "detected" this.carbonMonoxideLatestValue = "detected" - } else { - this.currentCarbonMonoxideValue = "tested" - this.carbonMonoxideLatestValue = "tested" + this.battery = 60 + this.batteryValue = 60 + this.batteryLatestValue = 60 } - }*/ - smokeDetectors.add(new SmokeDetector(id, label, displayName, this.currentSmokeValue, this.smokeLatestValue)) + smokeDetectors.add(new SmokeDetector(id, label, displayName, this.currentSmokeValue, this.smokeLatestValue, this.carbonMonoxide, this.carbonMonoxideLatestValue, this.battery)) } //By Model Checker