safehome.device
Class DeviceCamera

java.lang.Object
  extended by java.lang.Thread
      extended by safehome.device.DeviceCamera
All Implemented Interfaces:
Runnable, interfaceCamera

public class DeviceCamera
extends Thread
implements interfaceCamera

DeviceCamera class is a virtual device driver for a camera device. This class creates a thread to update the elapsed time information.

Author:
cs550 TA

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
(package private)  int centerHeight
           
(package private)  int centerWidth
           
(package private)  Font font
           
(package private)  BufferedImage imgSource
           
(package private) static int RETURN_SIZE
           
(package private) static int SOURCE_SIZE
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DeviceCamera()
          Constructs a camera instance and starts the update thread execution.
 
Method Summary
 int getID()
          Gets an camera ID
 BufferedImage getView()
          Gets a current camera view.
 boolean panLeft()
          Turns a camera view left and changes camera angle information.
 boolean panRight()
          Turns a camera view right and changes camera angle information.
 void run()
           
 void setID(int id)
          Sets an camera ID and loads an image file for a camera.
 boolean zoomIn()
          Zooms a camera view in and changes camera zoom information.
 boolean zoomOut()
          Zooms a camera view out and changes camera zoom information.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

imgSource

BufferedImage imgSource

font

Font font

centerWidth

int centerWidth

centerHeight

int centerHeight

RETURN_SIZE

static final int RETURN_SIZE
See Also:
Constant Field Values

SOURCE_SIZE

static final int SOURCE_SIZE
See Also:
Constant Field Values
Constructor Detail

DeviceCamera

public DeviceCamera()
Constructs a camera instance and starts the update thread execution.

Method Detail

setID

public void setID(int id)
Description copied from interface: interfaceCamera
Sets an camera ID and loads an image file for a camera. The name of a camera image file is camera[ID].jpg. The image file should be in the current working directory. If the image file is not found or loaded, an error message will be shown.

Specified by:
setID in interface interfaceCamera
Parameters:
id - a camera ID

getID

public int getID()
Description copied from interface: interfaceCamera
Gets an camera ID

Specified by:
getID in interface interfaceCamera
Returns:
a camera ID

getView

public BufferedImage getView()
Description copied from interface: interfaceCamera
Gets a current camera view. This method may be periodically invoked to implement a camera movie.

Specified by:
getView in interface interfaceCamera
Returns:
an image representing a current camera view and camera information.

panRight

public boolean panRight()
Description copied from interface: interfaceCamera
Turns a camera view right and changes camera angle information. The limit and step of pan angle depend on the implementing class.

Specified by:
panRight in interface interfaceCamera
Returns:
true if a camera turns right successfully. Otherwise, false.

panLeft

public boolean panLeft()
Description copied from interface: interfaceCamera
Turns a camera view left and changes camera angle information. The limit and step of pan angle depend on the implementing class.

Specified by:
panLeft in interface interfaceCamera
Returns:
true if a camera turns left successfully. Otherwise, false.

zoomIn

public boolean zoomIn()
Description copied from interface: interfaceCamera
Zooms a camera view in and changes camera zoom information. The limit and step of zoom depend on the implementing class.

Specified by:
zoomIn in interface interfaceCamera
Returns:
true if a camera zooms in successfully. Otherwise, false.

zoomOut

public boolean zoomOut()
Description copied from interface: interfaceCamera
Zooms a camera view out and changes camera zoom information. The limit and step of zoom depend on the implementing class

Specified by:
zoomOut in interface interfaceCamera
Returns:
true if a camera zooms out successfully. Otherwise, false.

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread