Class LnTrafficRouter

  • All Implemented Interfaces:
    java.util.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.

    • Constructor Detail

      • LnTrafficRouter

        public LnTrafficRouter​(LocoNetSystemConnectionMemo m)
        Create a default instance connected to a given SystemConnectionMemo.
        m - the connected LocoNetSystemConnectionMemo
    • Method Detail

      • 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
        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.
        i - Interface to be connected
      • disconnectPort

        public void disconnectPort​(LocoNetInterface i)
        Break connection to upstream LocoNetInterface object. Once broken, attempts to send via "message" member will fail.
        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
        true if busy, false if nothing waiting to send