Package jmri.jmrix.can
Class AbstractCanTrafficController
java.lang.Object
jmri.jmrix.AbstractMRTrafficController
jmri.jmrix.can.AbstractCanTrafficController
- All Implemented Interfaces:
CanInterface
- Direct Known Subclasses:
TrafficController
public abstract class AbstractCanTrafficController
extends AbstractMRTrafficController
implements CanInterface
Abstract base for TrafficControllers in a CANbus based Message/Reply
protocol.
AbstractMRTrafficController is extended to allow for the translation between CAN messages and the message format of the CAN adapter that connects to the layout.
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficController
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier -
Field Summary
Fields 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 TypeMethodDescriptionvoidAdd a CanListener to start of the notification list.voidabstract CanReplyvoiddistributeOneReply(CanReply msg, AbstractMRListener mLastSender) abstract AbstractMRMessageprotected AbstractMRMessageSets the system to normal mode during programming while in IDLESTATE.protected AbstractMRMessageSet the system to programming mode.protected voidforwardToPort(AbstractMRMessage m, AbstractMRListener reply) Actually transmits the next message to the port Overridden to include translation to the correct CAN hardware message format Actually transmit the next message to the port.voidHandle each reply when complete.protected abstract AbstractMRMessageGet the correct concrete class for the hardware connection messageprotected 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 AbstractMRListenerAlways nullvoidMethods inherited from class jmri.jmrix.AbstractMRTrafficController
addConsoleListener, addHeaderToOutput, addListener, addTrailerToOutput, canReceive, connectionWarn, connectPort, disconnectPort, distributeReply, endOfMessage, enterProgModeDelayTime, forwardMessage, forwardReply, getLastSender, getPortName, getSynchronizeRx, handleTimeout, hasTimeouts, lengthOfByteStream, loadChars, newRcvNotifier, newReply, notifyMessage, notifyReply, portReadyToSend, portWarn, portWarnTCP, programmerIdle, readByteProtected, receiveLoop, recovery, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, setSynchronizeRx, status, terminate, 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.can.CanInterface
sendCanMessage, sendCanReply, status
-
Constructor Details
-
AbstractCanTrafficController
public AbstractCanTrafficController()
-
-
Method Details
-
addCanListener
- Specified by:
addCanListenerin interfaceCanInterface
-
addCanConsoleListener
Add a CanListener to start of the notification list. This is intended only for Consoles to receive the CanFrame 1st, not after another Listener has sent a response to that Frame.- Parameters:
l- The CanListener to add.
-
removeCanListener
- Specified by:
removeCanListenerin interfaceCanInterface
-
forwardToPort
Actually transmits the next message to the port Overridden to include translation to the correct CAN hardware message format 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:
-
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. Always null- Specified by:
pollMessagein classAbstractMRTrafficController- Returns:
- Formatted poll message
-
pollReplyHandler
Always null- Specified by:
pollReplyHandlerin classAbstractMRTrafficController
-
enterProgMode
Set the system to programming mode. Always null- 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
Sets the system to normal mode during programming while in IDLESTATE. IfAbstractMRTrafficController.programmerIdle()returns true, enterNormalMode() is called after a timeout. Always null- 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:
-
newMessage
Get the correct concrete class for the hardware connection message- Returns:
- new blank message
-
decodeFromHardware
-
encodeForHardware
-
handleOneIncomingReply
Handle each reply when complete.Overridden to include translation form the CAN hardware format
- Overrides:
handleOneIncomingReplyin classAbstractMRTrafficController- Throws:
IOException- on error.
-
distributeOneReply
-