public interface RobotUsbDevice
RobotUsbDevice is an interface to USB devices that are commuicated with using
a serial communication stream. This is in contrast to more other USB devices that use
the full capabilities of USB. See http://www.usb.org/developers/defined_class.
Note that this is not to be confused with RobotUsbDeviceTty.| Modifier and Type | Interface and Description |
|---|---|
static class |
RobotUsbDevice.Channel |
static class |
RobotUsbDevice.FirmwareVersion |
static class |
RobotUsbDevice.USBIdentifiers |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the device
|
boolean |
getDebugRetainBuffers() |
DeviceManager.UsbDeviceType |
getDeviceType() |
RobotUsbDevice.FirmwareVersion |
getFirmwareVersion()
Returns the firmware version of this USB device, or null if no such version is known.
|
java.lang.String |
getProductName() |
SerialNumber |
getSerialNumber() |
RobotUsbDevice.USBIdentifiers |
getUsbIdentifiers()
Returns the USB-level vendor and product id of this device.
|
boolean |
isAttached()
Returns whether or not this USB device is known to be physically attached
|
boolean |
isOpen()
Returns whether the device is open or not
|
void |
logRetainedBuffers(long nsOrigin,
long nsTimerExpire,
java.lang.String tag,
java.lang.String format,
java.lang.Object... args) |
boolean |
mightBeAtUsbPacketStart()
Answers as to whether we're it's probably the case we're at the start of a Usb
packet.
|
int |
read(byte[] data,
int ibFirst,
int cbToRead,
long msTimeout,
TimeWindow timeWindow)
Reads a requested number of bytes from the device.
|
void |
requestReadInterrupt(boolean interruptRequested)
Interrupts any reads that are currently pending inside the device, possibly waiting
on a perhaps lengthy timeout.
|
void |
resetAndFlushBuffers()
Resets the remote USB device comm-layer as best we can.
|
void |
setBaudRate(int rate)
Sets the rate of data transmission used to communicate with the device.
|
void |
setBreak(boolean enable)
Sets or unsets a break state on the communication line
|
void |
setDataCharacteristics(byte dataBits,
byte stopBits,
byte parity)
Set the Data Characteristics
|
void |
setDebugRetainBuffers(boolean retain) |
void |
setDeviceType(DeviceManager.UsbDeviceType deviceType) |
void |
setFirmwareVersion(RobotUsbDevice.FirmwareVersion version)
Sets the firmware version of this USB device.
|
void |
setLatencyTimer(int latencyTimer)
Set the latency timer
|
void |
skipToLikelyUsbPacketStart()
Skips to the beginning of a USB packet, if not already there.
|
void |
write(byte[] data)
Write to device
|
void setDebugRetainBuffers(boolean retain)
boolean getDebugRetainBuffers()
void logRetainedBuffers(long nsOrigin,
long nsTimerExpire,
java.lang.String tag,
java.lang.String format,
java.lang.Object... args)
void setBaudRate(int rate)
throws RobotUsbException
rate - baud rateRobotUsbExceptionvoid setDataCharacteristics(byte dataBits,
byte stopBits,
byte parity)
throws RobotUsbException
dataBits - data bitsstopBits - stop bitsparity - parityRobotUsbExceptionvoid setLatencyTimer(int latencyTimer)
throws RobotUsbException
latencyTimer - latency timerRobotUsbExceptionvoid setBreak(boolean enable)
throws RobotUsbException
enable - whether or not to set a break stateRobotUsbExceptionvoid resetAndFlushBuffers()
throws RobotUsbException
RobotUsbExceptionvoid write(byte[] data)
throws java.lang.InterruptedException,
RobotUsbException
data - byte arrayjava.lang.InterruptedExceptionRobotUsbExceptionvoid skipToLikelyUsbPacketStart()
boolean mightBeAtUsbPacketStart()
int read(byte[] data,
int ibFirst,
int cbToRead,
long msTimeout,
TimeWindow timeWindow)
throws RobotUsbException,
java.lang.InterruptedException
data - byte array into which to read the dataibFirst - first index in data at which to read the datacbToRead - number of bytes to readmsTimeout - amount of time to wait, in ms, for data to become available to readtimeWindow - optional place to return information as to when the data was readRobotUsbExceptionjava.lang.InterruptedExceptionvoid requestReadInterrupt(boolean interruptRequested)
void close()
boolean isOpen()
boolean isAttached()
RobotUsbDevice.FirmwareVersion getFirmwareVersion()
setFirmwareVersion(FirmwareVersion)void setFirmwareVersion(RobotUsbDevice.FirmwareVersion version)
getFirmwareVersion()RobotUsbDevice.USBIdentifiers getUsbIdentifiers()
SerialNumber getSerialNumber()
java.lang.String getProductName()
void setDeviceType(DeviceManager.UsbDeviceType deviceType)
DeviceManager.UsbDeviceType getDeviceType()