From: Seyed Amir Hossein Aqajari Date: Fri, 28 Feb 2020 19:37:30 +0000 (-0800) Subject: Merge branch 'oldInfraNewAnalysis' of ssh://plrg.eecs.uci.edu/home/git/smartthings... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a5a7e14435fbfca7969c338e83842d4881dadbf8;hp=5ae2e0d7adfcb62565c6aedfc13faea7217802ab;p=smartthings-infrastructure.git Merge branch 'oldInfraNewAnalysis' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure into oldInfraNewAnalysis --- diff --git a/ColorControl/ColorControls.groovy b/ColorControl/ColorControls.groovy index a2c93de..8a3f08d 100644 --- a/ColorControl/ColorControls.groovy +++ b/ColorControl/ColorControls.groovy @@ -13,7 +13,7 @@ public class ColorControls { private String displayName = "colorControl0" private String color = "Red" private String currentColor = "Red" - private String currentSwitch = "on" + private String currentSwitch = "off" private int level = 50 private int currentLevel = 50 private int hue = 50 @@ -38,7 +38,7 @@ public class ColorControls { this.currentSaturation = 40 this.colorTemperature = 10000 this.color = "Red" - this.currentSwitch = "on" + this.currentSwitch = "off" } else { this.level = 50 this.currentLevel = 50 @@ -48,7 +48,7 @@ public class ColorControls { this.currentSaturation = 50 this.colorTemperature = 15000 this.color = "Blue" - this.currentSwitch = "off" + this.currentSwitch = "on" } colorControls.add(new ColorControl(sendEvent, id, label, displayName, this.color, this.hue, this.saturation, this.level, this.currentSwitch, this.colorTemperature)) } diff --git a/Extractor/Extractor.groovy b/Extractor/Extractor.groovy index cf19c45..f9c96a6 100644 --- a/Extractor/Extractor.groovy +++ b/Extractor/Extractor.groovy @@ -103,7 +103,7 @@ import Timer.SimulatedTimer @Field File extractedObjectsConstructorApp2 = new File("Extractor/App2/extractedObjectsConstructorApp2.groovy") //Set this to true for global-state variable conflict -@Field assignDifferentModes = true +@Field assignDifferentModes = false @Field chooseMode = 0 //Empty the files if (App == "App1") { diff --git a/SwitchLevel/SwitchLevel.groovy b/SwitchLevel/SwitchLevel.groovy index 7db6a16..ea2e122 100644 --- a/SwitchLevel/SwitchLevel.groovy +++ b/SwitchLevel/SwitchLevel.groovy @@ -8,7 +8,7 @@ public class SwitchLevel { private String displayName private String switchState private String currentSwitch - private int level + private int currentLevel private int rate private int hue private int saturation @@ -23,7 +23,7 @@ public class SwitchLevel { this.id = id this.label = label this.displayName = displayName - this.level = level + this.currentLevel = level this.rate = level this.hue = hue this.saturation = saturation @@ -34,8 +34,8 @@ public class SwitchLevel { //By Apps def setColor(LinkedHashMap metaData) { - if ((this.level != metaData["level"]) || (this.hue != metaData["hue"]) || (this.saturation != metaData["saturation"])) { - this.level = metaData["level"] + if ((this.currentLevel != metaData["level"]) || (this.hue != metaData["hue"]) || (this.saturation != metaData["saturation"])) { + this.currentLevel = metaData["level"] this.rate = metaData["level"] this.hue = metaData["hue"] this.saturation = metaData["saturation"] @@ -55,9 +55,9 @@ public class SwitchLevel { } def setLevel(int level) { - if (this.level != level) { + if (this.currentLevel != level) { println("the switch with id:$id is setted to level $level!") - this.level = level + this.currentLevel = level this.rate = level sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) @@ -65,9 +65,9 @@ public class SwitchLevel { } def setLevel(long level) { - if (this.level != level) { + if (this.currentLevel != level) { println("the switch with id:$id is setted to level $level!") - this.level = level + this.currentLevel = level this.rate = level sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) @@ -131,7 +131,7 @@ public class SwitchLevel { this.currentSwitch = value } else if (name == "level") { println("the switch with id:$id is setted to level $value!") - this.level = value.toInteger() + this.currentLevel = value.toInteger() this.rate = value.toInteger() } } @@ -139,7 +139,7 @@ public class SwitchLevel { def currentValue(String deviceFeature) { if (deviceFeature == "level") { - return level + return currentLevel } else if (deviceFeature == "switch") { return switchState } @@ -147,7 +147,7 @@ public class SwitchLevel { def latestValue(String deviceFeature) { if (deviceFeature == "level") { - return level + return currentLevel } else if (deviceFeature == "switch") { return switchState } diff --git a/SwitchLevel/SwitchLevels.groovy b/SwitchLevel/SwitchLevels.groovy index d9d2e26..aa931d9 100644 --- a/SwitchLevel/SwitchLevels.groovy +++ b/SwitchLevel/SwitchLevels.groovy @@ -12,13 +12,13 @@ public class SwitchLevels { private String id = "switchLevelID0" private String label = "switchLevel0" private String displayName = "switchLevel0" - private int level = 50 + private int currentLevel = 50 private int rate = 50 private int hue = 30 private int saturation = 70 - private String switchState = "on" - private String currentSwitch = "on" - private String switchLatestValue = "on" + private String switchState = "off" + private String currentSwitch = "off" + private String switchLatestValue = "off" SwitchLevels(Closure sendEvent, int deviceNumbers, boolean init) { this.sendEvent = sendEvent @@ -27,23 +27,23 @@ public class SwitchLevels { this.switchLevels = [] if (init) { - this.level = 50 + this.currentLevel = 50 this.rate = 50 this.hue = 30 this.saturation = 70 - this.switchState = "off" - this.currentSwitch = "off" - this.switchLatestValue = "off" + this.switchState = "on" + this.currentSwitch = "on" + this.switchLatestValue = "on" } else { - this.level = 60 + this.currentLevel = 60 this.rate = 60 this.hue = 50 this.saturation = 90 - this.switchState = "on" - this.currentSwitch = "on" - this.switchLatestValue = "on" + this.switchState = "off" + this.currentSwitch = "off" + this.switchLatestValue = "off" } - switchLevels.add(new SwitchLevel(sendEvent, id, label, displayName, this.level, this.hue, this.saturation, this.switchState, this.switchLatestValue)) + switchLevels.add(new SwitchLevel(sendEvent, id, label, displayName, this.currentLevel, this.hue, this.saturation, this.switchState, this.switchLatestValue)) } //Methods for closures @@ -68,8 +68,8 @@ public class SwitchLevels { //By Apps def setColor(LinkedHashMap metaData) { - if ((this.level != metaData["level"]) || (this.hue != metaData["hue"]) || (this.saturation != metaData["saturation"])) { - this.level = metaData["level"] + if ((this.currentLevel != metaData["level"]) || (this.hue != metaData["hue"]) || (this.saturation != metaData["saturation"])) { + this.currentLevel = metaData["level"] this.rate = metaData["level"] this.hue = metaData["hue"] this.saturation = metaData["saturation"] @@ -83,17 +83,17 @@ public class SwitchLevels { } def setLevel(int level) { - if (this.level != level) { + if (this.currentLevel != level) { switchLevels[0].setLevel(level) - this.level = level + this.currentLevel = level this.rate = level } } def setLevel(long level) { - if (this.level != level) { + if (this.currentLevel != level) { switchLevels[0].setLevel(level) - this.level = level + this.currentLevel = level this.rate = level } } @@ -142,7 +142,7 @@ public class SwitchLevels { } } else if (eventDataMap["name"] == "level") { if (eventDataMap["value"].toInteger() != switchLevels[0].level) { - this.level = eventDataMap["value"].toInteger() + this.currentLevel = eventDataMap["value"].toInteger() this.rate = eventDataMap["value"].toInteger() switchLevels[0].setValue(eventDataMap["value"], "level") sendEvent(eventDataMap)