1 //Create a class for speech synthesis
2 package SpeechSynthesis
3 import SmartThing.SmartThings
5 public class SpeechSynthesises extends SmartThings {
6 List speechSynthesises = new ArrayList()
8 SpeechSynthesises(Closure sendEvent, boolean init) {
9 // Only initialize one time since we only have one device for each capability
10 speechSynthesises = smartThings
13 StringBuilder id = new StringBuilder("speechSynthesisID0")
14 StringBuilder label = new StringBuilder("speechSynthesis")
15 StringBuilder displayName = new StringBuilder("speechSynthesis0")
16 MutableInteger level = new MutableInteger()
23 speechSynthesises.add(new SpeechSynthesis(sendEvent, id, label, displayName, level))
26 // Methods to set values
27 def setLevel(int level) {
28 speechSynthesises[0].setLevel(level)
31 def speak(String message) {
32 speechSynthesises[0].speak(message)
35 // Methods to return values
36 def getCurrentLevel() {
37 List tmpValues = new ArrayList()
38 tmpValues.add(speechSynthesises[0].getCurrentLevel())