jmri.jmrix.bachrus
Class SpeedoTrafficController

Show UML class diagram
java.lang.Object
  extended by jmri.jmrix.bachrus.SpeedoTrafficController
All Implemented Interfaces:
SerialPortEventListener, EventListener, SpeedoInterface

public class SpeedoTrafficController
extends Object
implements SpeedoInterface, SerialPortEventListener

Converts Stream-based I/O to/from speedo messages. The "SpeedoInterface" side sends/receives message objects. The connection to a SpeedoPortController is via a pair of *Streams, which then carry sequences of characters for transmission. Note that this processing is handled in an independent thread. Updated January 2010 for gnu io (RXTX) - Andrew Berridge. Comments tagged with "AJB" indicate changes or observations by me Removed Runnable implementation and methods for it


Field Summary
protected  Vector<SpeedoListener> cmdListeners
           
(package private)  DataInputStream istream
           
(package private)  SpeedoListener lastSender
           
(package private) static org.slf4j.Logger log
           
(package private)  OutputStream ostream
           
protected static SpeedoTrafficController self
           
 
Constructor Summary
SpeedoTrafficController()
           
 
Method Summary
 void addSpeedoListener(SpeedoListener l)
           
 void connectPort(SpeedoPortController p)
          Make connection to existing PortController object.
 void disconnectPort(SpeedoPortController p)
          Break connection to existing SpeedoPortController object.
(package private)  boolean endReply(SpeedoReply msg)
           
static SpeedoTrafficController instance()
          static function returning the SpeedoTrafficController instance to use.
protected  void notifyReply(SpeedoReply r)
           
 void removeSpeedoListener(SpeedoListener l)
           
 void serialEvent(SerialPortEvent event)
          serialEvent - respond to an event triggered by RXTX.
 boolean status()
          Test operational status of interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cmdListeners

protected Vector<SpeedoListener> cmdListeners

lastSender

SpeedoListener lastSender

self

protected static volatile SpeedoTrafficController self

istream

DataInputStream istream

ostream

OutputStream ostream

log

static org.slf4j.Logger log
Constructor Detail

SpeedoTrafficController

public SpeedoTrafficController()
Method Detail

status

public boolean status()
Description copied from interface: SpeedoInterface
Test operational status of interface.

Specified by:
status in interface SpeedoInterface
Returns:
true is interface implementation is operational.

addSpeedoListener

public void addSpeedoListener(SpeedoListener l)
Specified by:
addSpeedoListener in interface SpeedoInterface

removeSpeedoListener

public void removeSpeedoListener(SpeedoListener l)
Specified by:
removeSpeedoListener in interface SpeedoInterface

notifyReply

protected void notifyReply(SpeedoReply r)

connectPort

public void connectPort(SpeedoPortController p)
Make connection to existing PortController object.


disconnectPort

public void disconnectPort(SpeedoPortController p)
Break connection to existing SpeedoPortController object. Once broken, attempts to send via "message" member will fail.


instance

public static SpeedoTrafficController instance()
static function returning the SpeedoTrafficController instance to use.

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

endReply

boolean endReply(SpeedoReply msg)

serialEvent

public void serialEvent(SerialPortEvent event)
serialEvent - respond to an event triggered by RXTX. In this case we are only dealing with DATA_AVAILABLE but the other events are left here for reference. AJB Jan 2010

Specified by:
serialEvent in interface SerialPortEventListener


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