|
jamod at SF | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.wimpi.modbus.util.SerialParameters
Helper class wrapping all serial port communication parameters. Very similar to the javax.comm demos, however, not the same.
Constructor Summary | |
SerialParameters()
Constructs a new SerialParameters instance with default values. |
|
SerialParameters(java.util.Properties props,
java.lang.String prefix)
Constructs a new SerialParameters instance with parameters obtained from a Properties instance. |
|
SerialParameters(java.lang.String portName,
int baudRate,
int flowControlIn,
int flowControlOut,
int databits,
int stopbits,
int parity,
boolean echo)
Constructs a new SerialParameters instance with given parameters. |
Method Summary | |
int |
getBaudRate()
Return the baud rate as int. |
java.lang.String |
getBaudRateString()
Returns the baud rate as a String. |
int |
getDatabits()
Returns the number of data bits as int. |
java.lang.String |
getDatabitsString()
Returns the number of data bits as String. |
java.lang.String |
getEncoding()
Returns the encoding to be used. |
int |
getFlowControlIn()
Returns the input flow control type as int. |
java.lang.String |
getFlowControlInString()
Returns the input flow control type as String. |
int |
getFlowControlOut()
Returns the output flow control type as int. |
java.lang.String |
getFlowControlOutString()
Returns the output flow control type as String. |
int |
getParity()
Returns the parity schema as int. |
java.lang.String |
getParityString()
Returns the parity schema as String. |
java.lang.String |
getPortName()
Returns the port name. |
int |
getStopbits()
Returns the number of stop bits as int. |
java.lang.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(java.lang.String rate)
Sets the baud rate. |
void |
setDatabits(int databits)
Sets the number of data bits. |
void |
setDatabits(java.lang.String databits)
Sets the number of data bits from the given String. |
void |
setEcho(boolean newEcho)
Set the Echo value. |
void |
setEncoding(java.lang.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(java.lang.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(java.lang.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(java.lang.String parity)
Sets the parity schema from the given String. |
void |
setPortName(java.lang.String name)
Sets the port name. |
void |
setStopbits(int stopbits)
Sets the number of stop bits. |
void |
setStopbits(java.lang.String stopbits)
Sets the number of stop bits from the given String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SerialParameters()
public SerialParameters(java.lang.String portName, int baudRate, int flowControlIn, int flowControlOut, int databits, int stopbits, int parity, boolean echo)
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.public SerialParameters(java.util.Properties props, java.lang.String prefix)
props
- a Properties instance.prefix
- a prefix for the properties keys if embedded into
other properties.Method Detail |
public void setPortName(java.lang.String name)
name
- the new port name.public java.lang.String getPortName()
public void setBaudRate(int rate)
rate
- the new baud rate.public void setBaudRate(java.lang.String rate)
rate
- the new baud rate.public int getBaudRate()
public java.lang.String getBaudRateString()
public void setFlowControlIn(int flowcontrol)
flowcontrol
- the new flow control type.public void setFlowControlIn(java.lang.String flowcontrol)
flowcontrol
- the flow control for reading type.public int getFlowControlIn()
public java.lang.String getFlowControlInString()
public void setFlowControlOut(int flowControlOut)
flowControlOut
- new output flow control type as int.public void setFlowControlOut(java.lang.String flowControlOut)
flowControlOut
- the new output flow control type as String.public int getFlowControlOut()
public java.lang.String getFlowControlOutString()
public void setDatabits(int databits)
databits
- the new number of data bits.public void setDatabits(java.lang.String databits)
databits
- the new number of data bits as String.public int getDatabits()
public java.lang.String getDatabitsString()
public void setStopbits(int stopbits)
stopbits
- the new number of stop bits setting.public void setStopbits(java.lang.String stopbits)
stopbits
- the number of stop bits as String.public int getStopbits()
public java.lang.String getStopbitsString()
public void setParity(int parity)
parity
- the new parity schema as int.public void setParity(java.lang.String parity)
parity
- the new parity schema as String.public int getParity()
public java.lang.String getParityString()
public void setEncoding(java.lang.String enc)
enc
- the encoding as string.Modbus.SERIAL_ENCODING_ASCII
,
Modbus.SERIAL_ENCODING_RTU
,
Modbus.SERIAL_ENCODING_BIN
public java.lang.String getEncoding()
Modbus.SERIAL_ENCODING_ASCII
,
Modbus.SERIAL_ENCODING_RTU
,
Modbus.SERIAL_ENCODING_BIN
public boolean isEcho()
public void setEcho(boolean newEcho)
newEcho
- The new Echo value.
|
jamod at SF | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |