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, setFirmwareVersion
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDeviceType, getFirmwareVersion, getSerialNumber, setDeviceType, setFirmwareVersion
public static final java.lang.String TAG
public static boolean DEBUG
public RobotUsbDeviceFtdi(FtDevice device, SerialNumber serialNumber)
public java.lang.String getTag()
getTag
in class RobotUsbDeviceImplBase
public void setDebugRetainBuffers(boolean retain)
setDebugRetainBuffers
in interface RobotUsbDevice
public boolean getDebugRetainBuffers()
getDebugRetainBuffers
in interface RobotUsbDevice
public void logRetainedBuffers(long nsTimerStart, long nsTimerExpire, java.lang.String tag, java.lang.String format, java.lang.Object... args)
logRetainedBuffers
in interface RobotUsbDevice
public void setBaudRate(int rate) throws RobotUsbException
RobotUsbDevice
setBaudRate
in interface RobotUsbDevice
rate
- baud rateRobotUsbException
public void setDataCharacteristics(byte dataBits, byte stopBits, byte parity) throws RobotUsbException
RobotUsbDevice
setDataCharacteristics
in interface RobotUsbDevice
dataBits
- data bitsstopBits
- stop bitsparity
- parityRobotUsbException
public void setLatencyTimer(int latencyTimer) throws RobotUsbException
RobotUsbDevice
setLatencyTimer
in interface RobotUsbDevice
latencyTimer
- latency timerRobotUsbException
public void setBreak(boolean enable) throws RobotUsbException
RobotUsbDevice
setBreak
in interface RobotUsbDevice
enable
- whether or not to set a break stateRobotUsbException
public void resetAndFlushBuffers() throws RobotUsbException
RobotUsbDevice
resetAndFlushBuffers
in interface RobotUsbDevice
RobotUsbException
public void write(byte[] data) throws java.lang.InterruptedException, RobotUsbException
RobotUsbDevice
write
in interface RobotUsbDevice
data
- byte arrayjava.lang.InterruptedException
RobotUsbException
public int read(byte[] data, int ibFirst, int cbToRead, long msTimeout, TimeWindow timeWindow) throws RobotUsbException, java.lang.InterruptedException
RobotUsbDevice
read
in interface RobotUsbDevice
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 readRobotUsbException
java.lang.InterruptedException
public boolean mightBeAtUsbPacketStart()
RobotUsbDevice
mightBeAtUsbPacketStart
in interface RobotUsbDevice
public void skipToLikelyUsbPacketStart()
RobotUsbDevice
skipToLikelyUsbPacketStart
in interface RobotUsbDevice
public void requestReadInterrupt(boolean interruptRequested)
RobotUsbDevice
requestReadInterrupt
in interface RobotUsbDevice
public void close()
RobotUsbDevice
close
in interface RobotUsbDevice
public boolean isOpen()
RobotUsbDevice
isOpen
in interface RobotUsbDevice
public boolean isAttached()
RobotUsbDevice
isAttached
in interface RobotUsbDevice
public RobotUsbDevice.USBIdentifiers getUsbIdentifiers()
RobotUsbDevice
getUsbIdentifiers
in interface RobotUsbDevice
public java.lang.String getProductName()
getProductName
in interface RobotUsbDevice
public boolean supportsCbusBitbang()
public void cbus_setup(int mask, int init) throws java.lang.InterruptedException, RobotUsbException
java.lang.InterruptedException
RobotUsbException
public void cbus_write(int outputs) throws java.lang.InterruptedException, RobotUsbException
java.lang.InterruptedException
RobotUsbException