Class FC3ReadRegistersTask
java.lang.Object
io.openems.edge.bridge.modbus.api.task.AbstractTask<com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersRequest,com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse>
io.openems.edge.bridge.modbus.api.task.AbstractReadTask<com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersRequest,com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse,ModbusRegisterElement,com.ghgande.j2mod.modbus.procimg.Register>
io.openems.edge.bridge.modbus.api.task.AbstractReadRegistersTask<com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersRequest,com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse>
io.openems.edge.bridge.modbus.api.task.FC3ReadRegistersTask
- All Implemented Interfaces:
ReadTask
,Task
,ManagedTask
public class FC3ReadRegistersTask
extends AbstractReadRegistersTask<com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersRequest,com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse>
Implements a Read Holding Register Task, implementing Modbus function code 3
(http://www.simplymodbus.ca/FC03.htm).
-
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
ConstructorDescriptionFC3ReadRegistersTask
(int startAddress, Priority priority, ModbusElement... elements) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersRequest
Factory for aModbusRequest
.protected com.ghgande.j2mod.modbus.procimg.Register[]
parseResponse
(com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse response) Parses aModbusResponse
to an array of values.protected String
payloadToString
(com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse response) Converts the actual payload of the RESPONSE to a human readable format suitable for logs; without header data (like Unit-ID, function code, checksum, etc).Methods inherited from class io.openems.edge.bridge.modbus.api.task.AbstractReadRegistersTask
calculateNextPosition, handleResponse
Methods inherited from class io.openems.edge.bridge.modbus.api.task.AbstractReadTask
execute, getPriority, payloadToString
Methods inherited from class io.openems.edge.bridge.modbus.api.task.AbstractTask
deactivate, debug, executeRequest, getElements, getLength, getLogVerbosity, getParent, getStartAddress, logError, logInfo, logRequest, 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
-
FC3ReadRegistersTask
-
-
Method Details
-
createModbusRequest
protected com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersRequest createModbusRequest()Description copied from class:AbstractReadTask
Factory for aModbusRequest
.- Specified by:
createModbusRequest
in classAbstractReadTask<com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersRequest,
com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse, ModbusRegisterElement, com.ghgande.j2mod.modbus.procimg.Register> - Returns:
- a new
ModbusRequest
-
parseResponse
protected com.ghgande.j2mod.modbus.procimg.Register[] parseResponse(com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse response) throws OpenemsException Description copied from class:AbstractReadTask
Parses aModbusResponse
to an array of values.- Specified by:
parseResponse
in classAbstractReadTask<com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersRequest,
com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse, ModbusRegisterElement, com.ghgande.j2mod.modbus.procimg.Register> - Parameters:
response
- theModbusResponse
- Returns:
- array of results
- Throws:
OpenemsException
- on error
-
payloadToString
protected String payloadToString(com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse response) Description copied from class:AbstractTask
Converts the actual payload of the RESPONSE to a human readable format suitable for logs; without header data (like Unit-ID, function code, checksum, etc).- Specified by:
payloadToString
in classAbstractTask<com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersRequest,
com.ghgande.j2mod.modbus.msg.ReadMultipleRegistersResponse> - Parameters:
response
- the response- Returns:
- a string
-