Package jmri.jmrix.lenz
Class XNetTrafficRouter
java.lang.Object
jmri.jmrix.AbstractMRTrafficController
jmri.jmrix.lenz.XNetTrafficController
jmri.jmrix.lenz.XNetTrafficRouter
- All Implemented Interfaces:
EventListener,AbstractMRListener,XNetInterface,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.AbstractMRTrafficController
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier -
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) XNetListenerStore the last senderFields inherited from class jmri.jmrix.lenz.XNetTrafficController
highPriorityListeners, highPriorityQueue, mCommandStation, mListenerMasks, mMemo, selfFields inherited from class jmri.jmrix.AbstractMRTrafficController
allowUnexpectedReply, 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, xmtThreadFields inherited from interface jmri.jmrix.lenz.XNetInterface
ALL, COMMINFO, CONSIST, CS_INFO, FEEDBACK, INTERFACE, PROGRAMMING, THROTTLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidMake connection to existing XNetInterface object for upstream communication.voidBreak connection to upstream LocoNetInterface object.voidListen for the messages to the LI100/LI101.voidReceive an XNet message from upstream and forward it to all the local clients.protected voidForward 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.XNetTrafficController
addXNetListener, connectPort, endOfMessage, enterNormalMode, enterProgMode, forwardMessage, forwardReply, getCommandStation, getFeedbackMessageCache, getSystemConnectionMemo, handleTimeout, hasTimeSlot, loadChars, newReply, notifyMessage, pollMessage, pollReplyHandler, programmerIdle, removeXNetListener, sendHighPriorityXNetMessage, setSystemConnectionMemoMethods inherited from class jmri.jmrix.AbstractMRTrafficController
addConsoleListener, 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 Details
-
connected
boolean connected -
lastSender
Store the last sender
-
-
Constructor Details
-
XNetTrafficRouter
-
-
Method Details
-
status
Description copied from interface:XNetInterfaceCheck whether an implementation is operational.- Specified by:
statusin interfaceXNetInterface- Overrides:
statusin classAbstractMRTrafficController- Returns:
- true if OK, else false.
-
sendXNetMessage
Forward a preformatted XNetMessage to the actual interface.- Specified by:
sendXNetMessagein interfaceXNetInterface- Parameters:
m- Message to send; will be updated with CRCreplyTo- sending listener to NOT notify.
-
message
Receive an XNet message from upstream and forward it to all the local clients.- Specified by:
messagein interfaceXNetListener- Parameters:
m- The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.
-
message
Listen for the messages to the LI100/LI101.- Specified by:
messagein interfaceXNetListener- Parameters:
l- The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.
-
notifyTimeout
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 interfaceXNetListener- Parameters:
msg- message which has timed out.
-
connect
Make connection to existing XNetInterface 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
-
notify
Forward an XNetMessage to all registered listeners.- Parameters:
m- Message to forward. Listeners should not modify it!
-