public abstract class BaseGNetPlusPackage extends java.lang.Object implements ProtocolPackage
Modifier and Type | Field and Description |
---|---|
protected static int |
INDEX_CODE |
static int |
MAX_LENGTH |
static int |
MAX_PARAMETER_LENGTH |
protected byte[] |
mBuffer |
protected boolean |
mGNetPlusPackage |
Constructor and Description |
---|
BaseGNetPlusPackage(byte[] bBuffer,
int iOffset,
int iLength)
create a package from a byte array.
|
BaseGNetPlusPackage(byte baddress,
byte commandSet,
byte[] params)
create a GNetPlus package.
|
Modifier and Type | Method and Description |
---|---|
int |
getAddress()
get address of package, the address is a machine ID.
|
int |
getCommandSet()
get code of package
|
int |
getEventID()
get ID of event of package
|
int |
getLength()
get data length of package
|
byte[] |
getParameters()
get a data of package by byte array
|
java.lang.String |
getStringData()
get a data of package by string
|
boolean |
isACK()
it's a acknowledge package.
|
boolean |
isCheckError()
the package is has a incorrect checksum, or not.
|
boolean |
isNAK()
it's a negative-acknowledge package.
|
byte[] |
toBytes()
get a byte array from package mBuffer.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isEvent
public static final int MAX_LENGTH
public static final int MAX_PARAMETER_LENGTH
protected static final int INDEX_CODE
protected boolean mGNetPlusPackage
protected byte[] mBuffer
public BaseGNetPlusPackage(byte[] bBuffer, int iOffset, int iLength)
bBuffer
- specifies the byte array to create.iOffset
- pointer to the offset address of the byte array to create.iLength
- specifies the length, in bytes, of the byte array to create.public BaseGNetPlusPackage(byte baddress, byte commandSet, byte[] params)
baddress
- The address of the device.commandSet
- The request code.params
- The parameters of the request code.public int getAddress()
public int getCommandSet()
getCommandSet
in interface ProtocolPackage
public int getEventID()
getEventID
in interface ProtocolPackage
public boolean isACK()
isACK
in interface ProtocolPackage
public boolean isNAK()
isNAK
in interface ProtocolPackage
public int getLength()
public boolean isCheckError()
isCheckError
in interface ProtocolPackage
public java.lang.String getStringData()
public byte[] getParameters()
getParameters
in interface ProtocolPackage
public byte[] toBytes()
toBytes
in interface ProtocolPackage