'switch.off' : 1,
'location' : 3,
'mode' : 3,
+ 'sunset' : 1,
+ 'sunsetTime' : 1,
+ 'sunrise' : 1,
+ 'sunriseTime' : 1,
'acceleration' : 2,
'acceleration.active' : 1,
'acceleration.inactive' : 1,
variable = Temp
while (Temp != "\"" and Temp != "app" and Temp != "location"):
Temp = GetToken(F)
+ if Temp == "location":
+ # See if we have another case for location
+ Temp = GetToken(F) # Get ','
+ Temp = GetToken(F) # Get '"'
+ if Temp == "\"":
+ Temp = GetToken(F)
+ else:
+ # This is the special case where we will see, e.g., sunset, sunrise, etc.
+ Temp = "location"
if Temp == "\"":
- Temp = GetToken(F)
+ Temp = GetToken(F)
#print "DEBUG: %s - %s" % (variable, Temp)
#print capabilityMap
- if Temp == "app" or Temp == "location":
+ #print "DEBUG: location variable: %s" % Temp
+ if Temp == "app" or Temp == "location" or Temp == "mode" or Temp == "sunset" or Temp == "sunrise" or Temp == "sunsetTime" or Temp == "sunriseTime":
if Temp not in eventList:
eventList.append(Temp)
if (appName == "App1"):
def CountEvents():
global eventList
numOfActualEvents = 0
+ #print "DEBUG: eventlist: %d" % len(eventList)
for event in eventList:
+ #print "DEBUG: Event: %s %d" % (event, eventTypeCounterMap[event])
numOfActualEvents = numOfActualEvents + eventTypeCounterMap[event]
return numOfActualEvents
#print "DEBUG: App2: %d" % indexApp2
#print "DEBUG: eventList: %d" % len(eventList)
isApp1 = True
- while counter < len(eventList):
+ while counter < numOfActualEvents:
# Interleave events from App1 and App2
if isApp1 is True:
i = indexApp1
for line in event:
extractedEvents.write(line)
event.close()
+ elif eventList[i] == "sunrise":
+ event = open("eventSimulator/locationSunriseEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ elif eventList[i] == "sunset":
+ event = open("eventSimulator/locationSunsetEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ elif eventList[i] == "sunsetTime":
+ event = open("eventSimulator/locationSunsetTimeEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
+ elif eventList[i] == "sunriseTime":
+ event = open("eventSimulator/locationSunriseTimeEvent.groovy", "r")
+ for line in event:
+ extractedEvents.write(line)
+ event.close()
elif eventList[i] == "acceleration":
#Write two events subsequently
event = open("eventSimulator/accelerationActiveEvent.groovy", "r")