From 1e88d96015a45b9638c48e8841bffc617a23fc2c Mon Sep 17 00:00:00 2001 From: rtrimana Date: Fri, 26 Jul 2019 11:20:03 -0700 Subject: [PATCH] Adding new events. --- Extractor/ExtractorScript.py | 43 +++++++++++++++++++ eventSimulator/accelerationActiveEvent.groovy | 2 + .../accelerationInactiveEvent.groovy | 2 + eventSimulator/beaconLeftEvent.groovy | 2 + eventSimulator/beaconPresentEvent.groovy | 2 + .../carbonMonoxideClearEvent.groovy | 4 +- .../carbonMonoxideDetectedEvent.groovy | 2 +- .../carbonMonoxideTestedEvent.groovy | 2 +- eventSimulator/colorChangedEvent.groovy | 2 + eventSimulator/hueChangedEvent.groovy | 2 + eventSimulator/saturationChangedEvent.groovy | 2 + 11 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 eventSimulator/accelerationActiveEvent.groovy create mode 100644 eventSimulator/accelerationInactiveEvent.groovy create mode 100644 eventSimulator/beaconLeftEvent.groovy create mode 100644 eventSimulator/beaconPresentEvent.groovy create mode 100644 eventSimulator/colorChangedEvent.groovy create mode 100644 eventSimulator/hueChangedEvent.groovy create mode 100644 eventSimulator/saturationChangedEvent.groovy diff --git a/Extractor/ExtractorScript.py b/Extractor/ExtractorScript.py index d54f196..f986e16 100644 --- a/Extractor/ExtractorScript.py +++ b/Extractor/ExtractorScript.py @@ -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 index 0000000..b7fa4d9 --- /dev/null +++ b/eventSimulator/accelerationActiveEvent.groovy @@ -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 index 0000000..60c9021 --- /dev/null +++ b/eventSimulator/accelerationInactiveEvent.groovy @@ -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 index 0000000..699c4e7 --- /dev/null +++ b/eventSimulator/beaconLeftEvent.groovy @@ -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 index 0000000..0c20e73 --- /dev/null +++ b/eventSimulator/beaconPresentEvent.groovy @@ -0,0 +1,2 @@ + beaconSensorObject.setValue([name: "beacon", value: "present", deviceId: "beaconeSensorID0", descriptionText: "", + displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]]) diff --git a/eventSimulator/carbonMonoxideClearEvent.groovy b/eventSimulator/carbonMonoxideClearEvent.groovy index 721fb97..eca4d6c 100644 --- a/eventSimulator/carbonMonoxideClearEvent.groovy +++ b/eventSimulator/carbonMonoxideClearEvent.groovy @@ -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"]]) diff --git a/eventSimulator/carbonMonoxideDetectedEvent.groovy b/eventSimulator/carbonMonoxideDetectedEvent.groovy index 5aa27d1..98f57a6 100644 --- a/eventSimulator/carbonMonoxideDetectedEvent.groovy +++ b/eventSimulator/carbonMonoxideDetectedEvent.groovy @@ -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"]]) diff --git a/eventSimulator/carbonMonoxideTestedEvent.groovy b/eventSimulator/carbonMonoxideTestedEvent.groovy index 0c6e18e..98f57a6 100644 --- a/eventSimulator/carbonMonoxideTestedEvent.groovy +++ b/eventSimulator/carbonMonoxideTestedEvent.groovy @@ -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 index 0000000..a90b2bc --- /dev/null +++ b/eventSimulator/colorChangedEvent.groovy @@ -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 index 0000000..1f9307b --- /dev/null +++ b/eventSimulator/hueChangedEvent.groovy @@ -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 index 0000000..09d013b --- /dev/null +++ b/eventSimulator/saturationChangedEvent.groovy @@ -0,0 +1,2 @@ + colorControlObject.setValue([name: "saturation", value: "50", deviceId: "colorControlID0", descriptionText: "", + displayed: true, linkText: "", isStateChange: false, unit: "", data: [info: "info"]]) -- 2.34.1