Class 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).

    • Method Detail

      • onBeforeProcessImage

        protected 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 class AbstractImmediateWorker
        Throws:
        java.lang.InterruptedException
      • addProtocol

        public void addProtocol​(java.lang.String sourceId,
                                ModbusProtocol protocol)
        Adds the protocol.
        Parameters:
        sourceId - Component-ID of the source
        protocol - the ModbusProtocol
      • removeProtocol

        public void removeProtocol​(java.lang.String sourceId)
        Removes the protocol.
        Parameters:
        sourceId - Component-ID of the source