org.avineas.fins.payload
public class Response extends Payload
Modifier and Type | Field and Description |
---|---|
static int |
RESPONSEOK
OK response, meaning that the command was processes successfully.
|
MAXPAYLOADSIZE
Constructor and Description |
---|
Response(byte[] payload) |
Response(Command command,
int responseCode)
Convience constructor that creates a simple response
|
Response(Command command,
int responseCode,
byte[] contents)
Constructor that creates a response from a command with a specific
response code and data.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
getContents()
Get the contents of this response (meaning: the data after the
response code).
|
int |
getMainCode()
Get the main response code.
|
int |
getResponseCode()
Get the response code from this response.
|
java.lang.String |
getResponseCodeAsString()
Get the string representation of this response code.
|
int |
getSubCode()
Get the sub response code.
|
void |
setContents(byte[] contents)
Set the contents of the response, meaning the additional data
without response code.
|
void |
setResponseCode(int code) |
decode, encode, getBytes, getBytes, getMrc, getRequestCode, getSrc, setMrc, setRequestCode, setRequestCode, setSrc
public static final int RESPONSEOK
public Response(byte[] payload)
public Response(Command command, int responseCode, byte[] contents)
command
- The command to create the response forresponseCode
- The response codecontents
- The contents to passpublic Response(Command command, int responseCode)
command
- The command to which this response is a reactionresponseCode
- The response code, 0 is successpublic int getResponseCode()
public void setResponseCode(int code)
public int getMainCode()
public int getSubCode()
public java.lang.String getResponseCodeAsString()
public void setContents(byte[] contents)
contents
- The contents as byte arraypublic byte[] getContents()