Interface ModbusElement<T>

All Known Subinterfaces:
ModbusCoilElement, ModbusReadElement<T>, ModbusRegisterElement<T>, ModbusWriteElement<T>
All Known Implementing Classes:
AbstractDoubleWordElement, AbstractModbusElement, AbstractModbusRegisterElement, AbstractQuadrupleWordElement, AbstractWordElement, BitsWordElement, CoilElement, DummyCoilElement, DummyRegisterElement, FloatDoublewordElement, FloatQuadruplewordElement, SignedDoublewordElement, SignedQuadruplewordElement, SignedWordElement, StringWordElement, UnsignedDoublewordElement, UnsignedQuadruplewordElement, UnsignedWordElement

public interface ModbusElement<T>
A ModbusElement represents one or more registers or coils in an AbstractTask.
  • Method Details

    • getStartAddress

      int getStartAddress()
      Gets the start address of this Modbus element.
      the start address
    • getLength

      int getLength()
      Number of Registers or Coils.
      the number of Registers or Coils
    • setModbusTask

      void setModbusTask(AbstractTask abstractTask)
      Set the AbstractTask, where this Element belongs to.

      This is called by the AbstractTask constructor.

      abstractTask - the AbstractTask
    • isIgnored

      boolean isIgnored()
      Whether this Element should be ignored (= DummyElement).
      true for ignored elements
    • getType

      OpenemsType getType()
      Gets the type of this Register, e.g. INTEGER, BOOLEAN,..
      the OpenemsType
    • _setNextWriteValue

      void _setNextWriteValue(Optional<T> valueOpt) throws OpenemsException, IllegalArgumentException
      Sets a value that should be written to the Modbus device.
      valueOpt - the Optional value
      OpenemsException - on error
      IllegalArgumentException - on error
    • onSetNextWrite

      void onSetNextWrite(Consumer<Optional<T>> callback)
      Add an onSetNextWrite callback. It is called when a 'next write value' was set.
      callback - the callback
    • invalidate

      boolean invalidate(AbstractModbusBridge bridge)
      Invalidates the Channel in case it could not be read from the Modbus device, i.e. sets the value to 'UNDEFINED'/null. Applies the 'invalidateElementsAfterReadErrors' config setting of the bridge.
      bridge - the AbstractModbusBridge
      true if Channel was invalidated
    • deactivate

      void deactivate()
      This is called on deactivate of the Modbus-Bridge. It can be used to clear any references like listeners.