public class TelnetSerialPort extends SerialPort
SerialPort.
This class extends the SerialPort class and functions in the same way, however, there are
a couple of differences to be aware of:
TelnetClient via getTelnetClient() and invoke
TelnetClient.connect() (or one of its variants).
This will create the telnet connection to the access server.
IOException will be
thrown when attempting to access the serial port input or output streams. In addition, a
DATA_AVAILABLE event will be immediately generated.
notifyOnOutputEmpty(boolean).
Finally, sendBreak(int) is supported but the millis argument is ignored, as timing cannot be
assured over a TCP connection. Access servers typically enforce a fixed break time.SerialPort,
RFC 2217DATABITS_5, DATABITS_6, DATABITS_7, DATABITS_8, FLOWCONTROL_NONE, FLOWCONTROL_RTSCTS_IN, FLOWCONTROL_RTSCTS_OUT, FLOWCONTROL_XONXOFF_IN, FLOWCONTROL_XONXOFF_OUT, PARITY_EVEN, PARITY_MARK, PARITY_NONE, PARITY_ODD, PARITY_SPACE, STOPBITS_1, STOPBITS_1_5, STOPBITS_2| Constructor and Description |
|---|
TelnetSerialPort()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(SerialPortEventListener listener) |
void |
close() |
protected org.apache.commons.net.telnet.TelnetClient |
createTelnetClient()
Construct and configure the
TelnetClient to be used for this instance. |
void |
disableReceiveFraming() |
void |
disableReceiveThreshold() |
void |
disableReceiveTimeout() |
void |
enableReceiveFraming(int framingByte) |
void |
enableReceiveThreshold(int threshold) |
void |
enableReceiveTimeout(int timeout) |
int |
getBaudBase() |
int |
getBaudRate() |
boolean |
getCallOutHangup() |
int |
getDataBits() |
int |
getDivisor() |
byte |
getEndOfInputChar() |
int |
getFlowControlMode() |
int |
getInputBufferSize() |
java.io.InputStream |
getInputStream() |
boolean |
getLowLatency() |
java.lang.String |
getName()
Get the descriptive name of this client (used for logging purposes).
|
int |
getOutputBufferSize() |
java.io.OutputStream |
getOutputStream() |
int |
getParity() |
byte |
getParityErrorChar() |
int |
getReceiveFramingByte() |
int |
getReceiveThreshold() |
int |
getReceiveTimeout() |
java.lang.String |
getSignature()
Get the signature sent to the remote server at connection time.
|
int |
getStopBits() |
org.apache.commons.net.telnet.TelnetClient |
getTelnetClient()
Get the
TelnetClient associated with this instance. |
java.lang.String |
getUARTType() |
boolean |
isCD() |
boolean |
isCTS() |
boolean |
isDSR() |
boolean |
isDTR() |
boolean |
isReceiveFramingEnabled() |
boolean |
isReceiveThresholdEnabled() |
boolean |
isReceiveTimeoutEnabled() |
boolean |
isRI() |
boolean |
isRTS() |
void |
notifyOnBreakInterrupt(boolean value) |
void |
notifyOnCarrierDetect(boolean value) |
void |
notifyOnCTS(boolean value) |
void |
notifyOnDataAvailable(boolean value) |
void |
notifyOnDSR(boolean value) |
void |
notifyOnFramingError(boolean value) |
void |
notifyOnOutputEmpty(boolean value) |
void |
notifyOnOverrunError(boolean value) |
void |
notifyOnParityError(boolean value) |
void |
notifyOnRingIndicator(boolean value) |
void |
removeEventListener() |
void |
sendBreak(int millis) |
boolean |
setBaudBase(int arg0) |
boolean |
setCallOutHangup(boolean arg0) |
boolean |
setDivisor(int arg0) |
void |
setDTR(boolean value) |
boolean |
setEndOfInputChar(byte arg0) |
void |
setFlowControlMode(int flowControl) |
void |
setInputBufferSize(int size) |
boolean |
setLowLatency() |
void |
setName(java.lang.String name)
Set the descriptive name of this client (used for logging purposes).
|
void |
setOutputBufferSize(int size) |
boolean |
setParityErrorChar(byte arg0) |
void |
setRTS(boolean value) |
void |
setSerialPortParams(int baudRate,
int dataBits,
int stopBits,
int parity) |
void |
setSignature(java.lang.String signature)
Set the signature sent to the remote server at connection time.
|
boolean |
setUARTType(java.lang.String arg0,
boolean arg1) |
public java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.String getSignature()
public void setSignature(java.lang.String signature)
signature - signature string, or null (or empty string) to not send a signaturepublic org.apache.commons.net.telnet.TelnetClient getTelnetClient()
TelnetClient associated with this instance.protected org.apache.commons.net.telnet.TelnetClient createTelnetClient()
TelnetClient to be used for this instance.public java.io.InputStream getInputStream()
throws java.io.IOException
getInputStream in class CommPortjava.io.IOExceptionpublic java.io.OutputStream getOutputStream()
throws java.io.IOException
getOutputStream in class CommPortjava.io.IOExceptionpublic int getBaudRate()
getBaudRate in class SerialPortpublic int getDataBits()
getDataBits in class SerialPortpublic int getStopBits()
getStopBits in class SerialPortpublic int getParity()
getParity in class SerialPortpublic void sendBreak(int millis)
sendBreak in class SerialPortpublic void setFlowControlMode(int flowControl)
throws UnsupportedCommOperationException
setFlowControlMode in class SerialPortUnsupportedCommOperationExceptionpublic int getFlowControlMode()
getFlowControlMode in class SerialPortpublic void setSerialPortParams(int baudRate,
int dataBits,
int stopBits,
int parity)
throws UnsupportedCommOperationException
setSerialPortParams in class SerialPortUnsupportedCommOperationExceptionpublic void setDTR(boolean value)
setDTR in class SerialPortpublic boolean isDTR()
isDTR in class SerialPortpublic void setRTS(boolean value)
setRTS in class SerialPortpublic boolean isRTS()
isRTS in class SerialPortpublic boolean isCTS()
isCTS in class SerialPortpublic boolean isDSR()
isDSR in class SerialPortpublic boolean isRI()
isRI in class SerialPortpublic boolean isCD()
isCD in class SerialPortpublic void addEventListener(SerialPortEventListener listener) throws java.util.TooManyListenersException
addEventListener in class SerialPortjava.util.TooManyListenersExceptionpublic void removeEventListener()
removeEventListener in class SerialPortpublic void notifyOnDataAvailable(boolean value)
notifyOnDataAvailable in class SerialPortpublic void notifyOnOutputEmpty(boolean value)
notifyOnOutputEmpty in class SerialPortpublic void notifyOnCTS(boolean value)
notifyOnCTS in class SerialPortpublic void notifyOnDSR(boolean value)
notifyOnDSR in class SerialPortpublic void notifyOnRingIndicator(boolean value)
notifyOnRingIndicator in class SerialPortpublic void notifyOnCarrierDetect(boolean value)
notifyOnCarrierDetect in class SerialPortpublic void notifyOnOverrunError(boolean value)
notifyOnOverrunError in class SerialPortpublic void notifyOnParityError(boolean value)
notifyOnParityError in class SerialPortpublic void notifyOnFramingError(boolean value)
notifyOnFramingError in class SerialPortpublic void notifyOnBreakInterrupt(boolean value)
notifyOnBreakInterrupt in class SerialPortpublic void enableReceiveThreshold(int threshold)
throws UnsupportedCommOperationException
enableReceiveThreshold in class CommPortUnsupportedCommOperationExceptionpublic void disableReceiveThreshold()
disableReceiveThreshold in class CommPortpublic boolean isReceiveThresholdEnabled()
isReceiveThresholdEnabled in class CommPortpublic int getReceiveThreshold()
getReceiveThreshold in class CommPortpublic void enableReceiveTimeout(int timeout)
throws UnsupportedCommOperationException
enableReceiveTimeout in class CommPortUnsupportedCommOperationExceptionpublic void disableReceiveTimeout()
disableReceiveTimeout in class CommPortpublic boolean isReceiveTimeoutEnabled()
isReceiveTimeoutEnabled in class CommPortpublic int getReceiveTimeout()
getReceiveTimeout in class CommPortpublic void enableReceiveFraming(int framingByte)
throws UnsupportedCommOperationException
enableReceiveFraming in class CommPortUnsupportedCommOperationExceptionpublic void disableReceiveFraming()
disableReceiveFraming in class CommPortpublic boolean isReceiveFramingEnabled()
isReceiveFramingEnabled in class CommPortpublic int getReceiveFramingByte()
getReceiveFramingByte in class CommPortpublic void setInputBufferSize(int size)
setInputBufferSize in class CommPortpublic int getInputBufferSize()
getInputBufferSize in class CommPortpublic void setOutputBufferSize(int size)
setOutputBufferSize in class CommPortpublic int getOutputBufferSize()
getOutputBufferSize in class CommPortpublic int getBaudBase()
throws UnsupportedCommOperationException,
java.io.IOException
getBaudBase in class SerialPortUnsupportedCommOperationExceptionjava.io.IOExceptionpublic boolean getCallOutHangup()
throws UnsupportedCommOperationException
getCallOutHangup in class SerialPortUnsupportedCommOperationExceptionpublic int getDivisor()
throws UnsupportedCommOperationException,
java.io.IOException
getDivisor in class SerialPortUnsupportedCommOperationExceptionjava.io.IOExceptionpublic byte getEndOfInputChar()
throws UnsupportedCommOperationException
getEndOfInputChar in class SerialPortUnsupportedCommOperationExceptionpublic boolean getLowLatency()
throws UnsupportedCommOperationException
getLowLatency in class SerialPortUnsupportedCommOperationExceptionpublic byte getParityErrorChar()
throws UnsupportedCommOperationException
getParityErrorChar in class SerialPortUnsupportedCommOperationExceptionpublic java.lang.String getUARTType()
throws UnsupportedCommOperationException
getUARTType in class SerialPortUnsupportedCommOperationExceptionpublic boolean setBaudBase(int arg0)
throws UnsupportedCommOperationException,
java.io.IOException
setBaudBase in class SerialPortUnsupportedCommOperationExceptionjava.io.IOExceptionpublic boolean setCallOutHangup(boolean arg0)
throws UnsupportedCommOperationException
setCallOutHangup in class SerialPortUnsupportedCommOperationExceptionpublic boolean setDivisor(int arg0)
throws UnsupportedCommOperationException,
java.io.IOException
setDivisor in class SerialPortUnsupportedCommOperationExceptionjava.io.IOExceptionpublic boolean setEndOfInputChar(byte arg0)
throws UnsupportedCommOperationException
setEndOfInputChar in class SerialPortUnsupportedCommOperationExceptionpublic boolean setLowLatency()
throws UnsupportedCommOperationException
setLowLatency in class SerialPortUnsupportedCommOperationExceptionpublic boolean setParityErrorChar(byte arg0)
throws UnsupportedCommOperationException
setParityErrorChar in class SerialPortUnsupportedCommOperationExceptionpublic boolean setUARTType(java.lang.String arg0,
boolean arg1)
throws UnsupportedCommOperationException
setUARTType in class SerialPortUnsupportedCommOperationException