Class ModbusWorker
- java.lang.Object
-
- io.openems.common.worker.AbstractWorker
-
- io.openems.common.worker.AbstractImmediateWorker
-
- io.openems.edge.bridge.modbus.api.worker.ModbusWorker
-
public class ModbusWorker extends AbstractImmediateWorker
The ModbusWorker schedules the execution of all Modbus-Tasks, like reading and writing modbus registers.It tries to execute all Write-Tasks as early as possible (directly after the TOPIC_CYCLE_EXECUTE_WRITE event) and all Read-Tasks as late as possible to have correct values available exactly when they are needed (i.e. at the TOPIC_CYCLE_BEFORE_PROCESS_IMAGE event).
-
-
Field Summary
-
Fields inherited from class io.openems.common.worker.AbstractWorker
ALWAYS_WAIT_FOR_TRIGGER_NEXT_RUN, DO_NOT_WAIT, thread
-
-
Constructor Summary
Constructors Constructor Description ModbusWorker(AbstractModbusBridge parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProtocol(java.lang.String sourceId, ModbusProtocol protocol)
Adds the protocol.protected void
forever()
This method is called in a loop forever until the Thread gets interrupted.void
onBeforeProcessImage()
This is called on TOPIC_CYCLE_BEFORE_PROCESS_IMAGE cycle event.void
onExecuteWrite()
This is called on TOPIC_CYCLE_EXECUTE_WRITE cycle event.void
removeProtocol(java.lang.String sourceId)
Removes the protocol.-
Methods inherited from class io.openems.common.worker.AbstractImmediateWorker
activate, deactivate, getCycleTime
-
Methods inherited from class io.openems.common.worker.AbstractWorker
modified, triggerNextRun
-
-
-
-
Constructor Detail
-
ModbusWorker
public ModbusWorker(AbstractModbusBridge parent)
-
-
Method Detail
-
onBeforeProcessImage
public void onBeforeProcessImage()
This is called on TOPIC_CYCLE_BEFORE_PROCESS_IMAGE cycle event.
-
onExecuteWrite
public void onExecuteWrite()
This is called on TOPIC_CYCLE_EXECUTE_WRITE cycle event.
-
forever
protected void forever() throws java.lang.InterruptedException
Description copied from class:AbstractWorker
This method is called in a loop forever until the Thread gets interrupted.- Specified by:
forever
in classAbstractImmediateWorker
- Throws:
java.lang.InterruptedException
-
addProtocol
public void addProtocol(java.lang.String sourceId, ModbusProtocol protocol)
Adds the protocol.- Parameters:
sourceId
- Component-ID of the sourceprotocol
- the ModbusProtocol
-
removeProtocol
public void removeProtocol(java.lang.String sourceId)
Removes the protocol.- Parameters:
sourceId
- Component-ID of the source
-
-