public final class SerialComFTDID2XX extends SerialComVendorLib
FTDI provides two interfaces for their USB-UART ICs; first interface is Virtual COM port and second is provided via a proprietary DLL (a.k.a. D2XX). The D2XX interface provides special functions that are not available in standard operating system COM port APIs, such as setting the device into a different mode or writing data into the device EEPROM.
Using this interface requires FTDI drivers to be installed. For Windows FTDI provides CDM package. For Linux and Mac os x, FTDI drivers are provided but default drivers need to be un-installed.
More information about D2XX is here : http://www.ftdichip.com/Drivers/D2XX.htm
[0] The data types used in java layer may be bigger in size than the native layer. For example; if native function returns 16 bit signed integer, than java method will return 32 bit integer. This is done to make sure that no data loss occur. This library take care of sign and their applicability internally.
[1] Developers are requested to check with vendor library documentation if a particular function is supported for desired platform or not and also how does a particular API will behave. Also consider paying attention to valid values and range when passing arguments to a method. For FTDI d2xx the API guide is here : http://www.ftdichip.com/Support/Documents/ProgramGuides/D2XX_Programmer's_Guide(FT_000071).pdf
[2] The VCP and D2XX drivers are mutually exclusive for Linux OS and therefore either udev rule can be used to unbind/unload default drivers or it can be done manually. https://github.com/RishiGupta12/serial-communication-manager/blob/master/tools-and-utilities/udev-ftdi-unbind-ftdi_sio.sh https://github.com/RishiGupta12/serial-communication-manager/blob/master/tools-and-utilities/udev-ftdi-unload-vcp-driver.sh
[3] The udev rules to support various applications designs are here : https://github.com/RishiGupta12/serial-communication-manager/blob/master/tools-and-utilities/99-scm-extra-udev.rules
[4] It seems like d2xx drivers are user space usb drivers using libusb. So if you encounter any problems with permissions add following udev rules : https://github.com/RishiGupta12/serial-communication-manager/blob/master/tools-and-utilities/99-scm-ftdi-d2xx.rules
[5] The application notes for FTDI devices are here : http://www.ftdichip.com/Support/Documents/AppNotes.htm
SCM version 1.0.4 is linked to d2xx 1.3.6 version for Linux, 2.12.06 for Windows and 1.2.2 for Mac os x.
| Modifier and Type | Class and Description |
|---|---|
static class |
SerialComFTDID2XX.DATABITS
Pre-defined enum constants for number of data bits (word length) in a serial frame.
|
static class |
SerialComFTDID2XX.FLOWCTRL
Pre-defined enum constants for flow control of a serial frame.
|
static class |
SerialComFTDID2XX.PARITY
Pre-defined enum constants for enabling type of parity in a serial frame.
|
static class |
SerialComFTDID2XX.STOPBITS
Pre-defined enum constants for number of stop bits in a serial frame.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CE_BREAK
Bit mask to represent break detection in D2XX terminology.
|
static int |
CE_DNS
Bit mask to represent LPTx device not selected in D2XX terminology.
|
static int |
CE_FRAME
Bit mask to represent receive framing error in D2XX terminology.
|
static int |
CE_IOE
Bit mask to represent LPTx I/O error in D2XX terminology.
|
static int |
CE_MODE
Bit mask to represent requested mode unsupported in D2XX terminology.
|
static int |
CE_OOP
Bit mask to represent LPTx out of paper in D2XX terminology.
|
static int |
CE_OVERRUN
Bit mask to represent receive over run in D2XX terminology.
|
static int |
CE_PTO
Bit mask to represent LPTx timeout in D2XX terminology.
|
static int |
CE_RXOVER
Bit mask to represent receive queue overflow in D2XX terminology.
|
static int |
CE_RXPARITY
Bit mask to represent receive parity error in D2XX terminology.
|
static int |
CE_TXFULL
Bit mask to represent that transmit queue is full in D2XX terminology.
|
static int |
CLRBREAK
Constant indicating that the break condition need to be cleared.
|
static int |
CLRDTR
Constant indicating that the DTR signal need to be un-set.
|
static int |
CLRRTS
Constant indicating that the RTS signal need to be un-set.
|
static int |
EV_BREAK
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_CTS
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_DSR
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_ERR
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_EVENT1
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_EVENT2
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_PERR
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_RING
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_RLSD
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_RX80FULL
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_RXCHAR
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_RXFLAG
Bit mask to represent an event in D2XX terminology.
|
static int |
EV_TXEMPTY
Bit mask to represent an event in D2XX terminology.
|
static int |
FT_DEVICE_100AX
Value indicating FTDI 100AX devices.
|
static int |
FT_DEVICE_2232C
Value indicating FTDI 2232C devices.
|
static int |
FT_DEVICE_2232H
Value indicating FTDI 2232H devices.
|
static int |
FT_DEVICE_232B
Value indicating FTDI 232B (FT2xxB) devices.
|
static int |
FT_DEVICE_232H
Value indicating FTDI 232H devices.
|
static int |
FT_DEVICE_232R
Value indicating FTDI 232R devices.
|
static int |
FT_DEVICE_4232H
Value indicating FTDI 4232H devices.
|
static int |
FT_DEVICE_AM
Value indicating FTDI AM devices.
|
static int |
FT_DEVICE_BM
Value indicating FTDI BM devices.
|
static int |
FT_DEVICE_UNKNOWN
Value indicating devices unknown to D2XX library.
|
static int |
FT_DEVICE_X_SERIES
Value indicating FTDI X (FT2xxX) series devices.
|
static int |
FT_LIST_ALL
Bit mask to represent FT_LIST_ALL in D2XX terminology.
|
static int |
FT_LIST_BY_INDEX
Bit mask to represent FT_LIST_BY_INDEX in D2XX terminology.
|
static int |
FT_LIST_NUMBER_ONLY
Bit mask to represent FT_LIST_NUMBER_ONLY in D2XX terminology.
|
static int |
FT_OPEN_BY_DESCRIPTION
Bit mask to represent FT_OPEN_BY_DESCRIPTION in D2XX terminology.
|
static int |
FT_OPEN_BY_LOCATION
Bit mask to represent FT_OPEN_BY_LOCATION in D2XX terminology.
|
static int |
FT_OPEN_BY_SERIAL_NUMBER
Bit mask to represent FT_OPEN_BY_SERIAL_NUMBER in D2XX terminology.
|
static int |
GENERIC_READ
Bit mask to represent opening device for reading in D2XX terminology.
|
static int |
GENERIC_WRITE
Bit mask to represent opening device for writing in D2XX terminology.
|
static int |
MS_CTS_ON
Bit mask to represent modem status in D2XX terminology.
|
static int |
MS_DSR_ON
Bit mask to represent modem status in D2XX terminology.
|
static int |
MS_RING_ON
Bit mask to represent modem status in D2XX terminology.
|
static int |
MS_RLSD_ON
Bit mask to represent modem status in D2XX terminology.
|
static int |
PURGE_RXABORT
Bit mask to represent killing all current and pending receive operations in D2XX
terminology.
|
static int |
PURGE_RXCLEAR
Bit mask to represent clearing receive queue in D2XX terminology.
|
static int |
PURGE_TXABORT
Bit mask to represent killing all current and pending transmission operations in
D2XX terminology.
|
static int |
PURGE_TXCLEAR
Bit mask to represent clearing transmit queue in D2XX terminology.
|
static int |
SETBREAK
Constant indicating that the break condition need to be set.
|
static int |
SETDTR
Constant indicating that the DTR signal need to be set.
|
static int |
SETRTS
Constant indicating that the RTS signal need to be set.
|
VLIB_FTDI_D2XX, VLIB_MCHP_SIMPLEIO, VLIB_SLABS_CP210XMANUFACTURING, VLIB_SLABS_CP210XRUNTIME, VLIB_SLABS_USBXPRESS| Constructor and Description |
|---|
SerialComFTDID2XX(File libDirectory,
String vlibName,
int cpuArch,
int osType,
SerialComSystemProperty serialComSystemProperty)
Allocates a new SerialComFTDID2XX object and extract and load shared libraries as required.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
clearDTR(long handle)
Executes FT_ClrDtr function of D2XX library.
|
boolean |
clearRTS(long handle)
Executes FT_ClrRts function of D2XX library.
|
boolean |
close(long handle)
Executes FT_Close function of D2XX library.
|
int |
createDeviceInfoList()
Executes FT_CreateDeviceInfoList function of D2XX library.
|
boolean |
cyclePort(long handle)
Executes FT_CyclePort function of D2XX library.
|
boolean |
eeProgram(long handle,
String manufacturer,
String manufacturerID,
String description,
String serialNumber,
int[] values)
Executes FT_EE_Program function of D2XX library.
|
boolean |
eeProgramEx(long handle,
String manufacturer,
String manufacturerID,
String description,
String serialNumber,
int[] values)
Executes FT_EE_ProgramEx function of D2XX library.
|
boolean |
eepromProgram(long handle,
FTeepromData eepromData,
String manufacturer,
String manufacturerID,
String description,
String serialNumber)
Executes FT_EEPROM_Program function of D2XX library.
|
FTeepromData |
eepromRead(long handle,
int deviceType,
char[] manufacturer,
char[] manufacturerID,
char[] description,
char[] serialNumber)
Executes FT_EEPROM_Read function of D2XX library.
|
FTprogramData |
eeRead(long handle,
int version)
Executes FT_EE_Read function of D2XX library.
|
FTprogramData |
eeReadEx(long handle,
int version,
char[] manufacturer,
char[] manufacturerID,
char[] description,
char[] serialNumber)
Executes FT_EE_ReadEx function of D2XX library.
|
int |
eeUAread(long handle,
byte[] buffer,
int length)
Executes FT_EE_UARead function of D2XX library.
|
int |
eeUAsize(long handle)
Executes FT_EE_UASize function of D2XX library.
|
boolean |
eeUAwrite(long handle,
byte[] buffer,
int length)
Executes FT_EE_UAWrite function of D2XX library.
|
boolean |
eraseEE(long handle)
Executes FT_EraseEE function of D2XX library.
|
int |
getBitMode(long handle)
Executes FT_GetBitMode function of D2XX library.
|
long |
getComPortNumber(long handle)
Executes FT_GetComPortNumber function of D2XX library.
|
FTOpenedDeviceInfo |
getDeviceInfo(long handle)
Executes FT_GetDeviceInfo function of D2XX library.
|
FTdevicelistInfoNode |
getDeviceInfoDetail(int index)
Executes FT_GetDeviceInfoDetail function of D2XX library.
|
FTdevicelistInfoNode[] |
getDeviceInfoList(int numOfDevices)
Executes FT_GetDeviceInfoList function of D2XX library.
|
long |
getDriverVersion(long handle)
Executes FT_GetDriverVersion function of D2XX library.
|
int |
getLatencyTimer(long handle)
Executes FT_GetLatencyTimer function of D2XX library.
|
long |
getLibraryVersion()
Executes FT_GetLibraryVersion function of D2XX library.
|
int |
getModemStatus(long handle)
Executes FT_GetModemStatus function of D2XX library.
|
int |
getQueueStatus(long handle)
Executes FT_GetQueueStatus function of D2XX library.
|
long[] |
getStatus(long handle)
Executes FT_GetStatus function of D2XX library.
|
int[] |
getVidPid()
Executes FT_GetVIDPID function of D2XX library.
|
FTdeviceInfo[] |
listDevices(int pvArg1,
int dwFlags)
Executes FT_ListDevices function of D2XX library.
|
long |
open(int index)
Executes FT_Open function of D2XX library.
|
long |
openEx(String serialOrDescription,
long locationId,
int dwFlags)
Executes FT_OpenEx function of D2XX library.
|
boolean |
purge(long handle,
boolean purgeTxBuffer,
boolean purgeRxBuffer)
Executes FT_Purge function of D2XX library.
|
int |
read(long handle,
byte[] buffer,
int numOfBytesToRead)
Executes FT_Read function of D2XX library.
|
int |
readEE(long handle,
int offset)
Executes FT_ReadEE function of D2XX library.
|
boolean |
reload(int vid,
int pid)
Executes FT_Reload function of D2XX library.
|
boolean |
rescan()
Executes FT_Rescan function of D2XX library.
|
boolean |
resetDevice(long handle)
Executes FT_ResetDevice function of D2XX library.
|
boolean |
resetPort(long handle)
Executes FT_ResetPort function of D2XX library.
|
boolean |
restartInTask(long handle)
Executes FT_StopInTask function of D2XX library.
|
boolean |
setBaudRate(long handle,
int baudRate)
Executes FT_SetBaudRate function of D2XX library.
|
boolean |
setBitMode(long handle,
int mask,
int mode)
Executes FT_SetBitMode function of D2XX library.
|
boolean |
setBreakOff(long handle)
Executes FT_SetBreakOff function of D2XX library.
|
boolean |
setBreakOn(long handle)
Executes FT_SetBreakOn function of D2XX library.
|
boolean |
setChars(long handle,
char eventChar,
char eventEnable,
char errorChar,
char errorEnable)
Executes FT_SetChars function of D2XX library.
|
boolean |
setDataCharacteristics(long handle,
SerialComFTDID2XX.DATABITS dataBits,
SerialComFTDID2XX.STOPBITS stopBits,
SerialComFTDID2XX.PARITY parity)
Executes FT_SetDataCharacteristics function of D2XX library.
|
boolean |
setDeadmanTimeout(long handle,
int count)
Executes FT_SetDeadmanTimeout function of D2XX library.
|
boolean |
setDivisor(long handle,
int divisor)
Executes FT_SetDivisor function of D2XX library.
|
boolean |
setDTR(long handle)
Executes FT_SetDtr function of D2XX library.
|
boolean |
setEventNotificationAndWait(long handle,
int eventMask)
Executes FT_SetEventNotification function of D2XX library and blocks until one or more
events specified in eventMask occurs.
|
boolean |
setFlowControl(long handle,
SerialComFTDID2XX.FLOWCTRL flctrl,
char xon,
char xoff)
Executes FT_SetFlowControl function of D2XX library.
|
boolean |
setLatencyTimer(long handle,
int value)
Executes FT_SetLatencyTimer function of D2XX library.
|
boolean |
setResetPipeRetryCount(long handle,
int count)
Executes SetResetPipeRetryCount function of D2XX library.
|
boolean |
setRTS(long handle)
Executes FT_SetRts function of D2XX library.
|
boolean |
setTimeouts(long handle,
long readTimeOut,
long writeTimeOut)
Executes FT_SetTimeouts function of D2XX library.
|
boolean |
setUSBParameters(long handle,
int inTransferSize,
int outTransferSize)
Executes FT_SetUSBParameters function of D2XX library.
|
boolean |
setVidPid(int vid,
int pid)
Executes FT_SetVIDPID function of D2XX library.
|
boolean |
stopInTask(long handle)
Executes FT_StopInTask function of D2XX library.
|
boolean |
w32ClearCommBreak(long handle)
Executes FT_W32_ClearCommBreak function of D2XX library.
|
int[] |
w32ClearCommError(long handle)
Executes FT_W32_ClearCommError function of D2XX library.
|
boolean |
w32CloseHandle(long handle)
Executes FT_W32_CloseHandle function of D2XX library.
|
long |
w32CreateFile(String serialNum,
String description,
long location,
int dwAttrsAndFlags,
int dwAccess,
boolean overLapped)
Executes FT_W32_CreateFile function of D2XX library.
|
boolean |
w32EscapeCommFunction(long handle,
short function)
Executes FT_W32_EscapeCommFunction function of D2XX library.
|
int |
w32GetCommMask(long handle)
Executes FT_W32_GetCommMask function of D2XX library.
|
int |
w32GetCommModemStatus(long handle)
Executes FT_W32_GetCommModemStatus function of D2XX library.
|
int[] |
w32GetCommState(long handle)
Executes FT_W32_GetCommState function of D2XX library.
|
int[] |
w32GetCommTimeouts(long handle)
Executes FT_W32_GetCommTimeouts function of D2XX library.
|
String |
w32GetLastError(long handle)
Executes FT_W32_GetLastError function of D2XX library.
|
boolean |
w32GetOverlappedResult(long handle,
boolean wait)
Executes FT_W32_GetOverlappedResult function of D2XX library.
|
boolean |
w32PurgeComm(long handle,
int event)
Executes FT_W32_PurgeComm function of D2XX library.
|
int |
w32ReadFile(long handle,
byte[] buffer,
int numOfBytesToRead)
Executes FT_W32_ReadFile function of D2XX library.
|
boolean |
w32SetCommBreak(long handle)
Executes FT_W32_SetCommBreak function of D2XX library.
|
boolean |
w32SetCommMask(long handle,
int flag)
Executes FT_W32_SetCommMask function of D2XX library.
|
boolean |
w32SetCommState(long handle,
int[] dcb)
Executes FT_W32_SetCommState function of D2XX library.
|
boolean |
w32SetCommTimeouts(long handle,
int readIntervalTimeout,
int readTotalTimeoutMultiplier,
int readTotalTimeoutConstant,
int writeTotalTimeoutMultiplier,
int writeTotalTimeoutConstant)
Executes FT_W32_SetCommTimeouts function of D2XX library.
|
boolean |
w32SetupComm(long handle,
int readBufSize,
int writeBufSize)
Executes FT_W32_SetupComm function of D2XX library.
|
boolean |
w32WaitCommEvent(long handle,
int event)
Executes FT_W32_WaitCommEvent function of D2XX library.
|
int |
w32WriteFile(long handle,
byte[] buffer,
int numOfBytesToWrite)
Executes FT_W32_WriteFile function of D2XX library.
|
int |
write(long handle,
byte[] buffer,
int numOfBytesToWrite)
Executes FT_Write function of D2XX library.
|
boolean |
writeEE(long handle,
int offset,
int valueToWrite)
Executes FT_WriteEE function of D2XX library.
|
getVendorLibInstancepublic static final int FT_DEVICE_UNKNOWN
Value indicating devices unknown to D2XX library.
public static final int FT_DEVICE_AM
Value indicating FTDI AM devices.
public static final int FT_DEVICE_BM
Value indicating FTDI BM devices.
public static final int FT_DEVICE_100AX
Value indicating FTDI 100AX devices.
public static final int FT_DEVICE_232B
Value indicating FTDI 232B (FT2xxB) devices.
public static final int FT_DEVICE_232R
Value indicating FTDI 232R devices.
public static final int FT_DEVICE_232H
Value indicating FTDI 232H devices.
public static final int FT_DEVICE_2232C
Value indicating FTDI 2232C devices.
public static final int FT_DEVICE_2232H
Value indicating FTDI 2232H devices.
public static final int FT_DEVICE_4232H
Value indicating FTDI 4232H devices.
public static final int FT_DEVICE_X_SERIES
Value indicating FTDI X (FT2xxX) series devices.
public static final int GENERIC_READ
Bit mask to represent opening device for reading in D2XX terminology.
public static final int GENERIC_WRITE
Bit mask to represent opening device for writing in D2XX terminology.
public static final int FT_LIST_NUMBER_ONLY
Bit mask to represent FT_LIST_NUMBER_ONLY in D2XX terminology.
public static final int FT_LIST_BY_INDEX
Bit mask to represent FT_LIST_BY_INDEX in D2XX terminology.
public static final int FT_LIST_ALL
Bit mask to represent FT_LIST_ALL in D2XX terminology.
public static final int FT_OPEN_BY_SERIAL_NUMBER
Bit mask to represent FT_OPEN_BY_SERIAL_NUMBER in D2XX terminology.
public static final int FT_OPEN_BY_DESCRIPTION
Bit mask to represent FT_OPEN_BY_DESCRIPTION in D2XX terminology.
public static final int FT_OPEN_BY_LOCATION
Bit mask to represent FT_OPEN_BY_LOCATION in D2XX terminology.
public static final int SETRTS
Constant indicating that the RTS signal need to be set.
public static final int CLRRTS
Constant indicating that the RTS signal need to be un-set.
public static final int SETDTR
Constant indicating that the DTR signal need to be set.
public static final int CLRDTR
Constant indicating that the DTR signal need to be un-set.
public static final int SETBREAK
Constant indicating that the break condition need to be set.
public static final int CLRBREAK
Constant indicating that the break condition need to be cleared.
public static final int MS_CTS_ON
Bit mask to represent modem status in D2XX terminology.
public static final int MS_DSR_ON
Bit mask to represent modem status in D2XX terminology.
public static final int MS_RING_ON
Bit mask to represent modem status in D2XX terminology.
public static final int MS_RLSD_ON
Bit mask to represent modem status in D2XX terminology.
public static final int EV_RXCHAR
Bit mask to represent an event in D2XX terminology.
public static final int EV_RXFLAG
Bit mask to represent an event in D2XX terminology.
public static final int EV_TXEMPTY
Bit mask to represent an event in D2XX terminology.
public static final int EV_CTS
Bit mask to represent an event in D2XX terminology.
public static final int EV_DSR
Bit mask to represent an event in D2XX terminology.
public static final int EV_RLSD
Bit mask to represent an event in D2XX terminology.
public static final int EV_BREAK
Bit mask to represent an event in D2XX terminology.
public static final int EV_ERR
Bit mask to represent an event in D2XX terminology.
public static final int EV_RING
Bit mask to represent an event in D2XX terminology.
public static final int EV_PERR
Bit mask to represent an event in D2XX terminology.
public static final int EV_RX80FULL
Bit mask to represent an event in D2XX terminology.
public static final int EV_EVENT1
Bit mask to represent an event in D2XX terminology.
public static final int EV_EVENT2
Bit mask to represent an event in D2XX terminology.
public static final int PURGE_TXABORT
Bit mask to represent killing all current and pending transmission operations in D2XX terminology.
public static final int PURGE_RXABORT
Bit mask to represent killing all current and pending receive operations in D2XX terminology.
public static final int PURGE_TXCLEAR
Bit mask to represent clearing transmit queue in D2XX terminology.
public static final int PURGE_RXCLEAR
Bit mask to represent clearing receive queue in D2XX terminology.
public static final int CE_RXOVER
Bit mask to represent receive queue overflow in D2XX terminology.
public static final int CE_OVERRUN
Bit mask to represent receive over run in D2XX terminology.
public static final int CE_RXPARITY
Bit mask to represent receive parity error in D2XX terminology.
public static final int CE_FRAME
Bit mask to represent receive framing error in D2XX terminology.
public static final int CE_BREAK
Bit mask to represent break detection in D2XX terminology.
public static final int CE_TXFULL
Bit mask to represent that transmit queue is full in D2XX terminology.
public static final int CE_PTO
Bit mask to represent LPTx timeout in D2XX terminology.
public static final int CE_IOE
Bit mask to represent LPTx I/O error in D2XX terminology.
public static final int CE_DNS
Bit mask to represent LPTx device not selected in D2XX terminology.
public static final int CE_OOP
Bit mask to represent LPTx out of paper in D2XX terminology.
public static final int CE_MODE
Bit mask to represent requested mode unsupported in D2XX terminology.
public SerialComFTDID2XX(File libDirectory, String vlibName, int cpuArch, int osType, SerialComSystemProperty serialComSystemProperty) throws UnsatisfiedLinkError, SerialComLoadException, SerialComUnexpectedException, SecurityException, FileNotFoundException
Allocates a new SerialComFTDID2XX object and extract and load shared libraries as required.
libDirectory - directory in which native library will be extracted and vendor library will
be found.vlibName - name of vendor library to load and link.cpuArch - architecture of CPU this library is running on.osType - operating system this library is running on.serialComSystemProperty - instance of SerialComSystemProperty to get required java properties.SerialComUnexpectedException - if a critical java system property is null in system.SecurityException - if any java system property can not be accessed.FileNotFoundException - if the vendor library file is not found.SerialComLoadException - if any file system related issue occurs.UnsatisfiedLinkError - if loading/linking shared library fails.SerialComException - if initializing native library fails.public boolean setVidPid(int vid,
int pid)
throws SerialComException
Executes FT_SetVIDPID function of D2XX library.
By default, the d2xx driver will support a limited set of VID and PID matched devices (VID 0x0403 with PIDs 0x6001, 0x6010, 0x6006 only). In order to use the driver with other VID and PID combinations this method should be called so that the driver can update its internal device list table.
vid - USB-IF vendor id of the USB device.pid - product id of the USB device.SerialComException - if an I/O error occurs.IllegalArgumentException - if vid or pid is negative or invalid number.public int[] getVidPid()
throws SerialComException
Executes FT_GetVIDPID function of D2XX library.
Retrieves the current VID and PID combination from within the internal device list table. The sequence of return array is USB VID and USB PID.
SerialComException - if an I/O error occurs.public int createDeviceInfoList()
throws SerialComException
Executes FT_CreateDeviceInfoList function of D2XX library.
Returns the number of FTDI devices connected to the system presently. If any device is removed or added to the system this method should be called again so that internal list can be updated by driver.
SerialComException - if an I/O error occurs.public FTdevicelistInfoNode[] getDeviceInfoList(int numOfDevices) throws SerialComException
Executes FT_GetDeviceInfoList function of D2XX library.
Retrieves information about the connected devices and populate them in FTdevicelistInfoNode class objects.
numOfDevices - number of FTDI devices connected to system.SerialComException - if an I/O error occurs.IllegalArgumentException - if numOfDevices is negative or zero.public FTdevicelistInfoNode getDeviceInfoDetail(int index) throws SerialComException
Executes FT_GetDeviceInfoDetail function of D2XX library.
Retrieves information about the device at the given index.
index - in list corresponding to the device for which information is to be obtained.SerialComException - if an I/O error occurs.IllegalArgumentException - if index is negative.public FTdeviceInfo[] listDevices(int pvArg1, int dwFlags) throws SerialComException
Executes FT_ListDevices function of D2XX library.
Gets information concerning the devices currently connected. This function can return information such as the number of devices connected, the device serial number and device description strings, and the location IDs of connected devices.
The value of dwFlags bit mask can be composed or one or more of these constants: FT_LIST_NUMBER_ONLY, FT_LIST_BY_INDEX, FT_LIST_ALL, FT_OPEN_BY_SERIAL_NUMBER, FT_OPEN_BY_DESCRIPTION, FT_OPEN_BY_LOCATION.
Length of the returned array indicates number of FT devices found.
pvArg1 - index in FT device list.dwFlags - flag specifying what operation should be performed.IllegalArgumentException - if pvArg1 is negative or dwFlags is not one of the valid constants.SerialComException - if an I/O error occurs.public long open(int index)
throws SerialComException
Executes FT_Open function of D2XX library.
Open the device and return a handle which will be used for subsequent accesses.
index - in list corresponding to the device that needs to be opened.SerialComException - if an I/O error occurs.IllegalArgumentException - if index is negative.public long openEx(String serialOrDescription, long locationId, int dwFlags) throws SerialComException
Executes FT_OpenEx function of D2XX library.
Open the specified device and return a handle that will be used for subsequent accesses. The device can be specified by its serial number, device description or location.
The value of dwFlags bit mask can be composed or one or more of these constants: FT_OPEN_BY_SERIAL_NUMBER, FT_OPEN_BY_DESCRIPTION, FT_OPEN_BY_LOCATION.
serialOrDescription - serial number string or description string to identify the device to be opened.locationId - location ID of the device if it is to be opened using location ID.dwFlags - flag specifying what operation should be performed.SerialComException - if an I/O error occurs.public boolean close(long handle)
throws SerialComException
Executes FT_Close function of D2XX library.
Closes an open FT device.
handle - of the device that is to be close.SerialComException - if an I/O error occurs.public int read(long handle,
byte[] buffer,
int numOfBytesToRead)
throws SerialComException
Executes FT_Read function of D2XX library.
Read data from the device.
handle - handle of the device from which to read data.buffer - byte buffer where data read will be placed.numOfBytesToRead - number of bytes to be tried to read.SerialComException - if an I/O error occurs.IllegalArgumentException - if buffer is null or numOfBytesToRead is negative or zero.public int write(long handle,
byte[] buffer,
int numOfBytesToWrite)
throws SerialComException
Executes FT_Write function of D2XX library.
Write data from given buffer to the device.
handle - handle of the device to which data is to be sent.buffer - byte buffer that contains the data to be written to the device.numOfBytesToWrite - Number of bytes to write to the device.SerialComException - if an I/O error occurs.IllegalArgumentException - if buffer is null or numOfBytesToWrite is negative or zero.public boolean setBaudRate(long handle,
int baudRate)
throws SerialComException
Executes FT_SetBaudRate function of D2XX library.
Sets the baud rate value for the given FT device.
handle - handle of the device whose baud rate need to be set.baudRate - baud rate value to set.SerialComException - if an I/O error occurs.IllegalArgumentException - if baudRate is negative.public boolean setDivisor(long handle,
int divisor)
throws SerialComException
Executes FT_SetDivisor function of D2XX library.
Sets the divisor value for the given FT device.
handle - handle of the device whose divisor is to be set.divisor - divisor to be used for setting correct custom baud rate.SerialComException - if an I/O error occurs.IllegalArgumentException - if divisor is negative.public boolean setDataCharacteristics(long handle,
SerialComFTDID2XX.DATABITS dataBits,
SerialComFTDID2XX.STOPBITS stopBits,
SerialComFTDID2XX.PARITY parity)
throws SerialComException
Executes FT_SetDataCharacteristics function of D2XX library.
Sets the desired data characteristics for the given FT device.
handle - handle of the device whose data characteristics need to be set.dataBits - number of data bits in one frame (refer DATABITS enum in SerialComFTDID2XX class for this).stopBits - number of stop bits in one frame (refer STOPBITS enum in SerialComFTDID2XX class for this).parity - of the frame (refer PARITY enum in SerialComFTDID2XX class for this).SerialComException - if an I/O error occurs.IllegalArgumentException - if dataBits, stopBits or parity is null.public boolean setTimeouts(long handle,
long readTimeOut,
long writeTimeOut)
throws SerialComException
Executes FT_SetTimeouts function of D2XX library.
Sets the read and write time out values for the given FT device.
handle - handle of the device whose timeouts need to be set.readTimeOut - read time out in milliseconds.writeTimeOut - write time out in milliseconds.SerialComException - if an I/O error occurs.IllegalArgumentException - if divisor is negative.public boolean setFlowControl(long handle,
SerialComFTDID2XX.FLOWCTRL flctrl,
char xon,
char xoff)
throws SerialComException
Executes FT_SetFlowControl function of D2XX library.
Sets the flow control mode for the given FT device.
handle - handle of the device whose flow control is to be set.flctrl - flow control of serial frame (refer FLOWCTRL enum in SerialComFTDID2XX class for this).xon - character used to signal Xon if software flow control is used.xoff - character used to signal Xoff if software flow control is used.SerialComException - if an I/O error occurs.IllegalArgumentException - if flctrl is null.public boolean setDTR(long handle)
throws SerialComException
Executes FT_SetDtr function of D2XX library.
Sets the Data Terminal Ready (DTR) control signal.
handle - handle of the device for which DTR signal need to be set.SerialComException - if an I/O error occurs.public boolean clearDTR(long handle)
throws SerialComException
Executes FT_ClrDtr function of D2XX library.
This method clears the Data Terminal Ready (DTR) control signal.
handle - handle of the device for which DTR signal need to be cleared.SerialComException - if an I/O error occurs.public boolean setRTS(long handle)
throws SerialComException
Executes FT_SetRts function of D2XX library.
Sets the Request To Send (RTS) control signal.
handle - handle of the device for which RTS signal need to be set.SerialComException - if an I/O error occurs.public boolean clearRTS(long handle)
throws SerialComException
Executes FT_ClrRts function of D2XX library.
This method clears the Request To Send (RTS) control signal.
handle - handle of the device for which RTS signal need to be cleared.SerialComException - if an I/O error occurs.public int getModemStatus(long handle)
throws SerialComException
Executes FT_GetModemStatus function of D2XX library.
Gets the modem status and line status from the device.
handle - handle of the device whose status is to be observed.SerialComException - if an I/O error occurs.public int getQueueStatus(long handle)
throws SerialComException
Executes FT_GetQueueStatus function of D2XX library.
Gets the number of bytes in the receive queue.
handle - handle of the device for whom number of bytes is to be calculated.SerialComException - if an I/O error occurs.public FTOpenedDeviceInfo getDeviceInfo(long handle) throws SerialComException
Executes FT_GetDeviceInfo function of D2XX library.
Get device information for an open device.
handle - of the device for which information is to be obtained.SerialComException - if an I/O error occurs.public long getDriverVersion(long handle)
throws SerialComException
Executes FT_GetDriverVersion function of D2XX library.
Gets the D2XX driver version number.
handle - handle of the device for whom driver version is to found.SerialComException - if an I/O error occurs.public long getLibraryVersion()
throws SerialComException
Executes FT_GetLibraryVersion function of D2XX library.
Gets the D2XX DLL version number.
SerialComException - if an I/O error occurs.public long getComPortNumber(long handle)
throws SerialComException
Executes FT_GetComPortNumber function of D2XX library.
Retrieves the COM port associated with a device.
handle - handle of the device for whom COM port is to found.SerialComException - if an I/O error occurs.public long[] getStatus(long handle)
throws SerialComException
Executes FT_GetStatus function of D2XX library.
Gets the device status including number of characters in the receive queue, number of characters in the transmit queue, and the current event status.
handle - handle of the device for whom information need to be found.SerialComException - if an I/O error occurs.public boolean setEventNotificationAndWait(long handle,
int eventMask)
throws SerialComException
Executes FT_SetEventNotification function of D2XX library and blocks until one or more events specified in eventMask occurs. Once this method returns, application can determine which event has occurred using getStatus method.
handle - handle of the device for which to set event mask and wait.eventMask - bit mask of the constants EV_XXXXX in SerialComFTDID2XX class.SerialComException - if an I/O error occurs.public boolean setChars(long handle,
char eventChar,
char eventEnable,
char errorChar,
char errorEnable)
throws SerialComException
Executes FT_SetChars function of D2XX library.
Sets the special characters for the device.
handle - handle of the device for which characters need to be set.eventChar - event character.eventEnable - 0 if event character disabled, non-zero otherwise.errorChar - error character.errorEnable - 0 if error character disabled, non-zero otherwise.SerialComException - if an I/O error occurs.public boolean setBreakOn(long handle)
throws SerialComException
Executes FT_SetBreakOn function of D2XX library.
Sets the BREAK condition for the device.
handle - handle of the device for which break condition need to be set.SerialComException - if an I/O error occurs.public boolean setBreakOff(long handle)
throws SerialComException
Executes FT_SetBreakOff function of D2XX library.
Resets the BREAK condition for the device.
handle - handle of the device for which break condition need to be reset.SerialComException - if an I/O error occurs.public boolean purge(long handle,
boolean purgeTxBuffer,
boolean purgeRxBuffer)
throws SerialComException
Executes FT_Purge function of D2XX library.
This method purges receive and transmit buffers in the device.
handle - handle of the device for which buffer need to be cleared.purgeTxBuffer - true if transmit buffer need to be cleared.purgeRxBuffer - true if receive buffer need to be cleared.SerialComException - if an I/O error occurs.IllegalArgumentException - if both purgeTxBuffer and purgeRxBuffer are false.public boolean resetDevice(long handle)
throws SerialComException
Executes FT_ResetDevice function of D2XX library.
This method sends a reset command to the device.
handle - handle of the device which need to be reset.SerialComException - if an I/O error occurs.public boolean resetPort(long handle)
throws SerialComException
Executes FT_ResetPort function of D2XX library.
This method sends a reset command to the port.
handle - handle of the device whose port need to be reset.SerialComException - if an I/O error occurs.public boolean cyclePort(long handle)
throws SerialComException
Executes FT_CyclePort function of D2XX library.
Send a cycle command to the USB port.
handle - handle of the device who need to be cycled.SerialComException - if an I/O error occurs.public boolean rescan()
throws SerialComException
Executes FT_Rescan function of D2XX library.
Send a cycle command to the USB port.
SerialComException - if an I/O error occurs.public boolean reload(int vid,
int pid)
throws SerialComException
Executes FT_Reload function of D2XX library.
Send a cycle command to the USB port.
vid - Vendor ID of the devices to reload the driver for.pid - Product ID of the devices to reload the driver for.SerialComException - if an I/O error occurs.public boolean setResetPipeRetryCount(long handle,
int count)
throws SerialComException
Executes SetResetPipeRetryCount function of D2XX library.
Set the ResetPipeRetryCount value.
handle - handle of the device for which this count is to be set.count - maximum number of times that the driver tries to reset a pipe on which an error has occurred.SerialComException - if an I/O error occurs.public boolean stopInTask(long handle)
throws SerialComException
Executes FT_StopInTask function of D2XX library.
Stops the driver's IN task.
handle - handle of the device for which this count is to be set.SerialComException - if an I/O error occurs.public boolean restartInTask(long handle)
throws SerialComException
Executes FT_StopInTask function of D2XX library.
Stops the driver's IN task.
handle - handle of the device for which this count is to be set.SerialComException - if an I/O error occurs.public boolean setDeadmanTimeout(long handle,
int count)
throws SerialComException
Executes FT_SetDeadmanTimeout function of D2XX library.
This method allows the maximum time in milliseconds that a USB request can remain outstanding to be set.
handle - handle of the device for which this time out is to be set.count - timeout value in milliseconds. Default value is 5000.SerialComException - if an I/O error occurs.public int readEE(long handle,
int offset)
throws SerialComException
Executes FT_ReadEE function of D2XX library.
Read a value from an EEPROM location.
handle - handle of the device whose EEPROM is to be read.offset - EEPROM location to read from.SerialComException - if an I/O error occurs.IllegalArgumentException - if offset is negative.public boolean writeEE(long handle,
int offset,
int valueToWrite)
throws SerialComException
Executes FT_WriteEE function of D2XX library.
Write a value to an EEPROM location.
handle - handle of the device whose EEPROM will be written.offset - EEPROM location to write at.valueToWrite - value to write at given address.SerialComException - if an I/O error occurs.IllegalArgumentException - if offset is negative.public boolean eraseEE(long handle)
throws SerialComException
Executes FT_EraseEE function of D2XX library.
Erase the entire contents of an EEPROM, including the user area.
handle - handle of the device which need to be erased.SerialComException - if an I/O error occurs.public FTprogramData eeRead(long handle, int version) throws SerialComException
Executes FT_EE_Read function of D2XX library.
Read the contents of the EEPROM.
handle - handle of the device whose contents are to be read.version - of the FT_PROGRAM_DATA structure defined in FTD2XX.h file.SerialComException - if an I/O error occurs.public FTprogramData eeReadEx(long handle, int version, char[] manufacturer, char[] manufacturerID, char[] description, char[] serialNumber) throws SerialComException
Executes FT_EE_ReadEx function of D2XX library.
Read the contents of the EEPROM.
handle - handle of the device whose contents are to be read.version - of the FT_PROGRAM_DATA structure defined in FTD2XX.h file.manufacturer - char array of size 32 bytes to save manufacturer name.manufacturerID - char array of size 16 bytes to save manufacturer ID.description - char array of size 64 bytes to save device description.serialNumber - char array of size 16 bytes to save serial number of device.IllegalArgumentException - if manufacturer, manufacturerID, description or serialNumber is
null.SerialComException - if an I/O error occurs.public boolean eeProgram(long handle,
String manufacturer,
String manufacturerID,
String description,
String serialNumber,
int[] values)
throws SerialComException
Executes FT_EE_Program function of D2XX library.
Programs the EEPROM. When creating array of data values to be written, Manufacturer, ManufacturerId, Description and should be set to -1.
handle - handle of the device whose EEPROM is to be programmed.manufacturer - manufacturer name string (see app note for maximum suggested size, typically 32).manufacturerID - manufacturer ID string (see app note for maximum suggested size, typically 16).description - device description (see app note for maximum suggested size, typically 64).serialNumber - serial number of device (see app note for maximum suggested size, typically 16).values - array of integer with all values populated in order as declared in
FT_PROGRAM_DATA structure in FTD2XX.h file.IllegalArgumentException - if manufacturer, manufacturerID, description or serialNumber is
null.SerialComException - if an I/O error occurs.public boolean eeProgramEx(long handle,
String manufacturer,
String manufacturerID,
String description,
String serialNumber,
int[] values)
throws SerialComException
Executes FT_EE_ProgramEx function of D2XX library.
Programs the EEPROM. When creating array of data values to be written, Manufacturer, ManufacturerId, Description and should be set to -1.
handle - handle of the device whose EEPROM is to be programmed.manufacturer - manufacturer name string (see app note for maximum suggested size, typically 32).manufacturerID - manufacturer ID string (see app note for maximum suggested size, typically 16).description - device description (see app note for maximum suggested size, typically 64).serialNumber - serial number of device (see app note for maximum suggested size, typically 16).values - array of integer with all values populated in order as declared in
FT_PROGRAM_DATA structure in FTD2XX.h file.IllegalArgumentException - if manufacturer, manufacturerID, description or serialNumber is
null.SerialComException - if an I/O error occurs.public int eeUAsize(long handle)
throws SerialComException
Executes FT_EE_UASize function of D2XX library.
Get the available size of the EEPROM user area.
handle - handle of the device whose EEPROM area is to be calculated.SerialComException - if an I/O error occurs.public int eeUAread(long handle,
byte[] buffer,
int length)
throws SerialComException
Executes FT_EE_UARead function of D2XX library.
Read the contents of the EEPROM user area.
handle - handle of the device whose EEPROM area is to be read.buffer - byte buffer to store data.length - number of bytes to read from EEPROM.IllegalArgumentException - if buffer is null or length > buffer.length.SerialComException - if an I/O error occurs.public boolean eeUAwrite(long handle,
byte[] buffer,
int length)
throws SerialComException
Executes FT_EE_UAWrite function of D2XX library.
Write data into the EEPROM user area.
handle - handle of the device whose EEPROM area is to be written.buffer - byte buffer to containing data.length - number of bytes to write from buffer to EEPROM user area.IllegalArgumentException - if buffer is null or length > buffer.length.SerialComException - if an I/O error occurs.public FTeepromData eepromRead(long handle, int deviceType, char[] manufacturer, char[] manufacturerID, char[] description, char[] serialNumber) throws SerialComException
Executes FT_EEPROM_Read function of D2XX library.
Read data from the EEPROM, this command will work for all existing FTDI chipset, and must be used for the FT-X series.
handle - handle of the device whose contents are to be read.deviceType - one of the constants FT_DEVICE_XXXX.manufacturer - char array to save manufacturer name (suggested size 32).manufacturerID - char array to save manufacturer ID (suggested size 16).description - char array to save device description (suggested size 64).serialNumber - char array to save serial number of device (suggested size 16).IllegalArgumentException - if deviceType is invalid or length of byte arrays are incorrect.SerialComException - if an I/O error occurs.public boolean eepromProgram(long handle,
FTeepromData eepromData,
String manufacturer,
String manufacturerID,
String description,
String serialNumber)
throws SerialComException
Executes FT_EEPROM_Program function of D2XX library.
Write data into the EEPROM, this command will work for all existing FTDI chipset, and must be used for the FT-X series.
handle - handle of the device whose EEPROM is to be programmed.eepromData - an instance of class containing data to be written to EEPROM.manufacturer - manufacturer name string.manufacturerID - manufacturer ID string.description - device description string.serialNumber - serial number of device string.IllegalArgumentException - if eepromData is not an instance of class corresponding to
the device type or length of byte arrays are incorrect.SerialComException - if an I/O error occurs.public boolean setLatencyTimer(long handle,
int value)
throws SerialComException
Executes FT_SetLatencyTimer function of D2XX library.
Set the latency timer value.
handle - handle of the device whose timer need to be set.value - timer value.SerialComException - if an I/O error occurs.public int getLatencyTimer(long handle)
throws SerialComException
Executes FT_GetLatencyTimer function of D2XX library.
Get the current value of the latency timer.
handle - handle of the device whose timer value is to be read.SerialComException - if an I/O error occurs.public boolean setBitMode(long handle,
int mask,
int mode)
throws SerialComException
Executes FT_SetBitMode function of D2XX library.
Enables different chip modes.
handle - handle of the device whose mode is to be set.mask - required value for bit mode mask. This sets up which bits are inputs and outputs.
A bit value of 0 sets the corresponding pin to an input, a bit value of 1 sets the corresponding
pin to an output. In the case of CBUS Bit Bang, the upper nibble of this value controls which
pins are inputs and outputs, while the lower nibble controls which of the outputs are high and low.mode - it should be one of the following : 0x0 for Reset, 0x1 for Asynchronous Bit Bang, 0x2
for MPSSE, 0x4 for Synchronous Bit Bang, 0x8 for MCU Host Bus Emulation Mode, 0x10 for Fast
Opto-Isolated Serial Mode, 0x20 for CBUS Bit Bang Mode, 0x40 for Single Channel Synchronous
245 FIFO Mode.SerialComException - if an I/O error occurs.public int getBitMode(long handle)
throws SerialComException
Executes FT_GetBitMode function of D2XX library.
Gets the instantaneous value of the data bus.
handle - handle of the device whose mode is to be fetched.SerialComException - if an I/O error occurs.public boolean setUSBParameters(long handle,
int inTransferSize,
int outTransferSize)
throws SerialComException
Executes FT_SetUSBParameters function of D2XX library.
Set the USB request transfer size. Check with application note that setting output transfer size is supported or not. If not supported then outTransferSize must be 0.
handle - handle of the device whose parameters is to be set.inTransferSize - Transfer size for USB IN request.outTransferSize - Transfer size for USB OUT request.IllegalArgumentException - if inTransferSize or outTransferSize is negative.SerialComException - if an I/O error occurs.public long w32CreateFile(String serialNum, String description, long location, int dwAttrsAndFlags, int dwAccess, boolean overLapped) throws SerialComException
Executes FT_W32_CreateFile function of D2XX library.
Opens the specified device and return a handle which will be used for subsequent accesses. The device can be specified by its serial number, device description, or location. This function must be used if overlapped I/O is required.
serialNum - serial number string if device is to be opened using serial number.description - description of the device if it is to be opened using description.location - location of the device if it is to be opened using location.dwAttrsAndFlags - one of the constant FT_OPEN_BY_SERIAL_NUMBER, FT_OPEN_BY_DESCRIPTION or
FT_OPEN_BY_LOCATION.dwAccess - bit mask of GENERIC_READ or GENERIC_WRITE or both.overLapped - true if device is to be opened for overlapped operations.IllegalArgumentException - if serialNum or description is null or location is negative when
they must be valid.SerialComException - if an I/O error occurs.public boolean w32CloseHandle(long handle)
throws SerialComException
Executes FT_W32_CloseHandle function of D2XX library.
Close the specified device handle.
handle - of the device that is to be close.SerialComException - if an I/O error occurs.public int w32ReadFile(long handle,
byte[] buffer,
int numOfBytesToRead)
throws SerialComException
Executes FT_W32_ReadFile function of D2XX library.
Read data from the device.
Note that SCM supports only non-overlapped version of FT_W32_ReadFile method. If the application wishes to do anything in parallel, it should use java thread. By default this method will block. If non-blocking behavior is required application can set timeouts using w32SetCommTimeouts method.
handle - handle of the device from which to read data.buffer - byte buffer where data read will be placed.numOfBytesToRead - number of bytes to be tried to read.SerialComException - if an I/O error occurs.IllegalArgumentException - if buffer is null or numOfBytesToRead is negative or zero.public int w32WriteFile(long handle,
byte[] buffer,
int numOfBytesToWrite)
throws SerialComException
Executes FT_W32_WriteFile function of D2XX library.
Write data from given buffer to the device.
Note that SCM supports only non-overlapped version of FT_W32_WriteFile method. If the application wishes to do anything in parallel, it should use java thread. By default this method will block. If non-blocking behavior is required application can set timeouts using w32SetCommTimeouts method.
handle - handle of the device to which data is to be sent.buffer - byte buffer that contains the data to be written to the device.numOfBytesToWrite - number of bytes to write from buffer to the device.SerialComException - if an I/O error occurs.IllegalArgumentException - if buffer is null or numOfBytesToWrite is negative or zero.public boolean w32GetOverlappedResult(long handle,
boolean wait)
throws SerialComException
Executes FT_W32_GetOverlappedResult function of D2XX library.
Gets the result of an overlapped operation.
Note that this method is not supported by SCM as SCM implements only non-overlapped version of FT_W32_WriteFile and FT_W32_ReadFile functions.
handle - handle of the device whose baud rate need to be set.wait - Set to TRUE if the function does not return until the operation has been completed.SerialComException - if an I/O error occurs.public boolean w32EscapeCommFunction(long handle,
short function)
throws SerialComException
Executes FT_W32_EscapeCommFunction function of D2XX library.
Perform an extended function.
handle - handle of the device.function - can be one of the following constant : SETRTS, CLRRTS, SETDTR, CLRDTR, SETBREAK
and CLRBREAK defined in this class.SerialComException - if an I/O error occurs.public int w32GetCommModemStatus(long handle)
throws SerialComException
Executes FT_W32_GetCommModemStatus function of D2XX library.
Gets the current modem control value.
handle - handle of the device.SerialComException - if an I/O error occurs.public boolean w32SetupComm(long handle,
int readBufSize,
int writeBufSize)
throws SerialComException
Executes FT_W32_SetupComm function of D2XX library.
Sets the read and write buffers.
handle - handle of the device.SerialComException - if an I/O error occurs.public boolean w32SetCommState(long handle,
int[] dcb)
throws SerialComException
Executes FT_W32_SetCommState function of D2XX library.
Sets the setting given in DCB structure. Create an array of integers of size 28, fill all the values as if filling C structure but type cast every value to int. Native layer will type cast them back to data type as expected by C function. The DCBlength, fDummy2, wReserved, wReserved1 are ignored by native layer. The DCB configuration values must be in the following order : DCBlength, BaudRate, fBinary, fParity, fOutxCtsFlow, fOutxDsrFlow, fDtrControl, fDsrSensitivity, fTXContinueOnXoff, fOutX, fInX, fErrorChar, fNull, fRtsControl, fAbortOnError, fDummy2, wReserved, XonLim, XoffLim, ByteSize, Parity, StopBits, XonChar, XoffChar, ErrorChar, EofChar, EvtChar and wReserved1.
handle - handle of the device.dcb - configuration values array defined in correct order.SerialComException - if an I/O error occurs.public int[] w32GetCommState(long handle)
throws SerialComException
Executes FT_W32_GetCommState function of D2XX library.
Gets the current device state. The returned DCB configuration values are in the following order : DCBlength, BaudRate, fBinary, fParity, fOutxCtsFlow, fOutxDsrFlow, fDtrControl, fDsrSensitivity, fTXContinueOnXoff, fOutX, fInX, fErrorChar, fNull, fRtsControl, fAbortOnError, fDummy2, wReserved, XonLim, XoffLim, ByteSize, Parity, StopBits, XonChar, XoffChar, ErrorChar, EofChar, EvtChar and wReserved1. To extract char data type values, application must type cast value to appropriate type. For example to obtain xonchar value use; char XonChar = (char) dcbval[22];
handle - handle of the device.SerialComException - if an I/O error occurs.public boolean w32SetCommTimeouts(long handle,
int readIntervalTimeout,
int readTotalTimeoutMultiplier,
int readTotalTimeoutConstant,
int writeTotalTimeoutMultiplier,
int writeTotalTimeoutConstant)
throws SerialComException
Executes FT_W32_SetCommTimeouts function of D2XX library.
Sets the timeout parameters for I/O requests.
handle - handle of the device.readIntervalTimeout - The maximum time allowed to elapse before the arrival of the next byte
on the communications line, in milliseconds.readTotalTimeoutMultiplier - The multiplier used to calculate the total time-out period for
read operations, in milliseconds.readTotalTimeoutConstant - A constant used to calculate the total time-out period for read
operations, in milliseconds.writeTotalTimeoutMultiplier - The multiplier used to calculate the total time-out period for
write operations, in milliseconds.writeTotalTimeoutConstant - A constant used to calculate the total time-out period for write
operations, in milliseconds.SerialComException - if an I/O error occurs.public int[] w32GetCommTimeouts(long handle)
throws SerialComException
Executes FT_W32_GetCommTimeouts function of D2XX library.
Gets the timeout parameters for I/O requests.
handle - handle of the device whose timeout values is to be fetched.SerialComException - if an I/O error occurs.public boolean w32SetCommBreak(long handle)
throws SerialComException
Executes FT_W32_SetCommBreak function of D2XX library.
Puts the communications line in the BREAK state.
handle - handle of the device.SerialComException - if an I/O error occurs.public boolean w32ClearCommBreak(long handle)
throws SerialComException
Executes FT_W32_ClearCommBreak function of D2XX library.
Puts the communications line in the non-BREAK state.
handle - handle of the device.SerialComException - if an I/O error occurs.public boolean w32SetCommMask(long handle,
int flag)
throws SerialComException
Executes FT_W32_SetCommMask function of D2XX library.
Specifies events that the device has to monitor.
handle - handle of the device.flag - bit mask of the constants EV_XXXXX in SerialComFTDID2XX class.SerialComException - if an I/O error occurs.public int w32GetCommMask(long handle)
throws SerialComException
Executes FT_W32_GetCommMask function of D2XX library.
Retrieves the events that are currently being monitored by a device.
handle - handle of the device.SerialComException - if an I/O error occurs.public boolean w32WaitCommEvent(long handle,
int event)
throws SerialComException
Executes FT_W32_WaitCommEvent function of D2XX library.
Waits for an event to occur.
Note that SCM supports only non-overlapped version of FT_W32_WaitCommEvent method. If the application wishes to do anything in parallel, it should use java thread. By default this method will block.
handle - handle of the device.event - bit mask of the constants EV_XXXXX defined in SerialComFTDID2XX class.SerialComException - if an I/O error occurs.public boolean w32PurgeComm(long handle,
int event)
throws SerialComException
Executes FT_W32_PurgeComm function of D2XX library.
Aborts and clear buffers as per flag bits.
handle - handle of the device.event - bit mask of the constants PURGE_XXXXX in this class.SerialComException - if an I/O error occurs.public String w32GetLastError(long handle) throws SerialComException
Executes FT_W32_GetLastError function of D2XX library.
Gets the last error that occurred on the device.
handle - handle of the device.SerialComException - if an I/O error occurs.public int[] w32ClearCommError(long handle)
throws SerialComException
Executes FT_W32_ClearCommError function of D2XX library.
Gets information about a communications error and get current status of the device. The returned array has following sequence of information starting at index 0: bit mask of error constants (CE_XXXX), fCtsHold, fDsrHold, fRlsdHold, fXoffHold, fXoffSent, fEof, fTxim, fReserved, cbInQue and cbOutQue.
handle - handle of the device.SerialComException - if an I/O error occurs.Copyright © 2016. All rights reserved.