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 4878c48b9f82c55e43a105068269d29e1b6f02dc..c3d652d1e8aa85090c56c75dcb2d564b368b26b6 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 0ff9cfdf1ae825fca522d4d303fb96319a262fe4..90223c54bdd233baf3feb1690ed53477676ef9e9 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 58721250259feda3219a7bb5d20cea79868c0193..2e82fb3fef08229a42658a87191b89b684975b99 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 2c965908705c6ce01e97c1a12739009886ffa5c4..f972b70f78763701106c05be19fd7f7ffd28b5ac 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 1d8c810b7e70c195e8c1372a5ce4c338c00781b0..f4fcf24cc318f2eeebd4d666a5612bb836666948 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 b21dbf9035f0520ae503ae0df79594de790a2c19..67db55410bec374162b2406d86d98484ab5f63ed 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 5a8aed073d13e4cd3fac2b96b5c88f395f70caca..92f6c550a9db80f957165d58bc7b713a946d99de 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 56caae1e6983ed43b1cb273bcef90f69f73c0a6f..0668b80493a8cc9bfeb836918ea8887cef4c1f72 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