org.vigia.server.communications
Class ClientCommunicator

java.lang.Object
  extended by org.vigia.server.communications.ClientCommunicator
All Implemented Interfaces:
Communicator

public class ClientCommunicator
extends java.lang.Object
implements Communicator

An implementation of the server communication interface.

Author:
jrios

Field Summary
protected  ControlCommunicator controlCommunicator
          The data communicator.
protected  DataCommunicator dataCommunicator
          The control communicator.
 
Constructor Summary
ClientCommunicator(int controlPort)
          Creates a communicator to listen a client.
 
Method Summary
 void addCommandListener(CommandListener commandListener)
          Adds a listener to obtain control messages from the remote camera.
 void sendFrame(java.awt.image.BufferedImage image)
          Sends a frame to the client.
 void sendLog(ELog log, java.lang.String message)
          Sends an error to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

controlCommunicator

protected ControlCommunicator controlCommunicator
The data communicator.


dataCommunicator

protected DataCommunicator dataCommunicator
The control communicator.

Constructor Detail

ClientCommunicator

public ClientCommunicator(int controlPort)
                   throws java.io.IOException
Creates a communicator to listen a client.

Parameters:
controlPort - The control port.
Throws:
java.io.IOException - Error creating the socket.
Method Detail

addCommandListener

public void addCommandListener(CommandListener commandListener)
Description copied from interface: Communicator
Adds a listener to obtain control messages from the remote camera.

Specified by:
addCommandListener in interface Communicator
Parameters:
commandListener - an implementation of the control listener.
See Also:
Communicator.addCommandListener(org.vigia.server.communications.CommandListener)

sendLog

public void sendLog(ELog log,
                    java.lang.String message)
             throws NotConnectedException,
                    java.io.IOException
Description copied from interface: Communicator
Sends an error to the client.

Specified by:
sendLog in interface Communicator
Parameters:
log - the kind of error.
message - an error's description.
Throws:
NotConnectedException - There isn't any client connected.
java.io.IOException - Error sending the message.
See Also:
Communicator.sendLog(org.vigia.shared.communications.ELog, java.lang.String)

sendFrame

public void sendFrame(java.awt.image.BufferedImage image)
               throws java.io.IOException
Description copied from interface: Communicator
Sends a frame to the client.

Specified by:
sendFrame in interface Communicator
Parameters:
image - the frame.
Throws:
java.io.IOException - Error sending the frame.
See Also:
Communicator.sendFrame(java.awt.image.BufferedImage)