projects
/
smartthings-infrastructure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removing getXXX methods + properties. Adding getProperty feature to SmartThing(s)
[smartthings-infrastructure.git]
/
SpeechSynthesis
/
SpeechSynthesis.groovy
diff --git
a/SpeechSynthesis/SpeechSynthesis.groovy
b/SpeechSynthesis/SpeechSynthesis.groovy
index da60b36591ad58150ee1b6d3b915838ae2cc2003..cd57d0ca8c086f51a3799830cb2590c3a2628ac4 100644
(file)
--- a/
SpeechSynthesis/SpeechSynthesis.groovy
+++ b/
SpeechSynthesis/SpeechSynthesis.groovy
@@
-2,21
+2,16
@@
package SpeechSynthesis
import SmartThing.SmartThing
package SpeechSynthesis
import SmartThing.SmartThing
-//Importing mutable integer class
-import MutableInteger.MutableInteger
-
public class SpeechSynthesis extends SmartThing {
// id, label, and display name of the device
public class SpeechSynthesis extends SmartThing {
// id, label, and display name of the device
- StringBuilder id = new StringBuilder()
- StringBuilder label = new StringBuilder()
- StringBuilder displayName = new StringBuilder()
- // Features with numberical values
- MutableInteger currentLevel = new MutableInteger()
+ String id
+ String label
+ String displayName
// Maps from features to values
// Maps from features to values
- HashMap<String,
MutableInteger> deviceIntValuesMap = new HashMap<String, Mutable
Integer>()
+ HashMap<String,
Integer> deviceIntValuesMap = new HashMap<String,
Integer>()
- SpeechSynthesis(Closure sendEvent, String
Builder id, StringBuilder label, StringBuilder displayName, Mutable
Integer currentLevel) {
- deviceIntValue
sMap = deviceIntValueSmartThing
+ SpeechSynthesis(Closure sendEvent, String
id, String label, String displayName,
Integer currentLevel) {
+ deviceIntValue
SmartThing = deviceIntValuesMap
idSmartThing = id
labelSmartThing = label
displayNameSmartThing = displayName
idSmartThing = id
labelSmartThing = label
displayNameSmartThing = displayName
@@
-26,27
+21,16
@@
public class SpeechSynthesis extends SmartThing {
this.id = id
this.label = label
this.displayName = displayName
this.id = id
this.label = label
this.displayName = displayName
- this.currentLevel = currentLevel
deviceIntValuesMap.put("level", currentLevel)
}
// Methods to set values
def setLevel(int newValue) {
deviceIntValuesMap.put("level", currentLevel)
}
// Methods to set values
def setLevel(int newValue) {
- if (!currentLevel.getValue().equals(newValue)) {
- String tmpID = id.toString()
- currentLevel.setValue(newValue)
- println("The level of speech synthesis with id:$tmpID is changed to $currentLevel")
- }
+ action(newValue, "level")
}
def speak(String message) {
}
def speak(String message) {
- String tmpID = id.toString()
- println("Speech synthesis with id:$tmpID, SPEAKING:\"$message\"!")
- }
-
- // Methods to return values
- def getCurrentLevel() {
- return currentLevel.getValue()
+ println("Speech synthesis with id:$id, SPEAKING:\"$message\"!")
}
}
}
}