Module de.ibapl.spsw.jniprovider
Package de.ibapl.spsw.jniprovider
Class GenericTermiosSerialPortSocket
- java.lang.Object
-
- java.nio.channels.spi.AbstractInterruptibleChannel
-
- de.ibapl.spsw.jniprovider.AbstractSerialPortSocket<GenericTermiosSerialPortSocket>
-
- de.ibapl.spsw.jniprovider.GenericTermiosSerialPortSocket
-
- All Implemented Interfaces:
InOutSpeedConfiguration,SerialPortConfiguration,SerialPortSocket,Closeable,AutoCloseable,ByteChannel,Channel,InterruptibleChannel,ReadableByteChannel,WritableByteChannel
public class GenericTermiosSerialPortSocket extends AbstractSerialPortSocket<GenericTermiosSerialPortSocket> implements InOutSpeedConfiguration
JNI wrapper around the POSIX termios structure. Use serial_struct TIOCGSERIAL to get more infos?- Author:
- scream3r, Arne Plöse
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.ibapl.spsw.jniprovider.AbstractSerialPortSocket
AbstractSerialPortSocket.SerialInputStream, AbstractSerialPortSocket.SerialOutputStream
-
-
Field Summary
Fields Modifier and Type Field Description static CleanerCLEANER-
Fields inherited from class de.ibapl.spsw.jniprovider.AbstractSerialPortSocket
is, os
-
Fields inherited from interface de.ibapl.spsw.api.SerialPortConfiguration
INFINITE_TIMEOUT, PORT_FD_INVALID, PORT_IS_CLOSED, PORT_IS_OPEN
-
-
Constructor Summary
Constructors Constructor Description GenericTermiosSerialPortSocket(String portName)GenericTermiosSerialPortSocket(String portName, Speed speed, DataBits dataBits, StopBits stopBits, Parity parity, Set<FlowControl> flowControls)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrainOutputBuffer()SpeedgetInSpeed()intgetInterByteReadTimeout()SpeedgetOutSpeed()intgetOverallReadTimeout()intgetOverallWriteTimeout()protected voidimplCloseChannel()booleanisDTR()booleanisRTS()protected voidopen(String portName, int paramBitSet)Open portvoidsendXOFF()voidsendXON()voidsetInSpeed(Speed speed)protected voidsetInSpeed0(int parameterBitSet)voidsetOutSpeed(Speed speed)protected voidsetOutSpeed0(int parameterBitSet)voidsetTimeouts(int interByteReadTimeout, int overallReadTimeout, int overallWriteTimeout)-
Methods inherited from class de.ibapl.spsw.jniprovider.AbstractSerialPortSocket
ensureOpen, getDatatBits, getFlowControl, getInBufferBytesCount, getInputStream, getOutBufferBytesCount, getOutputStream, getParameters, getParity, getPortName, getSpeed, getStopBits, getXOFFChar, getXONChar, isCTS, isDCD, isDSR, isRI, open, read, sendBreak, setBreak, setDataBits, setDTR, setFlowControl, setParameters, setParity, setRTS, setSpeed, setStopBits, setXOFFChar, setXONChar, toString, write, writeBytes_ParamsOK, writeSingle
-
Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel
begin, close, end, isOpen
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.nio.channels.InterruptibleChannel
close
-
Methods inherited from interface de.ibapl.spsw.api.SerialPortConfiguration
calculateMillisForCharacters, calculateMillisPerCharacter, calculateSpeedInCharactersPerSecond
-
-
-
-
Field Detail
-
CLEANER
public static final Cleaner CLEANER
-
-
Constructor Detail
-
GenericTermiosSerialPortSocket
public GenericTermiosSerialPortSocket(String portName) throws IOException
- Throws:
IOException
-
GenericTermiosSerialPortSocket
public GenericTermiosSerialPortSocket(String portName, Speed speed, DataBits dataBits, StopBits stopBits, Parity parity, Set<FlowControl> flowControls) throws IOException
- Throws:
IOException
-
-
Method Detail
-
open
protected final void open(String portName, int paramBitSet) throws IOException
Description copied from class:AbstractSerialPortSocketOpen port- Specified by:
openin classAbstractSerialPortSocket<GenericTermiosSerialPortSocket>- Parameters:
portName- the name of port for openingparamBitSet- the parameters as masked bit set.- Throws:
IOException
-
implCloseChannel
protected void implCloseChannel() throws IOException- Overrides:
implCloseChannelin classAbstractSerialPortSocket<GenericTermiosSerialPortSocket>- Throws:
IOException
-
drainOutputBuffer
public void drainOutputBuffer() throws IOException- Specified by:
drainOutputBufferin interfaceSerialPortConfiguration- Throws:
IOException
-
getInterByteReadTimeout
public int getInterByteReadTimeout() throws IOException- Specified by:
getInterByteReadTimeoutin interfaceSerialPortConfiguration- Throws:
IOException
-
getOverallReadTimeout
public int getOverallReadTimeout() throws IOException- Specified by:
getOverallReadTimeoutin interfaceSerialPortConfiguration- Throws:
IOException
-
getOverallWriteTimeout
public int getOverallWriteTimeout() throws IOException- Specified by:
getOverallWriteTimeoutin interfaceSerialPortConfiguration- Throws:
IOException
-
getInSpeed
public Speed getInSpeed() throws IOException
- Specified by:
getInSpeedin interfaceInOutSpeedConfiguration- Throws:
IOException
-
getOutSpeed
public Speed getOutSpeed() throws IOException
- Specified by:
getOutSpeedin interfaceInOutSpeedConfiguration- Throws:
IOException
-
isDTR
public boolean isDTR() throws IOException- Throws:
IOException
-
isRTS
public boolean isRTS() throws IOException- Throws:
IOException
-
sendXOFF
public void sendXOFF() throws IOException- Specified by:
sendXOFFin interfaceSerialPortConfiguration- Throws:
IOException
-
sendXON
public void sendXON() throws IOException- Specified by:
sendXONin interfaceSerialPortConfiguration- Throws:
IOException
-
setTimeouts
public void setTimeouts(int interByteReadTimeout, int overallReadTimeout, int overallWriteTimeout) throws IOException- Specified by:
setTimeoutsin interfaceSerialPortConfiguration- Throws:
IOException
-
setInSpeed0
protected void setInSpeed0(int parameterBitSet) throws IOException- Throws:
IOException
-
setOutSpeed0
protected void setOutSpeed0(int parameterBitSet) throws IOException- Throws:
IOException
-
setInSpeed
public void setInSpeed(Speed speed) throws IOException
- Specified by:
setInSpeedin interfaceInOutSpeedConfiguration- Throws:
IOException
-
setOutSpeed
public void setOutSpeed(Speed speed) throws IOException
- Specified by:
setOutSpeedin interfaceInOutSpeedConfiguration- Throws:
IOException
-
-