Interface ModbusElement<T>

    • Method Detail

      • getStartAddress

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

        int getLength()
        Number of Registers or Coils.
        Returns:
        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.

        Parameters:
        abstractTask - the AbstractTask
      • isIgnored

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

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

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

        void onSetNextWrite​(java.util.function.Consumer<java.util.Optional<T>> callback)
        Add an onSetNextWrite callback. It is called when a 'next write value' was set.
        Parameters:
        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.
        Parameters:
        the - AbstractModbusBridge
        Returns:
        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.