jmri.jmrix.lenz.liusb
Class LIUSBXNetPacketizer

Show UML class diagram
java.lang.Object
  extended by jmri.jmrix.AbstractMRTrafficController
      extended by jmri.jmrix.lenz.XNetTrafficController
          extended by jmri.jmrix.lenz.XNetPacketizer
              extended by jmri.jmrix.lenz.liusb.LIUSBXNetPacketizer
All Implemented Interfaces:
XNetInterface
Direct Known Subclasses:
LIUSBEthernetXNetPacketizer

public class LIUSBXNetPacketizer
extends XNetPacketizer

This is an extention of the XNetPacketizer to handle the device specific requirements of the LIUSB.

In particular, LIUSBXNetPacketizer adds functions to add and remove the 0xFF 0xFE or 0xFF 0xFD bytes that appear prior to any message read in.


Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficController
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier
 
Field Summary
(package private) static org.slf4j.Logger log
           
 
Fields inherited from class jmri.jmrix.lenz.XNetTrafficController
mListenerMasks
 
Fields inherited from class jmri.jmrix.AbstractMRTrafficController
allowUnexpectedReply, AUTORETRYSTATE, cmdListeners, controller, flushReceiveChars, IDLESTATE, istream, maxRcvExceptionCount, mCurrentMode, mCurrentState, mLastSender, mWaitBeforePoll, NORMALMODE, NOTIFIEDSTATE, OKSENDMSGSTATE, ostream, POLLSTATE, PROGRAMINGMODE, rcvException, replyInDispatch, WAITMSGREPLYSTATE, WAITREPLYINNORMMODESTATE, WAITREPLYINPROGMODESTATE, waitTimePoll, xmtException, xmtRunnable
 
Fields inherited from interface jmri.jmrix.lenz.XNetInterface
ALL, COMMINFO, CONSIST, CS_INFO, FEEDBACK, INTERFACE, PROGRAMMING, THROTTLE
 
Constructor Summary
LIUSBXNetPacketizer(LenzCommandStation pCommandStation)
           
 
Method Summary
protected  int addHeaderToOutput(byte[] msg, AbstractMRMessage m)
          Add header to the outgoing byte stream.
protected  int lengthOfByteStream(AbstractMRMessage m)
          Determine how much many bytes the entire message will take, including space for header and trailer
protected  void loadChars(AbstractMRReply msg, DataInputStream istream)
          Get characters from the input source, and file a message.
 
Methods inherited from class jmri.jmrix.lenz.XNetPacketizer
addTrailerToOutput, portReadyToSend, sendXNetMessage, status
 
Methods inherited from class jmri.jmrix.lenz.XNetTrafficController
addXNetListener, endOfMessage, enterNormalMode, enterProgMode, forwardMessage, forwardReply, getCommandStation, getFeedbackMessageCache, getSystemConnectionMemo, handleTimeout, instance, newReply, pollMessage, pollReplyHandler, programmerIdle, removeXNetListener, sendHighPriorityXNetMessage, setInstance, setSystemConnectionMemo
 
Methods inherited from class jmri.jmrix.AbstractMRTrafficController
addListener, canReceive, connectionWarn, connectPort, disconnectPort, enterProgModeDelayTime, finalize, forwardToPort, getLastSender, getPortName, getSelfLock, handleOneIncomingReply, hasTimeouts, newRcvNotifier, notifyMessage, notifyReply, portWarn, portWarnTCP, readByteProtected, receiveLoop, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, terminate, transmitWait, waitForStartOfReply
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.slf4j.Logger log
Constructor Detail

LIUSBXNetPacketizer

public LIUSBXNetPacketizer(LenzCommandStation pCommandStation)
Method Detail

addHeaderToOutput

protected int addHeaderToOutput(byte[] msg,
                                AbstractMRMessage m)
Add header to the outgoing byte stream.

Overrides:
addHeaderToOutput in class AbstractMRTrafficController
Parameters:
msg - The output byte stream
Returns:
next location in the stream to fill

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

loadChars

protected void loadChars(AbstractMRReply msg,
                         DataInputStream istream)
                  throws IOException
Get characters from the input source, and file a message.

Returns only when the message is complete.

Only used in the Receive thread.

Overrides:
loadChars in class XNetTrafficController
Parameters:
msg - message to fill
istream - character source.
Throws:
IOException - when presented by the input source.


Copyright © 1997-2013 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