Package jmri.jmrix.ecos
Class EcosTrafficController
java.lang.Object
jmri.jmrix.AbstractMRTrafficController
jmri.jmrix.ecos.EcosTrafficController
- All Implemented Interfaces:
EcosInterface
Converts Stream-based I/O to/from ECOS messages. The "EcosInterface" side
sends/receives message objects.
The connection to a EcosPortController is via a pair of *Streams, which then carry sequences of characters for transmission. Note that this processing is handled in an independent thread.
This handles the state transitions, based on the necessary state in each message.
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficController
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier -
Field Summary
FieldsModifier and TypeFieldDescription(package private) EcosSystemConnectionMemoprotected static final EcosTrafficControllerprotected booleanFields 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, xmtThread -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected booleanOverride in the system specific code if necessaryprotected booleanprotected AbstractMRMessageECoS doesn't support this function.protected AbstractMRMessageECoS doesn't support this function.protected intGet the delay (wait time) after enabling the programming track.protected voidforwardMessage(AbstractMRListener client, AbstractMRMessage m) Implement this to forward a specific message type to a protocol-specific listener interface.protected voidforwardReply(AbstractMRListener client, AbstractMRReply r) Forward a EcosReply to all registered EcosInterface listeners.protected voidforwardToPort(AbstractMRMessage m, AbstractMRListener reply) Actually transmit the next message to the port.protected AbstractMRReplynewReply()protected AbstractMRMessageInvoked if it's appropriate to do low-priority polling of the command station, this should return the next message to send, or null if the TrafficController should just sleep.protected AbstractMRListenervoidvoidsendEcosMessage(EcosMessage m, EcosListener reply) Send a message through the interface.booleansendWaitMessage(EcosMessage m, AbstractMRListener reply) voidprotected voidMethods inherited from class jmri.jmrix.AbstractMRTrafficController
addConsoleListener, addHeaderToOutput, addListener, addTrailerToOutput, connectionWarn, connectPort, disconnectPort, distributeReply, getLastSender, getPortName, getSynchronizeRx, handleOneIncomingReply, handleTimeout, hasTimeouts, lengthOfByteStream, loadChars, newRcvNotifier, notifyMessage, notifyReply, portReadyToSend, portWarn, portWarnTCP, programmerIdle, readByteProtected, receiveLoop, recovery, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, setSynchronizeRx, status, terminateThreads, transmitLoop, transmitWait, unexpectedReplyStateError, waitForStartOfReply, warnOnTimeoutMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.jmrix.ecos.EcosInterface
status
-
Field Details
-
adaptermemo
-
unsolicitedSensorMessageSeen
-
self
-
-
Constructor Details
-
EcosTrafficController
public EcosTrafficController()Create a new EcosTrafficController instance.
-
-
Method Details
-
setAdapterMemo
-
addEcosListener
- Specified by:
addEcosListenerin interfaceEcosInterface
-
removeEcosListener
- Specified by:
removeEcosListenerin interfaceEcosInterface
-
enterProgModeDelayTime
Get the delay (wait time) after enabling the programming track. Override in subclass to add a longer delay.- Overrides:
enterProgModeDelayTimein classAbstractMRTrafficController- Returns:
- 0 as default delay
-
forwardMessage
Implement this to forward a specific message type to a protocol-specific listener interface. This puts the casting into the concrete class. Forward an EcosMessage to all registered EcosInterface listeners.- Specified by:
forwardMessagein classAbstractMRTrafficController- Parameters:
client- abstract listener.m- message to forward.
-
forwardReply
Forward a EcosReply to all registered EcosInterface listeners.- Specified by:
forwardReplyin classAbstractMRTrafficController
-
pollMessage
Invoked if it's appropriate to do low-priority polling of the command station, this should return the next message to send, or null if the TrafficController should just sleep.- Specified by:
pollMessagein classAbstractMRTrafficController- Returns:
- Formatted poll message
-
pollReplyHandler
- Specified by:
pollReplyHandlerin classAbstractMRTrafficController
-
sendEcosMessage
Send a message through the interface.- Specified by:
sendEcosMessagein interfaceEcosInterface- Parameters:
m- Message to be sent.reply- Listener to be notified of reply.
-
forwardToPort
Actually transmit the next message to the port.- Overrides:
forwardToPortin classAbstractMRTrafficController- Parameters:
m- the message to sendreply- the Listener sending the message, often provided as 'this'- See Also:
-
enterProgMode
ECoS doesn't support this function.- Specified by:
enterProgModein classAbstractMRTrafficController- Returns:
- any message that needs to be returned to the Command Station to change modes. If no message is needed, returns null.
- See Also:
-
enterNormalMode
ECoS doesn't support this function.- Specified by:
enterNormalModein classAbstractMRTrafficController- Returns:
- any message that needs to be returned to the Command Station to change modes. If no message is needed, returns null.
- See Also:
-
newReply
- Specified by:
newReplyin classAbstractMRTrafficController
-
canReceive
Override in the system specific code if necessary- Overrides:
canReceivein classAbstractMRTrafficController- Returns:
- for now, receive always OK
-
endOfMessage
- Specified by:
endOfMessagein classAbstractMRTrafficController
-
sendWaitMessage
-
terminate
- Overrides:
terminatein classAbstractMRTrafficController
-