From c16421586f6281bce41fb42a22befbbb7d099745 Mon Sep 17 00:00:00 2001 From: rtrimana Date: Sat, 27 Jul 2019 11:10:22 -0700 Subject: [PATCH] Adding more features for physical interaction detection and warning. --- Extractor/ExtractorScript.py | 13 +++++++++++-- ModelCheck.py | 6 ++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Extractor/ExtractorScript.py b/Extractor/ExtractorScript.py index 375a688..974afc4 100644 --- a/Extractor/ExtractorScript.py +++ b/Extractor/ExtractorScript.py @@ -86,7 +86,7 @@ def ExtractFunctions(F, appName): eventVarMap[Temp] = variable #Check and analyze capabilities for physical interaction - AnalyzeCapabilities(Temp, appName) + AnalyzeCapabilities(Temp, appName, F) Temp = GetToken(F) @@ -96,7 +96,7 @@ def ExtractFunctions(F, appName): -def AnalyzeCapabilities(Temp, appName): +def AnalyzeCapabilities(Temp, appName, F): #Illuminance related if (Temp == "capability.switch" or Temp == "capability.switchLevel" or @@ -115,6 +115,15 @@ def AnalyzeCapabilities(Temp, appName): app1Capabilities.append(Temp) else: app2Capabilities.append(Temp) + if (Temp == "capability"): + Temp = GetToken(F) #Get '"' + Temp = GetToken(F) #Get 'Music' + Temp = Temp + GetToken(F) #Get 'Player' + if (Temp == "MusicPlayer"): + if (appName == "App1"): + app1Capabilities.append("capability.musicPlayer") + else: + app2Capabilities.append("capability.musicPlayer") def AnalyzePhysicalInteraction(app1Capab, app2Capab): #Light diff --git a/ModelCheck.py b/ModelCheck.py index 6defff6..601323e 100644 --- a/ModelCheck.py +++ b/ModelCheck.py @@ -61,14 +61,16 @@ print "PHASE 2: Running JPF ...\n" writeLogList = open(jpfLogDir + "logList", "w+") for item in appPairs: - # Copy apps into Extractor/App1 and Extractor/App2 + # Copy apps into Extractor/App1 and Extractor/App2 + print "==> First app: %s" % item[0] + print "==> Second app: %s" % item[1] os.system("cp " + appDir + item[0] + " Extractor/App1/App1.groovy") os.system("cp " + appDir + item[1] + " Extractor/App2/App2.groovy") # Run Runner.py to extract things and create main.groovy, then compile it print "==> Compiling the apps ...\n" os.system("make Runner") - os.system("make main") + #os.system("make main") # Call JPF print "==> Calling JPF and generate logs ...\n" -- 2.34.1