lejos.nxt.rcxcomm
Class RCXAbstractPort

java.lang.Object
  extended by lejos.nxt.rcxcomm.RCXAbstractPort
Direct Known Subclasses:
RCXPort

public abstract class RCXAbstractPort
extends Object

RCXAbstractPort provides an interface similar to java.net.Socket Adapted from original code created by the LEGO3 Team at DTU-IAU RCXAbstractPort implements input and output stream handling and input buffering. It uses a packet handler for sending and receivng packets. This version is abstract because it has no packet handler defined. Specific versions of RCXAbstractPort override the constructor and set up the packet handler to use a specific protocol stack.

Author:
Brian Bagnall, Lawrie Griffiths

Field Summary
protected  PacketHandler packetHandler
           
 
Constructor Summary
RCXAbstractPort(PacketHandler handler)
          Constructor for the RCXAbstractPort.
 
Method Summary
 void close()
          Closes this RCXPort, stopping the Listener thread.
 InputStream getInputStream()
          Returns an input stream for this RCXPort.
 OutputStream getOutputStream()
          Returns an output stream for this RCXPort.
 int getTimeOut()
          Getter for property timeOut.
 void reset()
          Resets sequence numbers for this port
 void setTimeOut(int timeOut)
          Setter for property timeOut.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packetHandler

protected PacketHandler packetHandler
Constructor Detail

RCXAbstractPort

public RCXAbstractPort(PacketHandler handler)
                throws IOException
Constructor for the RCXAbstractPort. Opens the port, and sets the protocol packet handler.

Parameters:
handler - the packet handler
Throws:
IOException
Method Detail

getInputStream

public InputStream getInputStream()
Returns an input stream for this RCXPort.

Returns:
an input stream for reading bytes from this RCXPort.

getOutputStream

public OutputStream getOutputStream()
Returns an output stream for this RCXPort.

Returns:
an output stream for writing bytes to this RCXPort.

reset

public void reset()
Resets sequence numbers for this port


close

public void close()
Closes this RCXPort, stopping the Listener thread.


getTimeOut

public int getTimeOut()
Getter for property timeOut.

Returns:
Value of property timeOut.

setTimeOut

public void setTimeOut(int timeOut)
Setter for property timeOut.

Parameters:
timeOut - New value of property timeOut.