Package jmri.jmrix.can.adapters.lawicell
Class LawicellTrafficController
- java.lang.Object
- 
- jmri.jmrix.AbstractMRTrafficController
- 
- jmri.jmrix.can.AbstractCanTrafficController
- 
- jmri.jmrix.can.TrafficController
- 
- 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 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficControllerAbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static intBOOTMODEstatic intNORMAL- 
Fields inherited from class jmri.jmrix.can.TrafficController_canid
 - 
Fields inherited from class jmri.jmrix.AbstractMRTrafficControllerallowUnexpectedReply, 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 SummaryConstructors Constructor Description LawicellTrafficController()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddTrailerToOutput(byte[] msg, int offset, AbstractMRMessage m)Add trailer to the outgoing byte stream.CanReplydecodeFromHardware(AbstractMRReply m)Make a CanReply from a Lawicell-specific reply.AbstractMRMessageencodeForHardware(CanMessage m)Encode a CanMessage into Lawicell format for the hardware.(package private) booleanendNormalReply(AbstractMRReply r)protected booleanendOfMessage(AbstractMRReply r)Normal Lawicell replies will end with CR; errors are BELL.protected voidforwardMessage(AbstractMRListener client, AbstractMRMessage m)Forward a CanMessage to all registered CanInterface listeners.protected voidforwardReply(AbstractMRListener client, AbstractMRReply r)Forward a CanReply to all registered CanInterface listeners.intgetgcState()booleanisBootMode()protected intlengthOfByteStream(AbstractMRMessage m)Determine how much many bytes the entire message will take, including space for header and trailerprotected AbstractMRMessagenewMessage()Get the correct concrete class for the hardware connection messageprotected AbstractMRReplynewReply()voidsendCanMessage(CanMessage m, CanListener reply)Forward a preformatted message to the actual interface.voidsendCanReply(CanReply r, CanListener reply)Forward a preformatted reply to the actual interface.voidsetgcState(int s)- 
Methods inherited from class jmri.jmrix.can.TrafficControllergetCanid, setCanId, setCanId
 - 
Methods inherited from class jmri.jmrix.can.AbstractCanTrafficControlleraddCanConsoleListener, addCanListener, distributeOneReply, enterNormalMode, enterProgMode, forwardToPort, handleOneIncomingReply, pollMessage, pollReplyHandler, removeCanListener
 - 
Methods inherited from class jmri.jmrix.AbstractMRTrafficControlleraddConsoleListener, addHeaderToOutput, addListener, canReceive, connectionWarn, connectPort, disconnectPort, distributeReply, enterProgModeDelayTime, getLastSender, getPortName, getSynchronizeRx, handleTimeout, hasTimeouts, loadChars, newRcvNotifier, notifyMessage, notifyReply, portReadyToSend, portWarn, portWarnTCP, programmerIdle, readByteProtected, receiveLoop, recovery, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, setSynchronizeRx, status, terminate, terminateThreads, transmitLoop, transmitWait, unexpectedReplyStateError, waitForStartOfReply, warnOnTimeout
 - 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface jmri.jmrix.can.CanInterfacestatus
 
- 
 
- 
- 
- 
Field Detail- 
NORMALpublic static final int NORMAL - See Also:
- Constant Field Values
 
 - 
BOOTMODEpublic static final int BOOTMODE - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
LawicellTrafficControllerpublic LawicellTrafficController() 
 
- 
 - 
Method Detail- 
forwardMessageprotected void forwardMessage(AbstractMRListener client, AbstractMRMessage m) Forward a CanMessage to all registered CanInterface listeners.- Specified by:
- forwardMessagein class- AbstractMRTrafficController
- Parameters:
- client- abstract listener.
- m- message to forward.
 
 - 
forwardReplyprotected void forwardReply(AbstractMRListener client, AbstractMRReply r) Forward a CanReply to all registered CanInterface listeners.- Specified by:
- forwardReplyin class- AbstractMRTrafficController
 
 - 
getgcStatepublic int getgcState() 
 - 
setgcStatepublic void setgcState(int s) 
 - 
isBootModepublic boolean isBootMode() 
 - 
sendCanMessagepublic void sendCanMessage(CanMessage m, CanListener reply) Forward a preformatted message to the actual interface. Send a message through the interface.- Parameters:
- m- Message to be sent.
- reply- Listener to be notified of reply.
 
 - 
sendCanReplypublic void sendCanReply(CanReply r, CanListener reply) Forward a preformatted reply to the actual interface. Send a reply through the interface.- Parameters:
- r- Reply to be sent.
- reply- Listener to be notified of reply.
 
 - 
addTrailerToOutputprotected void addTrailerToOutput(byte[] msg, int offset, AbstractMRMessage m) Add trailer to the outgoing byte stream.- Overrides:
- addTrailerToOutputin class- AbstractMRTrafficController
- Parameters:
- msg- The output byte stream
- offset- the first byte not yet used
- m- output message to extend
 
 - 
lengthOfByteStreamprotected int lengthOfByteStream(AbstractMRMessage m) Determine how much many bytes the entire message will take, including space for header and trailer- Overrides:
- lengthOfByteStreamin class- AbstractMRTrafficController
- Parameters:
- m- The message to be sent
- Returns:
- Number of bytes
 
 - 
newMessageprotected AbstractMRMessage newMessage() Description copied from class:AbstractCanTrafficControllerGet the correct concrete class for the hardware connection message- Specified by:
- newMessagein class- AbstractCanTrafficController
- Returns:
- new blank message
 
 - 
decodeFromHardwarepublic CanReply decodeFromHardware(AbstractMRReply m) Make a CanReply from a Lawicell-specific reply.- Specified by:
- decodeFromHardwarein class- AbstractCanTrafficController
 
 - 
encodeForHardwarepublic AbstractMRMessage encodeForHardware(CanMessage m) Encode a CanMessage into Lawicell format for the hardware.- Specified by:
- encodeForHardwarein class- AbstractCanTrafficController
 
 - 
newReplyprotected AbstractMRReply newReply() - Specified by:
- newReplyin class- AbstractMRTrafficController
 
 - 
endOfMessageprotected boolean endOfMessage(AbstractMRReply r) Normal Lawicell replies will end with CR; errors are BELL.- Specified by:
- endOfMessagein class- AbstractMRTrafficController
 
 - 
endNormalReplyboolean endNormalReply(AbstractMRReply r) 
 
- 
 
-