public abstract class ModbusTransaction extends Object
A transaction is defined by the sequence of sending a request message and receiving a related response message.
| Constructor and Description |
|---|
ModbusTransaction() |
| Modifier and Type | Method and Description |
|---|---|
abstract 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 |
getTransactionID()
getTransactionID -- get the next transaction ID to use.
|
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 retries)
Set the amount of retries for opening
the connection for executing the transaction.
|
public ModbusRequest getRequest()
public void setRequest(ModbusRequest req)
The related ModbusResponse is acquired
from the passed in ModbusRequest instance.
req - a ModbusRequest.public ModbusResponse getResponse()
public void setRetries(int retries)
retries - the amount of retries as int.public boolean isCheckingValidity()
public void setCheckingValidity(boolean b)
b - true if checking validity, false otherwise.public int getTransactionID()
public abstract void execute()
throws ModbusException
ModbusException - if an I/O error occurs,
or the response is a modbus protocol exception.Copyright © 2025. All Rights Reserved.