public class SerialParameters extends Object
| Constructor and Description |
|---|
SerialParameters()
Constructs a new SerialParameters instance with
default values.
|
SerialParameters(Properties props,
String prefix)
Constructs a new SerialParameters instance with
parameters obtained from a Properties instance.
|
SerialParameters(String portName,
int baudRate,
int flowControlIn,
int flowControlOut,
int databits,
int stopbits,
int parity,
boolean echo,
int timeout)
Constructs a new SerialParameters instance with
given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getBaudRate()
Return the baud rate as int.
|
String |
getBaudRateString()
Returns the baud rate as a String.
|
int |
getDatabits()
Returns the number of data bits as int.
|
String |
getDatabitsString()
Returns the number of data bits as String.
|
String |
getEncoding()
Returns the encoding to be used.
|
int |
getFlowControlIn()
Returns the input flow control type as int.
|
String |
getFlowControlInString()
Returns the input flow control type as String.
|
int |
getFlowControlOut()
Returns the output flow control type as int.
|
String |
getFlowControlOutString()
Returns the output flow control type as String.
|
int |
getParity()
Returns the parity schema as int.
|
String |
getParityString()
Returns the parity schema as String.
|
String |
getPortName()
Returns the port name.
|
int |
getReceiveTimeout()
Returns the receive timeout for serial communication.
|
int |
getStopbits()
Returns the number of stop bits as int.
|
String |
getStopbitsString()
Returns the number of stop bits as String.
|
boolean |
isEcho()
Get the Echo value.
|
void |
setBaudRate(int rate)
Sets the baud rate.
|
void |
setBaudRate(String rate)
Sets the baud rate.
|
void |
setDatabits(int databits)
Sets the number of data bits.
|
void |
setDatabits(String databits)
Sets the number of data bits from the given String.
|
void |
setEcho(boolean newEcho)
Set the Echo value.
|
void |
setEncoding(String enc)
Sets the encoding to be used.
|
void |
setFlowControlIn(int flowcontrol)
Sets the type of flow control for the input
as given by the passed in int.
|
void |
setFlowControlIn(String flowcontrol)
Sets the type of flow control for the input
as given by the passed in String.
|
void |
setFlowControlOut(int flowControlOut)
Sets the output flow control type as given
by the passed in int.
|
void |
setFlowControlOut(String flowControlOut)
Sets the output flow control type as given
by the passed in String.
|
void |
setParity(int parity)
Sets the parity schema.
|
void |
setParity(String parity)
Sets the parity schema from the given
String.
|
void |
setPortName(String name)
Sets the port name.
|
void |
setReceiveTimeout(int receiveTimeout)
Sets the receive timeout for serial communication.
|
void |
setReceiveTimeout(String str)
Sets the receive timeout for the serial communication
parsing the given String using Integer.parseInt(String).
|
void |
setStopbits(int stopbits)
Sets the number of stop bits.
|
void |
setStopbits(String stopbits)
Sets the number of stop bits from the given String.
|
public SerialParameters()
public SerialParameters(String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity, boolean echo, int timeout)
portName - The name of the port.baudRate - The baud rate.flowControlIn - Type of flow control for receiving.flowControlOut - Type of flow control for sending.databits - The number of data bits.stopbits - The number of stop bits.parity - The type of parity.echo - Flag for setting the RS485 echo mode.timeout - the timeoutpublic SerialParameters(Properties props, String prefix)
props - a Properties instance.prefix - a prefix for the properties keys if embedded into other properties.public void setPortName(String name)
name - the new port name.public String getPortName()
public void setBaudRate(int rate)
rate - the new baud rate.public void setBaudRate(String rate)
rate - the new baud rate.public int getBaudRate()
public String getBaudRateString()
public void setFlowControlIn(int flowcontrol)
flowcontrol - the new flow control type.public void setFlowControlIn(String flowcontrol)
flowcontrol - the flow control for reading type.public int getFlowControlIn()
public String getFlowControlInString()
public void setFlowControlOut(int flowControlOut)
flowControlOut - new output flow control type as int.public void setFlowControlOut(String flowControlOut)
flowControlOut - the new output flow control type as String.public int getFlowControlOut()
public String getFlowControlOutString()
public void setDatabits(int databits)
databits - the new number of data bits.public void setDatabits(String databits)
databits - the new number of data bits as String.public int getDatabits()
public String getDatabitsString()
public void setStopbits(int stopbits)
stopbits - the new number of stop bits setting.public void setStopbits(String stopbits)
stopbits - the number of stop bits as String.public int getStopbits()
public String getStopbitsString()
public void setParity(int parity)
parity - the new parity schema as int.public void setParity(String parity)
parity - the new parity schema as String.public int getParity()
public String getParityString()
public void setEncoding(String enc)
enc - the encoding as string.Modbus#SERIAL_ENCODING_ASCII,
Modbus#SERIAL_ENCODING_RTU,
Modbus#SERIAL_ENCODING_BINpublic String getEncoding()
Modbus#SERIAL_ENCODING_ASCII,
Modbus#SERIAL_ENCODING_RTU,
Modbus#SERIAL_ENCODING_BINpublic boolean isEcho()
public void setEcho(boolean newEcho)
newEcho - The new Echo value.public int getReceiveTimeout()
public void setReceiveTimeout(int receiveTimeout)
receiveTimeout - the receiveTimeout in milliseconds.public void setReceiveTimeout(String str)
str - the timeout as String.Copyright © 2017. All rights reserved.