public class BasicSerialParameters extends Object implements SerialParameters
SerialParameters.DEFAULT_BAUD_RATE, DEFAULT_DATA_BITS, DEFAULT_PARITY, DEFAULT_READ_TIMEOUT, DEFAULT_RS485_AFTER_SEND_DELAY, DEFAULT_RS485_BEFORE_SEND_DELAY, DEFAULT_RS485_RTS_HIGH_ENABLED, DEFAULT_STOP_BITS, RS485_AFTER_SEND_DELAY_FLAG, RS485_BEFORE_SEND_DELAY_FLAG, RS485_ECHO_FLAG, RS485_RTS_HIGH_FLAG, RS485_TERMINATION_FLAG| Constructor | Description |
|---|---|
BasicSerialParameters() |
| Modifier and Type | Method | Description |
|---|---|---|
int |
getBaudRate() |
Get the baud rate.
|
int |
getDataBits() |
Get the data bits.
|
Set<SerialFlowControl> |
getFlowControl() |
Get the flow control.
|
SerialParity |
getParity() |
Get the parity.
|
int |
getReadTimeout() |
Get the read timeout.
|
int |
getRs485AfterSendDelay() |
Get a time to wait after sending data before disabling transmit mode when
in RS-485 mode.
|
int |
getRs485BeforeSendDelay() |
Get a time to wait after enabling transmit mode before sending data when
in RS-485 mode.
|
Boolean |
getRs485ModeEnabled() |
Get the RS-485 mode.
|
SerialStopBits |
getStopBits() |
Get the stop bits.
|
int |
getWaitTime() |
Get the wait time.
|
boolean |
isRs485EchoEnabled() |
Get the RS-485 "echo" mode.
|
boolean |
isRs485RtsHighEnabled() |
Get the RS-485 RTS "high" mode.
|
boolean |
isRs485TerminationEnabled() |
Get the RS-485 termination mode.
|
void |
populateRs485Flags(String flags) |
Parse a comma-delimited list of RS-485 flags and configure the associated
settings on this instance.
|
void |
setBaudRate(int baudRate) |
Set the baud rate.
|
void |
setDataBits(int dataBits) |
Set the data bits.
|
void |
setFlowControl(Set<SerialFlowControl> flowControl) |
Set the flow control.
|
void |
setParity(SerialParity parity) |
Set the parity.
|
void |
setReadTimeout(int readTimeout) |
Set the read timeout.
|
void |
setRs485AfterSendDelay(int rs485AfterSendDelay) |
Set a time to wait after sending data before disabling transmit mode when
in RS-485 mode
|
void |
setRs485BeforeSendDelay(int rs485BeforeSendDelay) |
Set a time to wait after enabling transmit mode before sending data when
in RS-485 mode.
|
void |
setRs485EchoEnabled(boolean rs485EchoEnabled) |
Set the RS-485 "echo" mode.
|
void |
setRs485ModeEnabled(Boolean rs485ModeEnabled) |
Set the RS-485 mode.
|
void |
setRs485RtsHighEnabled(boolean rs485RtsHighEnabled) |
Set the RS-485 RTS "high" mode.
|
void |
setRs485TerminationEnabled(boolean rs485TerminationEnabled) |
Set the RS-485 termination mode.
|
void |
setStopBits(SerialStopBits stopBits) |
Set the stop bits.
|
void |
setWaitTime(int waitTime) |
Set the wait time.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitbitsShortcut, rs485Flagspublic void populateRs485Flags(String flags)
Each boolean-style flag can be prefixed with ! to disable the
associated setting, for example "!RtsHigh" would disable the RTS
High setting.
flags - an RS-485 flags string as returned from
SerialParameters.rs485Flags()public int getBaudRate()
SerialParametersgetBaudRate in interface SerialParametersSerialParameters.DEFAULT_BAUD_RATEpublic void setBaudRate(int baudRate)
baudRate - the baud rate to setpublic int getDataBits()
SerialParametersgetDataBits in interface SerialParametersSerialParameters.DEFAULT_DATA_BITSpublic void setDataBits(int dataBits)
dataBits - the data bits to setpublic SerialStopBits getStopBits()
SerialParametersgetStopBits in interface SerialParametersSerialParameters.DEFAULT_STOP_BITSpublic void setStopBits(SerialStopBits stopBits)
stopBits - the stop bits to setpublic SerialParity getParity()
SerialParametersgetParity in interface SerialParametersSerialParameters.DEFAULT_PARITYpublic void setParity(SerialParity parity)
parity - the parity to setpublic Set<SerialFlowControl> getFlowControl()
SerialParametersgetFlowControl in interface SerialParameterspublic void setFlowControl(Set<SerialFlowControl> flowControl)
flowControl - the flow control, or null for nonepublic int getWaitTime()
SerialParametersgetWaitTime in interface SerialParameterspublic void setWaitTime(int waitTime)
waitTime - the wait time to set, in millisecondspublic int getReadTimeout()
SerialParametersgetReadTimeout in interface SerialParametersSerialParameters.DEFAULT_READ_TIMEOUTpublic void setReadTimeout(int readTimeout)
readTimeout - the read timeout to set, in millisecondspublic Boolean getRs485ModeEnabled()
SerialParameters
When this is set to true then the other getRs485*
settings are used. This is only needed for some RS-485 hardware, and the
other getRs485* settings may not be supported across all
platforms.
getRs485ModeEnabled in interface SerialParameterspublic void setRs485ModeEnabled(Boolean rs485ModeEnabled)
When this is set to true then the other getRs485*
settings are used.
rs485ModeEnabled - true to enable RS-485 modepublic boolean isRs485RtsHighEnabled()
SerialParameters
This setting is only applicable when SerialParameters.getRs485ModeEnabled() is
true.
isRs485RtsHighEnabled in interface SerialParametersSerialParameters.DEFAULT_RS485_RTS_HIGH_ENABLEDpublic void setRs485RtsHighEnabled(boolean rs485RtsHighEnabled)
rs485RtsHighEnabled - true to set the RTS line high (to 1) when transmittingpublic boolean isRs485TerminationEnabled()
SerialParameters
This setting is only applicable when SerialParameters.getRs485ModeEnabled() is
true.
isRs485TerminationEnabled in interface SerialParameterspublic void setRs485TerminationEnabled(boolean rs485TerminationEnabled)
rs485TerminationEnabled - true to enable RS-485 bus terminationpublic boolean isRs485EchoEnabled()
SerialParameters
This setting is only applicable when SerialParameters.getRs485ModeEnabled() is
true.
isRs485EchoEnabled in interface SerialParameterspublic void setRs485EchoEnabled(boolean rs485EchoEnabled)
rs485EchoEnabled - true to enable receive during transmitpublic int getRs485BeforeSendDelay()
SerialParameters
This setting is only applicable when SerialParameters.getRs485ModeEnabled() is
true.
getRs485BeforeSendDelay in interface SerialParametersSerialParameters.DEFAULT_RS485_BEFORE_SEND_DELAYpublic void setRs485BeforeSendDelay(int rs485BeforeSendDelay)
rs485BeforeSendDelay - the delay, in microsecondspublic int getRs485AfterSendDelay()
SerialParameters
This setting is only applicable when SerialParameters.getRs485ModeEnabled() is
true.
getRs485AfterSendDelay in interface SerialParametersSerialParameters.DEFAULT_RS485_AFTER_SEND_DELAYpublic void setRs485AfterSendDelay(int rs485AfterSendDelay)
rs485AfterSendDelay - the delay, in microseconds