public class GNetPackage extends java.lang.Object implements ProtocolPackage
| Modifier and Type | Field and Description |
|---|---|
static int |
GNET_CODE_ACK
a GNet acknowledge package
|
static int |
GNET_CODE_NAK
a GNet negative-acknowledge package
|
static int |
INDEX_HEADER |
| Constructor and Description |
|---|
GNetPackage(byte[] bBuffer,
int iOffset,
int iLength)
create a package from a byte array.
|
GNetPackage(byte bCode,
java.lang.String szParam,
boolean bIsAddCheckSum)
create a GNet package.
|
GNetPackage(char bCode,
java.lang.String szParam,
boolean bIsAddCheckSum)
create a GNet package.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getCommandSet()
get code of package
|
int |
getEventID() |
int |
getIntegerData()
get a data of package by integer value
|
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 |
isEvent()
it's a event of the GNetPlus package.
|
boolean |
isNAK()
it's a negative-acknowledge package.
|
byte[] |
toBytes()
get a byte array from package mBuffer.
|
public static final int INDEX_HEADER
public static final int GNET_CODE_ACK
public static final int GNET_CODE_NAK
public GNetPackage(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 GNetPackage(char bCode,
java.lang.String szParam,
boolean bIsAddCheckSum)
bCode - The request code.szParam - The parameters of the request code.bIsAddCheckSum - send command include the check sum.public GNetPackage(byte bCode,
java.lang.String szParam,
boolean bIsAddCheckSum)
bCode - The request code.szParam - The parameters of the request code.bIsAddCheckSum - send command include the check sum.public int getCommandSet()
getCommandSet in interface ProtocolPackagepublic boolean isEvent()
isEvent in interface ProtocolPackagepublic boolean isACK()
isACK in interface ProtocolPackagepublic boolean isNAK()
isNAK in interface ProtocolPackagepublic int getEventID()
getEventID in interface ProtocolPackagepublic int getLength()
public java.lang.String getStringData()
public byte[] getParameters()
getParameters in interface ProtocolPackagepublic int getIntegerData()
public boolean isCheckError()
isCheckError in interface ProtocolPackagepublic byte[] toBytes()
toBytes in interface ProtocolPackage