Temp = GetToken(F)
#If counter >= 5 that means it is not found, so it must be appTouch
if (counter >= 5):
- Temp = "appTouch"
+ Temp = "Touched"
eventMap.append(Temp)
Temp = GetToken(F)
extractedEvents.write("while(counter > 0) {\n")
extractedEvents.write("\tdef eventNumber = random.nextInt(%d)\n" % (len(eventMap) - 1))
extractedEvents.write("\tswitch(eventNumber) {\n")
+ eventCounter = 0;
for i in range(len(eventMap)):
- extractedEvents.write("\t\tcase %d:\n" % i)
+ extractedEvents.write("\t\tcase %d:\n" % eventCounter)
if eventMap[i] == "lock":
- event = open("eventSimulator/eventLocked.groovy", "r")
+ event = open("eventSimulator/lockEvent.groovy", "r")
for line in event:
extractedEvents.write(line)
event.close()
elif eventMap[i] == "unlock":
- event = open("eventSimulator/eventUnlocked.groovy", "r")
+ event = open("eventSimulator/unlockEvent.groovy", "r")
for line in event:
extractedEvents.write(line)
event.close()
elif eventMap[i] == "contact.open":
- event = open("eventSimulator/eventContactOpen.groovy", "r")
+ event = open("eventSimulator/contactOpenEvent.groovy", "r")
for line in event:
extractedEvents.write(line)
event.close()
elif eventMap[i] == "contact.closed":
- event = open("eventSimulator/eventContactClosed.groovy", "r")
+ event = open("eventSimulator/contactClosedEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ elif eventMap[i] == "switch.on":
+ event = open("eventSimulator/switchOnEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ elif eventMap[i] == "switch.off":
+ event = open("eventSimulator/switchOffEvent.groovy", "r")
for line in event:
extractedEvents.write(line)
event.close()
elif eventMap[i] == "nfcTouch":
- event = open("eventSimulator/eventNfcTouch.groovy", "r")
+ event = open("eventSimulator/nfcTouchEvent.groovy", "r")
for line in event:
extractedEvents.write(line)
event.close()
- elif eventMap[i] == "appTouch":
- event = open("eventSimulator/eventAppTouch.groovy", "r")
+ elif eventMap[i] == "Touched":
+ event = open("eventSimulator/appTouchEvent.groovy", "r")
for line in event:
extractedEvents.write(line)
event.close()
+ elif eventMap[i] == "button":
+ #Write two events subsequently
+ event = open("eventSimulator/buttonPushedEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ extractedEvents.write("\t\t\tbreak\n")
+ eventCounter = eventCounter + 1
+ extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+ event = open("eventSimulator/buttonHeldEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ elif eventMap[i] == "presence":
+ #Write two events subsequently
+ event = open("eventSimulator/presencePresentEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ extractedEvents.write("\t\t\tbreak\n")
+ eventCounter = eventCounter + 1
+ extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+ event = open("eventSimulator/presenceLeftEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ elif eventMap[i] == "doorState":
+ #Write two events subsequently
+ event = open("eventSimulator/doorOpenEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ extractedEvents.write("\t\t\tbreak\n")
+ eventCounter = eventCounter + 1
+ extractedEvents.write("\t\tcase %d:\n" % eventCounter)
+ event = open("eventSimulator/doorClosedEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ eventCounter = eventCounter + 1
+
###TODO: Add more events later
extractedEvents.write("\n\t\t\tbreak\n")
extractedEvents.write("\t}\n")
--- /dev/null
+ appObject.setValue([name: "Touched", value: "Touched", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
--- /dev/null
+ aeonKeyFobObject.setValue([name: "button", value: "pushed", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "pushed"]])
--- /dev/null
+ contactObject.setValue([name: "contact.closed", value: "closed", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "closed"]])
--- /dev/null
+ contactObject.setValue([name: "contact.open", value: "closed", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "open"]])
--- /dev/null
+ doorControlObject.setValue([name: "doorState", value: "closed", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "closed"]])
--- /dev/null
+ doorControlObject.setValue([name: "doorState", value: "open", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "open"]])
+++ /dev/null
- appObject.setValue([name: "Touched", value: "Touched", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
\ No newline at end of file
+++ /dev/null
- contactObject.setValue([name: "contact0", value: "closed", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
\ No newline at end of file
+++ /dev/null
- contactObject.setValue([name: "contact0", value: "open", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
\ No newline at end of file
+++ /dev/null
- lockObject.setValue([name: "lock0", value: "locked", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
\ No newline at end of file
+++ /dev/null
- appObject.setValue([name: "NfcTouch", value: "NfcTouch", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
\ No newline at end of file
+++ /dev/null
-def events = [1,2,3,4,5,6,7]
-def list = events.permutations()
-int count = Verify.getInt(0,list.size()-1)
-println "COUNT: " + count
-
-list[count].each {
- switch(it) {
- case 1:
- appObject.setValue([name: "Touched", value: "Touched", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
- println "1"
- break
- case 2:
- lockObject.setValue([name: "lock0", value: "locked", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
- println " 2"
- break
- case 3:
- lockObject.setValue([name: "lock0", value: "unlocked", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
- println " 3"
- break
- case 4:
- contactObject.setValue([name: "contact0", value: "open", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
- println " 4"
- break
- case 5:
- contactObject.setValue([name: "contact0", value: "closed", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
- println " 5"
- break
- case 6:
- switchObject.setValue([name: "switch0", value: "on", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
- println " 6"
- break
- case 7:
- switchObject.setValue([name: "switch0", value: "off", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
- println " 7"
- default:
- break
- }
-}
--- /dev/null
+ switchObject.setValue([name: "switch.off", value: "off", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "off"]])
--- /dev/null
+ switchObject.setValue([name: "switch.on", value: "on", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "on"]])
+++ /dev/null
- lockObject.setValue([name: "lock0", value: "unlocked", deviceId: 0, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
\ No newline at end of file
--- /dev/null
+ lockObject.setValue([name: "lock", value: "locked", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "locked"]])
--- /dev/null
+ appObject.setValue([name: "nfcTouch", value: "Touched", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "Touched"]])
--- /dev/null
+ presenceSensorObject.setValue([name: "presence", value: "not present", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "not present"]])
--- /dev/null
+ presenceSensorObject.setValue([name: "presence", value: "present", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "present"]])
--- /dev/null
+ lockObject.setValue([name: "unlock", value: "unlocked ", deviceId: 0, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "locked"]])