Class CbusSimCanListener

java.lang.Object
jmri.jmrix.can.cbus.node.CbusNodeCanListener
jmri.jmrix.can.cbus.simulator.CbusSimCanListener
All Implemented Interfaces:
EventListener, AbstractMRListener, CanListener
Direct Known Subclasses:
CbusDummyCS, CbusDummyNodeCanListener, CbusEventResponder

public class CbusSimCanListener
extends CbusNodeCanListener
Simulating event request responses.
Since:
4.15.2
See Also:
CbusSimulator
  • Field Details

  • Constructor Details

  • Method Details

    • setDelay

      public final void setDelay​(int delay)
      Set the simulated network delay.
      Parameters:
      delay - Delay in ms
    • getDelay

      public final int getDelay()
      Get the simulated network delay. Defaults to 50ms
      Returns:
      delay in ms
    • setProcessIn

      public final void setProcessIn​(boolean newval)
      Set if to Listen for CanReply Frames incoming to JMRI.
      Parameters:
      newval - true to listen, else false
    • setProcessOut

      public final void setProcessOut​(boolean newval)
      Set if to Listen for CanMessage Frames outgoing to JMRI.
      Parameters:
      newval - true to listen, else false
    • setSendIn

      public final void setSendIn​(boolean newval)
      Set if to Send Frames from the Sim as Incoming CanReply.
      Parameters:
      newval - true to send as incoming
    • setSendOut

      public final void setSendOut​(boolean newval)
      Set if to Send Frames from the Sim as Outgoing CanMessage.
      Parameters:
      newval - true to send as outgoing
    • getProcessIn

      public final boolean getProcessIn()
      Get if to Listen for CanReply Frames incoming to JMRI. Defaults to false
      Returns:
      true to listen, else false
    • getProcessOut

      public final boolean getProcessOut()
      Get if to Listen for CanMessage Frames outgoing to JMRI. Defaults to true
      Returns:
      true to listen, else false
    • getSendIn

      public final boolean getSendIn()
      Get if to Send Frames from the Sim as Incoming CanReply. Defaults to true
      Returns:
      true to send as incoming
    • getSendOut

      public final boolean getSendOut()
      Get if to Send Frames from the Sim as Outgoing CanMessage. Defaults to false
      Returns:
      true to send as outgoing
    • startProcessFrame

      protected void startProcessFrame​(AbstractMessage m)
      Method to be overridden by extending methods.
      Parameters:
      m - CanFrame or CanReply to process
    • message

      public final void message​(CanMessage m)
      Forwards non-extended CanMessage according to #getProcessOut Processes certain outgoing CAN Frames.

      We don't know if it's this JMRI instance or something external teaching the node so we monitor them the same

      Specified by:
      message in interface CanListener
      Overrides:
      message in class CbusNodeCanListener
    • reply

      public final void reply​(CanReply r)
      Forwards non-extended CanReply according to #getProcessIn Processes all incoming and certain outgoing CAN Frames
      Specified by:
      reply in interface CanListener
      Overrides:
      reply in class CbusNodeCanListener
    • dispose

      Disconnects from network
      Overrides:
      dispose in class CbusNodeCanListener