jmri.jmrix.lenz
Class XNetTrafficRouter

java.lang.Object
  extended by jmri.jmrix.AbstractMRTrafficController
      extended by jmri.jmrix.lenz.XNetTrafficController
          extended by jmri.jmrix.lenz.XNetTrafficRouter
All Implemented Interfaces:
EventListener, AbstractMRListener, XNetInterface, XNetListener

public class XNetTrafficRouter
extends XNetTrafficController
implements XNetListener

Implements a XNetInterface 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, Paul Bender Copyright (C) 2004-2010

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficController
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier
 
Field Summary
 
Fields inherited from class jmri.jmrix.lenz.XNetTrafficController
mListenerMasks
 
Fields inherited from class jmri.jmrix.AbstractMRTrafficController
allowUnexpectedReply, AUTORETRYSTATE, cmdListeners, controller, flushReceiveChars, IDLESTATE, istream, mCurrentMode, mCurrentState, mLastSender, mWaitBeforePoll, NORMALMODE, NOTIFIEDSTATE, OKSENDMSGSTATE, ostream, POLLSTATE, PROGRAMINGMODE, rcvException, replyInDispatch, WAITMSGREPLYSTATE, WAITREPLYINNORMMODESTATE, WAITREPLYINPROGMODESTATE, waitTimePoll, xmtException, xmtRunnable
 
Fields inherited from interface jmri.jmrix.lenz.XNetInterface
ALL, COMMINFO, CONSIST, CS_INFO, FEEDBACK, INTERFACE, PROGRAMMING, THROTTLE
 
Constructor Summary
XNetTrafficRouter(LenzCommandStation pCommandStation)
           
 
Method Summary
 void connect(XNetInterface i)
          Make connection to existing XNetInterface object for upstream communication.
 void disconnectPort(XNetInterface i)
          Break connection to upstream LocoNetInterface object.
 void message(XNetMessage l)
          Member function that will be invoked by a XNetInterface implementation to forward a XNet message sent to the layout.
 void message(XNetReply m)
          Receive a XNet message from upstream and forward it to all the local clients.
protected  void notify(XNetReply m)
          Forward a XNetMessage to all registered listeners.
 void notifyTimeout(XNetMessage msg)
          Member function invoked by an XNetInterface implementation to notify * a sender that an outgoing message timed out and was dropped from the * queue.
 void sendXNetMessage(XNetMessage m, XNetListener replyTo)
          Forward a preformatted XNetMessage to the actual interface.
 boolean status()
           
 
Methods inherited from class jmri.jmrix.lenz.XNetTrafficController
addXNetListener, endOfMessage, enterNormalMode, enterProgMode, forwardMessage, forwardReply, getCommandStation, getSystemConnectionMemo, handleTimeout, instance, loadChars, newReply, pollMessage, pollReplyHandler, programmerIdle, removeXNetListener, sendHighPriorityXNetMessage, setInstance, setSystemConnectionMemo
 
Methods inherited from class jmri.jmrix.AbstractMRTrafficController
addHeaderToOutput, addListener, addTrailerToOutput, canReceive, connectionWarn, connectPort, disconnectPort, enterProgModeDelayTime, finalize, forwardToPort, getLastSender, getPortName, getSelfLock, handleOneIncomingReply, hasTimeouts, lengthOfByteStream, newRcvNotifier, notifyMessage, notifyReply, portReadyToSend, portWarn, portWarnTCP, readByteProtected, receiveLoop, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, terminate, transmitWait, waitForStartOfReply
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XNetTrafficRouter

public XNetTrafficRouter(LenzCommandStation pCommandStation)
Method Detail

status

public boolean status()
Specified by:
status in interface XNetInterface
Specified by:
status in class XNetTrafficController

sendXNetMessage

public void sendXNetMessage(XNetMessage m,
                            XNetListener replyTo)
Forward a preformatted XNetMessage to the actual interface.

Specified by:
sendXNetMessage in interface XNetInterface
Specified by:
sendXNetMessage in class XNetTrafficController
Parameters:
m - Message to send; will be updated with CRC

message

public void message(XNetReply m)
Receive a XNet message from upstream and forward it to all the local clients.

Specified by:
message in interface XNetListener
Parameters:
m - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.

message

public void message(XNetMessage l)
Description copied from interface: XNetListener
Member function that will be invoked by a XNetInterface implementation to forward a XNet message sent to the layout. Normally, this function will do nothing.

Specified by:
message in interface XNetListener
Parameters:
l - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.

notifyTimeout

public void notifyTimeout(XNetMessage msg)
Description copied from interface: XNetListener
Member function invoked by an XNetInterface implementation to notify * a sender that an outgoing message timed out and was dropped from the * queue.

Specified by:
notifyTimeout in interface XNetListener

connect

public void connect(XNetInterface i)
Make connection to existing XNetInterface object for upstream communication.

Parameters:
i - Interface to be connected

disconnectPort

public void disconnectPort(XNetInterface i)
Break connection to upstream LocoNetInterface object. Once broken, attempts to send via "message" member will fail.

Parameters:
i - previously connected interface

notify

protected void notify(XNetReply m)
Forward a XNetMessage to all registered listeners.

Parameters:
m - Message to forward. Listeners should not modify it!


Copyright © 1997 - 2011 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