public class ForteDataBufferLayer extends de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer implements IForteSocket, java.io.Serializable
JAVA object/primitive | IEC 61499 data type |
---|---|
boolean | BOOL |
int | SINT, INT, DINT, USINT, UINT, UDINT |
long | LINT, ULINT |
float | REAL |
double | LREAL |
DateAndTime*, LocalDateTime | DATE_AND_TIME |
String | STRING** |
ForteDataType
,
DateAndTime
,
Serialized FormConstructor and Description |
---|
ForteDataBufferLayer() |
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 buffer's capacity
|
void |
disconnect()
Closes the connection.
|
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()
|
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.
|
void |
initialise(java.util.List<java.lang.Enum<?>> dataTypes,
java.util.List<java.lang.Integer> arraySizes)
Initializes this object's buffer that can hold multiple arrays of various data types
|
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.
|
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 |
setDateAndTimeReference(DateAndTime dt)
Sets a DateAndTime object as reference for any new DateAndTime objects received.
|
void |
setPosition(int position)
Sets the position.
|
closeConnection, getAbove, getBelow, getConnectionState, getRawBytes, readDouble, readFloat, readLong, sendData, setAbove, setBelow
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 void initialise(java.util.List<java.lang.Enum<?>> dataTypes, java.util.List<java.lang.Integer> arraySizes)
initialise
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
dataTypes
- List containing the ForteDataType enumerations.
This could be the inputs of outputs set in a CommLayerParams object.arraySizes
- List containing the corresponding array sizes (1 for non-arrays)
This could be the array sizes set in a CommLayerParams object.ForteDataType
public boolean put(float value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(float[] value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(double value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(double[] value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(int value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
value
- Value to be converted to byte datapublic boolean put(int[] value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(long value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(long[] value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(boolean value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(boolean[] value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(java.lang.String value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(java.lang.String[] value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(DateAndTime value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean put(DateAndTime[] value)
IForteSocket
put
in interface IForteSocket
put
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public byte[] array()
IForteSocket
array
in interface IForteSocket
array
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean getBool()
IForteSocket
IForteSocket.isBool()
to determine whether the correct data type is at the next position.getBool
in interface IForteSocket
getBool
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public long getLong()
IForteSocket
IForteSocket.isLong()
to determine whether the correct data type is at the next position.getLong
in interface IForteSocket
getLong
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public int getInt()
IForteSocket
IForteSocket.isInt()
to determine whether the correct data type is at the next position.getInt
in interface IForteSocket
getInt
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public float getFloat()
IForteSocket
IForteSocket.isFloat()
to determine whether the correct data type is at the next position.getFloat
in interface IForteSocket
getFloat
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public double getDouble()
IForteSocket
IForteSocket.isDouble()
to determine whether the correct data type is at the next position.getDouble
in interface IForteSocket
getDouble
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public DateAndTime getDateAndTime()
IForteSocket
IForteSocket.isDateAndTime()
to determine whether the correct data type is at the next position.getDateAndTime
in interface IForteSocket
getDateAndTime
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public java.lang.String getString()
IForteSocket
IForteSocket.isString()
to determine whether the correct data type is at the next position.getString
in interface IForteSocket
getString
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean[] getBoolArray()
IForteSocket
IForteSocket.isBoolArray()
to determine whether the correct data type is at the next position.getBoolArray
in interface IForteSocket
getBoolArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public long[] getLongArray()
IForteSocket
IForteSocket.isLongArray()
to determine whether the correct data type is at the next position.getLongArray
in interface IForteSocket
getLongArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public int[] getIntArray()
IForteSocket
IForteSocket.isIntArray()
to determine whether the correct data type is at the next position.getIntArray
in interface IForteSocket
getIntArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public float[] getFloatArray()
IForteSocket
IForteSocket.isFloatArray()
to determine whether the correct data type is at the next position.getFloatArray
in interface IForteSocket
getFloatArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public double[] getDoubleArray()
IForteSocket
IForteSocket.isDoubleArray()
to determine whether the correct data type is at the next position.getDoubleArray
in interface IForteSocket
getDoubleArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public DateAndTime[] getDateAndTimeArray()
IForteSocket
IForteSocket.isDateAndTimeArray()
to determine whether the correct data type is at the next position.getDateAndTimeArray
in interface IForteSocket
getDateAndTimeArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public java.lang.String[] getStringArray()
IForteSocket
IForteSocket.isStringArray()
to determine whether the correct data type is at the next position.getStringArray
in interface IForteSocket
getStringArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isBool()
isBool
in interface IForteSocket
isBool
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isLong()
isLong
in interface IForteSocket
isLong
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isInt()
isInt
in interface IForteSocket
isInt
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isFloat()
isFloat
in interface IForteSocket
isFloat
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isDouble()
isDouble
in interface IForteSocket
isDouble
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isDateAndTime()
isDateAndTime
in interface IForteSocket
isDateAndTime
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isString()
isString
in interface IForteSocket
isString
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isBoolArray()
isBoolArray
in interface IForteSocket
isBoolArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isLongArray()
isLongArray
in interface IForteSocket
isLongArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isIntArray()
isIntArray
in interface IForteSocket
isIntArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isFloatArray()
isFloatArray
in interface IForteSocket
isFloatArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isDoubleArray()
isDoubleArray
in interface IForteSocket
isDoubleArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isDateAndTimeArray()
isDateAndTimeArray
in interface IForteSocket
isDateAndTimeArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isStringArray()
isStringArray
in interface IForteSocket
isStringArray
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public void recvData() throws java.io.IOException
ICommunicationLayer
recvData
in interface ICommunicationLayer
recvData
in interface IForteSocket
recvData
in class AbstractCommunicationLayer
java.io.IOException
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
sendData
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
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 sendRsp() throws java.io.IOException
IForteSocket
sendRsp
in interface IForteSocket
sendRsp
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
java.io.IOException
public void reset()
IForteSocket
reset
in interface IForteSocket
reset
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public ForteDataType getTypeAtPosition(int position)
IForteSocket
getTypeAtPosition
in interface IForteSocket
getTypeAtPosition
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public ForteDataType getTypeAtNextPosition()
IForteSocket
getTypeAtNextPosition
in interface IForteSocket
getTypeAtNextPosition
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean isArrayAtPosition(int position)
IForteSocket
isArrayAtPosition
in interface IForteSocket
isArrayAtPosition
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public void rewind()
IForteSocket
rewind
in interface IForteSocket
rewind
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public java.util.Iterator<java.lang.Object> iterator()
IForteSocket
iterator
in interface IForteSocket
iterator
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
#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 isConnected()
isConnected
in interface IForteSocket
isConnected
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public byte readByte() throws java.io.IOException
ICommunicationLayer
readByte
in interface ICommunicationLayer
readByte
in class AbstractCommunicationLayer
java.io.IOException
public int capacity()
IForteSocket
capacity
in interface IForteSocket
capacity
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public boolean incrementPosition()
IForteSocket
incrementPosition
in interface IForteSocket
incrementPosition
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public int getNumDataValues()
getNumDataValues
in interface IForteSocket
getNumDataValues
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public void setPosition(int position)
IForteSocket
IForteSocket.getNumDataValues()
].
-1 is the initialized state.setPosition
in interface IForteSocket
setPosition
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public void setDateAndTimeReference(DateAndTime dt)
IForteSocket
setDateAndTimeReference
in interface IForteSocket
setDateAndTimeReference
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
public void disconnect() throws java.io.IOException
IForteSocket
disconnect
in interface IForteSocket
disconnect
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer
java.io.IOException
public int getPosition()
getPosition
in interface IForteSocket
getPosition
in class de.htw.berlin.polysun4diac.forte.comm.AbstractDataBufferLayer