jmri.jmrix.loconet
Class LnTrafficRouter

java.lang.Object
  extended by jmri.jmrix.loconet.LnTrafficController
      extended by jmri.jmrix.loconet.LnTrafficRouter
All Implemented Interfaces:
EventListener, LocoNetInterface, LocoNetListener
Direct Known Subclasses:
LnMessageClient

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 a LnTrafficRouter implementation at the remote node, all of the routing of messages to multiple consumers can be done without traffic over the connection.

Author:
Bob Jacobsen Copyright (C) 2002

Field Summary
 
Fields inherited from class jmri.jmrix.loconet.LnTrafficController
listeners, receivedByteCount, receivedMsgCount, self, transmittedMsgCount
 
Fields inherited from interface jmri.jmrix.loconet.LocoNetInterface
ALL, POWER, PROGRAMMING, SENSORS, SLOTINFO, TURNOUTS
 
Constructor Summary
LnTrafficRouter()
           
 
Method Summary
 void connect(LocoNetInterface i)
          Make connection to existing LocoNetInterface object for upstream communication.
 void disconnectPort(LocoNetInterface i)
          Break connection to upstream LocoNetInterface object.
 boolean isXmtBusy()
          Implement abstract method to signal if there's a backlog of information waiting to be sent.
 void message(LocoNetMessage m)
          Receive a LocoNet message from upstream and forward it to all the local clients.
 void sendLocoNetMessage(LocoNetMessage m)
          Forward a preformatted LocoNetMessage to the actual interface.
 boolean status()
           
 
Methods inherited from class jmri.jmrix.loconet.LnTrafficController
addLocoNetListener, getReceivedByteCount, getReceivedMsgCount, getTransmittedMsgCount, instance, notify, removeLocoNetListener, resetStatistics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LnTrafficRouter

public LnTrafficRouter()
Method Detail

status

public boolean status()
Specified by:
status in interface LocoNetInterface
Specified by:
status in class LnTrafficController

sendLocoNetMessage

public void sendLocoNetMessage(LocoNetMessage m)
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

public void disconnectPort(LocoNetInterface i)
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


Copyright © 1997 - 2009 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads