jmri.jmrix.powerline.simulator
Class SpecificTrafficController

java.lang.Object
  extended by jmri.jmrix.AbstractMRTrafficController
      extended by jmri.jmrix.powerline.SerialTrafficController
          extended by jmri.jmrix.powerline.simulator.SpecificTrafficController
All Implemented Interfaces:
SerialInterface

public class SpecificTrafficController
extends SerialTrafficController

Converts Stream-based I/O to/from messages. The "SerialInterface" side sends/receives message objects.

The connection to a SerialPortController is via a pair of *Streams, which then carry sequences of characters for transmission. Note that this processing is handled in an independent thread.

This maintains a list of nodes, but doesn't currently do anything with it.

Author:
Bob Jacobsen Copyright (C) 2001, 2003, 2005, 2006, 2008, 2009, Ken Cameron Copyright (C) 2010 Converted to multiple connection, kcameron Copyright (C) 2011

Nested Class Summary
 
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficController
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier
 
Field Summary
 
Fields inherited from class jmri.jmrix.powerline.SerialTrafficController
logDebug
 
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
SpecificTrafficController(SerialSystemConnectionMemo memo)
           
 
Method Summary
protected  boolean endOfMessage(AbstractMRReply msg)
           This is a default, null implementation, which must be overridden in an adapter-specific subclass.
protected  void forwardToPort(AbstractMRMessage m, AbstractMRListener reply)
          Actually transmits the next message to the port
 SerialMessage getSerialMessage(int length)
          Get a message of a specific length for filling in.
protected  void loadChars(AbstractMRReply msg, DataInputStream istream)
          read a stream and pick packets out of it.
protected  AbstractMRReply newReply()
           This is a default, null implementation, which must be overridden in an adapter-specific subclass.
 void sendInsteonSequence(InsteonSequence s, SerialListener l)
          Send a sequence of Insteon messages Makes them into the local messages and then queues in order
 void sendX10Sequence(X10Sequence s, SerialListener l)
          Send a sequence of X10 messages Makes them into the local messages and then queues in order
 
Methods inherited from class jmri.jmrix.powerline.SerialTrafficController
addSerialListener, enterNormalMode, enterProgMode, enterProgModeDelayTime, forwardMessage, forwardReply, getAdapterMemo, getNumberOfIntensitySteps, getSensorManager, pollMessage, pollReplyHandler, removeSerialListener, sendSerialMessage, setAdapterMemo, setInstance, setSensorManager
 
Methods inherited from class jmri.jmrix.AbstractMRTrafficController
addHeaderToOutput, addListener, addTrailerToOutput, canReceive, connectionWarn, connectPort, disconnectPort, finalize, getLastSender, getPortName, getSelfLock, handleOneIncomingReply, handleTimeout, hasTimeouts, lengthOfByteStream, 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.powerline.SerialInterface
status
 

Constructor Detail

SpecificTrafficController

public SpecificTrafficController(SerialSystemConnectionMemo memo)
Method Detail

sendX10Sequence

public void sendX10Sequence(X10Sequence s,
                            SerialListener l)
Send a sequence of X10 messages

Makes them into the local messages and then queues in order

Overrides:
sendX10Sequence in class SerialTrafficController

sendInsteonSequence

public void sendInsteonSequence(InsteonSequence s,
                                SerialListener l)
Send a sequence of Insteon messages

Makes them into the local messages and then queues in order

Overrides:
sendInsteonSequence in class SerialTrafficController

getSerialMessage

public SerialMessage getSerialMessage(int length)
Get a message of a specific length for filling in.

Overrides:
getSerialMessage in class SerialTrafficController

forwardToPort

protected void forwardToPort(AbstractMRMessage m,
                             AbstractMRListener reply)
Description copied from class: AbstractMRTrafficController
Actually transmits the next message to the port

Overrides:
forwardToPort in class SerialTrafficController

newReply

protected AbstractMRReply newReply()
Description copied from class: SerialTrafficController

This is a default, null implementation, which must be overridden in an adapter-specific subclass.

Overrides:
newReply in class SerialTrafficController

endOfMessage

protected boolean endOfMessage(AbstractMRReply msg)
Description copied from class: SerialTrafficController

This is a default, null implementation, which must be overridden in an adapter-specific subclass.

Overrides:
endOfMessage in class SerialTrafficController

loadChars

protected void loadChars(AbstractMRReply msg,
                         DataInputStream istream)
                  throws IOException
read a stream and pick packets out of it. knows the size of the packets from the contents.

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


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