|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ionetrics.lib.annotatorcomm.ftd2xx.FTD2XX
public class FTD2XX
This class provides a device interface to FTDI's FTD2XX devices through their D2XX drivers. This is the primary class for device interaction.
Typical use:FTD2XX device; InputStream in; OutputStream out; System.out.println("Devices present: " + FTD2XX.getNumberOfDevices()); for (FTD2XXDeviceInfo info : FTD2XX.getDeviceInfoList()) System.out.println(" " + info); device = new FTD2XX(FTD2XX.getDeviceInfoList()); in = device.getInputStream(); out = device.getOutputStream(); ... // configure device (baud rate, parity, data bits, stop bits, flow control, etc) ... // communicate through the I/O streams in.close(); out.close(); device.close();
Constructor Summary | |
---|---|
FTD2XX(FTD2XXDeviceInfo deviceInfo)
Construct a FTD2XX object and open the device. |
Method Summary | |
---|---|
void |
close()
Close the device and its I/O stream. |
protected void |
finalize()
Release device resources. |
FTD2XXDeviceInfo |
getDeviceInfo()
Get information about the device. |
static FTD2XXDeviceInfo[] |
getDeviceInfoList()
Get a listing of devices and information about their current state. |
java.io.InputStream |
getInputStream()
Get an input stream to the device. |
static int |
getNumberOfDevices()
Get the number of devices connected. |
java.io.OutputStream |
getOutputStream()
Get an output stream to the device. |
void |
purge(FTD2XXPurge purge)
Purge RXTX buffers according to purge options. |
void |
reset()
Reset the device. |
void |
setBaudRate(int rate)
Set the baud rate. |
void |
setDataCharacteristics(FTD2XXDataBits dataBits,
FTD2XXStopBits stopBits,
FTD2XXParity parity)
Set data bits, stop bits, and parity. |
void |
setDivisor(int divisor)
Set baud rate divisor. |
void |
setFlowControl(FTD2XXFlowControl flowControl)
Set the flow control mode. |
void |
setFlowControl(FTD2XXFlowControl flowControl,
char xon,
char xoff)
Set the flow control mode specifying Xon and Xoff values. |
void |
setTimeouts(int rxTimeout,
int txTimeout)
Set the RX and TX timeouts. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FTD2XX(FTD2XXDeviceInfo deviceInfo) throws java.io.IOException
deviceInfo
- device information
java.io.IOException
- failure to opengetDeviceInfoList()
Method Detail |
---|
public void close() throws java.io.IOException
close
in interface java.io.Closeable
java.io.IOException
- failure to closeprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- failure to release resourcespublic java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
- failure to get streampublic java.io.OutputStream getOutputStream() throws java.io.IOException
java.io.IOException
- failure to get streampublic FTD2XXDeviceInfo getDeviceInfo() throws java.io.IOException
java.io.IOException
public void purge(FTD2XXPurge purge) throws java.io.IOException
purge
- purge options
java.io.IOException
- failure to purgepublic void setTimeouts(int rxTimeout, int txTimeout) throws java.io.IOException
rxTimeout
- RX timeout in mstxTimeout
- TX timeout in ms
java.io.IOException
- failure to set timeoutspublic void setBaudRate(int rate) throws java.io.IOException
rate
- baud rate
java.io.IOException
- failure to set baud ratepublic void setDivisor(int divisor) throws java.io.IOException
divisor
- baud rate divisor
java.io.IOException
- failure to set divisorpublic void setDataCharacteristics(FTD2XXDataBits dataBits, FTD2XXStopBits stopBits, FTD2XXParity parity) throws java.io.IOException
dataBits
- number of data bitsstopBits
- number of stop bitsparity
- parity type
java.io.IOException
- failure to set data characteristicspublic void setFlowControl(FTD2XXFlowControl flowControl) throws java.io.IOException
flowControl
- flow control mode
java.io.IOException
- failure to set modepublic void setFlowControl(FTD2XXFlowControl flowControl, char xon, char xoff) throws java.io.IOException
flowControl
- flow control modexon
- Xon valuexoff
- Xoff value
java.io.IOException
- failure to set modepublic void reset() throws java.io.IOException
java.io.IOException
- failure to resetpublic static int getNumberOfDevices() throws java.io.IOException
java.io.IOException
- failure to get number of devicespublic static FTD2XXDeviceInfo[] getDeviceInfoList() throws java.io.IOException
java.io.IOException
- failure to get listing
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |