Merge branch 'master' of ssh://plrg.eecs.uci.edu/home/git/smartthings-infrastructure
authoramiraj <amiraj.95@uci.edu>
Sat, 10 Aug 2019 22:00:58 +0000 (15:00 -0700)
committeramiraj <amiraj.95@uci.edu>
Sat, 10 Aug 2019 22:00:58 +0000 (15:00 -0700)
ColorControl/ColorControl.groovy
ColorControl/ColorControls.groovy
Extractor/Extractor.groovy
Extractor/ExtractorScript.py
Methods/schedule.groovy
MusicPlayer/MusicPlayer.groovy
MusicPlayer/MusicPlayers.groovy
appLists/global-state-variable-interaction/globalstatevariableAppList

index 4878c48..c3d652d 100644 (file)
@@ -142,6 +142,16 @@ public class ColorControl {
                }
        }
 
+       def setLevel(long level) {
+               if (level != this.level) {
+                       this.currentLevel = level
+                       this.level = level
+                       println("The level of the light is changed to $level!")
+                       sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
+                                  displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+               }
+       }
+
        def setColorTemperature(int colorTemperature) {
                if (colorTemperature != this.colorTemperature) {
                        this.colorTemperature = colorTemperature
index 0ff9cfd..90223c5 100644 (file)
@@ -205,6 +205,14 @@ public class ColorControls {
                }
        }
 
+       def setLevel(long level) {
+               if (level != this.level) {
+                       this.currentLevel = level
+                       this.level = level
+                       colorControls[0].setLevel(level)
+               }
+       }
+
        def setColorTemperature(int colorTemperature) {
                if (colorTemperature != this.colorTemperature) {
                        this.colorTemperature = colorTemperature
@@ -212,6 +220,13 @@ public class ColorControls {
                }
        }
 
+       def setColorTemperature(long colorTemperature) {
+               if (colorTemperature != this.colorTemperature) {
+                       this.colorTemperature = colorTemperature
+                       colorControls[0].setColorTemperature(colorTemperature)                  
+               }
+       }
+
        def on() {
                if (this.currentSwitch != "on") {
                        this.currentSwitch = "on"
index 5872125..2e82fb3 100644 (file)
@@ -102,7 +102,7 @@ import Timer.SimulatedTimer
 @Field File extractedObjectsConstructorApp2 = new File("Extractor/App2/extractedObjectsConstructorApp2.groovy")
 
 //Set this to true for global-state variable conflict
-@Field assignDifferentModes = false
+@Field assignDifferentModes = true
 @Field chooseMode = 0
 //Empty the files
 if (App == "App1") {
@@ -115,7 +115,7 @@ if (App == "App1") {
        extractedObjectsApp2.write("")
        extractedObjectsConstructorApp2.write("")
        if (assignDifferentModes)
-               chooseMode = 1
+               chooseMode = 2
 }
 
 
index 2c96590..f972b70 100644 (file)
@@ -261,6 +261,7 @@ def AnalyzeCapabilities(Temp, appName, F):
                        Temp == "capability.switchLevel" or
                        Temp == "capability.illuminanceMeasurement" or
                        Temp == "capability.colorControl" or
+                       Temp == "capability.colorTemperature" or
                        #Motion related
                        Temp == "capability.motionSensor" or
                        Temp == "capability.accelerationSensor" or
@@ -289,7 +290,7 @@ def AnalyzeCapabilities(Temp, appName, F):
 def AnalyzePhysicalInteraction(app1Capab, app2Capab):
        #Light
        if ("capability.illuminanceMeasurement" in app1Capab) and ("capability.switch" in app2Capab or 
-                       "capability.switchLevel" in app2Capab or "capability.colorControl" in app2Capab):
+                       "capability.switchLevel" in app2Capab or "capability.colorControl" or "capability.colorTemperature" in app2Capab):
                print ("\nWARNING: Potential PHYSICAL CONFLICT (light) detected between App1 and App2!\n")
        #Motion
        # TODO: Technically this is not entirely precise since we need to be able to detect that the other app creates motion
index 1d8c810..f4fcf24 100644 (file)
@@ -22,6 +22,11 @@ def schedule(String time, String nameOfFunction) {
        }*/
        "$nameOfFunction"()
 }
+/////////////////////////////////////////////////////////////////////
+////schedule(Date, nameOfFunction as String)
+def schedule(Date date, String nameOfFunction) {
+       "$nameOfFunction"()
+}
 ////schedule(time, nameOfFunction as Closure)
 def schedule(String time, Closure nameOfFunction) {
        /*def _inputTime = time.split(':')
index b21dbf9..67db554 100644 (file)
@@ -2,6 +2,8 @@
 package MusicPlayer
 import Timer.SimulatedTimer
 
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
 
 public class MusicPlayer {
        private String id
@@ -208,6 +210,53 @@ public class MusicPlayer {
                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
                }
        }
+       def statesSince(String info, Date dateObj) {
+               statesSince()
+       }
+       def statesSince() {
+               eventsSince()
+       }
+       def eventsSince(Date dateObj) {
+               eventsSince()
+       }
+
+       def eventsSince() {
+               def evtActive = [[name: "status", value: "on", deviceId: "musicPlayerID0", descriptionText: "",
+                                 displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+               def evtInactive = [[name: "status", value: "off", deviceId: "musicPlayerID0", descriptionText: "",
+                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']]
+               def init = Verify.getInt(0,4)
+               def evtToSend = []
+               if (init == 0) {//return empty set
+                       return evtToSend
+               } else if (init == 1) {//send one active event
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 2) {//send two active events
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       evtActive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 3) {//send one inactive event
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               } else if (init == 4) {//send two inactive events
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       evtInactive.each{
+                               evtToSend.add(it)
+                       }
+                       return evtToSend
+               }
+       }
        def playText(LinkedHashMap metaData) {
                playText()
        }
index 5a8aed0..92f6c55 100644 (file)
@@ -172,6 +172,15 @@ public class MusicPlayers {
                        this.level = level
                }
        }
+       def playSoundAndTrack(String trackData, int duration, int trackNumber, int level) {
+               playTrackAndResume(trackData, duration)
+               if (level != this.level) {
+                       this.level = level
+               }
+               if (trackNumber!= this.trackNumber) {
+                       this.trackNumber = trackNumber
+               }
+       }
        def playTrackAtVolume(String trackData, int level) {
                playTrack(trackData)
                if (level != this.level) {
@@ -237,6 +246,9 @@ public class MusicPlayers {
                        musicPlayers[0].stop()
                }
        }
+       def statesSince(String info, Date dateObj, LinkedHashMap map) {
+               return musicPlayers[0].statesSince()
+       }
        def playText(LinkedHashMap metaData) {
                playText()
        }
index 56caae1..0668b80 100644 (file)
@@ -1,48 +1,51 @@
 beacon-control.groovy
-bon-voyage.groovy
-bose-soundtouch-control.groovy
-bright-when-dark-and-or-bright-after-sunset.groovy
-button-controller.groovy
-forgiving-security.groovy
-gentle-wake-up.groovy
-good-night.groovy
-good-night-house.groovy
-greetings-earthling.groovy
-hello-home-phrase-director.groovy
-hue-mood-lighting.groovy
-keep-me-cozy.groovy
-lighting-director.groovy
-make-it-so.groovy
-nobody-home.groovy
-notify-me-with-hue.groovy
-rise-and-shine.groovy
-routine-director.groovy
-scheduled-mode-change.groovy
-simple-sync-trigger.groovy
-single-button-controller.groovy
-smart-alarm.groovy
-smart-home-ventilation.groovy
-smart-security.groovy
-sonos-music-modes.groovy
-speaker-control.groovy
-speaker-mood-music.groovy
-speaker-notify-with-sound.groovy
-speaker-weather-forecast.groovy
-sunrise-sunset.groovy
-switch-activates-home-phrase-or-mode.groovy
-switch-changes-mode.groovy
-thermostat-mode-director.groovy
-vacation-lighting-director.groovy
-working-from-home.groovy
-button-controller-for-hlgs.groovy
-circadian-daylight.groovy
-ecobeeChangeMode.groovy
-ecobeeGenerateWeeklyStats.groovy
-ecobeeManageClimate.groovy
-ecobeeResumeProg.groovy
-MonitorAndSetEcobeeHumidity.groovy
-SmartPresence.groovy
-Switches.groovy
-WorkingFromHome.groovy
+#bon-voyage.groovy
+#bose-soundtouch-control.groovy
+#bright-when-dark-and-or-bright-after-sunset.groovy
+#forgiving-security.groovy
+#gentle-wake-up.groovy
+#good-night.groovy
+#good-night-house.groovy
+#greetings-earthling.groovy
+#hello-home-phrase-director.groovy
+#hue-mood-lighting.groovy
+#keep-me-cozy.groovy
+#lighting-director.groovy
+#make-it-so.groovy
+#nobody-home.groovy
+#notify-me-with-hue.groovy
+#rise-and-shine.groovy
+#routine-director.groovy
+#scheduled-mode-change.groovy
+#simple-sync-trigger.groovy
+#single-button-controller.groovy
+#smart-alarm.groovy
+#smart-home-ventilation.groovy
+#smart-security.groovy
+#sonos-music-modes.groovy
+#speaker-control.groovy
+#speaker-mood-music.groovy
+#speaker-notify-with-sound.groovy
+#speaker-weather-forecast.groovy
+#sunrise-sunset.groovy
+#switch-activates-home-phrase-or-mode.groovy
+#switch-changes-mode.groovy
+#thermostat-mode-director.groovy
+#vacation-lighting-director.groovy
+#working-from-home.groovy
+#circadian-daylight.groovy
+#SmartPresence.groovy
+#Switches.groovy
+#WorkingFromHome.groovy
 ### The following is a very buggy app
 ###talking-alarm-clock.groovy
+### The following apps are the same as single-button-controller
+### We only use one button so it does not matter
+###button-controller.groovy
+###button-controller-for-hlgs.groovy
+### The following are third party apps
+###ecobeeChangeMode.groovy
+###ecobeeGenerateWeeklyStats.groovy
+###ecobeeManageClimate.groovy
+###ecobeeResumeProg.groovy
+###MonitorAndSetEcobeeHumidity.groovy
\ No newline at end of file