-Added a class to serve up results to atom. A matching client C++ class should follow shortly.
-Generally beautified code


git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4148 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/971CV/src/org/frc971/VisionTuner.java b/971CV/src/org/frc971/VisionTuner.java
index a6f08c2..4aba589 100644
--- a/971CV/src/org/frc971/VisionTuner.java
+++ b/971CV/src/org/frc971/VisionTuner.java
@@ -9,6 +9,7 @@
 import java.util.logging.Logger;

 

 import java.io.FileNotFoundException;

+import java.io.IOException;

 

 import javax.swing.JPanel;

 import javax.swing.JSlider;

@@ -54,6 +55,8 @@
     private final JSlider hueMaxSlider = new JSlider();

     private final JSlider satMinSlider = new JSlider();

     private final JSlider valMinSlider = new JSlider();

+    

+    private ResultSender sender;

 

     private int totalFrames = -1; // don't count the first (warmup) frame

     private double totalMsec;

@@ -77,6 +80,13 @@
         	System.err.println("Warning: Logging initialization failed.");

         }

         

+        //initialize result sender

+        try {

+        	sender = new ResultSender();

+        }

+        catch (IOException e) {

+        	LOG.severe("Server initialization failed: " + e.getMessage() + " Result reporting disabled.");

+        }

         cameraFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

 

         recognizer.showIntermediateStages(true);

@@ -155,6 +165,9 @@
             LOG.fine("The recognizer took " + milliseconds + " ms, " + 

             (1000 * totalFrames / totalMsec) + " fps, %.2f avg");

         }

+        

+        //send results to atom. (and any connected clients)

+        

     }

 

     private void previousImage() {

@@ -202,13 +215,18 @@
         		LOG.severe("Cannot find test images.");

         }

         else {

-        	HTTPClient client = new HTTPClient();

-        	for (;;) {

-        		ImageWithTimestamp to_process = client.GetFrame();

-        		if (to_process.image != null) {

-        			tuner.processImage(to_process.image);

-        			LOG.fine("Captured time: " + Double.toString(to_process.timestamp));

-        		}

+        	try {

+        		HTTPClient client = new HTTPClient();

+        		for (;;) {

+            		ImageWithTimestamp to_process = client.GetFrame();

+            		if (to_process.image != null) {

+            			tuner.processImage(to_process.image);

+            			LOG.fine("Captured time: " + Double.toString(to_process.timestamp));

+            		}

+            	}

+        	}

+        	catch (IOException e) {

+        		LOG.severe("Client initialization failed.");

         	}

         }

     }