uk.ac.ed.inf.sdp2012.group7.control
Class SimulatorCommunication

java.lang.Object
  extended by uk.ac.ed.inf.sdp2012.group7.control.SimulatorCommunication
All Implemented Interfaces:
CommunicationInterface, ConstantsReuse

public class SimulatorCommunication
extends java.lang.Object
implements CommunicationInterface


Nested Class Summary
 
Nested classes/interfaces inherited from interface uk.ac.ed.inf.sdp2012.group7.control.ConstantsReuse
ConstantsReuse.OpCodes
 
Field Summary
 
Fields inherited from interface uk.ac.ed.inf.sdp2012.group7.control.ConstantsReuse
ROBOT_MAC, ROBOT_NAME
 
Constructor Summary
SimulatorCommunication()
           
SimulatorCommunication(java.lang.String host, int port)
           
 
Method Summary
 void closeConnection()
           
 void openConnection()
           
 int receiveFromRobot()
           
 int recieveFromRobot()
           
 ConstantsReuse.OpCodes sendToRobot(byte[] command)
          Sends a command to the robot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimulatorCommunication

public SimulatorCommunication(java.lang.String host,
                              int port)

SimulatorCommunication

public SimulatorCommunication()
Method Detail

recieveFromRobot

public int recieveFromRobot()
Specified by:
recieveFromRobot in interface CommunicationInterface

receiveFromRobot

public int receiveFromRobot()

sendToRobot

public ConstantsReuse.OpCodes sendToRobot(byte[] command)
Description copied from interface: CommunicationInterface
Sends a command to the robot

Specified by:
sendToRobot in interface CommunicationInterface
Parameters:
command - - The command to send (4 bytes)
Returns:
OpCodes - The robots response

openConnection

public void openConnection()
                    throws java.io.IOException
Specified by:
openConnection in interface CommunicationInterface
Throws:
java.io.IOException

closeConnection

public void closeConnection()
Specified by:
closeConnection in interface CommunicationInterface