X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=ContactSensor%2FContactSensors.groovy;h=c4136e301a843a3f836dea903abddf68a4c1940f;hb=550f30661578b8b79f521cb65e6c69b5dc699e35;hp=5f5f20e97b9ad97e13bcdfd96493de08f0c53141;hpb=c1971948245fda1774c4c76451387ae8c0b7ebc0;p=smartthings-infrastructure.git diff --git a/ContactSensor/ContactSensors.groovy b/ContactSensor/ContactSensors.groovy index 5f5f20e..c4136e3 100644 --- a/ContactSensor/ContactSensors.groovy +++ b/ContactSensor/ContactSensors.groovy @@ -2,9 +2,6 @@ package ContactSensor import Timer.SimulatedTimer -//JPF's Verify API -import gov.nasa.jpf.vm.Verify - public class ContactSensors { private int deviceNumbers private List contacts @@ -20,10 +17,22 @@ public class ContactSensors { private String alarmState = "armed" - ContactSensors(Closure sendEvent, int deviceNumbers) { + ContactSensors(Closure sendEvent, int deviceNumbers, boolean init) { this.sendEvent = sendEvent this.deviceNumbers = deviceNumbers this.contacts = [] + + if (init) { + this.contactState = "closed" + this.currentContact = "closed" + this.latestValue = "closed" + this.alarmState = "armed" + } else { + this.contactState = "open" + this.currentContact = "open" + this.latestValue = "open" + this.alarmState = "not armed" + } contacts.add(new ContactSensor(id, label, displayName, this.contactState, this.currentContact, this.alarmState, this.latestValue)) }