Removing getXXX methods + properties. Adding getProperty feature to SmartThing(s)
[smartthings-infrastructure.git] / StepSensor / StepSensor.groovy
index 538fca576c92602e5ff63a660832a9f767049515..7f0faf357ff5b5d1f3fe31c56fd26ad77db37c3f 100644 (file)
@@ -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<String, MutableInteger> deviceIntValuesMap = new HashMap<String, MutableInteger>()
+       HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
 
-       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()
-       }
 }