|
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.io.ModbusTCPTransaction
Class implementing the ModbusTransaction interface.
Constructor Summary | |
ModbusTCPTransaction()
Constructs a new ModbusTCPTransaction instance. |
|
ModbusTCPTransaction(ModbusRequest request)
Constructs a new ModbusTCPTransaction instance with a given ModbusRequest to be send when the transaction is executed. |
|
ModbusTCPTransaction(TCPMasterConnection con)
Constructs a new ModbusTCPTransaction instance with a given TCPMasterConnection to be used for transactions. |
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. |
boolean |
isCheckingValidity()
Tests whether the validity of a transaction will be checked. |
boolean |
isReconnecting()
Tests if the connection will be openend and closed for each execution. |
void |
setCheckingValidity(boolean b)
Sets the flag that controls whether the validity of a transaction will be checked. |
void |
setConnection(TCPMasterConnection con)
Sets the connection on which this ModbusTransaction should be executed. |
void |
setReconnecting(boolean b)
Sets the flag that controls whether a connection is openend and closed for each execution or not. |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ModbusTCPTransaction()
public ModbusTCPTransaction(ModbusRequest request)
request
- a ModbusRequest instance.public ModbusTCPTransaction(TCPMasterConnection con)
con
- a TCPMasterConnection instance.Method Detail |
public void setConnection(TCPMasterConnection con)
An implementation should be able to
handle open and closed connections.
con
- a TCPMasterConnection.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 int getTransactionID()
ModbusTransaction
getTransactionID
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 void setReconnecting(boolean b)
b
- true if reconnecting, false otherwise.public boolean isReconnecting()
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 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
|
jamod at SF | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |