First benchmark working with capability-based RMI; adjustments in callbacks, etc.
[iot2.git] / benchmarks / SmartLightsController / MotionDetection.java
index b683327b13b746aa63cc713c56b8205e499d8aff..d9c608e87c2b2fb1a3eaf026b09772f0a70f7c7c 100644 (file)
@@ -116,7 +116,7 @@ class MotionDetection implements CameraCallback {
        // counts the number of frames since a background image is added to algorithm
        private int frameCounter = 0;
 
-
+       private CameraSmart _camera;
 
        /*******************************************************************************************************************************************
        **
@@ -257,12 +257,13 @@ class MotionDetection implements CameraCallback {
         *
         *   @return [void] None.
         */
-       public void newCameraFrameAvailable(CameraSmart _camera) {
+       public void newCameraFrameAvailable(byte[] latestFrame, long timeStamp) {
                BufferedImage img = null;
 
                try {
                        // Parse the byte array into a Buffered Image
-                       InputStream in = new ByteArrayInputStream(_camera.getLatestFrame());
+                       //InputStream in = new ByteArrayInputStream(_camera.getLatestFrame());
+                       InputStream in = new ByteArrayInputStream(latestFrame);
                        img = ImageIO.read(in);
 
                } catch (RemoteException e) {
@@ -279,8 +280,8 @@ class MotionDetection implements CameraCallback {
                imageWriteLock.lock();  // lock the image and timestamp buffers since multithread
                latestImage = img;              // image into image buffer
 
-               // timestamp from camera into timestamo buffer
-               long dateLong = _camera.getTimestamp();
+               // timestamp from camera into timestamp buffer
+               long dateLong = timeStamp;
                possibleDate = new Date(dateLong);
 
                imageWriteLock.unlock();        // Never forget to unlock