1 //Create a class for speech synthesis
2 package SpeechSynthesis
3 import SmartThing.SmartThings
5 //Importing mutable integer class
6 import MutableInteger.MutableInteger
8 public class SpeechSynthesises extends SmartThings {
9 List speechSynthesises = new ArrayList()
11 SpeechSynthesises(Closure sendEvent, boolean init) {
12 // Only initialize one time since we only have one device for each capability
13 speechSynthesises = smartThings
16 StringBuilder id = new StringBuilder("speechSynthesisID0")
17 StringBuilder label = new StringBuilder("speechSynthesis")
18 StringBuilder displayName = new StringBuilder("speechSynthesis0")
19 MutableInteger level = new MutableInteger()
26 speechSynthesises.add(new SpeechSynthesis(sendEvent, id, label, displayName, level))
29 // Methods to set values
30 def setLevel(int level) {
31 speechSynthesises[0].setLevel(level)
34 def speak(String message) {
35 speechSynthesises[0].speak(message)
38 // Methods to return values
39 def getCurrentLevel() {
40 List tmpValues = new ArrayList()
41 tmpValues.add(speechSynthesises[0].getCurrentLevel())