+++ /dev/null
-//Global Object for functions in subscribe method!
-def installed = this.&installed
-//Global Object for functions in subscribe method!
-def updated = this.&updated
-//Global Object for functions in subscribe method!
-def initialize = this.&initialize
-//Global Object for functions in subscribe method!
-def lockDoor = this.&lockDoor
-//Global Object for functions in subscribe method!
-def unlockDoor = this.&unlockDoor
-//Global Object for functions in subscribe method!
-def doorHandler = this.&doorHandler
+++ /dev/null
-lock1 = obj.lockObject
-contact = obj.contactObject
-//Global variable for settings!
-settings = [app:app, lock1:lock1, contact:contact, minutesLater:minutesLater, secondsLater:secondsLater, recipients:recipients, phoneNumber:phoneNumber]
package IlluminanceMeasurement
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class IlluminanceMeasurements {
private int deviceNumbers
private List illuminanceMeasurements
this.deviceNumbers = deviceNumbers
this.illuminanceMeasurements = []
+ def init = Verify.getIntFromList(40000, 50000, 60000)
+ this.illuminance = init
+
illuminanceMeasurements.add(new IlluminanceMeasurement(id, label, displayName, this.illuminance))
}
# PART 1: Generate the permutations of app pairs
print "PHASE 1: Extracting the app pairs from the app lists ...\n"
+print "Got here!"
appList1 = []
appList2 = []
# Extract the first list
private int trackNumber
private String trackData
private String trackDescription
+ def sendEvent
- MusicPlayer(String id, String label, String displayName, int level, String mute, String status, int trackNumber, String trackData, String trackDescription) {
+ MusicPlayer(Closure sendEvent, String id, String label, String displayName, int level, String mute, String status, int trackNumber, String trackData, String trackDescription) {
+ this.sendEvent = sendEvent
this.id = id
this.label = label
this.displayName = displayName
if (initMute) {
this.mute = "unmuted"
} else {
- this.mute = "mute"
+ this.mute = "muted"
}
- def initStatus = Verify.getBoolean()
- if (initStatus) {
+ def initStatus = Verify.getInt(0,2)
+ if (initStatus == 0) {
this.status = "paused"
- } else {
+ } else if (initStatus == 1) {
this.status = "playing"
+ } else {
+ this.status = "stopped"
}
-
- musicPlayers.add(new MusicPlayer(id, label, displayName, this.level, this.mute, this.status, this.trackNumber, this.trackData, this.trackDescription))
+ def initTrack = Verify.getIntFromList(1, 2, 3)
+ this.trackNumber = initTrack
+ def initData = Verify.getBoolean()
+ if (initData) {
+ this.trackData = "someTrack"
+ } else {
+ this.trackData = "someOtherTrack"
+ }
+ def initDesc = Verify.getBoolean()
+ if (initDesc) {
+ this.trackDescription = "someDescriptions"
+ } else {
+ this.trackDescription = "someOtherDescriptions"
+ }
+ musicPlayers.add(new MusicPlayer(sendEvent, id, label, displayName, this.level, this.mute, this.status, this.trackNumber, this.trackData, this.trackDescription))
}
//By model checker
package PowerMeter
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class PowerMeters {
private int deviceNumbers
private List powerMeters
this.deviceNumbers = deviceNumbers
this.powerMeters = []
+ def init = Verify.getIntFromList(30, 50, 70)
+ this.power = init
+
powerMeters.add(new PowerMeter(id, label, displayName, this.power))
}
package RelativeHumidityMeasurement
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class RelativeHumidityMeasurements {
private int deviceNumbers
private List humidityMeasurements
this.deviceNumbers = deviceNumbers
this.humidityMeasurements = []
+ def init = Verify.getIntFromList(30, 50, 70)
+ this.humidity = init
+
humidityMeasurements.add(new RelativeHumidityMeasurement(id, label, displayName, this.humidity))
}
package RelaySwitch
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class RelaySwitches {
int deviceNumbers
List relaySwitches
this.deviceNumbers = deviceNumbers
this.relaySwitches = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.switchState = "off"
+ this.currentSwitch = "off"
+ this.switchLatestValue = "off"
+ } else {
+ this.switchState = "on"
+ this.currentSwitch = "on"
+ this.switchLatestValue = "on"
+ }
relaySwitches.add(new RelaySwitch(sendEvent, id, label, displayName, this.switchState, this.currentSwitch, this.switchLatestValue))
}
package SleepSensor
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class SleepSensors {
private int deviceNumbers
private List sleepSensors
this.deviceNumbers = deviceNumbers
this.sleepSensors = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.sleeping = "sleeping"
+ } else {
+ this.sleeping = "not sleeping"
+ }
sleepSensors.add(new SleepSensor(id, label, displayName, this.sleeping))
}
package StepSensor
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class StepSensors {
private int deviceNumbers
private List stepSensors
this.deviceNumbers = deviceNumbers
this.stepSensors = []
+ def initGoal = Verify.getIntFromList(1000, 2000, 3000)
+ this.goal = initGoal
+ def initSteps = Verify.getIntFromList(0, 1, 2)
+ this.steps = initSteps
+
stepSensors.add(new StepSensor(id, label, displayName, this.steps, this.goal))
}
package SwitchLevel
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class SwitchLevels {
int deviceNumbers
List switchLevels
this.deviceNumbers = deviceNumbers
this.switchLevels = []
+ def initLevel = Verify.getIntFromList(30, 50, 70)
+ this.level = initLevel
+ def init = Verify.getBoolean()
+ if (init) {
+ this.switchState = "off"
+ this.currentSwitch = "off"
+ this.switchLatestValue = "off"
+ } else {
+ this.switchState = "on"
+ this.currentSwitch = "on"
+ this.switchLatestValue = "on"
+ }
switchLevels.add(new SwitchLevel(sendEvent, id, label, displayName, this.level, this.switchState, this.switchLatestValue))
}
package TemperatureMeasurement
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class TemperatureMeasurements {
private int deviceNumbers
private List temperatureMeasurements
private String label = "temperatureMeasurement0"
private String displayName = "temperatureMeasurement0"
private int temperature = 50
-
-
-
TemperatureMeasurements(Closure sendEvent, int deviceNumbers) {
this.sendEvent = sendEvent
this.deviceNumbers = deviceNumbers
this.temperatureMeasurements = []
+
+ def initTemp = Verify.getIntFromList(30, 50, 70)
+ this.temperature = initTemp
temperatureMeasurements.add(new TemperatureMeasurement(id, label, displayName, this.temperature))
}
package Valve
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class Valves {
int deviceNumbers
List valves
this.deviceNumbers = deviceNumbers
this.valves = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.valve = "closed"
+ this.valveLatestValue = "closed"
+ } else {
+ this.valve = "open"
+ this.valveLatestValue = "open"
+ }
valves.add(new Valve(sendEvent, id, label, displayName, this.valve, this.valveLatestValue))
}
package WaterSensor
import Timer.SimulatedTimer
+//JPF's Verify API
+import gov.nasa.jpf.vm.Verify
+
public class WaterSensors {
private int deviceNumbers
private List waterSensors
this.deviceNumbers = deviceNumbers
this.waterSensors = []
+ def init = Verify.getBoolean()
+ if (init) {
+ this.water = "dry"
+ } else {
+ this.water = "wet"
+ }
waterSensors.add(new WaterSensor(id, label, displayName, this.water))
}
#!/bin/bash
# Device conflict
-python ModelCheck.py ../jpf-core/ ../logs/ ../smartapps/ appLists/device-interaction/locksAppList
+#python ModelCheck.py ../jpf-core/ ../logs/locks/ ../smartapps/ appLists/device-interaction/locksAppList
+python ModelCheck.py ../jpf-core/ ../logs/musicPlayers/ ../smartapps/ appLists/device-interaction/musicPlayersAppList
# Physical conflict
#python ModelCheck.py ../jpf-core/ ../logs/ ../smartapps/ appLists/physical-interaction/soundsensorAppList appLists/physical-interaction/soundAppList