Class AbstractDoubleWordElement<E,T>
- java.lang.Object
-
- io.openems.edge.bridge.modbus.api.element.AbstractModbusElement<T>
-
- io.openems.edge.bridge.modbus.api.element.AbstractModbusRegisterElement<E,T>
-
- io.openems.edge.bridge.modbus.api.element.AbstractDoubleWordElement<E,T>
-
- Type Parameters:
E
- the subclass of myselfT
- 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.
-
-
Field Summary
-
Fields inherited from class io.openems.edge.bridge.modbus.api.element.AbstractModbusElement
abstractTask, onSetNextWriteCallbacks
-
-
Constructor Summary
Constructors Constructor Description AbstractDoubleWordElement(OpenemsType type, int startAddress)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
_setInputRegisters(com.ghgande.j2mod.modbus.procimg.InputRegister... registers)
void
_setNextWriteValue(java.util.Optional<T> valueOpt)
Sets a value that should be written to the Modbus device.protected abstract T
fromByteBuffer(java.nio.ByteBuffer buff)
Converts a 4-byte ByteBuffer to the the current OpenemsType.int
getLength()
Number of Registers or Coils.protected abstract E
self()
Gets an instance of the correct subclass of myself.protected abstract java.nio.ByteBuffer
toByteBuffer(java.nio.ByteBuffer buff, T value)
Converts the current OpenemsType to a 4-byte ByteBuffer.E
wordOrder(WordOrder wordOrder)
Sets the Word-Order.-
Methods inherited from class io.openems.edge.bridge.modbus.api.element.AbstractModbusRegisterElement
byteOrder, getByteOrder, getNextWriteValue, setInputRegisters, setNextWriteValueRegisters
-
Methods inherited from class io.openems.edge.bridge.modbus.api.element.AbstractModbusElement
deactivate, debug, getModbusTask, getStartAddress, getType, invalidate, isDebug, isIgnored, onSetNextWrite, onUpdateCallback, setModbusTask, setValue, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.openems.edge.bridge.modbus.api.element.ModbusElement
deactivate, getStartAddress, getType, invalidate, isIgnored, onSetNextWrite, setModbusTask
-
Methods inherited from interface io.openems.edge.bridge.modbus.api.element.ModbusRegisterElement
getNextWriteValueAndReset, setNextWriteValue
-
-
-
-
Constructor Detail
-
AbstractDoubleWordElement
public AbstractDoubleWordElement(OpenemsType type, int startAddress)
-
-
Method Detail
-
self
protected abstract E self()
Gets an instance of the correct subclass of myself.- Specified by:
self
in classAbstractModbusRegisterElement<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 classAbstractModbusRegisterElement<E,T>
-
fromByteBuffer
protected abstract T fromByteBuffer(java.nio.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(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, T value)
Converts the current OpenemsType to a 4-byte ByteBuffer.- Parameters:
buff
- the target ByteBuffervalue
- an instance of the given OpenemsType- Returns:
- the ByteBuffer
-
-