|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.kuka.roboticsAPI.controllerModel.sunrise.connectionLib.Message
public class Message
A message is used to send data over the connection lib. A message can hold parameters, has a id and a type.
| 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 |
|---|
public static final int MAX_SUNRISE_LENGTH
public static final int ParameterNameLength
| Constructor Detail |
|---|
public Message()
public Message(long id)
id - The id of the message.
public Message(long id,
int type)
id - The id of the message.type - The type of the message.| Method Detail |
|---|
public void addParam(double value)
value - The value of the parameter.public void addParam(int value)
value - The value of the parameter.public void addParamLong(long value)
value - The value of the parameter.SerializableBLOB.createFromLongInteger(long)public void addParam(byte[] value)
value - The value of the parameter.public void addParam(double[] value)
value - The value of the parameter.public void addParam(int[] value)
value - The value of the parameter.public void addParam(String value)
value - The value of the parameter.public void addParam(ISerializableType value)
value - The value of the parameter.public void clear()
public void clearParams()
public void setType(MessageType messageType)
messageType - The type the message should have.public void setType(int messageType)
messageType - The type the message should have.public final void setId(long messageId)
messageId - The id of the message.public long getId()
public int getType()
public int getMessageLength()
public Iterable<ISerializableType> getParameters()
public int getParamCount()
public ISerializableType getParam(int index)
index - The index.
public ISerializableType getParam(String paramName)
paramName - The parameter name.
null.public byte[] getParamBlob(int index)
index - The index.
public byte[] getParamBlob(String paramName)
paramName - The parameter name.
public int[] getParamIntArray(int index)
index - The index.
public int[] getParamIntArray(String paramName)
paramName - The parameter name.
public double[] getParamDoubleArray(int index)
index - The index.
public double[] getParamDoubleArray(String paramName)
paramName - The parameter name.
public int getParamInt(int index)
index - The index.
public int getParamInt(String paramName)
paramName - The parameter name.
public long getParamLong(int index)
index - The index.
public long getParamLong(String paramName)
paramName - The parameter name.
public double getParamDouble(int index)
index - The index.
public double getParamDouble(String paramName)
paramName - The parameter name.
public String getParamString(int index)
index - The index.
public String getParamString(String paramName)
paramName - The parameter name.
public Class<? extends Object> getParamType(int index)
index - The index.
public String getParamName(int index)
index - The index.
public String toString()
toString in class Object
public void markAsError(String errorMessage,
int errorCode,
String kxrModule,
String kxrId)
errorMessage - the error string to transmit.errorCode - the error code describing why the SSR execution failedkxrModule - the name of the KXR module needed for localisationkxrId - the id of the KXR key needed for localisationpublic int toByteBuffer(FastByteBuffer buffer)
buffer - The buffer in which the message will be serialized, beginning
at index 0.
public Message getParamMessageFromBlob(int index)
index - The index.
public static Message fromByteBuffer(FastByteBuffer buffer)
buffer - The buffer containing the data.
public static Message fromByteBufferChecked(FastByteBuffer buffer)
throws MessageDeserializationException
buffer - the buffer containing the data
MessageDeserializationException - if an error occurred during message deserialization
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||