public class FtdiClient extends Object implements FtdiInterface
| Constructor and Description |
|---|
FtdiClient() |
| Modifier and Type | Method and Description |
|---|---|
int |
awaitEvent(int timeout)
Waits for an event.
|
void |
close()
Closes the device.
|
void |
enableEvents(int mask)
Enables events.
|
int |
getModemStatus()
Gets the modem status.
|
int |
getQueueStatus()
Gets the read queue status.
|
void |
open(int index,
String serial)
Opens a local device.
|
void |
open(String node,
int index,
String serial)
Opens a remote device.
|
int |
read(byte[] data)
Reads data.
|
int |
read(byte[] data,
int offset,
int count)
Reads data.
|
void |
setBaudrate(int baudrate)
Sets the baud rate.
|
void |
setDataCharacteristics(int wordLength,
int stopBits,
int parity)
Sets the data characteristics.
|
void |
setDtr(boolean set)
Sets the state of the DTR line.
|
void |
setFlowControl(int flow)
Sets the flow control.
|
void |
setRts(boolean set)
Sets the state of the RTS line.
|
void |
setTimeouts(int rcveTimeout,
int xmitTimeout)
Sets the timeouts.
|
int |
write(byte[] data)
Writes data.
|
int |
write(byte[] data,
int offset,
int count)
Writes data.
|
public void open(int index,
String serial)
throws org.lsst.ccs.drivers.commons.DriverException
open in interface FtdiInterfaceindex - The zero-based index of the FTDI device within the
list selected by the serial argument.serial - A string which, if non-null and non-empty, restricts
the list of available devices to those with a serial
number containing this string.org.lsst.ccs.drivers.commons.DriverExceptionpublic void open(String node, int index, String serial) throws org.lsst.ccs.drivers.commons.DriverException
open in interface FtdiInterfacenode - The name of the node where the device is located.index - The zero-based index of the FTDI device within the
list selected by the serial argument.serial - A string which, if non-null and non-empty, restricts
the list of available devices to those with a serial
number containing this string.org.lsst.ccs.drivers.commons.DriverExceptionpublic void close()
throws org.lsst.ccs.drivers.commons.DriverException
close in interface FtdiInterfaceorg.lsst.ccs.drivers.commons.DriverExceptionpublic void setBaudrate(int baudrate)
throws org.lsst.ccs.drivers.commons.DriverException
setBaudrate in interface FtdiInterfacebaudrate - The baud rate ro setorg.lsst.ccs.drivers.commons.DriverExceptionpublic void setDataCharacteristics(int wordLength,
int stopBits,
int parity)
throws org.lsst.ccs.drivers.commons.DriverException
setDataCharacteristics in interface FtdiInterfacewordLength - The encoded word length to setstopBits - The encoded number of stop bits to setparity - The encoded parity value to setorg.lsst.ccs.drivers.commons.DriverExceptionpublic void setFlowControl(int flow)
throws org.lsst.ccs.drivers.commons.DriverException
setFlowControl in interface FtdiInterfaceflow - The encoded flow control value to setorg.lsst.ccs.drivers.commons.DriverExceptionpublic void setTimeouts(int rcveTimeout,
int xmitTimeout)
throws org.lsst.ccs.drivers.commons.DriverException
setTimeouts in interface FtdiInterfacercveTimeout - The receive timeout to set (ms)xmitTimeout - The transmit timeout to set (ms)org.lsst.ccs.drivers.commons.DriverExceptionpublic void setDtr(boolean set)
throws org.lsst.ccs.drivers.commons.DriverException
setDtr in interface FtdiInterfaceset - True to set the line; false to clear it.org.lsst.ccs.drivers.commons.DriverExceptionpublic void setRts(boolean set)
throws org.lsst.ccs.drivers.commons.DriverException
setRts in interface FtdiInterfaceset - True to set the line; false to clear it.org.lsst.ccs.drivers.commons.DriverExceptionpublic void enableEvents(int mask)
throws org.lsst.ccs.drivers.commons.DriverException
enableEvents in interface FtdiInterfacemask - Bit mask of events to be enabled.org.lsst.ccs.drivers.commons.DriverExceptionpublic int awaitEvent(int timeout)
throws org.lsst.ccs.drivers.commons.DriverException
awaitEvent in interface FtdiInterfacetimeout - The maximum time (msec) to wait; 0 means no timeout.org.lsst.ccs.drivers.commons.DriverExceptionpublic int read(byte[] data)
throws org.lsst.ccs.drivers.commons.DriverException
read in interface FtdiInterfacedata - A byte array to receive the read data.org.lsst.ccs.drivers.commons.DriverExceptionpublic int read(byte[] data,
int offset,
int count)
throws org.lsst.ccs.drivers.commons.DriverException
read in interface FtdiInterfacedata - A byte array to receive the read dataoffset - The offset in the array to the start of the datacount - The maximum number of bytes to readorg.lsst.ccs.drivers.commons.DriverExceptionpublic int write(byte[] data)
throws org.lsst.ccs.drivers.commons.DriverException
write in interface FtdiInterfacedata - A byte array containing the data to write.org.lsst.ccs.drivers.commons.DriverExceptionpublic int write(byte[] data,
int offset,
int count)
throws org.lsst.ccs.drivers.commons.DriverException
write in interface FtdiInterfacedata - A byte array containing the data to writeoffset - The offset in the array to the start of the datacount - The number of bytes to writeorg.lsst.ccs.drivers.commons.DriverExceptionpublic int getQueueStatus()
throws org.lsst.ccs.drivers.commons.DriverException
getQueueStatus in interface FtdiInterfaceorg.lsst.ccs.drivers.commons.DriverExceptionpublic int getModemStatus()
throws org.lsst.ccs.drivers.commons.DriverException
getModemStatus in interface FtdiInterfaceorg.lsst.ccs.drivers.commons.DriverExceptionCopyright © 2018 LSST. All rights reserved.