public final class RXTXPort extends SerialPort
SerialPort| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
debug |
protected static boolean |
debug_events |
protected static boolean |
debug_read |
protected static boolean |
debug_read_results |
protected static boolean |
debug_verbose |
protected static boolean |
debug_write |
DATABITS_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 |
|---|
RXTXPort(String name)
Open the named port
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(SerialPortEventListener lsnr) |
boolean |
checkMonitorThread() |
boolean |
clearCommInput()
Extension to CommAPI
returns boolean true on success
|
void |
close() |
void |
disableReceiveFraming() |
void |
disableReceiveThreshold() |
void |
disableReceiveTimeout() |
void |
enableReceiveFraming(int f)
Receive framing control
|
void |
enableReceiveThreshold(int thresh) |
void |
enableReceiveTimeout(int time) |
protected void |
finalize()
Finalize the port
|
int |
getBaudBase()
Extension to CommAPI
|
int |
getBaudRate() |
boolean |
getCallOutHangup()
Extension to CommAPI
returns boolean true on success
|
int |
getDataBits() |
int |
getDivisor()
Extension to CommAPI
|
byte |
getEndOfInputChar()
Extension to CommAPI
This is an extension to CommAPI.
|
int |
getFlowControlMode() |
int |
getInputBufferSize() |
InputStream |
getInputStream()
get the InputStream
|
boolean |
getLowLatency()
Extension to CommAPI
returns boolean true on success
|
int |
getOutputBufferSize() |
OutputStream |
getOutputStream()
get the OutputStream
|
int |
getParity() |
byte |
getParityErrorChar()
Extension to CommAPI
This is an extension to CommAPI.
|
int |
getReceiveFramingByte() |
int |
getReceiveThreshold() |
int |
getReceiveTimeout() |
int |
getStopBits() |
String |
getUARTType()
Extension to CommAPI
This is an extension to CommAPI.
|
boolean |
isCD() |
boolean |
isCTS() |
boolean |
isDSR() |
boolean |
isDTR() |
boolean |
isReceiveFramingEnabled() |
boolean |
isReceiveThresholdEnabled() |
boolean |
isReceiveTimeoutEnabled() |
boolean |
isRI() |
boolean |
isRTS() |
protected int |
nativeavailable()
RXTXPort read methods
|
protected boolean |
nativeDrain(boolean i) |
int |
NativegetReceiveTimeout() |
void |
notifyOnBreakInterrupt(boolean enable) |
void |
notifyOnCarrierDetect(boolean enable) |
void |
notifyOnCTS(boolean enable) |
void |
notifyOnDataAvailable(boolean enable) |
void |
notifyOnDSR(boolean enable) |
void |
notifyOnFramingError(boolean enable) |
void |
notifyOnOutputEmpty(boolean enable) |
void |
notifyOnOverrunError(boolean enable) |
void |
notifyOnParityError(boolean enable) |
void |
notifyOnRingIndicator(boolean enable) |
protected int |
readArray(byte[] b,
int off,
int len) |
protected int |
readByte() |
protected int |
readTerminatedArray(byte[] b,
int off,
int len,
byte[] t) |
void |
removeEventListener()
Remove the serial port event listener
|
void |
sendBreak(int duration)
Write to the port
|
boolean |
sendEvent(int event,
boolean state) |
boolean |
setBaudBase(int BaudBase)
Extension to CommAPI.
|
boolean |
setCallOutHangup(boolean NoHup)
Extension to CommAPI
returns boolean true on success
|
boolean |
setDivisor(int Divisor)
Extension to CommAPI.
|
void |
setDTR(boolean state) |
boolean |
setEndOfInputChar(byte b)
Extension to CommAPI
This is an extension to CommAPI.
|
void |
setFlowControlMode(int flowcontrol) |
void |
setInputBufferSize(int size) |
boolean |
setLowLatency()
Extension to CommAPI
returns boolean true on success
|
void |
setOutputBufferSize(int size) |
boolean |
setParityErrorChar(byte b)
Extension to CommAPI
This is an extension to CommAPI.
|
void |
setRcvFifoTrigger(int trigger)
Deprecated.
deprecated but used in Kaffe
|
void |
setRTS(boolean state) |
void |
setSerialPortParams(int b,
int d,
int s,
int p) |
boolean |
setUARTType(String type,
boolean test)
Extension to CommAPI
This is an extension to CommAPI.
|
static int |
staticGetBaudRate(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static int |
staticGetDataBits(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static int |
staticGetParity(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static int |
staticGetStopBits(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static boolean |
staticIsCD(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static boolean |
staticIsCTS(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static boolean |
staticIsDSR(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static boolean |
staticIsDTR(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static boolean |
staticIsRI(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static boolean |
staticIsRTS(String port)
Extension to CommAPI
This is an extension to CommAPI.
|
static boolean |
staticSetDSR(String port,
boolean flag)
Extension to CommAPI
This is an extension to CommAPI.
|
static boolean |
staticSetDTR(String port,
boolean flag)
Extension to CommAPI
This is an extension to CommAPI.
|
static boolean |
staticSetRTS(String port,
boolean flag)
Extension to CommAPI
This is an extension to CommAPI.
|
static void |
staticSetSerialPortParams(String f,
int b,
int d,
int s,
int p)
Extension to CommAPI
This is an extension to CommAPI.
|
protected void |
waitForTheNativeCodeSilly()
Give the native code a chance to start listening to the hardware
or should we say give the native code control of the issue.
|
protected void |
writeArray(byte[] b,
int off,
int len,
boolean i) |
protected void |
writeByte(int b,
boolean i) |
protected static final boolean debug
protected static final boolean debug_read
protected static final boolean debug_read_results
protected static final boolean debug_write
protected static final boolean debug_events
protected static final boolean debug_verbose
public RXTXPort(String name) throws PortInUseException
name - the name of the device to openPortInUseExceptionSerialPortpublic OutputStream getOutputStream()
getOutputStream in class CommPortpublic InputStream getInputStream()
getInputStream in class CommPortInputStreampublic void setSerialPortParams(int b,
int d,
int s,
int p)
throws UnsupportedCommOperationException
setSerialPortParams in class SerialPortUnsupportedCommOperationExceptionpublic 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 setFlowControlMode(int flowcontrol)
setFlowControlMode in class SerialPortflowcontrol - FLOWCONTROL_NONE is defaultSerialPort.FLOWCONTROL_NONEpublic int getFlowControlMode()
getFlowControlMode in class SerialPortpublic void enableReceiveFraming(int f)
throws UnsupportedCommOperationException
enableReceiveFraming in class CommPortf - frammingUnsupportedCommOperationExceptionpublic void disableReceiveFraming()
disableReceiveFraming in class CommPortpublic boolean isReceiveFramingEnabled()
isReceiveFramingEnabled in class CommPortpublic int getReceiveFramingByte()
getReceiveFramingByte in class CommPortpublic int NativegetReceiveTimeout()
public void disableReceiveTimeout()
disableReceiveTimeout in class CommPortpublic void enableReceiveTimeout(int time)
enableReceiveTimeout in class CommPorttime - public boolean isReceiveTimeoutEnabled()
isReceiveTimeoutEnabled in class CommPortpublic int getReceiveTimeout()
getReceiveTimeout in class CommPortpublic void enableReceiveThreshold(int thresh)
enableReceiveThreshold in class CommPortthresh - thresholdpublic void disableReceiveThreshold()
disableReceiveThreshold in class CommPortpublic int getReceiveThreshold()
getReceiveThreshold in class CommPortpublic boolean isReceiveThresholdEnabled()
isReceiveThresholdEnabled in class CommPortpublic void setInputBufferSize(int size)
setInputBufferSize in class CommPortsize - public int getInputBufferSize()
getInputBufferSize in class CommPortpublic void setOutputBufferSize(int size)
setOutputBufferSize in class CommPortsize - public int getOutputBufferSize()
getOutputBufferSize in class CommPortpublic boolean isDTR()
isDTR in class SerialPortpublic void setDTR(boolean state)
setDTR in class SerialPortstate - public void setRTS(boolean state)
setRTS in class SerialPortstate - public boolean isCTS()
isCTS in class SerialPortpublic boolean isDSR()
isDSR in class SerialPortpublic boolean isCD()
isCD in class SerialPortpublic boolean isRI()
isRI in class SerialPortpublic boolean isRTS()
isRTS in class SerialPortpublic void sendBreak(int duration)
sendBreak in class SerialPortduration - protected void writeByte(int b,
boolean i)
throws IOException
IOExceptionprotected void writeArray(byte[] b,
int off,
int len,
boolean i)
throws IOException
IOExceptionprotected boolean nativeDrain(boolean i)
throws IOException
IOExceptionprotected int nativeavailable()
throws IOException
IOExceptionprotected int readByte()
throws IOException
IOExceptionprotected int readArray(byte[] b,
int off,
int len)
throws IOException
IOExceptionprotected int readTerminatedArray(byte[] b,
int off,
int len,
byte[] t)
throws IOException
IOExceptionpublic boolean checkMonitorThread()
public boolean sendEvent(int event,
boolean state)
event - state - public void addEventListener(SerialPortEventListener lsnr) throws TooManyListenersException
addEventListener in class SerialPortTooManyListenersExceptionpublic void removeEventListener()
removeEventListener in class SerialPortprotected void waitForTheNativeCodeSilly()
public void notifyOnDataAvailable(boolean enable)
notifyOnDataAvailable in class SerialPortpublic void notifyOnOutputEmpty(boolean enable)
notifyOnOutputEmpty in class SerialPortenable - public void notifyOnCTS(boolean enable)
notifyOnCTS in class SerialPortenable - public void notifyOnDSR(boolean enable)
notifyOnDSR in class SerialPortenable - public void notifyOnRingIndicator(boolean enable)
notifyOnRingIndicator in class SerialPortenable - public void notifyOnCarrierDetect(boolean enable)
notifyOnCarrierDetect in class SerialPortenable - public void notifyOnOverrunError(boolean enable)
notifyOnOverrunError in class SerialPortenable - public void notifyOnParityError(boolean enable)
notifyOnParityError in class SerialPortenable - public void notifyOnFramingError(boolean enable)
notifyOnFramingError in class SerialPortenable - public void notifyOnBreakInterrupt(boolean enable)
notifyOnBreakInterrupt in class SerialPortenable - public void setRcvFifoTrigger(int trigger)
public static int staticGetBaudRate(String port) throws UnsupportedCommOperationException
port - the name of the port thats been preopenedUnsupportedCommOperationException - This will not behave as expected with custom speedspublic static int staticGetDataBits(String port) throws UnsupportedCommOperationException
port - the name of the port thats been preopenedUnsupportedCommOperationExceptionpublic static int staticGetParity(String port) throws UnsupportedCommOperationException
port - the name of the port thats been preopenedUnsupportedCommOperationExceptionpublic static int staticGetStopBits(String port) throws UnsupportedCommOperationException
port - the name of the port thats been preopenedUnsupportedCommOperationExceptionpublic static void staticSetSerialPortParams(String f, int b, int d, int s, int p) throws UnsupportedCommOperationException
f - filenameb - baudrated - databitss - stopbitsp - parityUnsupportedCommOperationExceptionUnsupportedCommOperationExceptionpublic static boolean staticSetDSR(String port, boolean flag) throws UnsupportedCommOperationException
UnsupportedCommOperationExceptionpublic static boolean staticSetDTR(String port, boolean flag) throws UnsupportedCommOperationException
UnsupportedCommOperationExceptionpublic static boolean staticSetRTS(String port, boolean flag) throws UnsupportedCommOperationException
UnsupportedCommOperationExceptionpublic static boolean staticIsRTS(String port) throws UnsupportedCommOperationException
port - UnsupportedCommOperationExceptionpublic static boolean staticIsCD(String port) throws UnsupportedCommOperationException
port - UnsupportedCommOperationExceptionpublic static boolean staticIsCTS(String port) throws UnsupportedCommOperationException
port - UnsupportedCommOperationExceptionpublic static boolean staticIsDSR(String port) throws UnsupportedCommOperationException
port - UnsupportedCommOperationExceptionpublic static boolean staticIsDTR(String port) throws UnsupportedCommOperationException
port - UnsupportedCommOperationExceptionpublic static boolean staticIsRI(String port) throws UnsupportedCommOperationException
port - UnsupportedCommOperationExceptionpublic byte getParityErrorChar()
throws UnsupportedCommOperationException
getParityErrorChar in class SerialPortUnsupportedCommOperationException - Anyone know how to do this in Unix?public boolean setParityErrorChar(byte b)
throws UnsupportedCommOperationException
setParityErrorChar in class SerialPortb - Parity Error CharacterUnsupportedCommOperationException - Anyone know how to do this in Unix?public byte getEndOfInputChar()
throws UnsupportedCommOperationException
getEndOfInputChar in class SerialPortUnsupportedCommOperationException - Anyone know how to do this in Unix?public boolean setEndOfInputChar(byte b)
throws UnsupportedCommOperationException
setEndOfInputChar in class SerialPortb - End Of Input CharacterUnsupportedCommOperationExceptionpublic boolean setUARTType(String type, boolean test) throws UnsupportedCommOperationException
setUARTType in class SerialPorttype - String representation of the UART type which mayb
be "none", "8250", "16450", "16550", "16550A", "16650", "16550V2"
or "16750".test - boolean flag to determin if the UART should be tested.UnsupportedCommOperationExceptionpublic String getUARTType() throws UnsupportedCommOperationException
getUARTType in class SerialPortUnsupportedCommOperationExceptionpublic boolean setBaudBase(int BaudBase)
throws UnsupportedCommOperationException,
IOException
setBaudBase in class SerialPortBaudBase - The clock frequency divided by 16. Default
BaudBase is 115200.UnsupportedCommOperationExceptionIOExceptionpublic int getBaudBase()
throws UnsupportedCommOperationException,
IOException
getBaudBase in class SerialPortUnsupportedCommOperationExceptionIOExceptionpublic boolean setDivisor(int Divisor)
throws UnsupportedCommOperationException,
IOException
setDivisor in class SerialPortDivisor - UnsupportedCommOperationExceptionIOExceptionpublic int getDivisor()
throws UnsupportedCommOperationException,
IOException
getDivisor in class SerialPortUnsupportedCommOperationExceptionIOExceptionpublic boolean setLowLatency()
throws UnsupportedCommOperationException
setLowLatency in class SerialPortUnsupportedCommOperationExceptionpublic boolean getLowLatency()
throws UnsupportedCommOperationException
getLowLatency in class SerialPortUnsupportedCommOperationExceptionpublic boolean setCallOutHangup(boolean NoHup)
throws UnsupportedCommOperationException
setCallOutHangup in class SerialPortUnsupportedCommOperationExceptionpublic boolean getCallOutHangup()
throws UnsupportedCommOperationException
getCallOutHangup in class SerialPortUnsupportedCommOperationExceptionpublic boolean clearCommInput()
throws UnsupportedCommOperationException
Copyright © 2016. All rights reserved.