Package lejos.remote.rcx
Class RCXAbstractPort
- java.lang.Object
-
- lejos.remote.rcx.RCXAbstractPort
-
- Direct Known Subclasses:
RCXPort
public abstract class RCXAbstractPort extends java.lang.ObjectRCXAbstractPort 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
Fields Modifier and Type Field Description protected PacketHandlerpacketHandler
-
Constructor Summary
Constructors Constructor Description RCXAbstractPort(PacketHandler handler)Constructor for the RCXAbstractPort.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this RCXPort, stopping the Listener thread.java.io.InputStreamgetInputStream()Returns an input stream for this RCXPort.java.io.OutputStreamgetOutputStream()Returns an output stream for this RCXPort.intgetTimeOut()Getter for property timeOut.voidreset()Resets sequence numbers for this portvoidsetTimeOut(int timeOut)Setter for property timeOut.
-
-
-
Field Detail
-
packetHandler
protected PacketHandler packetHandler
-
-
Constructor Detail
-
RCXAbstractPort
public RCXAbstractPort(PacketHandler handler) throws java.io.IOException
Constructor for the RCXAbstractPort. Opens the port, and sets the protocol packet handler.- Parameters:
handler- the packet handler- Throws:
java.io.IOException
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream()
Returns an input stream for this RCXPort.- Returns:
- an input stream for reading bytes from this RCXPort.
-
getOutputStream
public java.io.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.
-
-