package com.ociweb.iot.maker;

import java.io.File;
import java.io.IOException;

/**
 * Time-based image listener backing for Raspberry Pi hardware.
 *
 * @author Brandon Sanders [brandon@alicorn.io]
 */
public class PiImageListenerBacking implements TimeListener {

    private final ImageListener handler;

    /**
     * Takes a picture from the currently connected Raspberry Pi camera and
     * saves it to a file.
     *
     * TODO: This method is primitive in that it relies on Pi command line tools
     *       and unknown delays in order to capture images. It would be preferable
     *       to leverage the native APIs in the Raspberry Pi, but those are
     *       extremely complex and undocumented...
     *
     * @param fileName Name of the file (without extensions) to save
     *                 the image to.
     *
     * @return A reference to the created image file.
     */
    public static File takePicture(String fileName) {
        try {
            Runtime.getRuntime().exec("raspistill --nopreview --timeout 1 --shutter 2500 --width 1280 --height 960 --quality 75 --output " + fileName + ".jpg");
        } catch (IOException e) {
            e.printStackTrace();
        }

        return new File(fileName + ".jpg");
    }

    public PiImageListenerBacking(ImageListener handler) {
        this.handler = handler;
    }

    @Override
    public void timeEvent(long time) {
        File f = takePicture("Pronghorn-Image-Capture-" + time);
        handler.onImage(f);
    }
}

@@ -24,16 +24,74 @@
 maker;%0A%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A
 import j
@@ -318,16 +318,113 @@
 ener %7B%0A%0A
+    private static final Logger logger = LoggerFactory.getLogger(PiImageListenerBacking.class);%0A%0A
     priv
@@ -1327,26 +1327,108 @@
     
-e.printStackTrace(
+logger.error(%22Unable to take picture from Raspberry Pi Camera due to error %5B%7B%7D%5D.%22, e.getMessage(), e
 );%0A 

Remove stack trace print