From: rtrimana Date: Thu, 1 Aug 2019 16:17:02 +0000 (-0700) Subject: Adding presence.present event. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=smartthings-infrastructure.git;a=commitdiff_plain;h=9dc6484751df10ca60697bdfd7889b9eee532637 Adding presence.present event. --- diff --git a/Extractor/ExtractorScript.py b/Extractor/ExtractorScript.py index c96daa7..c37c2b8 100644 --- a/Extractor/ExtractorScript.py +++ b/Extractor/ExtractorScript.py @@ -87,16 +87,11 @@ def ExtractFunctions(F, appName): while (Temp != "\"" and Temp != "app" and Temp != "location"): Temp = GetToken(F) if Temp == "\"": - Temp = GetToken(F) - #print "DEBUG: %s" % variable - #print capabilityMap - #print eventList - #if variable == "app" or variable == "location": - + Temp = GetToken(F) if Temp == "app" or Temp == "location": if Temp not in eventList: eventList.append(Temp) - elif variable in capabilityMap.keys() and capabilityMap[variable] not in capabilityList: + 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) @@ -106,7 +101,10 @@ def ExtractFunctions(F, appName): listOfEvents.append(variable) else: eventVarMap[Temp] = [variable] - + #print "DEBUG: %s - %s" % (variable, Temp) + #print capabilityMap + #print eventList + #Check and analyze capabilities for physical interaction AnalyzeCapabilities(Temp, appName, F) @@ -116,7 +114,6 @@ def ExtractFunctions(F, appName): AnalyzePhysicalInteraction(app1Capabilities, app2Capabilities) AnalyzePhysicalInteraction(app2Capabilities, app1Capabilities) - def AnalyzeCapabilities(Temp, appName, F): #Illuminance related if (Temp == "capability.switch" or @@ -274,13 +271,11 @@ def ExtractEvents(extractedEvents): for line in event: extractedEvents.write("\t\t" + line) event.close() - if capability == "capability.presenceSensor": - extractedEvents.write("\t\t\t} else {\n") - event = open("eventSimulator/presencePresencePresentEvent.groovy", "r") - for line in event: - extractedEvents.write("\t\t" + line) - event.close() - extractedEvents.write("\t\t\t}\n") + elif eventList[i] == "presence.present": #Case for Touched event + event = open("eventSimulator/presencePresencePresentEvent.groovy", "r") + for line in event: + extractedEvents.write("\t\t" + line) + event.close() elif eventList[i] == "doorState": #Write two events subsequently extractedEvents.write("\t\t\tdef event = Verify.getInt(0,1)\n") diff --git a/eventSimulator/lockLockedEvent.groovy b/eventSimulator/lockLockedEvent.groovy index 5cf9e4c..e208c90 100644 --- a/eventSimulator/lockLockedEvent.groovy +++ b/eventSimulator/lockLockedEvent.groovy @@ -1,2 +1,2 @@ lockObject.setValue([name: "lock", value: "locked", deviceId: "lockID0", descriptionText: "", - displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) \ No newline at end of file + displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])