Adding conflict variable in SpeechSynthesis device.
[smartthings-infrastructure.git] / SpeechSynthesis / SpeechSynthesis.groovy
index acc2d80545cee93895eeb840085192cddb4da16c..fb91378307726a2a98bc8fb5e433aa5d2796ba4e 100644 (file)
@@ -7,13 +7,15 @@ public class SpeechSynthesis {
        private String label
        private String displayName
        private int level
+       private boolean oneUser
 
 
-       SpeechSynthesis(String id, String label, String displayName, int level) {
+       SpeechSynthesis(String id, String label, String displayName, int level, boolean oneUser) {
                this.id = id
                this.label = label
                this.displayName = displayName
                this.level = level
+               this.oneUser = oneUser
        }
 
        def setLevel(int level) {
@@ -25,5 +27,11 @@ public class SpeechSynthesis {
 
        def speak(String message) {
                println("Speech synthesis with id:$id, SPEAKING:\"$message\"!")
+               // As a conflict variable
+               if (oneUser) {
+                       oneUser = false
+               } else {
+                       oneUser = true
+               }
        }
 }