public class Ftdi extends Object implements FtdiInterface
| Modifier and Type | Field and Description |
|---|---|
static int |
DATABITS_7
Word length value: 7 bits
|
static int |
DATABITS_8
Word length value: 8 bits
|
static int |
EVENT_LINE_STATUS
Event type: line status changed
|
static int |
EVENT_MODEM_STATUS
Event type: modem status changed
|
static int |
EVENT_RXCHAR
Event type: character received
|
static int |
FLOW_CONTROL_DTR_DSR
Flow control value: DTR/DSR
|
static int |
FLOW_CONTROL_NONE
Flow control value: none
|
static int |
FLOW_CONTROL_RTS_CTS
Flow control value: RTS/CTS
|
static int |
FLOW_CONTROL_XON_XOFF
Flow control value: XON/XOFF
|
static int |
MODEM_STATUS_CTS
Modem status bit: CTS
|
static int |
MODEM_STATUS_DCD
Modem status bit: DCD
|
static int |
MODEM_STATUS_DSR
Modem status bit: DSR
|
static int |
MODEM_STATUS_RI
Modem status bit: RI
|
static int |
PARITY_EVEN
Parity value: even
|
static int |
PARITY_MARK
Parity value: mark
|
static int |
PARITY_NONE
Parity value: none
|
static int |
PARITY_ODD
Parity value: odd
|
static int |
PARITY_SPACE
Parity value: space
|
static int |
STOPBITS_1
Stop bits value: 1
|
static int |
STOPBITS_2
Stop bits value: 2
|
| Constructor and Description |
|---|
Ftdi() |
| 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 local or 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 static final int DATABITS_8
public static final int DATABITS_7
public static final int STOPBITS_1
public static final int STOPBITS_2
public static final int PARITY_NONE
public static final int PARITY_ODD
public static final int PARITY_EVEN
public static final int PARITY_MARK
public static final int PARITY_SPACE
public static final int MODEM_STATUS_CTS
public static final int MODEM_STATUS_DSR
public static final int MODEM_STATUS_RI
public static final int MODEM_STATUS_DCD
public static final int FLOW_CONTROL_NONE
public static final int FLOW_CONTROL_RTS_CTS
public static final int FLOW_CONTROL_DTR_DSR
public static final int FLOW_CONTROL_XON_XOFF
public static final int EVENT_RXCHAR
public static final int EVENT_MODEM_STATUS
public static final int EVENT_LINE_STATUS
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, or
null to specify a local device.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 to set.org.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 set.stopBits - The encoded number of stop bits to set.parity - The encoded parity value to set.org.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 set.org.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). A value of 0
means no timeout.xmitTimeout - The transmit timeout to set (ms). A value of 0
means no timeout.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 data.offset - The offset in the array to the start of the data.count - The maximum number of bytes to read.org.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 write.offset - The offset in the array to the start of the data.count - The number of bytes to write.org.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 © 2015 LSST. All rights reserved.