Adding event for Power as variation is needed in power values.
authorrtrimana <rtrimana@uci.edu>
Wed, 7 Aug 2019 01:43:40 +0000 (18:43 -0700)
committerrtrimana <rtrimana@uci.edu>
Wed, 7 Aug 2019 01:43:40 +0000 (18:43 -0700)
Extractor/ExtractorScript.py
SpeechSynthesis/SpeechSynthesis.groovy
SpeechSynthesis/SpeechSynthesises.groovy
eventSimulator/powerMeterHighPowerEvent.groovy [new file with mode: 0644]
eventSimulator/powerMeterLowPowerEvent.groovy [new file with mode: 0644]

index 1172b4e..cf4b9de 100644 (file)
@@ -795,7 +795,15 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write(line)
                        event.close()
                elif eventList[i] == "power":
-                       event = open("eventSimulator/powerMeterEvent.groovy", "r")
+                       #Write two events subsequently
+                       event = open("eventSimulator/powerMeterHighPowerEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+                       extractedEvents.write("\n\t\t\tbreak\n")
+                       counter = counter + 1
+                       extractedEvents.write("\t\tcase %d:\n" % counter)
+                       event = open("eventSimulator/powerMeterLowPowerEvent.groovy", "r")
                        for line in event:
                                extractedEvents.write(line)
                        event.close()
index fb91378..1f25d79 100644 (file)
@@ -29,9 +29,9 @@ public class SpeechSynthesis {
                println("Speech synthesis with id:$id, SPEAKING:\"$message\"!")
                // As a conflict variable
                if (oneUser) {
-                       oneUser = false
+                       this.oneUser = false
                } else {
-                       oneUser = true
+                       this.oneUser = true
                }
        }
 }
index 69601c4..876e48d 100644 (file)
@@ -61,9 +61,9 @@ public class SpeechSynthesises {
                speechSynthesises[0].speak(message)
                // As a conflict variable
                if (oneUser) {
-                       oneUser = false
+                       this.oneUser = false
                } else {
-                       oneUser = true
+                       this.oneUser = true
                }
        }
 
diff --git a/eventSimulator/powerMeterHighPowerEvent.groovy b/eventSimulator/powerMeterHighPowerEvent.groovy
new file mode 100644 (file)
index 0000000..2fdf6dd
--- /dev/null
@@ -0,0 +1,2 @@
+                       powerMeterObject.setValue([name: "power", value: "70"/*A number between 0 to 100 as a charge*/, deviceId: "powerMeterID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
diff --git a/eventSimulator/powerMeterLowPowerEvent.groovy b/eventSimulator/powerMeterLowPowerEvent.groovy
new file mode 100644 (file)
index 0000000..58f7c58
--- /dev/null
@@ -0,0 +1,2 @@
+                       powerMeterObject.setValue([name: "power", value: "30"/*A number between 0 to 100 as a charge*/, deviceId: "powerMeterID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])