public class RobotUsbDeviceFtdi extends RobotUsbDeviceImplBase implements RobotUsbDevice
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
RobotUsbDeviceFtdi.RunnableWithRobotUsbCommException |
RobotUsbDevice.Channel, RobotUsbDevice.FirmwareVersion, RobotUsbDevice.USBIdentifiers| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
static java.lang.String |
TAG |
deviceType, deviceTypes, extantDevices, firmwareVersion, serialNumber| Constructor and Description |
|---|
RobotUsbDeviceFtdi(FtDevice device,
SerialNumber serialNumber) |
| Modifier and Type | Method and Description |
|---|---|
void |
cbus_setup(int mask,
int init) |
void |
cbus_write(int outputs) |
void |
close()
Closes the device
|
boolean |
getDebugRetainBuffers() |
java.lang.String |
getProductName() |
java.lang.String |
getTag() |
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 nsTimerStart,
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 |
setLatencyTimer(int latencyTimer)
Set the latency timer
|
void |
skipToLikelyUsbPacketStart()
Skips to the beginning of a USB packet, if not already there.
|
boolean |
supportsCbusBitbang() |
void |
write(byte[] data)
Write to device
|
dumpBytesReceived, dumpBytesSent, getDeviceType, getDeviceType, getExtantDevices, getFirmwareVersion, getSerialNumber, isOpen, removeFromExtantDevices, setDeviceType, setFirmwareVersionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetDeviceType, getFirmwareVersion, getSerialNumber, setDeviceType, setFirmwareVersionpublic static final java.lang.String TAG
public static boolean DEBUG
public RobotUsbDeviceFtdi(FtDevice device,
SerialNumber serialNumber)
public java.lang.String getTag()
getTag in class RobotUsbDeviceImplBasepublic void setDebugRetainBuffers(boolean retain)
setDebugRetainBuffers in interface RobotUsbDevicepublic boolean getDebugRetainBuffers()
getDebugRetainBuffers in interface RobotUsbDevicepublic void logRetainedBuffers(long nsTimerStart,
long nsTimerExpire,
java.lang.String tag,
java.lang.String format,
java.lang.Object... args)
logRetainedBuffers in interface RobotUsbDevicepublic void setBaudRate(int rate)
throws RobotUsbException
RobotUsbDevicesetBaudRate in interface RobotUsbDevicerate - baud rateRobotUsbExceptionpublic void setDataCharacteristics(byte dataBits,
byte stopBits,
byte parity)
throws RobotUsbException
RobotUsbDevicesetDataCharacteristics in interface RobotUsbDevicedataBits - data bitsstopBits - stop bitsparity - parityRobotUsbExceptionpublic void setLatencyTimer(int latencyTimer)
throws RobotUsbException
RobotUsbDevicesetLatencyTimer in interface RobotUsbDevicelatencyTimer - latency timerRobotUsbExceptionpublic void setBreak(boolean enable)
throws RobotUsbException
RobotUsbDevicesetBreak in interface RobotUsbDeviceenable - whether or not to set a break stateRobotUsbExceptionpublic void resetAndFlushBuffers()
throws RobotUsbException
RobotUsbDeviceresetAndFlushBuffers in interface RobotUsbDeviceRobotUsbExceptionpublic void write(byte[] data)
throws java.lang.InterruptedException,
RobotUsbException
RobotUsbDevicewrite in interface RobotUsbDevicedata - byte arrayjava.lang.InterruptedExceptionRobotUsbExceptionpublic int read(byte[] data,
int ibFirst,
int cbToRead,
long msTimeout,
TimeWindow timeWindow)
throws RobotUsbException,
java.lang.InterruptedException
RobotUsbDeviceread in interface RobotUsbDevicedata - 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.InterruptedExceptionpublic boolean mightBeAtUsbPacketStart()
RobotUsbDevicemightBeAtUsbPacketStart in interface RobotUsbDevicepublic void skipToLikelyUsbPacketStart()
RobotUsbDeviceskipToLikelyUsbPacketStart in interface RobotUsbDevicepublic void requestReadInterrupt(boolean interruptRequested)
RobotUsbDevicerequestReadInterrupt in interface RobotUsbDevicepublic void close()
RobotUsbDeviceclose in interface RobotUsbDevicepublic boolean isOpen()
RobotUsbDeviceisOpen in interface RobotUsbDevicepublic boolean isAttached()
RobotUsbDeviceisAttached in interface RobotUsbDevicepublic RobotUsbDevice.USBIdentifiers getUsbIdentifiers()
RobotUsbDevicegetUsbIdentifiers in interface RobotUsbDevicepublic java.lang.String getProductName()
getProductName in interface RobotUsbDevicepublic boolean supportsCbusBitbang()
public void cbus_setup(int mask,
int init)
throws java.lang.InterruptedException,
RobotUsbException
java.lang.InterruptedExceptionRobotUsbExceptionpublic void cbus_write(int outputs)
throws java.lang.InterruptedException,
RobotUsbException
java.lang.InterruptedExceptionRobotUsbException