org.jSyncManager.API.Protocol
Class USB_Packet
java.lang.Objectorg.jSyncManager.API.Protocol.USB_Packet
- Serializable
public class USB_Packet
extends java.lang.Object
implements Serializable
USB_Packet class.
This class holds a USB packet.
static byte | ABORT- A value to denote that this packet is an abort packet.
|
static byte | ACK- A value to denote that this packet is an ACKnowledgement packet.
|
static byte | DATA- A value to denote that this packet is a data packet.
|
static byte | NACK- A value to denote that this packet is a Negative ACKnowledgement packet.
|
static byte | TICKLE- A value to denote that this packet is a tickle packet.
|
byte[] | data- A byte array to hold this packets data portion.
|
int | packetSize- The size of this packet, in bytes.
|
byte | packetType- The packet type of the USB packet.
|
boolean | sent- A flag to denote wether or not this packet has been sent to the remote end.
|
byte | transactionID- This packets transaction ID.
|
USB_Packet(byte type, byte transID, byte[] data)- Create a new USB_Packet instance with the specified packet type, transaction ID, and data.
|
static USB_Packet | bytes2Packet(headerPkt[] , dataPkt[] )- Convert two arrays of bytes representing a USB packet header
and data to a USB_Packet instance.
|
static USB_Packet | bytes2Packet(pkt[] )- Convert an array of bytes representing a USB packet to a USB_Packet instance.
|
byte[] | packet2Bytes()- Converts this USB_Packet instance into a byte array suitable
for transmission to a handheld device.
|
String | toString()- Converts this object to a human-readable String.
|
ABORT
public static final byte ABORT
A value to denote that this packet is an abort packet.
Abort packets are used to terminate the synchronization operation.
ACK
public static final byte ACK
A value to denote that this packet is an ACKnowledgement packet.
DATA
public static final byte DATA
A value to denote that this packet is a data packet.
NACK
public static final byte NACK
A value to denote that this packet is a Negative ACKnowledgement packet.
Note that this type should not be used, as NACKs are unreliable,
and are not used by any handheld devices. It is provided here merely for the
sake of completeness.
TICKLE
public static final byte TICKLE
A value to denote that this packet is a tickle packet.
Tickle packets are used to keep the synchronization connection alive during
lengthy periods of processing. When received, the inter-packet timer is reset
and the tickle packet is discarded.
data
public byte[] data
A byte array to hold this packets data portion.
packetSize
public int packetSize
The size of this packet, in bytes.
packetType
public byte packetType
The packet type of the USB packet.
sent
public boolean sent
A flag to denote wether or not this packet has been sent to the remote end.
transactionID
public byte transactionID
This packets transaction ID.
USB_Packet
public USB_Packet(byte type,
byte transID,
byte[] data)Create a new USB_Packet instance with the specified packet type, transaction ID, and data.
type - the packet type.transID - the transaction ID for this packet.data - the data to be encapsulated within this packet.
bytes2Packet
public static USB_Packet bytes2Packet(headerPkt[] ,
dataPkt[] )Convert two arrays of bytes representing a USB packet header
and data to a USB_Packet instance.
- a USB_Packet representing the packet passed.
bytes2Packet
public static USB_Packet bytes2Packet(pkt[] )
Convert an array of bytes representing a USB packet to a USB_Packet instance.
- a USB_Packet representing the packet passed.
packet2Bytes
public byte[] packet2Bytes()
Converts this USB_Packet instance into a byte array suitable
for transmission to a handheld device.
- an array of bytes containing this packet instances data.
toString
public String toString()
Converts this object to a human-readable String.
- this object to a human-readable String.