1 //Create a class for image capture sensor
3 import Timer.SimulatedTimer
5 public class ImageCaptures {
6 private int deviceNumbers
7 private List imageCaptureSensors
10 //For one device(We cannot have obj.id)-> We should have obj[0].id
11 private String id = "motionSensorID0"
12 private String label = "motionSensor0"
13 private String displayName = "motionSensor0"
14 private String image = "imageData"
15 private String alarmState = "armed"
18 ImageCaptures(Closure sendEvent, int deviceNumbers) {
19 this.sendEvent = sendEvent
20 this.deviceNumbers = deviceNumbers
21 this.imageCaptureSensors = []
23 imageCaptureSensors.add(new ImageCapture(id, label, displayName, this.image, this.alarmState))
27 //Methods for closures
28 def count(Closure Input) {
29 imageCaptureSensors.count(Input)
32 imageCaptureSensors.size()
34 def each(Closure Input) {
35 imageCaptureSensors.each(Input)
37 def find(Closure Input) {
38 imageCaptureSensors.find(Input)
40 def collect(Closure Input) {
41 imageCaptureSensors.collect(Input)
45 imageCaptureSensors[0].alarmOn()
46 this.alarmState = "armed"
50 imageCaptureSensors[0].alarmOff()
51 this.alarmState = "not armed"
55 imageCaptureSensors[0].take()
58 imageCaptureSensors[ix]