X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=Battery%2FBattery.groovy;h=7162d6824066efdc7fb6b2f6dcb9cbab6f508dc9;hb=2d26e7af07daad1394408bdcf76150b5aacf3a8a;hp=3e4e5116e8047f7c911f39b929bcec9583870f79;hpb=83071d3bcfc33f015ece13868342644498a9dda3;p=smartthings-infrastructure.git diff --git a/Battery/Battery.groovy b/Battery/Battery.groovy index 3e4e511..7162d68 100644 --- a/Battery/Battery.groovy +++ b/Battery/Battery.groovy @@ -2,21 +2,16 @@ package Battery import SmartThing.SmartThing -//Importing mutable integer class -import MutableInteger.MutableInteger - public class Battery 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 currentBattery = new MutableInteger() + String id + String label + String displayName // Maps from features to values - HashMap deviceIntValuesMap = new HashMap() + HashMap deviceIntValuesMap = new HashMap() - Battery(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName, MutableInteger currentBattery) { - deviceIntValuesMap = deviceIntValueSmartThing + Battery(Closure sendEvent, String id, String label, String displayName, Integer currentBattery) { + deviceIntValueSmartThing = deviceIntValuesMap idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName @@ -26,13 +21,7 @@ public class Battery extends SmartThing { this.id = id this.label = label this.displayName = displayName - this.currentBattery = currentBattery deviceIntValuesMap.put("battery", currentBattery) } - - // Methods to return values - def getCurrentBattery() { - return currentBattery.toString() - } }