ProtoCommandRequest
public abstract class ProtoCommandRequest<T> extends Object
Constructors
Name | Description |
---|---|
public ProtoCommandRequest()
|
Methods
getId
public final int getId()
All classes must call this api to include id to the ProtoRequest
ReturnValue
Name | Description |
---|---|
int
|
unique id ranging from 1 to 255. |
parseResponse
public abstract Result<T> parseResponse(byte[] response)
Parses the raw response received from the tag into aResultobject.
Parameters
Name | Description |
---|---|
byte[] response
|
the response received from the tag |
ReturnValue
Name | Description |
---|---|
Result<T>
|
a Result with either the parsed data or an error. |
getRequest
public abstract <ProtoRequest extends
Returns the request to be sent to the tag.
ReturnValue
Name | Description |
---|---|
ProtoRequest
|
getExtension
public
Returns an extension from proto to parse the base response to the required form.
ReturnValue
Name | Description |
---|---|
|
responseId
public int responseId()
Returns the response id from the tag.
ReturnValue
Name | Description |
---|---|
int
|
setResponseId
public void setResponseId(int id)
Sets the response id from the tag. Should be called by the ProtoCommandRequest if excludeResponseErrorChecks returns true.
Parameters
Name | Description |
---|---|
int id
|
ReturnValue
Name | Description |
---|---|
void
|
excludeResponseErrorChecks
public boolean excludeResponseErrorChecks()
Excludes response status check for the implementation. Need to call setResponseId(id) from parseResponse(byte[]) if returned true.
ReturnValue
Name | Description |
---|---|
boolean
|
responseErrorCheck
public Result<T> responseErrorCheck(byte[] response)
Parameters
Name | Description |
---|---|
byte[] response
|
ReturnValue
Name | Description |
---|---|
Result<T>
|
toString
public String toString()
ReturnValue
Name | Description |
---|---|
String
|
Base interface for all command send to the tag.