jamod at SF

net.wimpi.modbus.io
Interface ModbusTransaction

All Known Implementing Classes:
ModbusSerialTransaction, ModbusTCPTransaction, ModbusUDPTransaction

public interface ModbusTransaction

Interface defining a ModbusTransaction.

A transaction is defined by the sequence of sending a request message and receiving a related response message.

Version:
1.2rc1 (09/11/2004)
Author:
Dieter Wimberger

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.
 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.
 

Method Detail

setRequest

public void setRequest(ModbusRequest req)
Sets the ModbusRequest for this ModbusTransaction.

The related ModbusResponse is acquired from the passed in ModbusRequest instance.

Parameters:
req - a ModbusRequest.

getRequest

public ModbusRequest getRequest()
Returns the ModbusRequest instance associated with this ModbusTransaction.

Returns:
the associated ModbusRequest instance.

getResponse

public ModbusResponse getResponse()
Returns the ModbusResponse instance associated with this ModbusTransaction.

Returns:
the associated ModbusRequest instance.

getTransactionID

public int getTransactionID()
Returns the actual transaction identifier of this ModbusTransaction. The identifier is a 2-byte (short) non negative integer value valid in the range of 0-65535.

Returns:
the actual transaction identifier as int.

setRetries

public void setRetries(int retries)
Set the amount of retries for opening the connection for executing the transaction.

Parameters:
retries - the amount of retries as int.

getRetries

public int getRetries()
Returns the amount of retries for opening the connection for executing the transaction.

Returns:
the amount of retries as int.

setCheckingValidity

public void setCheckingValidity(boolean b)
Sets the flag that controls whether the validity of a transaction will be checked.

Parameters:
b - true if checking validity, false otherwise.

isCheckingValidity

public boolean isCheckingValidity()
Tests whether the validity of a transaction will be checked.

Returns:
true if checking validity, false otherwise.

execute

public void execute()
             throws ModbusException
Executes this ModbusTransaction. Locks the ModbusTransport for sending the ModbusRequest and reading the related ModbusResponse. If reconnecting is activated the connection will be opened for the transaction and closed afterwards.

Throws:
ModbusException - if an I/O error occurs, or the response is a modbus protocol exception.

jamod at SF

Copyright © 2002-2004 jamod development team.