//Create a class for speech synthesis
package SpeechSynthesis
-import Timer.SimulatedTimer
+import SmartThing.SmartThing
-public class SpeechSynthesis {
- private String id
- private String label
- private String displayName
- private int level
+public class SpeechSynthesis extends SmartThing {
+ // id, label, and display name of the device
+ String id
+ String label
+ String displayName
+ // Maps from features to values
+ HashMap<String, Integer> deviceIntValuesMap = new HashMap<String, Integer>()
+ SpeechSynthesis(Closure sendEvent, String id, String label, String displayName, Integer currentLevel) {
+ deviceIntValueSmartThing = deviceIntValuesMap
+ idSmartThing = id
+ labelSmartThing = label
+ displayNameSmartThing = displayName
+ sendEventSmartThings = sendEvent
- SpeechSynthesis(String id, String label, String displayName, int level) {
+ // Initialization
this.id = id
this.label = label
this.displayName = displayName
- this.level = level
+
+ deviceIntValuesMap.put("level", currentLevel)
}
- def setLevel(int level) {
- println("The level of speech synthesis with id:$id is changed to $level")
- this.level = level
+ // Methods to set values
+ def setLevel(int newValue) {
+ action(newValue, "level")
}
def speak(String message) {