public class RXTXPort extends SerialPort
SerialPort| 限定符和类型 | 字段和说明 |
|---|---|
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 |
protected boolean |
HARDWARE_FAULT |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addEventListener(SerialPortEventListener lsnr) |
boolean |
checkMonitorThread() |
boolean |
clearCommInput()
Extension to CommAPI returns boolean true on success
UnsupportedCommOperationException
|
void |
close() |
void |
disableReceiveFraming() |
void |
disableReceiveThreshold() |
void |
disableReceiveTimeout() |
int |
disableRs485() |
void |
enableReceiveFraming(int f)
Receive framing control
|
void |
enableReceiveThreshold(int thresh) |
void |
enableReceiveTimeout(int time) |
int |
enableRs485(boolean busEnableActiveLow,
int delayBusEnableBeforeSendMs,
int delayBusEnableAfterSendMs) |
protected void |
finalize()
Finalize the port
|
int |
getBaudBase()
Extension to CommAPI
|
int |
getBaudRate() |
boolean |
getCallOutHangup()
Extension to CommAPI returns boolean true on success
UnsupportedCommOperationException
|
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
UnsupportedCommOperationException
|
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
UnsupportedCommOperationException
|
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
UnsupportedCommOperationException
|
void |
setOutputBufferSize(int size) |
boolean |
setParityErrorChar(byte b)
Extension to CommAPI This is an extension to CommAPI.
|
void |
setRcvFifoTrigger(int trigger)
已过时。
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 boolean HARDWARE_FAULT
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 open PortInUseExceptionPortInUseExceptionSerialPortpublic OutputStream getOutputStream()
getOutputStream 在类中 CommPortpublic InputStream getInputStream()
getInputStream 在类中 CommPortInputStreampublic void setSerialPortParams(int b,
int d,
int s,
int p)
throws UnsupportedCommOperationException
public int getBaudRate()
getBaudRate 在类中 SerialPortpublic int getDataBits()
getDataBits 在类中 SerialPortpublic int getStopBits()
getStopBits 在类中 SerialPortpublic int getParity()
getParity 在类中 SerialPortpublic void setFlowControlMode(int flowcontrol)
setFlowControlMode 在类中 SerialPortflowcontrol - FLOWCONTROL_NONE is defaultSerialPort.FLOWCONTROL_NONEpublic int getFlowControlMode()
getFlowControlMode 在类中 SerialPortpublic void enableReceiveFraming(int f)
throws UnsupportedCommOperationException
enableReceiveFraming 在类中 CommPortf - framming UnsupportedCommOperationExceptionUnsupportedCommOperationExceptionpublic void disableReceiveFraming()
disableReceiveFraming 在类中 CommPortpublic boolean isReceiveFramingEnabled()
isReceiveFramingEnabled 在类中 CommPortpublic int getReceiveFramingByte()
getReceiveFramingByte 在类中 CommPortpublic int NativegetReceiveTimeout()
public void disableReceiveTimeout()
disableReceiveTimeout 在类中 CommPortpublic void enableReceiveTimeout(int time)
enableReceiveTimeout 在类中 CommPorttime - public boolean isReceiveTimeoutEnabled()
isReceiveTimeoutEnabled 在类中 CommPortpublic int getReceiveTimeout()
getReceiveTimeout 在类中 CommPortpublic void enableReceiveThreshold(int thresh)
enableReceiveThreshold 在类中 CommPortthresh - thresholdpublic void disableReceiveThreshold()
disableReceiveThreshold 在类中 CommPortpublic int getReceiveThreshold()
getReceiveThreshold 在类中 CommPortpublic boolean isReceiveThresholdEnabled()
isReceiveThresholdEnabled 在类中 CommPortpublic void setInputBufferSize(int size)
setInputBufferSize 在类中 CommPortsize - public int getInputBufferSize()
getInputBufferSize 在类中 CommPortpublic void setOutputBufferSize(int size)
setOutputBufferSize 在类中 CommPortsize - public int getOutputBufferSize()
getOutputBufferSize 在类中 CommPortpublic boolean isDTR()
isDTR 在类中 SerialPortpublic void setDTR(boolean state)
setDTR 在类中 SerialPortstate - public void setRTS(boolean state)
setRTS 在类中 SerialPortstate - public boolean isCTS()
isCTS 在类中 SerialPortpublic boolean isDSR()
isDSR 在类中 SerialPortpublic boolean isCD()
isCD 在类中 SerialPortpublic boolean isRI()
isRI 在类中 SerialPortpublic boolean isRTS()
isRTS 在类中 SerialPortpublic void sendBreak(int duration)
sendBreak 在类中 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 在类中 SerialPortTooManyListenersExceptionpublic void removeEventListener()
removeEventListener 在类中 SerialPortprotected void waitForTheNativeCodeSilly()
public void notifyOnDataAvailable(boolean enable)
notifyOnDataAvailable 在类中 SerialPortpublic void notifyOnOutputEmpty(boolean enable)
notifyOnOutputEmpty 在类中 SerialPortenable - public void notifyOnCTS(boolean enable)
notifyOnCTS 在类中 SerialPortenable - public void notifyOnDSR(boolean enable)
notifyOnDSR 在类中 SerialPortenable - public void notifyOnRingIndicator(boolean enable)
notifyOnRingIndicator 在类中 SerialPortenable - public void notifyOnCarrierDetect(boolean enable)
notifyOnCarrierDetect 在类中 SerialPortenable - public void notifyOnOverrunError(boolean enable)
notifyOnOverrunError 在类中 SerialPortenable - public void notifyOnParityError(boolean enable)
notifyOnParityError 在类中 SerialPortenable - public void notifyOnFramingError(boolean enable)
notifyOnFramingError 在类中 SerialPortenable - public void notifyOnBreakInterrupt(boolean enable)
notifyOnBreakInterrupt 在类中 SerialPortenable - public void setRcvFifoTrigger(int trigger)
public static int staticGetBaudRate(String port) throws UnsupportedCommOperationException
port - the name of the port thats been preopenedUnsupportedCommOperationExceptionpublic 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 - parity
UnsupportedCommOperationExceptionUnsupportedCommOperationExceptionUnsupportedCommOperationExceptionpublic 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 在类中 SerialPortUnsupportedCommOperationExceptionpublic boolean setParityErrorChar(byte b)
throws UnsupportedCommOperationException
setParityErrorChar 在类中 SerialPortb - Parity Error CharacterUnsupportedCommOperationExceptionpublic byte getEndOfInputChar()
throws UnsupportedCommOperationException
getEndOfInputChar 在类中 SerialPortUnsupportedCommOperationExceptionpublic boolean setEndOfInputChar(byte b)
throws UnsupportedCommOperationException
setEndOfInputChar 在类中 SerialPortb - End Of Input CharacterUnsupportedCommOperationExceptionpublic boolean setUARTType(String type, boolean test) throws UnsupportedCommOperationException
setUARTType 在类中 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 在类中 SerialPortUnsupportedCommOperationExceptionpublic boolean setBaudBase(int BaudBase)
throws UnsupportedCommOperationException,
IOException
setBaudBase 在类中 SerialPortBaudBase - The clock frequency divided by 16. Default BaudBase is
115200.UnsupportedCommOperationExceptionIOExceptionpublic int getBaudBase()
throws UnsupportedCommOperationException,
IOException
getBaudBase 在类中 SerialPortUnsupportedCommOperationExceptionIOExceptionpublic boolean setDivisor(int Divisor)
throws UnsupportedCommOperationException,
IOException
setDivisor 在类中 SerialPortDivisor - UnsupportedCommOperationException, IOExceptionUnsupportedCommOperationExceptionIOExceptionpublic int getDivisor()
throws UnsupportedCommOperationException,
IOException
getDivisor 在类中 SerialPortUnsupportedCommOperationExceptionIOExceptionpublic boolean setLowLatency()
throws UnsupportedCommOperationException
setLowLatency 在类中 SerialPortUnsupportedCommOperationExceptionpublic boolean getLowLatency()
throws UnsupportedCommOperationException
getLowLatency 在类中 SerialPortUnsupportedCommOperationExceptionpublic boolean setCallOutHangup(boolean NoHup)
throws UnsupportedCommOperationException
setCallOutHangup 在类中 SerialPortUnsupportedCommOperationExceptionpublic boolean getCallOutHangup()
throws UnsupportedCommOperationException
getCallOutHangup 在类中 SerialPortUnsupportedCommOperationExceptionpublic boolean clearCommInput()
throws UnsupportedCommOperationException
public int enableRs485(boolean busEnableActiveLow,
int delayBusEnableBeforeSendMs,
int delayBusEnableAfterSendMs)
public int disableRs485()
Copyright © 2020. All rights reserved.