Package jmri.jmrix.lenz
Class XNetTrafficRouter
- java.lang.Object
- 
- jmri.jmrix.AbstractMRTrafficController
- 
- jmri.jmrix.lenz.XNetTrafficController
- 
- jmri.jmrix.lenz.XNetTrafficRouter
 
 
 
- 
- All Implemented Interfaces:
- java.util.EventListener,- AbstractMRListener,- XNetInterface,- XNetListener
 
 public class XNetTrafficRouter extends XNetTrafficController implements XNetListener Implements an 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. 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficControllerAbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier
 
- 
 - 
Field SummaryFields Modifier and Type Field Description (package private) booleanconnected(package private) XNetListenerlastSenderStore the last sender- 
Fields inherited from class jmri.jmrix.lenz.XNetTrafficControllerhighPriorityListeners, highPriorityQueue, mCommandStation, mListenerMasks, mMemo, self
 - 
Fields inherited from class jmri.jmrix.AbstractMRTrafficControllerallowUnexpectedReply, AUTORETRYSTATE, cmdListeners, connectionError, controller, flushReceiveChars, IDLESTATE, istream, listenerQueue, maxRcvExceptionCount, mCurrentMode, mCurrentState, mLastSender, msgQueue, mWaitBeforePoll, NORMALMODE, NOTIFIEDSTATE, OKSENDMSGSTATE, ostream, POLLSTATE, PROGRAMINGMODE, rcvException, rcvThread, replyInDispatch, threadStopRequest, timeoutFlag, timeouts, WAITMSGREPLYSTATE, WAITREPLYINNORMMODESTATE, WAITREPLYINPROGMODESTATE, waitTimePoll, xmtException, xmtRunnable, xmtThread
 - 
Fields inherited from interface jmri.jmrix.lenz.XNetInterfaceALL, COMMINFO, CONSIST, CS_INFO, FEEDBACK, INTERFACE, PROGRAMMING, THROTTLE
 
- 
 - 
Constructor SummaryConstructors Constructor Description XNetTrafficRouter(LenzCommandStation pCommandStation)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect(XNetInterface i)Make connection to existing XNetInterface object for upstream communication.voiddisconnectPort(XNetInterface i)Break connection to upstream LocoNetInterface object.voidmessage(XNetMessage l)Listen for the messages to the LI100/LI101.voidmessage(XNetReply m)Receive an XNet message from upstream and forward it to all the local clients.protected voidnotify(XNetReply m)Forward an XNetMessage to all registered listeners.voidnotifyTimeout(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.voidsendXNetMessage(XNetMessage m, XNetListener replyTo)Forward a preformatted XNetMessage to the actual interface.booleanstatus()Check whether an implementation is operational.- 
Methods inherited from class jmri.jmrix.lenz.XNetTrafficControlleraddXNetListener, connectPort, endOfMessage, enterNormalMode, enterProgMode, forwardMessage, forwardReply, getCommandStation, getFeedbackMessageCache, getSystemConnectionMemo, handleTimeout, hasTimeSlot, loadChars, newReply, notifyMessage, pollMessage, pollReplyHandler, programmerIdle, removeXNetListener, sendHighPriorityXNetMessage, setSystemConnectionMemo
 - 
Methods inherited from class jmri.jmrix.AbstractMRTrafficControlleraddConsoleListener, addHeaderToOutput, addListener, addTrailerToOutput, canReceive, connectionWarn, disconnectPort, distributeReply, enterProgModeDelayTime, forwardToPort, getLastSender, getPortName, getSynchronizeRx, handleOneIncomingReply, hasTimeouts, lengthOfByteStream, newRcvNotifier, notifyReply, portReadyToSend, portWarn, portWarnTCP, readByteProtected, receiveLoop, recovery, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, setSynchronizeRx, terminate, terminateThreads, transmitLoop, transmitWait, unexpectedReplyStateError, waitForStartOfReply, warnOnTimeout
 
- 
 
- 
- 
- 
Field Detail- 
connectedboolean connected 
 - 
lastSenderXNetListener lastSender Store the last sender
 
- 
 - 
Constructor Detail- 
XNetTrafficRouterpublic XNetTrafficRouter(LenzCommandStation pCommandStation) 
 
- 
 - 
Method Detail- 
statuspublic boolean status() Description copied from interface:XNetInterfaceCheck whether an implementation is operational.- Specified by:
- statusin interface- XNetInterface
- Overrides:
- statusin class- AbstractMRTrafficController
- Returns:
- true if OK, else false.
 
 - 
sendXNetMessagepublic void sendXNetMessage(XNetMessage m, XNetListener replyTo) Forward a preformatted XNetMessage to the actual interface.- Specified by:
- sendXNetMessagein interface- XNetInterface
- Parameters:
- m- Message to send; will be updated with CRC
- replyTo- sending listener to NOT notify.
 
 - 
messagepublic void message(XNetReply m) Receive an XNet message from upstream and forward it to all the local clients.- Specified by:
- messagein 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.
 
 - 
messagepublic void message(XNetMessage l) Listen for the messages to the LI100/LI101.- Specified by:
- messagein 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.
 
 - 
notifyTimeoutpublic void notifyTimeout(XNetMessage msg) Description copied from interface:XNetListenerMember function invoked by an XNetInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.- Specified by:
- notifyTimeoutin interface- XNetListener
- Parameters:
- msg- message which has timed out.
 
 - 
connectpublic void connect(XNetInterface i) Make connection to existing XNetInterface object for upstream communication.- Parameters:
- i- Interface to be connected
 
 - 
disconnectPortpublic 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
 
 
- 
 
-