'shock': 1,
'lqi': 1,
'rssi': 1,
+ 'schedule': 1,
'sound': 1,
'soundPressureLevel' : 1,
'tamper' : 1,
extractedFunctionsApp2.write("def %s = this.&" % NameofFunc)
extractedFunctionsApp2.write("%s\n" % NameofFunc)
+ #Check subscribed events
+ if (Temp == "initialize" or Temp == "installed"):
+ Temp = GetToken(F)
+ Temp = GetToken(F)
+ Temp = GetToken(F)
+ # If it is a schedule function, then extract the scheduled method and put it as one of the events
+ if (Temp == "schedule"):
+ eventList.append("schedule")
+ if (appName == "App1"):
+ eventAppList.append("App1")
+ else:
+ eventAppList.append("App2")
+ while Temp != ",":
+ Temp = GetToken(F)
+ Temp = GetToken(F)
+ # If this is a " then get the next one still---we are interested in the scheduled function name
+ if (Temp == "\""):
+ Temp = GetToken(F)
+ # Insert function name into the map
+ if "schedule" in eventVarMap.keys():
+ listOfEvents = eventVarMap["schedule"]
+ listOfEvents.append(Temp)
+ else:
+ eventVarMap["schedule"] = [Temp]
+
#Check input capability
if (Temp == "input"):
while Temp != "\"":
#print capabilityMap
#print "DEBUG: location variable: %s" % Temp
- #This is a bogus event, just skip it...
- if Temp == "unlock":
- continue
+ #This is a bogus event, just skip it...
+ if Temp == "unlock":
+ continue
#Translate and reduce through mapping
if Temp in eventTypesMap.keys():
Temp = eventTypesMap[Temp]
#print "DEBUG: App1: %d" % indexApp1
#print "DEBUG: App2: %d" % indexApp2
#print "DEBUG: eventList: %d" % len(eventList)
+ #print capabilityMap
+ #print eventVarMap
#print eventAppList
#print eventList
if indexApp2Start > 0:
isApp1 = True
#print "DEBUG: i: %d" % i
extractedEvents.write("\t\tcase %d:\n" % counter)
- if eventList[i] == "lock":
+ if eventList[i] == "schedule":
+ variable = eventVarMap[eventList[i]]
+ if eventList[i] not in eventVarCounterMap.keys():
+ eventVarCounterMap[eventList[i]] = 1
+ eventVarCount = 0
+ else:
+ eventVarCount = eventVarCounterMap[eventList[i]]
+ eventVarCounterMap[eventList[i]] = eventVarCount + 1
+ currentMethod = variable[eventVarCount]
+ extractedEvents.write("\t\t\t// Scheduled method in installed() or intialize()\n")
+ extractedEvents.write("\t\t\t%s.%s()" % (eventAppList[i].lower(), currentMethod))
+ elif eventList[i] == "lock":
#Write two events subsequently
event = open("eventSimulator/lockLockedEvent.groovy", "r")
for line in event: