public class WinSerialChannel extends SerialChannel
Implementation notes:
Scattering/Gathering IO is implemented in java.
Select implementation uses CancelIo function which cancels all io for the channel. Currently this will cause problem if one thread calls read/write, while another thread calls select. Since select is usually used in one thread applications, it is not problem at all.
If this class later implements AsynchronousChannel, the CancelIo has to be implemented in another way!
SerialChannel.Builder, SerialChannel.Configuration, SerialChannel.DataBits, SerialChannel.FlowControl, SerialChannel.Parity, SerialChannel.Speed, SerialChannel.StopBits| Modifier and Type | Field and Description |
|---|---|
static int |
EV_RXCHAR |
static int |
MAXDWORD |
static int |
MaxSelect |
static int |
VERSION |
address, block, clearOnClose, configuration, log, MaxSelectors, port, readLock, writeLock| Modifier and Type | Method and Description |
|---|---|
protected void |
checkVersion() |
protected void |
doClearBuffers(long address) |
protected void |
doClose(long handle) |
protected void |
doConfigure(long handle,
int baudRate,
int parity,
int dataBits,
int stopBits,
int flowControl,
boolean replaceError) |
static void |
doEnumPorts(List<String> list) |
protected long |
doOpen(byte[] port) |
protected int |
doRead(long handle,
ByteBuffer dst) |
protected int |
doWrite(long handle,
ByteBuffer src) |
static byte[] |
errorReplacement() |
int |
getReadIntervalTimeout() |
int |
getReadTotalTimeoutConstant() |
int |
getReadTotalTimeoutMultiplier() |
int |
getWriteTotalTimeoutConstant() |
int |
getWriteTotalTimeoutMultiplier() |
int |
read(ByteBuffer dst)
Reads data at buffers position and then increments the position.
|
static void |
setDebug(boolean on) |
protected void |
setEventMask(int mask) |
WinSerialChannel |
setReadIntervalTimeout(int readIntervalTimeout) |
WinSerialChannel |
setReadTotalTimeoutConstant(int readTotalTimeoutConstant) |
WinSerialChannel |
setReadTotalTimeoutMultiplier(int readTotalTimeoutMultiplier) |
protected void |
setTimeouts() |
WinSerialChannel |
setWriteTotalTimeoutConstant(int writeTotalTimeoutConstant) |
WinSerialChannel |
setWriteTotalTimeoutMultiplier(int writeTotalTimeoutMultiplier) |
String |
toString() |
int |
validOps() |
protected int |
version() |
protected int |
waitEvent(int mask) |
clearBuffers, configure, debug, doClose, getAllPorts, getConfiguration, getDataBits, getDataBits, getErrorReplacement, getFlowControl, getFlowControl, getFreePorts, getInputStream, getOutputStream, getParity, getParity, getPort, getSpeed, getSpeed, getSpeed, getStopBits, getStopBits, implCloseSelectableChannel, implConfigureBlocking, isClearOnClose, isReplaceError, open, read, read, setClearOnClose, write, write, writeblockingLock, configureBlocking, implCloseChannel, isBlocking, isRegistered, keyFor, provider, registerregisterbegin, close, end, isOpenpublic static final int VERSION
public static final int MAXDWORD
public static final int EV_RXCHAR
public static final int MaxSelect
protected void doClearBuffers(long address)
doClearBuffers in class SerialChannelprotected void doConfigure(long handle,
int baudRate,
int parity,
int dataBits,
int stopBits,
int flowControl,
boolean replaceError)
throws IOException
doConfigure in class SerialChannelIOExceptionprotected int version()
version in class SerialChannelprotected long doOpen(byte[] port)
doOpen in class SerialChannelprotected int doRead(long handle,
ByteBuffer dst)
throws IOException
doRead in class SerialChannelIOExceptionprotected int doWrite(long handle,
ByteBuffer src)
throws IOException
doWrite in class SerialChannelIOExceptionpublic static void setDebug(boolean on)
protected void doClose(long handle)
throws IOException
doClose in class SerialChannelIOExceptionprotected void checkVersion()
protected void setTimeouts()
throws IOException
setTimeouts in class SerialChannelIOExceptionpublic int validOps()
validOps in class SelectableChannelpublic static byte[] errorReplacement()
public int read(ByteBuffer dst) throws IOException
SerialChannelread in interface ReadableByteChannelread in class SerialChannelIOExceptionprotected void setEventMask(int mask)
throws IOException
IOExceptionprotected int waitEvent(int mask)
throws IOException
IOExceptionpublic int getReadIntervalTimeout()
public WinSerialChannel setReadIntervalTimeout(int readIntervalTimeout)
public int getReadTotalTimeoutMultiplier()
public WinSerialChannel setReadTotalTimeoutMultiplier(int readTotalTimeoutMultiplier)
public int getReadTotalTimeoutConstant()
public WinSerialChannel setReadTotalTimeoutConstant(int readTotalTimeoutConstant)
public int getWriteTotalTimeoutMultiplier()
public WinSerialChannel setWriteTotalTimeoutMultiplier(int writeTotalTimeoutMultiplier)
public int getWriteTotalTimeoutConstant()
public WinSerialChannel setWriteTotalTimeoutConstant(int writeTotalTimeoutConstant)
Copyright © 2015. All rights reserved.