Adding new events.
authorrtrimana <rtrimana@uci.edu>
Fri, 26 Jul 2019 18:20:03 +0000 (11:20 -0700)
committerrtrimana <rtrimana@uci.edu>
Fri, 26 Jul 2019 18:20:03 +0000 (11:20 -0700)
Extractor/ExtractorScript.py
eventSimulator/accelerationActiveEvent.groovy [new file with mode: 0644]
eventSimulator/accelerationInactiveEvent.groovy [new file with mode: 0644]
eventSimulator/beaconLeftEvent.groovy [new file with mode: 0644]
eventSimulator/beaconPresentEvent.groovy [new file with mode: 0644]
eventSimulator/carbonMonoxideClearEvent.groovy
eventSimulator/carbonMonoxideDetectedEvent.groovy
eventSimulator/carbonMonoxideTestedEvent.groovy
eventSimulator/colorChangedEvent.groovy [new file with mode: 0644]
eventSimulator/hueChangedEvent.groovy [new file with mode: 0644]
eventSimulator/saturationChangedEvent.groovy [new file with mode: 0644]

index d54f196..f986e16 100644 (file)
@@ -315,6 +315,49 @@ def ExtractEvents(extractedEvents):
                                extractedEvents.write("\t\t" + line)
                        event.close()
                        extractedEvents.write("\t\t\t}\n")
+               elif eventMap[i] == "acceleration":
+                       #Write two events subsequently
+                       extractedEvents.write("\t\t\tdef event = Verify.getInt(0,1)\n")
+                       extractedEvents.write("\t\t\tif (event == 0) {\n")
+                       event = open("eventSimulator/accelerationActiveEvent.groovy", "r")                      
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else {\n")
+                       event = open("eventSimulator/accelerationInactiveEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t}\n")
+               elif eventMap[i] == "beacon":
+                       #Write two events subsequently
+                       extractedEvents.write("\t\t\tdef event = Verify.getInt(0,1)\n")
+                       extractedEvents.write("\t\t\tif (event == 0) {\n")
+                       event = open("eventSimulator/beaconPresenceEvent.groovy", "r")                  
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t} else {\n")
+                       event = open("eventSimulator/beaconLeftEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write("\t\t" + line)
+                       event.close()
+                       extractedEvents.write("\t\t\t}\n")
+               elif eventMap[i] == "color":
+                       event = open("eventSimulator/colorChangeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventMap[i] == "hue":
+                       event = open("eventSimulator/hueChangeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
+               elif eventMap[i] == "saturation":
+                       event = open("eventSimulator/saturationChangeEvent.groovy", "r")
+                       for line in event:
+                               extractedEvents.write(line)
+                       event.close()
 
                ###TODO: Add more events later
                extractedEvents.write("\t\t\tbreak\n")
diff --git a/eventSimulator/accelerationActiveEvent.groovy b/eventSimulator/accelerationActiveEvent.groovy
new file mode 100644 (file)
index 0000000..b7fa4d9
--- /dev/null
@@ -0,0 +1,2 @@
+                       accelerationSensorObject.setValue([name: "acceleration", value: "active", deviceId: "accelerationSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
diff --git a/eventSimulator/accelerationInactiveEvent.groovy b/eventSimulator/accelerationInactiveEvent.groovy
new file mode 100644 (file)
index 0000000..60c9021
--- /dev/null
@@ -0,0 +1,2 @@
+                       accelerationSensorObject.setValue([name: "acceleration", value: "inactive", deviceId: "accelerationSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
diff --git a/eventSimulator/beaconLeftEvent.groovy b/eventSimulator/beaconLeftEvent.groovy
new file mode 100644 (file)
index 0000000..699c4e7
--- /dev/null
@@ -0,0 +1,2 @@
+                       beaconSensorObject.setValue([name: "beacon", value: "not present", deviceId: "beaconSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
diff --git a/eventSimulator/beaconPresentEvent.groovy b/eventSimulator/beaconPresentEvent.groovy
new file mode 100644 (file)
index 0000000..0c20e73
--- /dev/null
@@ -0,0 +1,2 @@
+                       beaconSensorObject.setValue([name: "beacon", value: "present", deviceId: "beaconeSensorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
index 721fb97..eca4d6c 100644 (file)
@@ -1,2 +1,2 @@
-                       smokeDetectorObject.setValue([name: "carbonMonoxide", value: "clear", deviceId: "smokeDetectorID0", descriptionText: "",
-                                               displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
+                       carbonMonoxideDetectorObject.setValue([name: "carbonMonoxide", value: "clear", deviceId: "carbonMonoxideDetectorID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
index 5aa27d1..98f57a6 100644 (file)
@@ -1,2 +1,2 @@
-                       smokeDetectorObject.setValue([name: "carbonMonoxide", value: "detected", deviceId: "smokeDetectorID0", descriptionText: "",
+                       carbonMonoxideDetectorObject.setValue([name: "carbonMonoxide", value: "tested", deviceId: "carbonMonoxideDetectorID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
index 0c6e18e..98f57a6 100644 (file)
@@ -1,2 +1,2 @@
-                       smokeDetectorObject.setValue([name: "carbonMonoxide", value: "tested", deviceId: "smokeDetectorID0", descriptionText: "",
+                       carbonMonoxideDetectorObject.setValue([name: "carbonMonoxide", value: "tested", deviceId: "carbonMonoxideDetectorID0", descriptionText: "",
                                        displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
diff --git a/eventSimulator/colorChangedEvent.groovy b/eventSimulator/colorChangedEvent.groovy
new file mode 100644 (file)
index 0000000..a90b2bc
--- /dev/null
@@ -0,0 +1,2 @@
+                       colorControlObject.setValue([name: "color", value: "red", deviceId: "colorControlID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
diff --git a/eventSimulator/hueChangedEvent.groovy b/eventSimulator/hueChangedEvent.groovy
new file mode 100644 (file)
index 0000000..1f9307b
--- /dev/null
@@ -0,0 +1,2 @@
+                       colorControlObject.setValue([name: "hue", value: "50", deviceId: "colorControlID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])
diff --git a/eventSimulator/saturationChangedEvent.groovy b/eventSimulator/saturationChangedEvent.groovy
new file mode 100644 (file)
index 0000000..09d013b
--- /dev/null
@@ -0,0 +1,2 @@
+                       colorControlObject.setValue([name: "saturation", value: "50", deviceId: "colorControlID0", descriptionText: "",
+                                       displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]])