Package jmri.jmrix.bachrus
Class SpeedoTrafficController
- java.lang.Object
-
- jmri.jmrix.bachrus.SpeedoTrafficController
-
- All Implemented Interfaces:
SpeedoInterface
,SerialPortEventListener
public class SpeedoTrafficController extends java.lang.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.Removed Runnable implementation and methods for it.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Vector<SpeedoListener>
cmdListeners
(package private) java.io.DataInputStream
istream
(package private) SpeedoListener
lastSender
(package private) java.io.OutputStream
ostream
-
Constructor Summary
Constructors Constructor Description SpeedoTrafficController(SpeedoSystemConnectionMemo adaptermemo)
Create a new SpeedoTrafficController instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
protected void
notifyReply(SpeedoReply r)
void
removeSpeedoListener(SpeedoListener l)
void
serialEvent(SerialPortEvent event)
Respond to an event triggered by RXTX.boolean
status()
Test operational status of interface.
-
-
-
Field Detail
-
cmdListeners
protected java.util.Vector<SpeedoListener> cmdListeners
-
lastSender
SpeedoListener lastSender
-
istream
java.io.DataInputStream istream
-
ostream
java.io.OutputStream ostream
-
-
Constructor Detail
-
SpeedoTrafficController
public SpeedoTrafficController(SpeedoSystemConnectionMemo adaptermemo)
Create a new SpeedoTrafficController instance.- Parameters:
adaptermemo
- the associated SystemConnectionMemo
-
-
Method Detail
-
status
public boolean status()
Description copied from interface:SpeedoInterface
Test operational status of interface.- Specified by:
status
in interfaceSpeedoInterface
- Returns:
- true is interface implementation is operational.
-
addSpeedoListener
public void addSpeedoListener(SpeedoListener l)
- Specified by:
addSpeedoListener
in interfaceSpeedoInterface
-
removeSpeedoListener
public void removeSpeedoListener(SpeedoListener l)
- Specified by:
removeSpeedoListener
in interfaceSpeedoInterface
-
notifyReply
protected void notifyReply(SpeedoReply r)
-
connectPort
public void connectPort(SpeedoPortController p)
Make connection to existing PortController object.- Parameters:
p
- speedo port controller.
-
disconnectPort
public void disconnectPort(SpeedoPortController p)
Break connection to existing SpeedoPortController object. Once broken, attempts to send via "message" member will fail.- Parameters:
p
- speedo port controller.
-
endReply
boolean endReply(SpeedoReply msg)
-
serialEvent
public void serialEvent(SerialPortEvent event)
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.- Specified by:
serialEvent
in interfaceSerialPortEventListener
-
-