public class DefaultUsbIrp extends java.lang.Object implements UsbIrp
The behavior and defaults follow those defined in the interface.
Any of the fields may be updated if the default is not appropriate; in most cases
the data will be the only field that needs to be set.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
acceptShortPacket |
protected int |
actualLength |
protected boolean |
complete |
protected byte[] |
data |
protected int |
length |
protected int |
offset |
protected UsbException |
usbException |
| Constructor and Description |
|---|
DefaultUsbIrp()
Constructor.
|
DefaultUsbIrp(byte[] data)
Constructor.
|
DefaultUsbIrp(byte[] data,
int offset,
int length,
boolean shortPacket)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
complete()
Complete this submission.
|
boolean |
getAcceptShortPacket()
Get the Short Packet policy.
|
int |
getActualLength()
Get the actual length.
|
byte[] |
getData()
Get the data.
|
int |
getLength()
Get the length.
|
int |
getOffset()
Get the offset.
|
UsbException |
getUsbException()
Get the UsbException.
|
boolean |
isComplete()
If this is complete.
|
boolean |
isUsbException()
If a UsbException occurred.
|
void |
setAcceptShortPacket(boolean accept)
Set the Short Packet policy.
|
void |
setActualLength(int l)
Set the actual length.
|
void |
setComplete(boolean b)
Set this as complete (or not).
|
void |
setData(byte[] d)
Set the data.
|
void |
setData(byte[] d,
int o,
int l)
Set the data, offset, and length.
|
void |
setLength(int l)
Set the length.
|
void |
setOffset(int o)
Set the offset.
|
void |
setUsbException(UsbException exception)
Set the UsbException.
|
void |
waitUntilComplete()
Wait until
complete. |
void |
waitUntilComplete(long timeout)
Wait until
complete, or the timeout has expired. |
protected byte[] data
protected boolean complete
protected boolean acceptShortPacket
protected int offset
protected int length
protected int actualLength
protected UsbException usbException
public DefaultUsbIrp()
public DefaultUsbIrp(byte[] data)
data - The data.java.lang.IllegalArgumentException - If the data is null.public DefaultUsbIrp(byte[] data,
int offset,
int length,
boolean shortPacket)
data - The data.offset - The offset.length - The length.shortPacket - The Short Packet policy.java.lang.IllegalArgumentException - If the data is null, or the offset and/or length is negative.public byte[] getData()
public int getOffset()
public int getLength()
public int getActualLength()
getActualLength in interface UsbIrppublic void setData(byte[] d,
int o,
int l)
throws java.lang.IllegalArgumentException
public void setData(byte[] d)
throws java.lang.IllegalArgumentException
public void setOffset(int o)
throws java.lang.IllegalArgumentException
public void setLength(int l)
throws java.lang.IllegalArgumentException
public void setActualLength(int l)
throws java.lang.IllegalArgumentException
setActualLength in interface UsbIrpl - The actual length.java.lang.IllegalArgumentException - If the length is negative.public boolean isUsbException()
isUsbException in interface UsbIrppublic UsbException getUsbException()
getUsbException in interface UsbIrppublic void setUsbException(UsbException exception)
setUsbException in interface UsbIrpexception - The UsbException.public boolean getAcceptShortPacket()
getAcceptShortPacket in interface UsbIrppublic void setAcceptShortPacket(boolean accept)
setAcceptShortPacket in interface UsbIrpaccept - The Short Packet policy.public boolean isComplete()
isComplete in interface UsbIrppublic void setComplete(boolean b)
setComplete in interface UsbIrpb - If this is complete (or not).public void complete()
This will:
Set this complete.waiting Threads.public void waitUntilComplete()
waitUntilComplete in interface UsbIrppublic void waitUntilComplete(long timeout)
complete, or the timeout has expired.
This will block until this is complete,
or the timeout has expired. If the timeout is 0 or less,
this behaves as the no-timeout method.
waitUntilComplete in interface UsbIrptimeout - The maximum number of milliseconds to wait.