Class AbstractReadRegistersTask<REQUEST extends com.ghgande.j2mod.modbus.msg.ModbusRequest,RESPONSE extends com.ghgande.j2mod.modbus.msg.ModbusResponse>
java.lang.Object
io.openems.edge.bridge.modbus.api.task.AbstractTask<REQUEST,RESPONSE>
io.openems.edge.bridge.modbus.api.task.AbstractReadTask<REQUEST,RESPONSE,ModbusRegisterElement,com.ghgande.j2mod.modbus.procimg.Register>
io.openems.edge.bridge.modbus.api.task.AbstractReadRegistersTask<REQUEST,RESPONSE>
- All Implemented Interfaces:
ReadTask
,Task
,ManagedTask
- Direct Known Subclasses:
FC3ReadRegistersTask
,FC4ReadInputRegistersTask
public abstract class AbstractReadRegistersTask<REQUEST extends com.ghgande.j2mod.modbus.msg.ModbusRequest,RESPONSE extends com.ghgande.j2mod.modbus.msg.ModbusResponse>
extends AbstractReadTask<REQUEST,RESPONSE,ModbusRegisterElement,com.ghgande.j2mod.modbus.procimg.Register>
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.openems.edge.bridge.modbus.api.task.Task
Task.ExecuteState
-
Field Summary
Fields inherited from class io.openems.edge.bridge.modbus.api.task.AbstractTask
elements, length, name, responseClazz, startAddress
-
Constructor Summary
ConstructorDescriptionAbstractReadRegistersTask
(String name, Class<RESPONSE> responseClazz, int startAddress, Priority priority, ModbusElement... elements) -
Method Summary
Modifier and TypeMethodDescriptionprotected final int
calculateNextPosition
(ModbusElement modbusElement, int position) Calculate the position of the next Element.protected final void
handleResponse
(ModbusRegisterElement element, int position, com.ghgande.j2mod.modbus.procimg.Register[] response) Handle a Response, e.g.Methods inherited from class io.openems.edge.bridge.modbus.api.task.AbstractReadTask
createModbusRequest, execute, getPriority, parseResponse, payloadToString
Methods inherited from class io.openems.edge.bridge.modbus.api.task.AbstractTask
deactivate, debug, executeRequest, getElements, getLength, getLogVerbosity, getParent, getStartAddress, logError, logInfo, logRequest, payloadToString, setParent, toLogMessage, toLogMessage, toLogMessage, toLogMessage
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.openems.edge.bridge.modbus.api.task.Task
deactivate, getElements, getLength, getParent, getStartAddress, setParent
-
Constructor Details
-
AbstractReadRegistersTask
public AbstractReadRegistersTask(String name, Class<RESPONSE> responseClazz, int startAddress, Priority priority, ModbusElement... elements)
-
-
Method Details
-
handleResponse
protected final void handleResponse(ModbusRegisterElement element, int position, com.ghgande.j2mod.modbus.procimg.Register[] response) throws OpenemsException Description copied from class:AbstractReadTask
Handle a Response, e.g. set the internal value.- Specified by:
handleResponse
in classAbstractReadTask<REQUEST extends com.ghgande.j2mod.modbus.msg.ModbusRequest,
RESPONSE extends com.ghgande.j2mod.modbus.msg.ModbusResponse, ModbusRegisterElement, com.ghgande.j2mod.modbus.procimg.Register> - Parameters:
element
- theModbusElement
position
- the current positionresponse
- the convertedModbusResponse
values- Throws:
OpenemsException
- on error
-
calculateNextPosition
Description copied from class:AbstractReadTask
Calculate the position of the next Element.- Specified by:
calculateNextPosition
in classAbstractReadTask<REQUEST extends com.ghgande.j2mod.modbus.msg.ModbusRequest,
RESPONSE extends com.ghgande.j2mod.modbus.msg.ModbusResponse, ModbusRegisterElement, com.ghgande.j2mod.modbus.procimg.Register> - Parameters:
modbusElement
- current Elementposition
- current position- Returns:
- next position
-