org.vigia.client.communications
Class RemoteCameraCommunicator

java.lang.Object
  extended by org.vigia.client.communications.RemoteCameraCommunicator
All Implemented Interfaces:
Communicator

public class RemoteCameraCommunicator
extends java.lang.Object
implements Communicator

An implementation of the client communication interface.

Author:
jrios

Field Summary
protected  ControlCommunicator controlCommunicator
          The control communicator.
protected  DataCommunicator dataCommunicator
          The data communicator.
 
Constructor Summary
RemoteCameraCommunicator(java.lang.String host, int controlPort, int dataPort)
          Creates a new communicator and connects with the remote server.
 
Method Summary
 void addFrameListener(FrameListener dataListener)
          Adds a listener to obtain the frames from the remote camera.
 void addLogListener(LogListener controlListener)
          Adds a listener to obtain control messages from the remote camera.
 void close()
          Closes the communication with the camera.
 boolean isClosed()
          Check if the communications are closed.
 void move(int pan, int tilt, int zoom)
          Send to the remote camera a move command in an absolute way.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataCommunicator

protected DataCommunicator dataCommunicator
The data communicator.


controlCommunicator

protected ControlCommunicator controlCommunicator
The control communicator.

Constructor Detail

RemoteCameraCommunicator

public RemoteCameraCommunicator(java.lang.String host,
                                int controlPort,
                                int dataPort)
                         throws java.net.UnknownHostException,
                                java.io.IOException
Creates a new communicator and connects with the remote server.

Parameters:
host - The remote host.
controlPort - The remote control port.
dataPort - The local data port.
Throws:
java.io.IOException - Error with the IO.
java.net.UnknownHostException - Host not found.
Method Detail

addLogListener

public void addLogListener(LogListener controlListener)
Description copied from interface: Communicator
Adds a listener to obtain control messages from the remote camera.

Specified by:
addLogListener in interface Communicator
Parameters:
controlListener - an implementation of the control listener.
See Also:
Communicator.addLogListener(org.vigia.shared.communications.LogListener)

addFrameListener

public void addFrameListener(FrameListener dataListener)
Description copied from interface: Communicator
Adds a listener to obtain the frames from the remote camera.

Specified by:
addFrameListener in interface Communicator
Parameters:
dataListener - an implementation of the data listener.
See Also:
Communicator.addFrameListener(org.vigia.shared.communications.FrameListener)

move

public void move(int pan,
                 int tilt,
                 int zoom)
          throws java.io.IOException
Description copied from interface: Communicator
Send to the remote camera a move command in an absolute way.

Specified by:
move in interface Communicator
Parameters:
pan - pan position.
tilt - tilt position.
zoom - zoom position.
Throws:
java.io.IOException - Error sending the command.
See Also:
Communicator.move(int, int, int)

close

public void close()
           throws java.io.IOException
Description copied from interface: Communicator
Closes the communication with the camera.

Specified by:
close in interface Communicator
Throws:
java.io.IOException - Error closing the communications.
See Also:
Communicator.close()

isClosed

public boolean isClosed()
Description copied from interface: Communicator
Check if the communications are closed.

Specified by:
isClosed in interface Communicator
Returns:
Is it's closed.
See Also:
Communicator.isClosed()