Class AbstractWordElement<E,​T>

    • Constructor Detail

      • AbstractWordElement

        public AbstractWordElement​(OpenemsType type,
                                   int startAddress)
    • Method Detail

      • getLength

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

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

        public void _setNextWriteValue​(java.util.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 java.nio.ByteBuffer toByteBuffer​(java.nio.ByteBuffer buff,
                                                            java.lang.Object value)
        Converts the current OpenemsType to a 2-byte ByteBuffer.
        Parameters:
        buff - the target ByteBuffer
        value - the value
        Returns:
        the ByteBuffer