//Create a class for image capture sensor
package ImageCapture
-import Timer.SimulatedTimer
+import SmartThing.SmartThings
-//JPF's Verify API
-import gov.nasa.jpf.vm.Verify
+public class ImageCaptures extends SmartThings {
+ List imageCaptureSensors = new ArrayList()
-public class ImageCaptures {
- private int deviceNumbers
- private List imageCaptureSensors
- def sendEvent
+ ImageCaptures(Closure sendEvent, boolean init) {
+ // Only initialize one time since we only have one device for each capability
+ imageCaptureSensors = smartThings
- //For one device(We cannot have obj.id)-> We should have obj[0].id
- private String id = "imageCaptureID0"
- private String label = "imageCapture0"
- private String displayName = "imageCapture0"
- private String image = "imageData"
- private String alarmState = "armed"
+ // Initialization
+ String id = "imageCaptureID0"
+ String label = "imageCapture"
+ String displayName = "imageCapturer"
+ String image = "image0"
-
- ImageCaptures(Closure sendEvent, int deviceNumbers) {
- this.sendEvent = sendEvent
- this.deviceNumbers = deviceNumbers
- this.imageCaptureSensors = []
-
- def initAlarm = Verify.getBoolean()
- if (initAlarm) {
- this.alarmState = "armed"
- } else {
- this.alarmState = "not armed"
- }
- imageCaptureSensors.add(new ImageCapture(id, label, displayName, this.image, this.alarmState))
- }
-
-
- //Methods for closures
- def count(Closure Input) {
- imageCaptureSensors.count(Input)
- }
- def size() {
- imageCaptureSensors.size()
- }
- def each(Closure Input) {
- imageCaptureSensors.each(Input)
- }
- def find(Closure Input) {
- imageCaptureSensors.find(Input)
- }
- def collect(Closure Input) {
- imageCaptureSensors.collect(Input)
- }
-
- def alarmOn() {
- if (alarmState != "armed") {
- imageCaptureSensors[0].alarmOn()
- this.alarmState = "armed"
- }
- }
-
- def alarmOff() {
- if (alarmState != "not armed") {
- imageCaptureSensors[0].alarmOff()
- this.alarmState = "not armed"
- }
+ imageCaptureSensors.add(new ImageCapture(sendEvent, id, label, displayName, image))
}
def take() {
imageCaptureSensors[0].take()
}
- def getAt(int ix) {
- imageCaptureSensors[ix]
+
+ def take(LinkedHashMap metaData) {
+ take()
}
}