Enum Class ModbusReadFunction

java.lang.Object
java.lang.Enum<ModbusReadFunction>
net.solarnetwork.node.io.modbus.ModbusReadFunction
All Implemented Interfaces:
Serializable, Comparable<ModbusReadFunction>, Constable, ModbusFunction

public enum ModbusReadFunction extends Enum<ModbusReadFunction> implements ModbusFunction
Modbus read functions.

These functions are separated from the write functions to help API methods be explicit about requiring read versus write functions.

Since:
2.5
Version:
2.1
Author:
matt
  • Enum Constant Details

    • ReadCoil

      public static final ModbusReadFunction ReadCoil
      Read coil.
    • ReadDiscreteInput

      public static final ModbusReadFunction ReadDiscreteInput
      Read discreet input.
    • ReadHoldingRegister

      public static final ModbusReadFunction ReadHoldingRegister
      Read holding register.
    • ReadInputRegister

      public static final ModbusReadFunction ReadInputRegister
      Read input register.
  • Method Details

    • values

      public static ModbusReadFunction[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ModbusReadFunction valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getCode

      public int getCode()
      Description copied from interface: ModbusFunction
      Get the function code.
      Specified by:
      getCode in interface ModbusFunction
      Returns:
      the code
    • toDisplayString

      public String toDisplayString()
      Description copied from interface: ModbusFunction
      Get a friendly display string for this function.
      Specified by:
      toDisplayString in interface ModbusFunction
      Returns:
      a display string
    • forCode

      public static ModbusReadFunction forCode(int code)
      Get an enum instance for a code value.
      Parameters:
      code - the code
      Returns:
      the enum
      Throws:
      IllegalArgumentException - if code is not a valid value
    • isReadFunction

      public boolean isReadFunction()
      Description copied from interface: ModbusFunction
      Return true if this function represents a read operation.
      Specified by:
      isReadFunction in interface ModbusFunction
      Returns:
      true if this function represents a read operation, false if a write operation
    • oppositeFunction

      public ModbusFunction oppositeFunction()
      Description copied from interface: ModbusFunction
      Get an "opposite" function from this function.

      This method is used to get a read function for a given write function, and a write function for a given read function.

      Specified by:
      oppositeFunction in interface ModbusFunction
      Returns:
      the function, or null if not applicable
    • blockType

      public ModbusRegisterBlockType blockType()
      Description copied from interface: ModbusFunction
      Get the register block type related to this function.
      Specified by:
      blockType in interface ModbusFunction
      Returns:
      the block type