jmri.jmrix.can.adapters.lawicell
Class LawicellTrafficController

java.lang.Object
  extended by jmri.jmrix.AbstractMRTrafficController
      extended by jmri.jmrix.can.AbstractCanTrafficController
          extended by jmri.jmrix.can.TrafficController
              extended by jmri.jmrix.can.adapters.lawicell.LawicellTrafficController
All Implemented Interfaces:
CanInterface

public class LawicellTrafficController
extends TrafficController

Traffic controller for the LAWICELL protocol.

Lawicell adapters use messages transmitted as an ASCII string of up to 24 characters of the form: ;ShhhhNd0d1d2d3d4d5d6d7: The S indicates a standard CAN frame hhhh is the two byte header N or R indicates a normal or remote frame d0 - d7 are the (up to) 8 data bytes

Author:
Andrew Crosland Copyright (C) 2008, Bob Jacobsen Copyright (C) 2008

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficController
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier
 
Field Summary
static int BOOTMODE
           
static int NORMAL
           
 
Fields inherited from class jmri.jmrix.can.TrafficController
_canid, self
 
Fields inherited from class jmri.jmrix.AbstractMRTrafficController
allowUnexpectedReply, AUTORETRYSTATE, cmdListeners, controller, flushReceiveChars, IDLESTATE, istream, mCurrentMode, mCurrentState, mLastSender, mWaitBeforePoll, NORMALMODE, NOTIFIEDSTATE, OKSENDMSGSTATE, ostream, POLLSTATE, PROGRAMINGMODE, rcvException, replyInDispatch, WAITMSGREPLYSTATE, WAITREPLYINNORMMODESTATE, WAITREPLYINPROGMODESTATE, waitTimePoll, xmtException, xmtRunnable
 
Constructor Summary
LawicellTrafficController()
           
 
Method Summary
protected  void addTrailerToOutput(byte[] msg, int offset, AbstractMRMessage m)
          Add trailer to the outgoing byte stream.
 CanReply decodeFromHardware(AbstractMRReply m)
          Make a CanReply from a system-specific reply
 AbstractMRMessage encodeForHardware(CanMessage m)
          Encode a CanMessage for the hardware
protected  boolean endOfMessage(AbstractMRReply r)
           
protected  void forwardMessage(AbstractMRListener client, AbstractMRMessage m)
          Forward a CanMessage to all registered CanInterface listeners.
protected  void forwardReply(AbstractMRListener client, AbstractMRReply r)
          Forward a CanReply to all registered CanInterface listeners.
 int getgcState()
           
static TrafficController instance()
          static function returning the CanTrafficController instance to use.
 boolean isBootMode()
           
protected  int lengthOfByteStream(AbstractMRMessage m)
          Determine how much many bytes the entire message will take, including space for header and trailer
protected  AbstractMRMessage newMessage()
          Get the correct concrete class for the hardware connection message
protected  AbstractMRReply newReply()
           
 void sendCanMessage(CanMessage m, CanListener reply)
          Forward a preformatted message to the actual interface.
 void setgcState(int s)
           
 
Methods inherited from class jmri.jmrix.can.TrafficController
getCanid, setInstance
 
Methods inherited from class jmri.jmrix.can.AbstractCanTrafficController
addCanListener, enterNormalMode, enterProgMode, forwardToPort, handleOneIncomingReply, pollMessage, pollReplyHandler, removeCanListener
 
Methods inherited from class jmri.jmrix.AbstractMRTrafficController
addHeaderToOutput, addListener, canReceive, connectionWarn, connectPort, disconnectPort, enterProgModeDelayTime, finalize, getLastSender, getPortName, getSelfLock, handleTimeout, hasTimeouts, loadChars, newRcvNotifier, notifyMessage, notifyReply, portReadyToSend, portWarn, portWarnTCP, programmerIdle, readByteProtected, receiveLoop, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, status, terminate, transmitWait, 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
status
 

Field Detail

NORMAL

public static final int NORMAL
See Also:
Constant Field Values

BOOTMODE

public static final int BOOTMODE
See Also:
Constant Field Values
Constructor Detail

LawicellTrafficController

public LawicellTrafficController()
Method Detail

forwardMessage

protected void forwardMessage(AbstractMRListener client,
                              AbstractMRMessage m)
Forward a CanMessage to all registered CanInterface listeners.

Specified by:
forwardMessage in class AbstractMRTrafficController

forwardReply

protected void forwardReply(AbstractMRListener client,
                            AbstractMRReply r)
Forward a CanReply to all registered CanInterface listeners.

Specified by:
forwardReply in class AbstractMRTrafficController

getgcState

public int getgcState()

setgcState

public void setgcState(int s)

isBootMode

public boolean isBootMode()

sendCanMessage

public void sendCanMessage(CanMessage m,
                           CanListener reply)
Forward a preformatted message to the actual interface.

Parameters:
m - Message to be sent.
reply - Listener to be notified of reply.

addTrailerToOutput

protected void addTrailerToOutput(byte[] msg,
                                  int offset,
                                  AbstractMRMessage m)
Add trailer to the outgoing byte stream.

Overrides:
addTrailerToOutput in class AbstractMRTrafficController
Parameters:
msg - The output byte stream
offset - the first byte not yet used

lengthOfByteStream

protected int lengthOfByteStream(AbstractMRMessage m)
Determine how much many bytes the entire message will take, including space for header and trailer

Overrides:
lengthOfByteStream in class AbstractMRTrafficController
Parameters:
m - The message to be sent
Returns:
Number of bytes

instance

public static TrafficController instance()
static function returning the CanTrafficController instance to use.

Returns:
The registered SprogTrafficController instance for general use, if need be creating one.

newMessage

protected AbstractMRMessage newMessage()
Description copied from class: AbstractCanTrafficController
Get the correct concrete class for the hardware connection message

Specified by:
newMessage in class AbstractCanTrafficController

decodeFromHardware

public CanReply decodeFromHardware(AbstractMRReply m)
Make a CanReply from a system-specific reply

Specified by:
decodeFromHardware in class AbstractCanTrafficController

encodeForHardware

public AbstractMRMessage encodeForHardware(CanMessage m)
Encode a CanMessage for the hardware

Specified by:
encodeForHardware in class AbstractCanTrafficController

newReply

protected AbstractMRReply newReply()
Specified by:
newReply in class AbstractMRTrafficController

endOfMessage

protected boolean endOfMessage(AbstractMRReply r)
Specified by:
endOfMessage in class AbstractMRTrafficController


Copyright © 1997 - 2011 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: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads