Infrastructure that works for all the locks' group!
[smartthings-infrastructure.git] / SpeechSynthesis / SpeechSynthesises.groovy
index 033db31f6325f4e0b3fd6668bd13f9f340c147ef..2ef8cec28f8b0bebfd640103524550f14e041e92 100644 (file)
@@ -2,6 +2,9 @@
 package SpeechSynthesis
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
 public class SpeechSynthesises {
        private int deviceNumbers
        private List speechSynthesises
@@ -19,6 +22,9 @@ public class SpeechSynthesises {
                this.deviceNumbers = deviceNumbers
                this.speechSynthesises = []
 
+               def init = Verify.getIntFromList(30, 50, 70)
+               this.level = init
+
                speechSynthesises.add(new SpeechSynthesis(id, label, displayName, this.level))
        }
 
@@ -40,8 +46,10 @@ public class SpeechSynthesises {
        }
 
        def setLevel(int level) {
-               speechSynthesises[0].setLevel(level)
-               this.level = level
+               if (level != this.level) {
+                       speechSynthesises[0].setLevel(level)
+                       this.level = level
+               }
        }
 
        def speak(String message) {