Class CbusSimCanListener

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void dispose()
      Disconnects from network
      int getDelay()
      Get the simulated network delay.
      boolean getProcessIn()
      Get if to Listen for CanReply Frames incoming to JMRI.
      boolean getProcessOut()
      Get if to Listen for CanMessage Frames outgoing to JMRI.
      boolean getSendIn()
      Get if to Send Frames from the Sim as Incoming CanReply.
      boolean getSendOut()
      Get if to Send Frames from the Sim as Outgoing CanMessage.
      void message​(CanMessage m)
      Forwards non-extended CanMessage according to #getProcessOut Processes certain outgoing CAN Frames.
      void reply​(CanReply r)
      Forwards non-extended CanReply according to #getProcessIn Processes all incoming and certain outgoing CAN Frames Called when an incoming CanFrame is received from the CAN Network.
      void setDelay​(int delay)
      Set the simulated network delay.
      void setProcessIn​(boolean newval)
      Set if to Listen for CanReply Frames incoming to JMRI.
      void setProcessOut​(boolean newval)
      Set if to Listen for CanMessage Frames outgoing to JMRI.
      void setSendIn​(boolean newval)
      Set if to Send Frames from the Sim as Incoming CanReply.
      void setSendOut​(boolean newval)
      Set if to Send Frames from the Sim as Outgoing CanMessage.
      protected void startProcessFrame​(AbstractMessage m)
      Method to be overridden by extending methods.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CbusSimCanListener

        public CbusSimCanListener​(CanSystemConnectionMemo memo,
                                  CbusNode node)
        Create a CanListener with Common Simulation setting attributes.
        Parameters:
        memo - System Connection
        node - Node ( if a CbusDummyNode ), else use null
    • Method Detail

      • 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 Called when an outgoing message is sent to the CAN Network.

        Specified by:
        message in interface CanListener
        Overrides:
        message in class CbusNodeCanListener
        Parameters:
        m - the CanMessage being sent.
      • reply

        public final void reply​(CanReply r)
        Forwards non-extended CanReply according to #getProcessIn Processes all incoming and certain outgoing CAN Frames Called when an incoming CanFrame is received from the CAN Network.
        Specified by:
        reply in interface CanListener
        Overrides:
        reply in class CbusNodeCanListener
        Parameters:
        r - the CanReply being received.