|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ionetrics.lib.annotatorcomm.ResponseMessage
public class ResponseMessage
ResponseMessage encapsulates the bytes of a response message and provides helpful methods for reading its values.
Field Summary | |
---|---|
static int |
CHECKSUM_RIDX
Checksum reverse index |
static int |
CMD_ID_IDX
Command ID index |
static int |
FOOTER_LEN
Length of the footer in bytes |
static int |
HEADER_LEN
Length of the header in bytes |
static int |
MSG_LEN_IDX
Message length index |
static byte |
RESP_FAILED
Response Code: Failed to execute (but the Command ID was valid), see Status Code for details |
static byte |
RESP_SUCCESS
Response Code: Success |
static byte |
RESP_UNSUPPORTED
Response Code: Unsupported Command ID |
static int |
RESPONSE_IDX
Response code index |
static int |
STATUS_IDX
Status code index |
static byte |
STATUS_INVALID_IN_CURRENT_CONFIG
Status Code: Invalid command in the current configuration |
static byte |
STATUS_UNSPECIFIED
Status Code: Unspecified failure |
static byte |
STATUS_UNSUPPORTED
Status Code: Unsupported command or subcommand |
Constructor Summary | |
---|---|
ResponseMessage(byte[] rsp)
Construct a ResponseMessage. |
Method Summary | |
---|---|
void |
errorCheck()
Error check the response. |
byte[] |
getBytes()
Get the response message's bytes. |
byte |
getChecksum()
Get the response checksum. |
short |
getId()
Get the Command ID. |
int |
getNextParamAsInt16()
Get the next parameter as a 16-bit integer. |
int |
getNextParamAsInt32()
Get the next parameter as a 32-bit integer. |
long |
getNextParamAsInt64()
Get the next parameter as a 64-bit integer. |
byte |
getNextParamAsInt8()
Get the next parameter as an 8-bit integer. |
int |
getNextParamAsUInt16()
Get the next parameter as an unsigned 16-bit integer. |
long |
getNextParamAsUInt32()
Get the next parameter as an unsigned 32-bit integer. |
int |
getNextParamAsUInt8()
Get the next parameter as an unsigned 8-bit integer. |
byte[] |
getParamBytes()
Get the response message's parameter bytes. |
byte |
getResponse()
Get the response code. |
int |
getRespParamLen()
Get the length of the response parameter bytes |
byte |
getStatus()
Get the response status code. |
java.lang.String |
getStatusMessage()
Get the status as a human readble String. |
void |
resetParamPointer()
Restart the parameter index. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HEADER_LEN
public static final int FOOTER_LEN
public static final int MSG_LEN_IDX
public static final int CMD_ID_IDX
public static final int RESPONSE_IDX
public static final int STATUS_IDX
public static final int CHECKSUM_RIDX
public static final byte RESP_SUCCESS
public static final byte RESP_FAILED
public static final byte RESP_UNSUPPORTED
public static final byte STATUS_UNSPECIFIED
public static final byte STATUS_UNSUPPORTED
public static final byte STATUS_INVALID_IN_CURRENT_CONFIG
Constructor Detail |
---|
public ResponseMessage(byte[] rsp)
rsp
- response message bytesMethod Detail |
---|
public short getId()
public byte getResponse()
public byte getStatus()
public java.lang.String getStatusMessage() throws CommandDependentStatusException
CommandDependentStatusException
- thrown on command dependent statuspublic void resetParamPointer()
getNextParamAsInt8()
,
getNextParamAsUInt8()
,
getNextParamAsInt16()
,
getNextParamAsUInt16()
,
getNextParamAsInt32()
,
getNextParamAsUInt32()
public byte getNextParamAsInt8() throws java.io.IOException
java.io.IOException
public int getNextParamAsUInt8() throws java.io.IOException
java.io.IOException
public int getNextParamAsInt16() throws java.io.IOException
java.io.IOException
public int getNextParamAsUInt16() throws java.io.IOException
java.io.IOException
public int getNextParamAsInt32() throws java.io.IOException
java.io.IOException
public long getNextParamAsUInt32() throws java.io.IOException
java.io.IOException
public long getNextParamAsInt64() throws java.io.IOException
java.io.IOException
public byte getChecksum()
public int getRespParamLen()
public byte[] getParamBytes() throws java.io.IOException
java.io.IOException
public byte[] getBytes()
public void errorCheck() throws CommandDependentStatusException, CommandFailedException, CommandUnsupportedException, java.io.IOException
CommandChecksumFailedException
- thrown if the checksum failed
CommandDependentStatusException
- thrown on command dependent status code
CommandFailedException
- thrown on command failure
CommandUnsupportedException
- thrown on unsupported command
java.io.IOException
- thrown for all other I/O failures
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |