Class ModbusRegisterElement<SELF extends AbstractModbusElement<SELF,com.ghgande.j2mod.modbus.procimg.Register[],T>,T>

java.lang.Object
io.openems.edge.bridge.modbus.api.element.ModbusElement
io.openems.edge.bridge.modbus.api.element.AbstractModbusElement<SELF,com.ghgande.j2mod.modbus.procimg.Register[],T>
io.openems.edge.bridge.modbus.api.element.ModbusRegisterElement<SELF,T>
Type Parameters:
SELF - the subclass of myself
T - the OpenEMS type
BINARY - the binary type
Direct Known Subclasses:
AbstractMultipleWordsElement, AbstractSingleWordElement

public abstract class ModbusRegisterElement<SELF extends AbstractModbusElement<SELF,com.ghgande.j2mod.modbus.procimg.Register[],T>,T> extends AbstractModbusElement<SELF,com.ghgande.j2mod.modbus.procimg.Register[],T>
A ModbusRegisterElement represents one or more Modbus Registers.
  • Constructor Details

    • ModbusRegisterElement

      protected ModbusRegisterElement(OpenemsType type, int startAddress, int length)
  • Method Details

    • byteBufferToValue

      protected abstract T byteBufferToValue(ByteBuffer buff)
    • valueToByteBuffer

      protected abstract void valueToByteBuffer(ByteBuffer buff, T value)
    • byteOrder

      public final SELF byteOrder(ByteOrder byteOrder)
      Sets the Byte-Order. Default is "BIG_ENDIAN". See http://www.simplymodbus.ca/FAQ.htm#Order.
      Parameters:
      byteOrder - the ByteOrder
      Returns:
      myself
    • getByteOrder

      protected final ByteOrder getByteOrder()
    • valueToRaw

      protected final com.ghgande.j2mod.modbus.procimg.Register[] valueToRaw(T value, WordOrder wordOrder)
    • rawToValue

      protected final T rawToValue(com.ghgande.j2mod.modbus.procimg.Register[] registers)
      Description copied from class: AbstractModbusElement
      Converts the RAW value from j2mod to the expected type.
      Specified by:
      rawToValue in class AbstractModbusElement<SELF extends AbstractModbusElement<SELF,com.ghgande.j2mod.modbus.procimg.Register[],T>,com.ghgande.j2mod.modbus.procimg.Register[],T>
      Parameters:
      registers - the raw value
      Returns:
      the typed/converted value
    • registersToValue

      protected abstract T registersToValue(com.ghgande.j2mod.modbus.procimg.Register[] registers)
      Converts the Registers from j2mod to the expected type.

      The length of the registers array is guaranteed to match `this.length`.

      Parameters:
      registers - the Registers
      Returns:
      the typed/converted value
    • commonRegistersToValue

      protected final T commonRegistersToValue(com.ghgande.j2mod.modbus.procimg.Register[] registers, WordOrder wordOrder)