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
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()
- }
}