|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.wimpi.modbus.io.ModbusSerialTransaction
public class ModbusSerialTransaction
Class implementing the ModbusTransaction interface.
Constructor Summary | |
---|---|
ModbusSerialTransaction()
Constructs a new ModbusSerialTransaction instance. |
|
ModbusSerialTransaction(ModbusRequest request)
Constructs a new ModbusSerialTransaction instance with a given ModbusRequest to be send when the transaction is executed. |
|
ModbusSerialTransaction(SerialConnection con)
Constructs a new ModbusSerialTransaction instance with a given ModbusRequest to be send when the transaction is executed. |
Method Summary | |
---|---|
void |
execute()
Executes this ModbusTransaction. |
ModbusRequest |
getRequest()
Returns the ModbusRequest instance associated with this ModbusTransaction. |
ModbusResponse |
getResponse()
Returns the ModbusResponse instance associated with this ModbusTransaction. |
int |
getRetries()
Returns the amount of retries for opening the connection for executing the transaction. |
int |
getTransactionID()
Returns the actual transaction identifier of this ModbusTransaction. |
int |
getTransDelayMS()
Get the TransDelayMS value. |
boolean |
isCheckingValidity()
Tests whether the validity of a transaction will be checked. |
void |
setCheckingValidity(boolean b)
Sets the flag that controls whether the validity of a transaction will be checked. |
void |
setRequest(ModbusRequest req)
Sets the ModbusRequest for this ModbusTransaction. |
void |
setRetries(int num)
Set the amount of retries for opening the connection for executing the transaction. |
void |
setSerialConnection(SerialConnection con)
Sets the port on which this ModbusTransaction should be executed. |
void |
setTransDelayMS(int newTransDelayMS)
Set the TransDelayMS value. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ModbusSerialTransaction()
public ModbusSerialTransaction(ModbusRequest request)
request
- a ModbusRequest instance.public ModbusSerialTransaction(SerialConnection con)
con
- a TCPMasterConnection instance.Method Detail |
---|
public void setSerialConnection(SerialConnection con)
con
- a SerialConnection.public int getTransactionID()
ModbusTransaction
getTransactionID
in interface ModbusTransaction
public void setRequest(ModbusRequest req)
ModbusTransaction
The related ModbusResponse is acquired
from the passed in ModbusRequest instance.
setRequest
in interface ModbusTransaction
req
- a ModbusRequest.public ModbusRequest getRequest()
ModbusTransaction
getRequest
in interface ModbusTransaction
public ModbusResponse getResponse()
ModbusTransaction
getResponse
in interface ModbusTransaction
public void setCheckingValidity(boolean b)
ModbusTransaction
setCheckingValidity
in interface ModbusTransaction
b
- true if checking validity, false otherwise.public boolean isCheckingValidity()
ModbusTransaction
isCheckingValidity
in interface ModbusTransaction
public int getRetries()
ModbusTransaction
getRetries
in interface ModbusTransaction
public void setRetries(int num)
ModbusTransaction
setRetries
in interface ModbusTransaction
num
- the amount of retries as int.public int getTransDelayMS()
public void setTransDelayMS(int newTransDelayMS)
newTransDelayMS
- The new TransDelayMS value.public void execute() throws ModbusIOException, ModbusSlaveException, ModbusException
ModbusTransaction
execute
in interface ModbusTransaction
ModbusException
- if an I/O error occurs,
or the response is a modbus protocol exception.
ModbusIOException
ModbusSlaveException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |