Class AbstractDoubleWordElement<E,T>

Type Parameters:
E - the subclass of myself
T - the target OpenemsType
All Implemented Interfaces:
ModbusElement<T>, ModbusRegisterElement<T>
Direct Known Subclasses:
FloatDoublewordElement, SignedDoublewordElement, UnsignedDoublewordElement

public abstract class AbstractDoubleWordElement<E,T> extends AbstractModbusRegisterElement<E,T>
A DoubleWordElement has a size of two Modbus Registers or 32 bit.
  • Constructor Details

    • AbstractDoubleWordElement

      public AbstractDoubleWordElement(OpenemsType type, int startAddress)
  • Method Details

    • self

      protected abstract E self()
      Gets an instance of the correct subclass of myself.
      Specified by:
      self in class AbstractModbusRegisterElement<E,T>
      Returns:
      myself
    • getLength

      public final int getLength()
      Description copied from interface: ModbusElement
      Number of Registers or Coils.
      Returns:
      the number of Registers or Coils
    • _setInputRegisters

      protected final void _setInputRegisters(com.ghgande.j2mod.modbus.procimg.InputRegister... registers)
      Specified by:
      _setInputRegisters in class AbstractModbusRegisterElement<E,T>
    • fromByteBuffer

      protected abstract T fromByteBuffer(ByteBuffer buff)
      Converts a 4-byte ByteBuffer to the the current OpenemsType.
      Parameters:
      buff - the ByteBuffer
      Returns:
      an instance of the given OpenemsType
    • _setNextWriteValue

      public final void _setNextWriteValue(Optional<T> valueOpt) throws OpenemsException
      Description copied from interface: ModbusElement
      Sets a value that should be written to the Modbus device.
      Parameters:
      valueOpt - the Optional value
      Throws:
      OpenemsException - on error
    • toByteBuffer

      protected abstract ByteBuffer toByteBuffer(ByteBuffer buff, T value)
      Converts the current OpenemsType to a 4-byte ByteBuffer.
      Parameters:
      buff - the target ByteBuffer
      value - an instance of the given OpenemsType
      Returns:
      the ByteBuffer
    • wordOrder

      public final E wordOrder(WordOrder wordOrder)
      Sets the Word-Order. Default is "MSWLSW" - "Most Significant Word; Least Significant Word". See http://www.simplymodbus.ca/FAQ.htm#Order.
      Parameters:
      wordOrder - the new Word-Order
      Returns:
      myself