com.kuka.roboticsAPI.controllerModel.sunrise.connectionLib
Class Message

java.lang.Object
  extended by com.kuka.roboticsAPI.controllerModel.sunrise.connectionLib.Message

public class Message
extends Object

A message is used to send data over the connection lib. A message can hold parameters, has a id and a type.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

Field Summary
static int MAX_SUNRISE_LENGTH
          The maximum length sunrise can receive.
static int ParameterNameLength
          Maximal length of a parameter name.
 
Constructor Summary
Message()
          Creates a new message with id 0 and type Unknown.
Message(long id)
          Creates a new message with the given id and type Unknown.
Message(long id, int type)
          Creates a new message with the given id and type.
 
Method Summary
 void addParam(byte[] value)
          Add a byte array parameter to the message.
 void addParam(double value)
          Add a double parameter to the message.
 void addParam(double[] value)
          Add a double array parameter to the message.
 void addParam(int value)
          Add an integer parameter to the message.
 void addParam(int[] value)
          Add a integer array parameter to the message.
 void addParam(ISerializableType value)
          Add a generic parameter to the message.
 void addParam(String value)
          Add a string parameter to the message.
 void addParamLong(long value)
          Add an long parameter to the message.
 void clear()
          Clears the message params, the id and the type.
 void clearParams()
          Clear all parameters of the message, but not the type or id.
static Message fromByteBuffer(FastByteBuffer buffer)
          Deserializes a message out of a byte array.
static Message fromByteBufferChecked(FastByteBuffer buffer)
          Deserializes a message out of a byte array.
 long getId()
          Gets the id of the message.
 int getMessageLength()
          Gets the length of the message in bytes.
 ISerializableType getParam(int index)
          Gets the parameter at the given index.
 ISerializableType getParam(String paramName)
          Gets the parameter with the given name.
 byte[] getParamBlob(int index)
          Gets the parameter at the given index with a cast to byte[].
 byte[] getParamBlob(String paramName)
          Gets the parameter with the specified name with a cast to byte[].
 int getParamCount()
          Gets the parameter count of the message.
 double getParamDouble(int index)
          Gets the parameter at the given index with a cast to double.
 double getParamDouble(String paramName)
          Gets the parameter with the specified name with a cast to double.
 double[] getParamDoubleArray(int index)
          Gets the parameter at the given index with a cast to double[].
 double[] getParamDoubleArray(String paramName)
          Gets the parameter with the specified name with a cast to double[].
 Iterable<ISerializableType> getParameters()
          Gets an iterable object of the current parameters of the message.
 int getParamInt(int index)
          Gets the parameter at the given index with a cast to integer.
 int getParamInt(String paramName)
          Gets the parameter with the specified name with a cast to int.
 int[] getParamIntArray(int index)
          Gets the parameter at the given index with a cast to int[].
 int[] getParamIntArray(String paramName)
          Gets the parameter with the specified name with a cast to int[].
 long getParamLong(int index)
          Gets the parameter at the given index as Java long value.
 long getParamLong(String paramName)
          Gets the parameter with the specified name as Java long value.
 Message getParamMessageFromBlob(int index)
          Gets the parameter at the given index with as a Message.
 String getParamName(int index)
          Gets the name of the parameter at the given index.
 String getParamString(int index)
          Gets the parameter at the given index with a cast to string.
 String getParamString(String paramName)
          Gets the parameter with the specified name with a cast to String.
 Class<? extends Object> getParamType(int index)
          Gets the class type of the parameter at the given index.
 int getType()
          Gets the type of the message.
 void markAsError(String errorMessage, int errorCode, String kxrModule, String kxrId)
          Marks the message as an error message.
 void setId(long messageId)
          Sets the id of the message.
 void setType(int messageType)
          Sets the type of the message.
 void setType(MessageType messageType)
          Sets the type of the message.
 int toByteBuffer(FastByteBuffer buffer)
          Serializes the message in the given byte buffer.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SUNRISE_LENGTH

public static final int MAX_SUNRISE_LENGTH
The maximum length sunrise can receive.

See Also:
Constant Field Values
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

ParameterNameLength

public static final int ParameterNameLength
Maximal length of a parameter name. Must match DF_VARIABLE_NAME_LENGTH in Sunrise and SUNRISE_PORT_NAME_LENGTH in roboticsAPI.

See Also:
Constant Field Values
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.
Constructor Detail

Message

public Message()
Creates a new message with id 0 and type Unknown.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

Message

public Message(long id)
Creates a new message with the given id and type Unknown.

Parameters:
id - The id of the message.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

Message

public Message(long id,
               int type)
Creates a new message with the given id and type.

Parameters:
id - The id of the message.
type - The type of the message.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.
Method Detail

addParam

public void addParam(double value)
Add a double parameter to the message.

Parameters:
value - The value of the parameter.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

addParam

public void addParam(int value)
Add an integer parameter to the message.

Parameters:
value - The value of the parameter.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

addParamLong

public void addParamLong(long value)
Add an long parameter to the message. The value will be serialized as BLOB.

Parameters:
value - The value of the parameter.
See Also:
SerializableBLOB.createFromLongInteger(long)
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

addParam

public void addParam(byte[] value)
Add a byte array parameter to the message.

Parameters:
value - The value of the parameter.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

addParam

public void addParam(double[] value)
Add a double array parameter to the message.

Parameters:
value - The value of the parameter.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

addParam

public void addParam(int[] value)
Add a integer array parameter to the message.

Parameters:
value - The value of the parameter.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

addParam

public void addParam(String value)
Add a string parameter to the message.

Parameters:
value - The value of the parameter.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

addParam

public void addParam(ISerializableType value)
Add a generic parameter to the message.

Parameters:
value - The value of the parameter.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

clear

public void clear()
Clears the message params, the id and the type.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

clearParams

public void clearParams()
Clear all parameters of the message, but not the type or id.

This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

setType

public void setType(MessageType messageType)
Sets the type of the message.

Parameters:
messageType - The type the message should have.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

setType

public void setType(int messageType)
Sets the type of the message.

Parameters:
messageType - The type the message should have.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

setId

public final void setId(long messageId)
Sets the id of the message.

Parameters:
messageId - The id of the message.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getId

public long getId()
Gets the id of the message.

Returns:
The id of the message.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getType

public int getType()
Gets the type of the message.

Returns:
The type of the message.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getMessageLength

public int getMessageLength()
Gets the length of the message in bytes.

Returns:
The length of the message in bytes.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParameters

public Iterable<ISerializableType> getParameters()
Gets an iterable object of the current parameters of the message.

Returns:
An iterable object of the current parameters of the message.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamCount

public int getParamCount()
Gets the parameter count of the message.

Returns:
The parameter count of the message.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParam

public ISerializableType getParam(int index)
Gets the parameter at the given index.

Parameters:
index - The index.
Returns:
The parameter at the given index.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParam

public ISerializableType getParam(String paramName)
Gets the parameter with the given name.

Parameters:
paramName - The parameter name.
Returns:
The parameter with the given name or null.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamBlob

public byte[] getParamBlob(int index)
Gets the parameter at the given index with a cast to byte[]. No type check is done.

Parameters:
index - The index.
Returns:
The parameter at the given index as byte array.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamBlob

public byte[] getParamBlob(String paramName)
Gets the parameter with the specified name with a cast to byte[]. No type check is done.

Parameters:
paramName - The parameter name.
Returns:
The parameter with the specified name as byte array.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamIntArray

public int[] getParamIntArray(int index)
Gets the parameter at the given index with a cast to int[]. No type check is done.

Parameters:
index - The index.
Returns:
The parameter at the given index as int array.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamIntArray

public int[] getParamIntArray(String paramName)
Gets the parameter with the specified name with a cast to int[]. No type check is done.

Parameters:
paramName - The parameter name.
Returns:
The parameter with the specified name as int array.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamDoubleArray

public double[] getParamDoubleArray(int index)
Gets the parameter at the given index with a cast to double[]. No type check is done.

Parameters:
index - The index.
Returns:
The parameter at the given index as double array.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamDoubleArray

public double[] getParamDoubleArray(String paramName)
Gets the parameter with the specified name with a cast to double[]. No type check is done.

Parameters:
paramName - The parameter name.
Returns:
The parameter with the specified name as double array.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamInt

public int getParamInt(int index)
Gets the parameter at the given index with a cast to integer. No type check is done.

Parameters:
index - The index.
Returns:
The parameter at the given index as integer.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamInt

public int getParamInt(String paramName)
Gets the parameter with the specified name with a cast to int. No type check is done.

Parameters:
paramName - The parameter name.
Returns:
The parameter with the specified name as int.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamLong

public long getParamLong(int index)
Gets the parameter at the given index as Java long value. The parameter must be a BLOB of size 8.

Parameters:
index - The index.
Returns:
The parameter at the given index as long.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamLong

public long getParamLong(String paramName)
Gets the parameter with the specified name as Java long value. The parameter must be a BLOB of size 8.

Parameters:
paramName - The parameter name.
Returns:
The parameter with the specified name as long.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamDouble

public double getParamDouble(int index)
Gets the parameter at the given index with a cast to double. No type check is done.

Parameters:
index - The index.
Returns:
The parameter at the given index as double.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamDouble

public double getParamDouble(String paramName)
Gets the parameter with the specified name with a cast to double. No type check is done.

Parameters:
paramName - The parameter name.
Returns:
The parameter with the specified name as double.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamString

public String getParamString(int index)
Gets the parameter at the given index with a cast to string. No type check is done.

Parameters:
index - The index.
Returns:
The parameter at the given index as string.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamString

public String getParamString(String paramName)
Gets the parameter with the specified name with a cast to String. No type check is done.

Parameters:
paramName - The parameter name.
Returns:
The parameter with the specified name as String.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamType

public Class<? extends Object> getParamType(int index)
Gets the class type of the parameter at the given index.

Parameters:
index - The index.
Returns:
The class of the parameter at the given index.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamName

public String getParamName(int index)
Gets the name of the parameter at the given index.

Parameters:
index - The index.
Returns:
The name of the parameter at the given index.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

toString

public String toString()

Overrides:
toString in class Object
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

markAsError

public void markAsError(String errorMessage,
                        int errorCode,
                        String kxrModule,
                        String kxrId)
Marks the message as an error message. Changes the type of the message and adds an error string.

Parameters:
errorMessage - the error string to transmit.
errorCode - the error code describing why the SSR execution failed
kxrModule - the name of the KXR module needed for localisation
kxrId - the id of the KXR key needed for localisation
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

toByteBuffer

public int toByteBuffer(FastByteBuffer buffer)
Serializes the message in the given byte buffer. The buffer should have little endian byte order.

Parameters:
buffer - The buffer in which the message will be serialized, beginning at index 0.
Returns:
The length of the serialized message in bytes.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

getParamMessageFromBlob

public Message getParamMessageFromBlob(int index)
Gets the parameter at the given index with as a Message. The data type at the index must be of type blob (byte array). No type check is done.

Parameters:
index - The index.
Returns:
The parameter at the given index as Message.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

fromByteBuffer

public static Message fromByteBuffer(FastByteBuffer buffer)
Deserializes a message out of a byte array.

Parameters:
buffer - The buffer containing the data.
Returns:
The deserialized message or null if an error occurred.
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.

fromByteBufferChecked

public static Message fromByteBufferChecked(FastByteBuffer buffer)
                                     throws MessageDeserializationException
Deserializes a message out of a byte array.

Parameters:
buffer - the buffer containing the data
Returns:
the deserialized message
Throws:
MessageDeserializationException - if an error occurred during message deserialization
This element is an undocumented internal feature. It is not intended to be used by applications as it might change or be removed in future versions.


Copyright © 2019. All rights reserved.