jmri.jmrix.can
Class AbstractCanTrafficController

java.lang.Object
  extended by jmri.jmrix.AbstractMRTrafficController
      extended by 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.

Author:
Andrew Crosland Copyright (C) 2008

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, cmdListeners, controller, IDLESTATE, istream, mCurrentMode, mCurrentState, mLastSender, mWaitBeforePoll, NORMALMODE, NOTIFIEDSTATE, OKSENDMSGSTATE, ostream, PROGRAMINGMODE, replyInDispatch, WAITMSGREPLYSTATE, WAITREPLYINNORMMODESTATE, WAITREPLYINPROGMODESTATE, xmtRunnable
 
Constructor Summary
AbstractCanTrafficController()
           
 
Method Summary
 void addCanListener(CanListener l)
           
abstract  CanReply decodeFromHardware(AbstractMRReply m)
           
abstract  AbstractMRMessage encodeForHardware(CanMessage m)
           
protected  AbstractMRMessage enterNormalMode()
           
protected  AbstractMRMessage enterProgMode()
           
protected  void forwardToPort(AbstractMRMessage m, AbstractMRListener reply)
          Actually transmits the next message to the port Overridden to include translation to the correct CAN hardware message format
 void handleOneIncomingReply()
          Handle each reply when complete.
protected abstract  AbstractMRMessage newMessage()
          Get the correct concrete class for the hardware connection message
protected  AbstractMRMessage 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 TC should just sleep.
protected  AbstractMRListener pollReplyHandler()
           
 void removeCanListener(CanListener l)
           
 
Methods inherited from class jmri.jmrix.AbstractMRTrafficController
addHeaderToOutput, addListener, addTrailerToOutput, canReceive, connectionWarn, connectPort, disconnectPort, endOfMessage, enterProgModeDelayTime, finalize, forwardMessage, forwardReply, getPortName, handleTimeout, hasTimeouts, lengthOfByteStream, loadChars, newRcvNotifier, newReply, notifyMessage, notifyReply, portReadyToSend, portWarn, programmerIdle, readByteProtected, receiveLoop, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, setInstance, status, waitForStartOfReply
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.jmrix.can.CanInterface
sendCanMessage, status
 

Constructor Detail

AbstractCanTrafficController

public AbstractCanTrafficController()
Method Detail

addCanListener

public void addCanListener(CanListener l)
Specified by:
addCanListener in interface CanInterface

removeCanListener

public void removeCanListener(CanListener l)
Specified by:
removeCanListener in interface CanInterface

forwardToPort

protected void forwardToPort(AbstractMRMessage m,
                             AbstractMRListener reply)
Actually transmits the next message to the port Overridden to include translation to the correct CAN hardware message format

Overrides:
forwardToPort in class AbstractMRTrafficController

pollMessage

protected AbstractMRMessage pollMessage()
Description copied from class: AbstractMRTrafficController
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 TC should just sleep.

Specified by:
pollMessage in class AbstractMRTrafficController

pollReplyHandler

protected AbstractMRListener pollReplyHandler()
Specified by:
pollReplyHandler in class AbstractMRTrafficController

enterProgMode

protected AbstractMRMessage enterProgMode()
Specified by:
enterProgMode in class AbstractMRTrafficController

enterNormalMode

protected AbstractMRMessage enterNormalMode()
Specified by:
enterNormalMode in class AbstractMRTrafficController

newMessage

protected abstract AbstractMRMessage newMessage()
Get the correct concrete class for the hardware connection message


decodeFromHardware

public abstract CanReply decodeFromHardware(AbstractMRReply m)

encodeForHardware

public abstract AbstractMRMessage encodeForHardware(CanMessage m)

handleOneIncomingReply

public void handleOneIncomingReply()
                            throws IOException
Handle each reply when complete.

Overridden to include translation form the CAN hardware format

Overrides:
handleOneIncomingReply in class AbstractMRTrafficController
Throws:
IOException


Copyright © 1997 - 2008 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: SourceForge_Logo