1 //Create a class for image capture sensor
3 import Timer.SimulatedTimer
6 import gov.nasa.jpf.vm.Verify
8 public class ImageCaptures {
9 private int deviceNumbers
10 private List imageCaptureSensors
13 //For one device(We cannot have obj.id)-> We should have obj[0].id
14 private String id = "imageCaptureID0"
15 private String label = "imageCapture0"
16 private String displayName = "imageCapture0"
17 private String image = "imageData"
18 private String alarmState = "armed"
21 ImageCaptures(Closure sendEvent, int deviceNumbers) {
22 this.sendEvent = sendEvent
23 this.deviceNumbers = deviceNumbers
24 this.imageCaptureSensors = []
26 /*def initAlarm = Verify.getBoolean()
28 this.alarmState = "armed"
30 this.alarmState = "not armed"
32 imageCaptureSensors.add(new ImageCapture(id, label, displayName, this.image, this.alarmState))
36 //Methods for closures
37 def count(Closure Input) {
38 imageCaptureSensors.count(Input)
41 imageCaptureSensors.size()
43 def each(Closure Input) {
44 imageCaptureSensors.each(Input)
46 def find(Closure Input) {
47 imageCaptureSensors.find(Input)
49 def sort(Closure Input) {
50 imageCaptureSensors.sort(Input)
52 def collect(Closure Input) {
53 imageCaptureSensors.collect(Input)
57 if (alarmState != "armed") {
58 this.alarmState = "armed"
59 imageCaptureSensors[0].alarmOn()
64 if (alarmState != "not armed") {
65 this.alarmState = "not armed"
66 imageCaptureSensors[0].alarmOff()
71 imageCaptureSensors[0].take()
74 imageCaptureSensors[ix]