Adding more features for physical interaction detection and warning.
authorrtrimana <rtrimana@uci.edu>
Sat, 27 Jul 2019 18:10:22 +0000 (11:10 -0700)
committerrtrimana <rtrimana@uci.edu>
Sat, 27 Jul 2019 18:10:22 +0000 (11:10 -0700)
Extractor/ExtractorScript.py
ModelCheck.py

index 375a688..974afc4 100644 (file)
@@ -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
index 6defff6..601323e 100644 (file)
@@ -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"