org.lsst.ccs.drivers.rcm
Class ImageClient

java.lang.Object
  extended by org.lsst.ccs.drivers.rcm.ImageClient

public class ImageClient
extends Object

Java interface to the image client routines

Author:
Owen Saxton

Nested Class Summary
static interface ImageClient.Listener
          Defines the data listener
 class ImageClient.ReadThread
          Thread that obtains the image data for the listener
 
Constructor Summary
ImageClient()
           
 
Method Summary
 Image awaitImage(Image image)
          Awaits an image.
 void clearListener()
          Clears the data listener.
 void close()
          Closes a connection.
static void deleteImageMetadataRef(Image image)
          Deletes an image's metadata reference.
protected  void finalize()
          Finalizer
 boolean getImage(Image image)
          Reads an image.
 void open(int id)
          Opens a connection.
 boolean readImage(Image image)
          Reads an image.
 void setListener(ImageClient.Listener listener, Image image)
          Sets the data listener.
 Image waitForImage(Image image)
          Awaits an image.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageClient

public ImageClient()
Method Detail

finalize

protected void finalize()
                 throws Throwable
Finalizer

Overrides:
finalize in class Object
Throws:
Throwable

open

public void open(int id)
          throws RcmException
Opens a connection.

Parameters:
id - The ID of the RCM to connect to
Throws:
RcmException

close

public void close()
           throws RcmException
Closes a connection.

Throws:
RcmException

awaitImage

public Image awaitImage(Image image)
                 throws RcmException
Awaits an image. Waits until a new image has been generated.

Parameters:
image - An Image object in which to save the reference and metadata for the new image, or null if a new image object is to be created.
Returns:
The Image object containing the new image reference and metadata.
Throws:
RcmException

readImage

public boolean readImage(Image image)
                  throws RcmException
Reads an image. Gets the pixel data for an image.

Parameters:
image - The Image object containing the valid metadata for an image. If the contained pixel data byte array is not null and is large enough, the pixel data us stored there. Otherwise a new array is created.
Returns:
True if the pixel data was successfully read, false otherwise.
Throws:
RcmException

deleteImageMetadataRef

public static void deleteImageMetadataRef(Image image)
Deletes an image's metadata reference. Deletes referenced C++ object.

Parameters:
image - The image whose metadata reference is to be deleted.

setListener

public void setListener(ImageClient.Listener listener,
                        Image image)
Sets the data listener. Sets the data listener object, whose class must implement the Listener interface, and therefore must contain the processImage method. This method is called with a complete Image object as its argument whenever a new image becomes available.

Parameters:
listener - The listener object to be set as the listener. Any existing listener is replaced.
image - An image object to be used to contain received images, or null if a new object is to be created each time.

clearListener

public void clearListener()
Clears the data listener. Clears the data listener object if it exists.


waitForImage

public Image waitForImage(Image image)
Awaits an image. Waits until a new image has been generated.

Parameters:
image - An Image object in which to save the reference and metadata for the new image, or null if a new image object is to be created.
Returns:
The Image object containing the new image reference and metadata.

getImage

public boolean getImage(Image image)
Reads an image. Gets the pixel data for an image.

Parameters:
image - The Image object containing the valid metadata for an image. If the contained pixel data byte array is not null and is large enough, the pixel data us stored there. Otherwise a new array is created.
Returns:
True if the pixel data was successfully read, false otherwise.


Copyright © 2013 LSST. All Rights Reserved.