projects
/
smartthings-infrastructure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adding missing methods etc.
[smartthings-infrastructure.git]
/
ColorTemperature
/
ColorTemperatures.groovy
diff --git
a/ColorTemperature/ColorTemperatures.groovy
b/ColorTemperature/ColorTemperatures.groovy
index 952bfcd86759678e50453bf4d3fa40c3cfc58205..d3826804318a6448eff9382233a52bfd1b0043e3 100644
(file)
--- a/
ColorTemperature/ColorTemperatures.groovy
+++ b/
ColorTemperature/ColorTemperatures.groovy
@@
-2,9
+2,6
@@
package ColorTemperature
import Timer.SimulatedTimer
package ColorTemperature
import Timer.SimulatedTimer
-//JPF's Verify API
-import gov.nasa.jpf.vm.Verify
-
public class ColorTemperatures {
private int deviceNumbers
private List colorTemperatues
public class ColorTemperatures {
private int deviceNumbers
private List colorTemperatues
@@
-14,17
+11,27
@@
public class ColorTemperatures {
private String id = "colorTemperatureID0"
private String label = "colorTemperature0"
private String displayName = "colorTemperature0"
private String id = "colorTemperatureID0"
private String label = "colorTemperature0"
private String displayName = "colorTemperature0"
- private String currentSwitch = "o
ff
"
+ private String currentSwitch = "o
n
"
private int level = 50
private int currentLevel = 50
private int colorTemperature = 15000
private int level = 50
private int currentLevel = 50
private int colorTemperature = 15000
- ColorTemperatures(Closure sendEvent, int deviceNumbers) {
+ ColorTemperatures(Closure sendEvent, int deviceNumbers
, boolean init
) {
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.colorTemperatues = []
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.colorTemperatues = []
+ if (init) {
+ this.level = 30
+ this.currentLevel = 40
+ this.colorTemperature = 10000
+ } else {
+ this.level = 50
+ this.currentLevel = 50
+ this.colorTemperature = 15000
+ }
+
colorTemperatues.add(new ColorTemperature(sendEvent, id, label, displayName, this.level, this.currentSwitch, this.colorTemperature))
}
colorTemperatues.add(new ColorTemperature(sendEvent, id, label, displayName, this.level, this.currentSwitch, this.colorTemperature))
}
@@
-74,6
+81,14
@@
public class ColorTemperatures {
//methods
//methods
+ def setLevel(long level) {
+ if (level != this.level) {
+ this.currentLevel = level
+ this.level = level
+ colorTemperatues[0].setLevel(level)
+ }
+ }
+
def setLevel(int level) {
if (level != this.level) {
this.currentLevel = level
def setLevel(int level) {
if (level != this.level) {
this.currentLevel = level
@@
-88,6
+103,13
@@
public class ColorTemperatures {
colorTemperatues[0].setColorTemperature(colorTemperature)
}
}
colorTemperatues[0].setColorTemperature(colorTemperature)
}
}
+
+ def setColorTemperature(int colorTemperature) {
+ if (colorTemperature != this.colorTemperature) {
+ this.colorTemperature = colorTemperature
+ colorTemperatues[0].setColorTemperature(colorTemperature)
+ }
+ }
def on(String currentSwitch) {
if (currentSwitch != this.currentSwitch) {
def on(String currentSwitch) {
if (currentSwitch != this.currentSwitch) {