readyToReturn = 0
ToReturn = ""
eventList = []
+eventAppList = [] # This list maps App1 or App2 to a specific event
eventVarMap = {}
eventVarCounterMap = {}
capabilityMap = {}
def ExtractFunctions(F, appName):
global eventList
+ global eventAppList
global app1Subscribe
global app2Subscribe
Temp = GetToken(F)
if Temp == "app" or Temp == "location":
if Temp not in eventList:
eventList.append(Temp)
+ if (appName == "App1"):
+ eventAppList.append("App1")
+ else:
+ eventAppList.append("App2")
elif Temp not in eventList or (variable in capabilityMap.keys() and capabilityMap[variable] not in capabilityList):
# We do not repeat the same capability twice
capability = capabilityMap[variable]
capabilityList.append(capability)
eventList.append(Temp)
+ if (appName == "App1"):
+ eventAppList.append("App1")
+ else:
+ eventAppList.append("App2")
if Temp in eventVarMap.keys():
listOfEvents = eventVarMap[Temp]
listOfEvents.append(variable)
def ExtractEvents(extractedEvents):
global eventList
+ global eventAppList
global eventVarMap
global capabilityMap
global eventVarCounterMap
extractedEvents.write("\tdef eventNumber = Verify.getInt(0,%d)\n" % (numOfActualEvents - 1))
extractedEvents.write("\tswitch(eventNumber) {\n")
counter = 0
- for i in range(len(eventList)):
+ indexApp1 = 0
+ indexApp2 = eventAppList.index("App2")
+ indexApp2Start = indexApp2
+ #print "DEBUG: App1: %d" % indexApp1
+ #print "DEBUG: App2: %d" % indexApp2
+ #print "DEBUG: eventList: %d" % len(eventList)
+ isApp1 = True
+ while counter < len(eventList):
+ # Interleave events from App1 and App2
+ if isApp1 is True:
+ i = indexApp1
+ indexApp1 = indexApp1 + 1
+ if indexApp2 < len(eventList):
+ isApp1 = False
+ else:
+ i = indexApp2
+ indexApp2 = indexApp2 + 1
+ if indexApp1 < indexApp2Start:
+ isApp1 = True
+ print "DEBUG: i: %d" % i
extractedEvents.write("\t\tcase %d:\n" % counter)
if eventList[i] == "lock":
#Write two events subsequently
+++ /dev/null
-while(true) {
- def eventNumber = Verify.getInt(0,9)
- switch(eventNumber) {
- case 0:
- def event = Verify.getInt(0,2)
- if (event == 0) {
- locationObject.setValue([name: "Location", value: "home", deviceId: "locationID0", descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- } else if (event == 1) {
- locationObject.setValue([name: "Location", value: "away", deviceId: "locationID0", descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- } else {
- locationObject.setValue([name: "Location", value: "night", deviceId: "locationID0", descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- }
- break
- case 1:
- contactObject.setValue([name: "contact.open", value: "open", deviceId: "contactSensorID0", descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- break
- case 2:
- break
- case 3:
- break
- case 4:
- break
- case 5:
- break
- case 6:
- break
- case 7:
- break
- case 8:
- break
- case 9:
- def event = Verify.getInt(0,1)
- if (event == 0) {
- aeonKeyFobObject.setValue([name: "button", value: "pushed", deviceId: "aeonKeyFobID0", descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- } else {
- aeonKeyFobObject.setValue([name: "button", value: "held", deviceId: "aeonKeyFobID0", descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
- }
- break
- }
-}
#!/bin/bash
# Device conflict
-python ModelCheck.py ../jpf-core/ ../logs/alarms/ ../smartapps/ appLists/device-interaction/alarmsAppList appLists/device-interaction/alarmsAppList2
+python ModelCheck.py ../jpf-core/ ../logs/thermostats/ ../smartapps/ appLists/device-interaction/thermostatsAppList appLists/device-interaction/thermostatsAppList2
+#python ModelCheck.py ../jpf-core/ ../logs/alarms/ ../smartapps/ appLists/device-interaction/alarmsAppList appLists/device-interaction/alarmsAppList2
#python ModelCheck.py ../jpf-core/ ../logs/locks/ ../smartapps/ appLists/device-interaction/locksAppList appLists/device-interaction/locksAppList2
#python ModelCheck.py ../jpf-core/ ../logs/musicPlayers/ ../smartapps/ appLists/device-interaction/musicPlayersAppList
#python ModelCheck.py ../jpf-core/ ../logs/relaySwitch/ ../smartapps/ appLists/device-interaction/relaySwitchesAppList