public class CommFunctionBlockLayer extends AbstractCommunicationLayer implements IForteSocket
Constructor and Description |
---|
CommFunctionBlockLayer() |
Modifier and Type | Method and Description |
---|---|
byte[] |
array()
This method is intended to allow array-backed buffers to be passed to native code more efficiently.
|
int |
capacity()
Returns the input byte buffer's capacity
|
boolean |
closeConnection()
Closes this layer and calls closeConnection() on the layer below.
|
void |
disconnect()
Closes the connection.
|
ICommunicationLayer |
getBelow() |
boolean |
getBool()
Increments the position by one.
|
boolean[] |
getBoolArray()
Increments the position by one.
|
DateAndTime |
getDateAndTime()
Increments the position by one.
|
DateAndTime[] |
getDateAndTimeArray()
Increments the position by one.
|
double |
getDouble()
Increments the position by one.
|
double[] |
getDoubleArray()
Increments the position by one.
|
float |
getFloat()
Increments the position by one.
|
float[] |
getFloatArray()
Increments the position by one.
|
int |
getInt()
Increments the position by one.
|
int[] |
getIntArray()
Increments the position by one.
|
long |
getLong()
Increments the position by one.
|
long[] |
getLongArray()
Increments the position by one.
|
int |
getNumDataValues() |
int |
getPosition()
Returns this data buffer's position.
|
java.lang.String |
getString()
Increments the position by one.
|
java.lang.String[] |
getStringArray()
Increments the position by one.
|
ForteDataType |
getTypeAtNextPosition()
Returns Intended for enabling the dynamic retrieval of data from the buffer.
|
ForteDataType |
getTypeAtPosition(int position)
Intended for enabling the dynamic retrieval of data from the buffer.
|
boolean |
incrementPosition()
Increments this buffer's position by 1.
|
boolean |
isArrayAtPosition(int position)
Intended for enabling the dynamic retrieval of data from the buffer.
|
boolean |
isBool() |
boolean |
isBoolArray() |
boolean |
isConnected() |
boolean |
isDateAndTime() |
boolean |
isDateAndTimeArray() |
boolean |
isDouble() |
boolean |
isDoubleArray() |
boolean |
isFloat() |
boolean |
isFloatArray() |
boolean |
isInt() |
boolean |
isIntArray() |
boolean |
isLong() |
boolean |
isLongArray() |
boolean |
isString() |
boolean |
isStringArray() |
java.util.Iterator<java.lang.Object> |
iterator()
Use this method with caution.
|
boolean |
openConnection(CommLayerParams params)
Opens the connection and sets up the communication stack.
|
boolean |
put(boolean value)
Adds a boolean to be sent to FORTE as an IEC 61499 BOOLEAN to buffer
|
boolean |
put(boolean[] value)
Adds a boolean[] array to be sent to FORTE as an IEC 61499 BOOLEAN array to buffer
|
boolean |
put(DateAndTime value)
Adds a DateAndTime object to be sent to FORTE as IEC 61499 DATE_AND_TIME data to buffer
|
boolean |
put(DateAndTime[] value)
Adds a DateAndTime[] array to be sent to FORTE as an IEC 61499 DATE_AND_TIME array to buffer
|
boolean |
put(double value)
Adds a double to be sent to FORTE as IEC 61499 LREAL to buffer
|
boolean |
put(double[] value)
Adds a double[] array to be sent to FORTE as an IEC 61499 LREAL array to buffer
|
boolean |
put(float value)
Adds a float to be sent to FORTE as IEC 61499 REAL to buffer
|
boolean |
put(float[] value)
Adds a float[] array to be sent to FORTE as an IEC 61499 REAL array to buffer
|
boolean |
put(int value)
Adds a 32 bit int to be sent to FORTE as one of the IEC 61499 32 bit integer types to buffer
|
boolean |
put(int[] value)
Adds a 32 bit int[] array to be sent to FORTE as an IEC 61499 32 bit integer array to buffer
|
boolean |
put(long value)
Adds a 64 bit long integer to be sent to FORTE as an IEC 61499 integer to buffer
|
boolean |
put(long[] value)
Adds a 64 bit long[] integer array to be sent to FORTE as an IEC 61499 integer array to buffer
|
boolean |
put(java.lang.String value)
Adds a String to be sent to FORTE as an IEC 61499 STRING to buffer
|
boolean |
put(java.lang.String[] value)
Adds a String[] array to be sent to FORTE as an IEC 61499 STRING array to buffer
|
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 |
reset()
Resets the position to its initialized state and clears the internal byte buffer.
|
void |
rewind()
Resets the position to its initialized state.
|
void |
sendData()
Writes the data stored within this instance's byte buffer to a DataOutputStream.
|
void |
sendData(byte[] data,
int off,
int len)
Performs the necessary actions for sending data.
|
void |
sendRsp()
Sends a response (e.g., a single byte with the value of 5)
|
void |
setBelow(ICommunicationLayer below)
Sets the communication layer below this layer.
|
void |
setDateAndTimeReference(DateAndTime dt)
Sets a DateAndTime object as reference for any new DateAndTime objects received.
|
void |
setPosition(int position)
Sets the position.
|
getAbove, getConnectionState, getRawBytes, sendData, setAbove
public byte[] array()
array
in interface IForteSocket
public int capacity()
capacity
in interface IForteSocket
public boolean getBool()
IForteSocket
IForteSocket.isBool()
to determine whether the correct data type is at the next position.getBool
in interface IForteSocket
public boolean[] getBoolArray()
IForteSocket
IForteSocket.isBoolArray()
to determine whether the correct data type is at the next position.getBoolArray
in interface IForteSocket
public DateAndTime getDateAndTime()
IForteSocket
IForteSocket.isDateAndTime()
to determine whether the correct data type is at the next position.getDateAndTime
in interface IForteSocket
public DateAndTime[] getDateAndTimeArray()
IForteSocket
IForteSocket.isDateAndTimeArray()
to determine whether the correct data type is at the next position.getDateAndTimeArray
in interface IForteSocket
public double getDouble()
IForteSocket
IForteSocket.isDouble()
to determine whether the correct data type is at the next position.getDouble
in interface IForteSocket
public double[] getDoubleArray()
IForteSocket
IForteSocket.isDoubleArray()
to determine whether the correct data type is at the next position.getDoubleArray
in interface IForteSocket
public float getFloat()
IForteSocket
IForteSocket.isFloat()
to determine whether the correct data type is at the next position.getFloat
in interface IForteSocket
public float[] getFloatArray()
IForteSocket
IForteSocket.isFloatArray()
to determine whether the correct data type is at the next position.getFloatArray
in interface IForteSocket
public int getInt()
IForteSocket
IForteSocket.isInt()
to determine whether the correct data type is at the next position.getInt
in interface IForteSocket
public int[] getIntArray()
IForteSocket
IForteSocket.isIntArray()
to determine whether the correct data type is at the next position.getIntArray
in interface IForteSocket
public long getLong()
IForteSocket
IForteSocket.isLong()
to determine whether the correct data type is at the next position.getLong
in interface IForteSocket
public long[] getLongArray()
IForteSocket
IForteSocket.isLongArray()
to determine whether the correct data type is at the next position.getLongArray
in interface IForteSocket
public int getNumDataValues()
getNumDataValues
in interface IForteSocket
public int getPosition()
IForteSocket
IForteSocket.incrementPosition()
must be called before extracting data.getPosition
in interface IForteSocket
public java.lang.String getString()
IForteSocket
IForteSocket.isString()
to determine whether the correct data type is at the next position.getString
in interface IForteSocket
public java.lang.String[] getStringArray()
IForteSocket
IForteSocket.isStringArray()
to determine whether the correct data type is at the next position.getStringArray
in interface IForteSocket
public ForteDataType getTypeAtNextPosition()
IForteSocket
getTypeAtNextPosition
in interface IForteSocket
public ForteDataType getTypeAtPosition(int position)
IForteSocket
getTypeAtPosition
in interface IForteSocket
public boolean incrementPosition()
IForteSocket
incrementPosition
in interface IForteSocket
public boolean isArrayAtPosition(int position)
IForteSocket
isArrayAtPosition
in interface IForteSocket
public boolean isBool()
isBool
in interface IForteSocket
public boolean isBoolArray()
isBoolArray
in interface IForteSocket
public boolean isDateAndTime()
isDateAndTime
in interface IForteSocket
public boolean isDateAndTimeArray()
isDateAndTimeArray
in interface IForteSocket
public boolean isDouble()
isDouble
in interface IForteSocket
public boolean isDoubleArray()
isDoubleArray
in interface IForteSocket
public boolean isFloat()
isFloat
in interface IForteSocket
public boolean isFloatArray()
isFloatArray
in interface IForteSocket
public boolean isInt()
isInt
in interface IForteSocket
public boolean isIntArray()
isIntArray
in interface IForteSocket
public boolean isLong()
isLong
in interface IForteSocket
public boolean isLongArray()
isLongArray
in interface IForteSocket
public boolean isString()
isString
in interface IForteSocket
public boolean isStringArray()
isStringArray
in interface IForteSocket
public java.util.Iterator<java.lang.Object> iterator()
IForteSocket
iterator
in interface IForteSocket
#isDouble()}, {@link #getDouble()} {@link #isDoubleArray()}, {@link #getDoubleArray()},
{@link #getBool()}, {@link #getInt()} {@link #getLong()}, {@link #getFloat()}, {@link #getString()},
{@link #getDateAndTime()}, {@link #getLocalDateTime()},
{@link #getBoolArray()}, {@link #getIntArray()} {@link #getLongArray()}, {@link #getFloatArray()}, {@link #getStringArray()},
{@link #getDateAndTimeArray()}, {@link #getLocalDateTimeArray()}, etc.
public boolean put(boolean value)
IForteSocket
put
in interface IForteSocket
public boolean put(boolean[] value)
IForteSocket
put
in interface IForteSocket
public boolean put(DateAndTime value)
IForteSocket
put
in interface IForteSocket
public boolean put(DateAndTime[] value)
IForteSocket
put
in interface IForteSocket
public boolean put(double value)
IForteSocket
put
in interface IForteSocket
public boolean put(double[] value)
IForteSocket
put
in interface IForteSocket
public boolean put(float value)
IForteSocket
put
in interface IForteSocket
public boolean put(float[] value)
IForteSocket
put
in interface IForteSocket
public boolean put(int value)
IForteSocket
put
in interface IForteSocket
value
- Value to be converted to byte datapublic boolean put(int[] value)
IForteSocket
put
in interface IForteSocket
public boolean put(long value)
IForteSocket
put
in interface IForteSocket
public boolean put(long[] value)
IForteSocket
put
in interface IForteSocket
public boolean put(java.lang.String value)
IForteSocket
put
in interface IForteSocket
public boolean put(java.lang.String[] value)
IForteSocket
put
in interface IForteSocket
public void reset()
IForteSocket
reset
in interface IForteSocket
public void rewind()
IForteSocket
rewind
in interface IForteSocket
public void setDateAndTimeReference(DateAndTime dt)
IForteSocket
setDateAndTimeReference
in interface IForteSocket
public void setPosition(int position)
IForteSocket
IForteSocket.getNumDataValues()
].
-1 is the initialized state.setPosition
in interface IForteSocket
public void sendData() throws java.io.IOException
IForteSocket
IForteSocket.reset()
is called after completing the write operation.
Before calling this method, the data output layer must be set using #setOutputLayer(AbstractCommunicationLayer)
.sendData
in interface IForteSocket
java.io.IOException
public void sendRsp() throws java.io.IOException
IForteSocket
sendRsp
in interface IForteSocket
java.io.IOException
public void disconnect() throws java.io.IOException
IForteSocket
disconnect
in interface IForteSocket
java.io.IOException
public boolean openConnection(CommLayerParams params) throws java.io.IOException
ICommunicationLayer
openConnection
in interface ICommunicationLayer
openConnection
in class AbstractCommunicationLayer
params
- CommLayerParams object holding the connection infojava.io.IOException
public boolean closeConnection() throws java.io.IOException
ICommunicationLayer
closeConnection
in interface ICommunicationLayer
closeConnection
in class AbstractCommunicationLayer
java.io.IOException
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
public void recvData() throws java.io.IOException
ICommunicationLayer
recvData
in interface ICommunicationLayer
recvData
in interface IForteSocket
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 isConnected()
isConnected
in interface IForteSocket
public ICommunicationLayer getBelow()
getBelow
in interface ICommunicationLayer
getBelow
in class AbstractCommunicationLayer
public void setBelow(ICommunicationLayer below)
ICommunicationLayer
setBelow
in interface ICommunicationLayer
setBelow
in class AbstractCommunicationLayer