public abstract class TCPcommunicationLayer extends AbstractCommunicationLayer
Constructor and Description |
---|
TCPcommunicationLayer() |
Modifier and Type | Method and Description |
---|---|
boolean |
closeConnection()
Closes this layer and calls closeConnection() on the layer below.
|
boolean |
getConnectionState() |
byte |
readByte()
Reads a byte from the communication layer below or the connected device if this layer is the bottom layer.
|
double |
readDouble()
Reads 8 bytes from the communication layer below or the connected device if this layer is the bottom layer.
|
float |
readFloat()
Reads 4 bytes from the communication layer below or the connected device if this layer is the bottom layer.
|
long |
readLong()
Reads 4 bytes from the communication layer below or the connected device if this layer is the bottom layer.
|
void |
recvData()
Performs the necessary actions for receiving data.
|
void |
recvData(byte[] buffer)
Reads
|
void |
sendData(byte[] data,
int off,
int len)
Performs the necessary actions for sending data.
|
getAbove, getBelow, getRawBytes, openConnection, sendData, setAbove, setBelow
public boolean closeConnection() throws java.io.IOException
ICommunicationLayer
closeConnection
in interface ICommunicationLayer
closeConnection
in class AbstractCommunicationLayer
java.io.IOException
public void recvData(byte[] buffer) throws java.io.IOException
buffer
- java.io.IOException
public void recvData() throws java.io.IOException
ICommunicationLayer
recvData
in interface ICommunicationLayer
recvData
in class AbstractCommunicationLayer
java.io.IOException
public byte readByte() throws java.io.IOException
ICommunicationLayer
readByte
in interface ICommunicationLayer
readByte
in class AbstractCommunicationLayer
java.io.IOException
public long readLong() throws java.io.IOException
ICommunicationLayer
readLong
in interface ICommunicationLayer
readLong
in class AbstractCommunicationLayer
java.io.IOException
public double readDouble() throws java.io.IOException
ICommunicationLayer
readDouble
in interface ICommunicationLayer
readDouble
in class AbstractCommunicationLayer
java.io.IOException
public float readFloat() throws java.io.IOException
ICommunicationLayer
readFloat
in interface ICommunicationLayer
readFloat
in class AbstractCommunicationLayer
java.io.IOException
public boolean getConnectionState()
getConnectionState
in interface ICommunicationLayer
getConnectionState
in class AbstractCommunicationLayer
public void sendData(byte[] data, int off, int len) throws java.io.IOException
ICommunicationLayer
sendData
in interface ICommunicationLayer
sendData
in class AbstractCommunicationLayer
data
- Byte array containing the datalen
- Length of the data to be sentjava.io.IOException