X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=StepSensor%2FStepSensor.groovy;fp=StepSensor%2FStepSensor.groovy;h=7f0faf357ff5b5d1f3fe31c56fd26ad77db37c3f;hb=2d26e7af07daad1394408bdcf76150b5aacf3a8a;hp=538fca576c92602e5ff63a660832a9f767049515;hpb=83071d3bcfc33f015ece13868342644498a9dda3;p=smartthings-infrastructure.git diff --git a/StepSensor/StepSensor.groovy b/StepSensor/StepSensor.groovy index 538fca5..7f0faf3 100644 --- a/StepSensor/StepSensor.groovy +++ b/StepSensor/StepSensor.groovy @@ -2,22 +2,16 @@ package StepSensor import SmartThing.SmartThing -//Importing mutable integer class -import MutableInteger.MutableInteger - public class StepSensor extends SmartThing { // id, label, and display name of the device - StringBuilder id = new StringBuilder() - StringBuilder label = new StringBuilder() - StringBuilder displayName = new StringBuilder() - // Features with numberical values - MutableInteger currentGoal = new MutableInteger() - MutableInteger currentSteps = new MutableInteger() + String id + String label + String displayName // Maps from features to values - HashMap deviceIntValuesMap = new HashMap() + HashMap deviceIntValuesMap = new HashMap() - StepSensor(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentSteps, MutableInteger currentGoal) { - deviceIntValuesMap = deviceIntValueSmartThing + StepSensor(Closure sendEvent, String id, String label, String displayName, Integer currentSteps, Integer currentGoal) { + deviceIntValueSmartThing = deviceIntValuesMap idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName @@ -27,19 +21,8 @@ public class StepSensor extends SmartThing { this.id = id this.label = label this.displayName = displayName - this.currentSteps = currentSteps - this.currentGoal = currentGoal deviceIntValuesMap.put("steps", currentSteps) deviceIntValuesMap.put("goal", currentGoal) } - - // Methods to return values - def getCurrentSteps() { - return currentSteps.getValue() - } - - def getCurrentGoal() { - return currentGoal.getValue() - } }