Class LnTrafficRouter

java.lang.Object
jmri.jmrix.loconet.LnTrafficController
jmri.jmrix.loconet.LnTrafficRouter
All Implemented Interfaces:
EventListener, LocoNetInterface, LocoNetListener

public class LnTrafficRouter extends LnTrafficController implements LocoNetListener
Implements a LocoNetInterface by doing a scatter-gather to another, simpler implementation.

This is intended for remote operation, where only one copy of each message should go to/from another node. By putting an LnTrafficRouter implementation at the remote node, all of the routing of messages to multiple consumers can be done without traffic over the connection.

  • Field Details

  • Constructor Details

    • LnTrafficRouter

      Create a default instance connected to a given SystemConnectionMemo.
      Parameters:
      m - the connected LocoNetSystemConnectionMemo
      Since:
      4.11.6
  • Method Details

    • status

      public boolean status()
      Description copied from class: LnTrafficController
      Check whether an implementation is operational. Returns true if operational.
      Specified by:
      status in interface LocoNetInterface
      Specified by:
      status in class LnTrafficController
      Returns:
      true if implementation is operational.
    • sendLocoNetMessage

      Forward a preformatted LocoNetMessage to the actual interface.
      Specified by:
      sendLocoNetMessage in interface LocoNetInterface
      Specified by:
      sendLocoNetMessage in class LnTrafficController
      Parameters:
      m - Message to send; will be updated with CRC
    • message

      public void message(LocoNetMessage m)
      Receive a LocoNet message from upstream and forward it to all the local clients.
      Specified by:
      message in interface LocoNetListener
      Parameters:
      m - The received LocoNet message. Note that this same object may be presented to multiple users. It should not be modified here.
    • connect

      public void connect(LocoNetInterface i)
      Make connection to existing LocoNetInterface object for upstream communication.
      Parameters:
      i - Interface to be connected
    • disconnectPort

      Break connection to upstream LocoNetInterface object. Once broken, attempts to send via "message" member will fail.
      Parameters:
      i - previously connected interface
    • isXmtBusy

      public boolean isXmtBusy()
      Implement abstract method to signal if there's a backlog of information waiting to be sent.
      Specified by:
      isXmtBusy in class LnTrafficController
      Returns:
      true if busy, false if nothing waiting to send