AnnotatorComm::FTD2XX::FTD2XX Class Reference

#include <FTD2XX.h>

List of all members.

Public Member Functions

 FTD2XX (FTD2XXDeviceInfo &info) throw (IOException)
 ~FTD2XX ()
void close () throw (IOException)
FTD2XXDeviceInfo getDeviceInfo () throw (IOException)
InputStreamgetInputStream () throw (IOException)
OutputStreamgetOutputStream () throw (IOException)
int read (uint8_t *buffer, int length) throw (IOException)
int write (uint8_t *buffer, int length) throw (IOException)
int available () throw (IOException)
void setTimeouts (int rxTimeout, int txTimeout) throw (IOException)
void setBaudRate (int rate) throw (IOException)
void setDataCharacteristics (FTD2XXDataBits dataBits, FTD2XXStopBits stopBits, FTD2XXParity parity) throw (IOException)
void setFlowControl (FTD2XXFlowControl flowControl, char xon, char xoff) throw (IOException)

Static Public Member Functions

static int getNumberOfDevices () throw (IOException)
static vector< FTD2XXDeviceInfogetDeviceInfoList () throw (IOException)


Detailed Description

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;

 cout << "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
 device.close();
 

Definition at line 82 of file FTD2XX.h.


Constructor & Destructor Documentation

AnnotatorComm::FTD2XX::FTD2XX::FTD2XX ( FTD2XXDeviceInfo info  )  throw (IOException)

Construct a FTD2XX

Parameters:
info device info
Exceptions:
IOException failure to open device

AnnotatorComm::FTD2XX::FTD2XX::~FTD2XX (  ) 

FTD2XX destructor


Member Function Documentation

int AnnotatorComm::FTD2XX::FTD2XX::available (  )  throw (IOException)

Get the number of bytes available to read.

Returns:
number of bytes available to read
Exceptions:
IOException failure to get number of bytes available

void AnnotatorComm::FTD2XX::FTD2XX::close (  )  throw (IOException)

Close the device and its I/O stream. All method calls throw an IOException once close() has been called. Further access to the device requires it to be reopened with a new FTD2XX object.

Exceptions:
IOException failure to close

FTD2XXDeviceInfo AnnotatorComm::FTD2XX::FTD2XX::getDeviceInfo (  )  throw (IOException)

Get information about the device.

Returns:
device information

static vector<FTD2XXDeviceInfo> AnnotatorComm::FTD2XX::FTD2XX::getDeviceInfoList (  )  throw (IOException) [static]

Get a listing of devices and information about their current state.

Returns:
device listing
Exceptions:
IOException failure to get listing

InputStream* AnnotatorComm::FTD2XX::FTD2XX::getInputStream (  )  throw (IOException)

Get an input stream to the device.

Returns:
device input stream
Exceptions:
IOException failure to get stream

static int AnnotatorComm::FTD2XX::FTD2XX::getNumberOfDevices (  )  throw (IOException) [static]

Get the number of devices connected.

Returns:
number of devices connected
Exceptions:
IOException failure to get number of devices

OutputStream* AnnotatorComm::FTD2XX::FTD2XX::getOutputStream (  )  throw (IOException)

Get an output stream to the device.

Returns:
device output stream
Exceptions:
IOException failure to get stream

int AnnotatorComm::FTD2XX::FTD2XX::read ( uint8_t *  buffer,
int  length 
) throw (IOException)

Fill a buffer from the device.

Parameters:
buffer buffer to fill
length buffer length
Returns:
number of bytes read
Exceptions:
IOException failure to read

void AnnotatorComm::FTD2XX::FTD2XX::setBaudRate ( int  rate  )  throw (IOException)

Set the baud rate.

Parameters:
rate baud rate
Exceptions:
IOException failure to set baud rate

void AnnotatorComm::FTD2XX::FTD2XX::setDataCharacteristics ( FTD2XXDataBits  dataBits,
FTD2XXStopBits  stopBits,
FTD2XXParity  parity 
) throw (IOException)

Set data bits, stop bits, and parity.

Parameters:
dataBits number of data bits
stopBits number of stop bits
parity parity type
Exceptions:
IOException failure to set data characteristics

void AnnotatorComm::FTD2XX::FTD2XX::setFlowControl ( FTD2XXFlowControl  flowControl,
char  xon,
char  xoff 
) throw (IOException)

Set the flow control mode specifying Xon and Xoff values.

Parameters:
flowControl flow control mode
xon Xon value
xoff Xoff value
Exceptions:
IOException failure to set mode

void AnnotatorComm::FTD2XX::FTD2XX::setTimeouts ( int  rxTimeout,
int  txTimeout 
) throw (IOException)

Set the RX and TX timeouts.

Parameters:
rxTimeout RX timeout in ms
txTimeout TX timeout in ms
Exceptions:
IOException failure to set timeouts

int AnnotatorComm::FTD2XX::FTD2XX::write ( uint8_t *  buffer,
int  length 
) throw (IOException)

Write a buffer to the device.

Parameters:
buffer buffer to write
length buffer length
Returns:
number of bytes written
Exceptions:
IOException failure to write buffer


The documentation for this class was generated from the following file:
Generated on Thu Jul 27 11:05:04 2006 for libAnnotatorComm by  doxygen 1.4.7