Class AbstractModbusConnection

java.lang.Object
net.solarnetwork.node.io.modbus.support.AbstractModbusConnection
Direct Known Subclasses:
ModbusConnectionSupport

public abstract class AbstractModbusConnection extends Object
Base class for Modbus connections.
Version:
1.0
Author:
matt
  • Constructor Details

    • AbstractModbusConnection

      public AbstractModbusConnection(int unitId, boolean headless)
      Constructor.
      Parameters:
      unitId - the unit ID
      headless - true for headless mode
  • Method Details

    • getUnitId

      public int getUnitId()
      Get the unit ID.
      Returns:
      the unit ID
    • isHeadless

      public boolean isHeadless()
      Get the headless mode.
      Returns:
      true if in headless mode
    • getRetries

      public int getRetries()
      Get the number of "retries" to perform on each transaction in the event of errors.
      Returns:
      the number of retries; defaults to 3
    • setRetries

      public void setRetries(int retries)
      Set the number of "retries" to perform on each transaction in the event of errors.
      Parameters:
      retries - the number of retries
    • getRetryDelayMs

      public long getRetryDelayMs()
      Get a retry delay, in milliseconds.
      Returns:
      the retry delay
    • setRetryDelayMs

      public void setRetryDelayMs(long retryDelayMs)
      Set a retry delay, in milliseconds.
      Parameters:
      retryDelayMs - the retry delay to set
    • isRetryReconnect

      public boolean isRetryReconnect()
      Get the retry reconnect mode.
      Returns:
      true to reconnect between error retries, false to continue using the same connection; defaults to false
    • setRetryReconnect

      public void setRetryReconnect(boolean retryReconnect)
      Toggle the mode to reconnect between error retries.

      When enabled, if an IO error occurs while executing a transaction the connection will be closed and reopened.

      Parameters:
      retryReconnect - true to reconnect between error retries, false to continue using the same connection