public interface ICommunicationLayer
Modifier and Type | Method and Description |
---|---|
boolean |
closeConnection()
Closes this layer and calls closeConnection() on the layer below.
|
ICommunicationLayer |
getAbove() |
ICommunicationLayer |
getBelow() |
boolean |
getConnectionState() |
byte[] |
getRawBytes() |
boolean |
openConnection(CommLayerParams params)
Opens the connection and sets up the communication stack.
|
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 |
sendData(byte[] data)
Performs the necessary actions for sending data.
|
void |
sendData(byte[] data,
int off,
int len)
Performs the necessary actions for sending data.
|
void |
setAbove(ICommunicationLayer layer)
Sets the communication layer above this layer.
|
void |
setBelow(ICommunicationLayer layer)
Sets the communication layer below this layer.
|
boolean openConnection(CommLayerParams params) throws java.io.IOException
params
- CommLayerParams object holding the connection infojava.io.IOException
boolean closeConnection() throws java.io.IOException
java.io.IOException
void sendData(byte[] data, int off, int len) throws java.io.IOException
data
- Byte array containing the dataOffset
- (start of write operation)len
- Length of the data to be sentjava.io.IOException
void sendData(byte[] data) throws java.io.IOException
data
- Byte array containing the datajava.io.IOException
void recvData() throws java.io.IOException
java.io.IOException
ICommunicationLayer getAbove()
ICommunicationLayer getBelow()
void setAbove(ICommunicationLayer layer)
void setBelow(ICommunicationLayer layer)
byte readByte() throws java.io.IOException
java.io.IOException
long readLong() throws java.io.IOException
java.io.IOException
double readDouble() throws java.io.IOException
java.io.IOException
float readFloat() throws java.io.IOException
java.io.IOException
boolean getConnectionState()
byte[] getRawBytes()
recvData()